From: Stefan Metzmacher Date: Mon, 22 May 2017 10:27:45 +0000 (+0200) Subject: s3:secrets: let secrets_store_machine_pw_sync() delete the des_salt_key when there... X-Git-Tag: samba-4.5.13~50 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fdbf0dee0a31c2659dc422e231495f4c4f835e06;p=thirdparty%2Fsamba.git s3:secrets: let secrets_store_machine_pw_sync() delete the des_salt_key when there's no value BUG: https://bugzilla.samba.org/show_bug.cgi?id=12782 Signed-off-by: Stefan Metzmacher Reviewed-by: Andreas Schneider (cherry picked from commit 45eea321a6faa6db1c9c706a27527cc0766dc831) --- diff --git a/source3/passdb/machine_account_secrets.c b/source3/passdb/machine_account_secrets.c index 6b89e2527f9..c3a760b2965 100644 --- a/source3/passdb/machine_account_secrets.c +++ b/source3/passdb/machine_account_secrets.c @@ -537,9 +537,16 @@ bool secrets_store_machine_pw_sync(const char *pass, const char *oldpass, const return ret; } - if (realm && salting_principal) { + if (realm != NULL) { char *key = des_salt_key(realm); - ret = secrets_store(key, salting_principal, strlen(salting_principal)+1 ); + + if (salting_principal != NULL) { + ret = secrets_store(key, + salting_principal, + strlen(salting_principal)+1); + } else { + ret = secrets_delete(key); + } } TALLOC_FREE(frame);