Skip to content

Commit

Permalink
Constify krb5_string_to_keysalts()'s string arg
Browse files Browse the repository at this point in the history
  • Loading branch information
nicowilliams authored and greghudson committed Jul 30, 2012
1 parent 5829ca2 commit 3576bd6
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 15 deletions.
6 changes: 3 additions & 3 deletions src/include/adm_proto.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ krb5_error_code krb5_keysalt_iterate(krb5_key_salt_tuple *, krb5_int32,
krb5_pointer),
krb5_pointer);

krb5_error_code krb5_string_to_keysalts(char *, const char *, const char *,
krb5_boolean, krb5_key_salt_tuple **,
krb5_int32 *);
krb5_error_code krb5_string_to_keysalts(const char *, const char *,
const char *, krb5_boolean,
krb5_key_salt_tuple **, krb5_int32 *);
#endif /* KRB5_ADM_PROTO_H__ */
2 changes: 1 addition & 1 deletion src/lib/kadm5/admin_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ kadm5_ret_t _kadm5_chpass_principal_util(void *server_handle,
maybe shouldn't be named krb5_*, but they are. */

krb5_error_code
krb5_string_to_keysalts(char *string, const char *tupleseps,
krb5_string_to_keysalts(const char *string, const char *tupleseps,
const char *ksaltseps, krb5_boolean dups,
krb5_key_salt_tuple **ksaltp, krb5_int32 *nksaltp);

Expand Down
2 changes: 1 addition & 1 deletion src/lib/kadm5/srv/svr_policy.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ kadm5_create_policy(void *server_handle,

/* Validate allowed_keysalts. */
static kadm5_ret_t
validate_allowed_keysalts(char *allowed_keysalts)
validate_allowed_keysalts(const char *allowed_keysalts)
{
kadm5_ret_t ret;
krb5_key_salt_tuple *ks_tuple = NULL;
Expand Down
22 changes: 12 additions & 10 deletions src/lib/kadm5/str_conv.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,16 +251,12 @@ krb5_keysalt_is_present(ksaltlist, nksalts, enctype, salttype)
* of key/salt tuples.
*/
krb5_error_code
krb5_string_to_keysalts(string, tupleseps, ksaltseps, dups, ksaltp, nksaltp)
char *string;
const char *tupleseps;
const char *ksaltseps;
krb5_boolean dups;
krb5_key_salt_tuple **ksaltp;
krb5_int32 *nksaltp;
krb5_string_to_keysalts(const char *string, const char *tupleseps,
const char *ksaltseps, krb5_boolean dups,
krb5_key_salt_tuple **ksaltp, krb5_int32 *nksaltp)
{
krb5_error_code kret;
char *kp, *sp, *ep;
char *dup_string, *kp, *sp, *ep;
char sepchar = 0, trailchar = 0;
krb5_enctype ktype;
krb5_int32 stype;
Expand All @@ -271,7 +267,10 @@ krb5_string_to_keysalts(string, tupleseps, ksaltseps, dups, ksaltp, nksaltp)
size_t len;

kret = 0;
kp = string;
dup_string = strdup(string);
if (dup_string == NULL)
return ENOMEM;
kp = dup_string;
tseplist = (tupleseps) ? tupleseps : default_tupleseps;
ksseplist = (ksaltseps) ? ksaltseps : default_ksaltseps;
while (kp) {
Expand Down Expand Up @@ -346,8 +345,10 @@ krb5_string_to_keysalts(string, tupleseps, ksaltseps, dups, ksaltp, nksaltp)
break;
}
}
if (kret)
if (kret) {
free(dup_string);
return kret;
}
if (sp)
sp[-1] = sepchar;
if (ep)
Expand All @@ -369,6 +370,7 @@ krb5_string_to_keysalts(string, tupleseps, ksaltseps, dups, ksaltp, nksaltp)
if (!*kp) kp = NULL;
}
} /* while kp */
free(dup_string);
return(kret);
}

Expand Down

0 comments on commit 3576bd6

Please sign in to comment.