s3-passdb: Silence scary DEBUG(0) message on first use of secrets.tdb databases
authorAndrew Bartlett <abartlet@samba.org>
Tue, 14 Aug 2012 12:58:19 +0000 (22:58 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 14 Aug 2012 13:37:22 +0000 (15:37 +0200)
When pdb_samba4 first opens this databse, this message is printed.

Andrew Bartlett

source3/passdb/machine_account_secrets.c

index a4b5709b283e1ca52efa748ddd625b0083800fa8..ebd7b4cc56d594eb0547db0cf778eb47bce6ae8c 100644 (file)
@@ -75,12 +75,17 @@ bool secrets_mark_domain_protected(const char *domain)
 bool secrets_clear_domain_protection(const char *domain)
 {
        bool ret;
-
-       ret = secrets_delete(protect_ids_keystr(domain));
-       if (!ret) {
-               DEBUG(0, ("Failed to remove Domain IDs protection\n"));
+       void *protection = secrets_fetch(protect_ids_keystr(domain), NULL);
+       
+       if (protection) {
+               SAFE_FREE(protection);
+               ret = secrets_delete(protect_ids_keystr(domain));
+               if (!ret) {
+                       DEBUG(0, ("Failed to remove Domain IDs protection\n"));
+               }
+               return ret;
        }
-       return ret;
+       return true;
 }
 
 bool secrets_store_domain_sid(const char *domain, const struct dom_sid  *sid)