From: Stefan Metzmacher Date: Wed, 17 May 2017 14:13:37 +0000 (+0200) Subject: s3:libads: remove unused kerberos_secrets_store_salting_principal() X-Git-Tag: samba-4.5.13~78 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=88abba9fb6e7d20fea68bd3f982a97643f25bfa7;p=thirdparty%2Fsamba.git s3:libads: remove unused kerberos_secrets_store_salting_principal() BUG: https://bugzilla.samba.org/show_bug.cgi?id=12782 Signed-off-by: Stefan Metzmacher Reviewed-by: Andreas Schneider (cherry picked from commit c56043a94a10c76a220ce3c7eb7cb8cf2e992cab) --- diff --git a/source3/libads/kerberos.c b/source3/libads/kerberos.c index 2872b00956e..cd3291ac94c 100644 --- a/source3/libads/kerberos.c +++ b/source3/libads/kerberos.c @@ -522,78 +522,6 @@ int create_kerberos_key_from_string(krb5_context context, return ret; } -/************************************************************************ - Routine to set the salting principal for this service. Active - Directory may use a non-obvious principal name to generate the salt - when it determines the key to use for encrypting tickets for a service, - and hopefully we detected that when we joined the domain. - Setting principal to NULL deletes this entry. - ************************************************************************/ - -bool kerberos_secrets_store_salting_principal(const char *service, - int enctype, - const char *principal) -{ - char *key = NULL; - bool ret = False; - krb5_context context = NULL; - krb5_principal princ = NULL; - char *princ_s = NULL; - char *unparsed_name = NULL; - krb5_error_code code; - - if (((code = krb5_init_context(&context)) != 0) || (context == NULL)) { - DEBUG(5, ("kerberos_secrets_store_salting_pricipal: kdb5_init_context failed: %s\n", - error_message(code))); - return False; - } - if (strchr_m(service, '@')) { - if (asprintf(&princ_s, "%s", service) == -1) { - goto out; - } - } else { - if (asprintf(&princ_s, "%s@%s", service, lp_realm()) == -1) { - goto out; - } - } - - if (smb_krb5_parse_name(context, princ_s, &princ) != 0) { - goto out; - } - if (smb_krb5_unparse_name(talloc_tos(), context, princ, &unparsed_name) != 0) { - goto out; - } - - if (asprintf(&key, "%s/%s/enctype=%d", - SECRETS_SALTING_PRINCIPAL, unparsed_name, enctype) - == -1) { - goto out; - } - - if ((principal != NULL) && (strlen(principal) > 0)) { - ret = secrets_store(key, principal, strlen(principal) + 1); - } else { - ret = secrets_delete(key); - } - - out: - - SAFE_FREE(key); - SAFE_FREE(princ_s); - TALLOC_FREE(unparsed_name); - - if (princ) { - krb5_free_principal(context, princ); - } - - if (context) { - krb5_free_context(context); - } - - return ret; -} - - /************************************************************************ ************************************************************************/ diff --git a/source3/libads/kerberos_proto.h b/source3/libads/kerberos_proto.h index 7c566729a11..8917d63b178 100644 --- a/source3/libads/kerberos_proto.h +++ b/source3/libads/kerberos_proto.h @@ -62,9 +62,6 @@ char *kerberos_fetch_salt_princ_for_host_princ(krb5_context context, const char *host_princ_s, int enctype); -bool kerberos_secrets_store_salting_principal(const char *service, - int enctype, - const char *principal); int kerberos_kinit_password(const char *principal, const char *password, int time_offset,