From: Andrew Bartlett Date: Wed, 6 Mar 2024 02:30:53 +0000 (+1300) Subject: lib/krb5_wrap: Rename confusing add_salt parameter to smb_krb5_kt_add_entry() X-Git-Tag: tdb-1.4.11~1453 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9fc4070f89dc64f66e2af38a1adf3ffc010e374a;p=thirdparty%2Fsamba.git lib/krb5_wrap: Rename confusing add_salt parameter to smb_krb5_kt_add_entry() This just adds the key directly, it is not related to if salting is used or not. Signed-off-by: Andrew Bartlett Reviewed-by: Jo Sutton --- diff --git a/lib/krb5_wrap/krb5_samba.c b/lib/krb5_wrap/krb5_samba.c index 116f916234d..5afd2404fce 100644 --- a/lib/krb5_wrap/krb5_samba.c +++ b/lib/krb5_wrap/krb5_samba.c @@ -1877,9 +1877,7 @@ out: * * @param[in] password The password of the keytab entry. * - * @param[in] no_salt If the password should not be salted. Normally - * this is only set to false for encryption types - * which do not support salting like RC4. + * @param[in] already_hashed The password is a key, not a password * * @retval 0 on Success * @@ -1894,7 +1892,7 @@ krb5_error_code smb_krb5_kt_add_entry(krb5_context context, const char *salt_principal, krb5_enctype enctype, krb5_data *password, - bool no_salt) + bool already_hashed) { krb5_error_code ret; krb5_keytab_entry kt_entry; @@ -1929,7 +1927,7 @@ krb5_error_code smb_krb5_kt_add_entry(krb5_context context, keyp = KRB5_KT_KEY(&kt_entry); - if (no_salt) { + if (already_hashed) { KRB5_KEY_DATA(keyp) = (KRB5_KEY_DATA_CAST *)SMB_MALLOC(password->length); if (KRB5_KEY_DATA(keyp) == NULL) { ret = ENOMEM; diff --git a/lib/krb5_wrap/krb5_samba.h b/lib/krb5_wrap/krb5_samba.h index e158a404dea..464a7f21569 100644 --- a/lib/krb5_wrap/krb5_samba.h +++ b/lib/krb5_wrap/krb5_samba.h @@ -249,7 +249,7 @@ krb5_error_code smb_krb5_kt_add_entry(krb5_context context, const char *salt_principal, krb5_enctype enctype, krb5_data *password, - bool no_salt); + bool already_hashed); krb5_error_code smb_krb5_get_credentials(krb5_context context, krb5_ccache ccache, diff --git a/source3/libads/kerberos_keytab.c b/source3/libads/kerberos_keytab.c index 466211a8611..9841c60f0d9 100644 --- a/source3/libads/kerberos_keytab.c +++ b/source3/libads/kerberos_keytab.c @@ -302,7 +302,7 @@ static int add_kt_entry_etypes(krb5_context context, TALLOC_CTX *tmpctx, salt_princ_s, enctypes[i], password, - false); /* no_salt */ + false); /* needs string2key (hashing) */ if (ret) { DBG_WARNING("Failed to add entry to keytab\n"); goto out; @@ -317,7 +317,7 @@ static int add_kt_entry_etypes(krb5_context context, TALLOC_CTX *tmpctx, salt_princ_s, enctypes[i], password, - false); /* no_salt */ + false); /* needs string2key (hashing) */ if (ret) { DBG_WARNING("Failed to add short entry to keytab\n"); goto out;