s3:secrets: let secrets_store_machine_pw_sync() delete the des_salt_key when there...
authorStefan Metzmacher <metze@samba.org>
Mon, 22 May 2017 10:27:45 +0000 (12:27 +0200)
committerStefan Metzmacher <metze@samba.org>
Tue, 27 Jun 2017 14:57:45 +0000 (16:57 +0200)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12782

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
source3/passdb/machine_account_secrets.c

index 6b89e2527f93a4f404dd3f8a63c6e79abf6a3d28..c3a760b2965c528fc09303d2b6349de14b9a228d 100644 (file)
@@ -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);