From 6dda284554a869f7fa1e6d2a035df06c97f103ef Mon Sep 17 00:00:00 2001 From: Greg Hudson Date: Thu, 14 Feb 2013 11:41:10 -0500 Subject: 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. --- src/plugins/preauth/pkinit/pkinit_crypto_nss.c | 35 ++++++++++------------ src/plugins/preauth/pkinit/pkinit_crypto_openssl.c | 35 ++++++++++------------ 2 files changed, 30 insertions(+), 40 deletions(-) (limited to 'src/plugins/preauth') diff --git a/src/plugins/preauth/pkinit/pkinit_crypto_nss.c b/src/plugins/preauth/pkinit/pkinit_crypto_nss.c index 7f73fbd25..b33ce749b 100644 --- a/src/plugins/preauth/pkinit/pkinit_crypto_nss.c +++ b/src/plugins/preauth/pkinit/pkinit_crypto_nss.c @@ -2053,39 +2053,34 @@ reassemble_pkcs11_name(PLArenaPool *pool, pkinit_identity_opts *idopts) int n = 0; char *ret; - krb5int_buf_init_dynamic(&buf); - krb5int_buf_add(&buf, "PKCS11:"); + k5_buf_init_dynamic(&buf); + k5_buf_add(&buf, "PKCS11:"); n = 0; if (idopts->p11_module_name != NULL) { - krb5int_buf_add_fmt(&buf, "%smodule_name=%s", - n++ ? "," : "", - idopts->p11_module_name); + k5_buf_add_fmt(&buf, "%smodule_name=%s", n++ ? "," : "", + idopts->p11_module_name); } if (idopts->token_label != NULL) { - krb5int_buf_add_fmt(&buf, "%stoken=%s", - n++ ? "," : "", - idopts->token_label); + k5_buf_add_fmt(&buf, "%stoken=%s", n++ ? "," : "", + idopts->token_label); } if (idopts->cert_label != NULL) { - krb5int_buf_add_fmt(&buf, "%scertlabel=%s", - n++ ? "," : "", - idopts->cert_label); + k5_buf_add_fmt(&buf, "%scertlabel=%s", n++ ? "," : "", + idopts->cert_label); } if (idopts->cert_id_string != NULL) { - krb5int_buf_add_fmt(&buf, "%scertid=%s", - n++ ? "," : "", - idopts->cert_id_string); + k5_buf_add_fmt(&buf, "%scertid=%s", n++ ? "," : "", + idopts->cert_id_string); } if (idopts->slotid != PK_NOSLOT) { - krb5int_buf_add_fmt(&buf, "%sslotid=%ld", - n++ ? "," : "", - (long)idopts->slotid); + k5_buf_add_fmt(&buf, "%sslotid=%ld", n++ ? "," : "", + (long)idopts->slotid); } - if (krb5int_buf_len(&buf) >= 0) - ret = PORT_ArenaStrdup(pool, krb5int_buf_data(&buf)); + if (k5_buf_len(&buf) >= 0) + ret = PORT_ArenaStrdup(pool, k5_buf_data(&buf)); else ret = NULL; - krb5int_free_buf(&buf); + k5_free_buf(&buf); return ret; } diff --git a/src/plugins/preauth/pkinit/pkinit_crypto_openssl.c b/src/plugins/preauth/pkinit/pkinit_crypto_openssl.c index 17c37c66b..0360736d9 100644 --- a/src/plugins/preauth/pkinit/pkinit_crypto_openssl.c +++ b/src/plugins/preauth/pkinit/pkinit_crypto_openssl.c @@ -4491,39 +4491,34 @@ reassemble_pkcs11_name(pkinit_identity_opts *idopts) int n = 0; char *ret; - krb5int_buf_init_dynamic(&buf); - krb5int_buf_add(&buf, "PKCS11:"); + k5_buf_init_dynamic(&buf); + k5_buf_add(&buf, "PKCS11:"); n = 0; if (idopts->p11_module_name != NULL) { - krb5int_buf_add_fmt(&buf, "%smodule_name=%s", - n++ ? "," : "", - idopts->p11_module_name); + k5_buf_add_fmt(&buf, "%smodule_name=%s", n++ ? "," : "", + idopts->p11_module_name); } if (idopts->token_label != NULL) { - krb5int_buf_add_fmt(&buf, "%stoken=%s", - n++ ? "," : "", - idopts->token_label); + k5_buf_add_fmt(&buf, "%stoken=%s", n++ ? "," : "", + idopts->token_label); } if (idopts->cert_label != NULL) { - krb5int_buf_add_fmt(&buf, "%scertlabel=%s", - n++ ? "," : "", - idopts->cert_label); + k5_buf_add_fmt(&buf, "%scertlabel=%s", n++ ? "," : "", + idopts->cert_label); } if (idopts->cert_id_string != NULL) { - krb5int_buf_add_fmt(&buf, "%scertid=%s", - n++ ? "," : "", - idopts->cert_id_string); + k5_buf_add_fmt(&buf, "%scertid=%s", n++ ? "," : "", + idopts->cert_id_string); } if (idopts->slotid != PK_NOSLOT) { - krb5int_buf_add_fmt(&buf, "%sslotid=%ld", - n++ ? "," : "", - (long)idopts->slotid); + k5_buf_add_fmt(&buf, "%sslotid=%ld", n++ ? "," : "", + (long)idopts->slotid); } - if (krb5int_buf_len(&buf) >= 0) - ret = strdup(krb5int_buf_data(&buf)); + if (k5_buf_len(&buf) >= 0) + ret = strdup(k5_buf_data(&buf)); else ret = NULL; - krb5int_free_buf(&buf); + k5_free_buf(&buf); return ret; } -- cgit