diff options
| author | Greg Hudson <ghudson@mit.edu> | 2013-02-14 11:41:10 -0500 |
|---|---|---|
| committer | Greg Hudson <ghudson@mit.edu> | 2013-02-14 11:42:28 -0500 |
| commit | 6dda284554a869f7fa1e6d2a035df06c97f103ef (patch) | |
| tree | 6854b38ce7274b914b82b20bfb65eb8130df1ab8 /src/lib/krb5/krb | |
| parent | 80f53c8b2c745e75dc9d22acba63812d8533c133 (diff) | |
| download | krb5-6dda284554a869f7fa1e6d2a035df06c97f103ef.tar.gz krb5-6dda284554a869f7fa1e6d2a035df06c97f103ef.tar.xz krb5-6dda284554a869f7fa1e6d2a035df06c97f103ef.zip | |
Modernize k5buf
Rename the krb5int_buf_ family of functions to use the k5_ prefix for
brevity. Reformat some k5buf implementation code to match current
practices.
Diffstat (limited to 'src/lib/krb5/krb')
| -rw-r--r-- | src/lib/krb5/krb/chpw.c | 52 | ||||
| -rw-r--r-- | src/lib/krb5/krb/gic_opt.c | 12 | ||||
| -rw-r--r-- | src/lib/krb5/krb/srv_rcache.c | 16 |
3 files changed, 38 insertions, 42 deletions
diff --git a/src/lib/krb5/krb/chpw.c b/src/lib/krb5/krb/chpw.c index beb77cb986..76f415d4b7 100644 --- a/src/lib/krb5/krb/chpw.c +++ b/src/lib/krb5/krb/chpw.c @@ -382,8 +382,8 @@ struct ad_policy_info { static void add_spaces(struct k5buf *buf) { - if (krb5int_buf_len(buf) > 0) - krb5int_buf_add(buf, " "); + if (k5_buf_len(buf) > 0) + k5_buf_add(buf, " "); } static krb5_error_code @@ -422,52 +422,48 @@ decode_ad_policy_info(const krb5_data *data, char **msg_out) /* Check that we processed exactly the expected number of bytes. */ assert(p == data->data + AD_POLICY_INFO_LENGTH); - krb5int_buf_init_dynamic(&buf); + k5_buf_init_dynamic(&buf); /* * Update src/tests/misc/test_chpw_message.c if changing these strings! */ if (policy.password_properties & AD_POLICY_COMPLEX) { - krb5int_buf_add(&buf, - _("The password must include numbers or symbols. " - "Don't include any part of your name in the " - "password.")); + k5_buf_add(&buf, _("The password must include numbers or symbols. " + "Don't include any part of your name in the " + "password.")); } if (policy.min_length_password > 0) { add_spaces(&buf); - krb5int_buf_add_fmt(&buf, - ngettext("The password must contain at least %d " - "character.", - "The password must contain at least %d " - "characters.", - policy.min_length_password), - policy.min_length_password); + k5_buf_add_fmt(&buf, ngettext("The password must contain at least %d " + "character.", + "The password must contain at least %d " + "characters.", + policy.min_length_password), + policy.min_length_password); } if (policy.password_history) { add_spaces(&buf); - krb5int_buf_add_fmt(&buf, - ngettext("The password must be different from the " - "previous password.", - "The password must be different from the " - "previous %d passwords.", - policy.password_history), - policy.password_history); + k5_buf_add_fmt(&buf, ngettext("The password must be different from " + "the previous password.", + "The password must be different from " + "the previous %d passwords.", + policy.password_history), + policy.password_history); } if (policy.min_passwordage) { password_days = policy.min_passwordage / AD_POLICY_TIME_TO_DAYS; if (password_days == 0) password_days = 1; add_spaces(&buf); - krb5int_buf_add_fmt(&buf, - ngettext("The password can only be changed once a " - "day.", - "The password can only be changed every " - "%d days.", (int)password_days), - (int)password_days); + k5_buf_add_fmt(&buf, ngettext("The password can only be changed once " + "a day.", + "The password can only be changed every " + "%d days.", (int)password_days), + (int)password_days); } - msg = krb5int_buf_data(&buf); + msg = k5_buf_data(&buf); if (msg == NULL) return ENOMEM; diff --git a/src/lib/krb5/krb/gic_opt.c b/src/lib/krb5/krb/gic_opt.c index 7a8750d1f0..dddabf7e1f 100644 --- a/src/lib/krb5/krb/gic_opt.c +++ b/src/lib/krb5/krb/gic_opt.c @@ -437,17 +437,17 @@ krb5_get_init_creds_opt_set_fast_ccache(krb5_context context, struct k5buf buf; char *cc_name; - krb5int_buf_init_dynamic(&buf); - krb5int_buf_add(&buf, krb5_cc_get_type(context, ccache)); - krb5int_buf_add(&buf, ":"); - krb5int_buf_add(&buf, krb5_cc_get_name(context, ccache)); - cc_name = krb5int_buf_data(&buf); + k5_buf_init_dynamic(&buf); + k5_buf_add(&buf, krb5_cc_get_type(context, ccache)); + k5_buf_add(&buf, ":"); + k5_buf_add(&buf, krb5_cc_get_name(context, ccache)); + cc_name = k5_buf_data(&buf); if (cc_name) retval = krb5_get_init_creds_opt_set_fast_ccache_name(context, opt, cc_name); else retval = ENOMEM; - krb5int_free_buf(&buf); + k5_free_buf(&buf); return retval; } diff --git a/src/lib/krb5/krb/srv_rcache.c b/src/lib/krb5/krb/srv_rcache.c index d474fb61a6..1b0a91a281 100644 --- a/src/lib/krb5/krb/srv_rcache.c +++ b/src/lib/krb5/krb/srv_rcache.c @@ -48,22 +48,22 @@ krb5_get_server_rcache(krb5_context context, const krb5_data *piece, cachetype = krb5_rc_default_type(context); - krb5int_buf_init_dynamic(&buf); - krb5int_buf_add(&buf, cachetype); - krb5int_buf_add(&buf, ":"); + k5_buf_init_dynamic(&buf); + k5_buf_add(&buf, cachetype); + k5_buf_add(&buf, ":"); for (i = 0; i < piece->length; i++) { if (piece->data[i] == '-') - krb5int_buf_add(&buf, "--"); + k5_buf_add(&buf, "--"); else if (!isvalidrcname((int) piece->data[i])) - krb5int_buf_add_fmt(&buf, "-%03o", piece->data[i]); + k5_buf_add_fmt(&buf, "-%03o", piece->data[i]); else - krb5int_buf_add_len(&buf, &piece->data[i], 1); + k5_buf_add_len(&buf, &piece->data[i], 1); } #ifdef HAVE_GETEUID - krb5int_buf_add_fmt(&buf, "_%lu", uid); + k5_buf_add_fmt(&buf, "_%lu", uid); #endif - cachename = krb5int_buf_data(&buf); + cachename = k5_buf_data(&buf); if (cachename == NULL) return ENOMEM; |
