s3:secrets: rename secrets_delete() to secrets_delete_entry()
authorStefan Metzmacher <metze@samba.org>
Tue, 20 Jun 2017 11:07:15 +0000 (13:07 +0200)
committerStefan Metzmacher <metze@samba.org>
Tue, 27 Jun 2017 14:57:45 +0000 (16:57 +0200)
secrets_delete_entry() fails if the key doesn't exist.

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/include/secrets.h
source3/passdb/machine_account_secrets.c
source3/passdb/secrets.c
source3/passdb/secrets_lsa.c
source3/utils/net.c

index 6f74494ea41b2ea5933e44bb0d87646c333e54e7..e7f87a9f67329f693d79f6e7f35b83bb8c1c4066 100644 (file)
@@ -88,7 +88,7 @@ struct db_context *secrets_db_ctx(void);
 void secrets_shutdown(void);
 void *secrets_fetch(const char *key, size_t *size);
 bool secrets_store(const char *key, const void *data, size_t size);
-bool secrets_delete(const char *key);
+bool secrets_delete_entry(const char *key);
 
 /* The following definitions come from passdb/machine_account_secrets.c */
 bool secrets_mark_domain_protected(const char *domain);
index 369f774e9cbaaa4d7b36fb7ff64c6856214653f6..7f19c65392a0e3080d05ddc12bc67a107da841a3 100644 (file)
@@ -92,7 +92,7 @@ bool secrets_clear_domain_protection(const char *domain)
        
        if (protection) {
                SAFE_FREE(protection);
-               ret = secrets_delete(protect_ids_keystr(domain));
+               ret = secrets_delete_entry(protect_ids_keystr(domain));
                if (!ret) {
                        DEBUG(0, ("Failed to remove Domain IDs protection\n"));
                }
@@ -381,7 +381,7 @@ static bool secrets_delete_prev_machine_password(const char *domain)
                return true;
        }
        SAFE_FREE(oldpass);
-       return secrets_delete(machine_prev_password_keystr(domain));
+       return secrets_delete_entry(machine_prev_password_keystr(domain));
 }
 
 /************************************************************************
@@ -394,13 +394,13 @@ bool secrets_delete_machine_password_ex(const char *domain)
        if (!secrets_delete_prev_machine_password(domain)) {
                return false;
        }
-       if (!secrets_delete(machine_password_keystr(domain))) {
+       if (!secrets_delete_entry(machine_password_keystr(domain))) {
                return false;
        }
-       if (!secrets_delete(machine_sec_channel_type_keystr(domain))) {
+       if (!secrets_delete_entry(machine_sec_channel_type_keystr(domain))) {
                return false;
        }
-       return secrets_delete(machine_last_change_time_keystr(domain));
+       return secrets_delete_entry(machine_last_change_time_keystr(domain));
 }
 
 /************************************************************************
@@ -409,7 +409,7 @@ bool secrets_delete_machine_password_ex(const char *domain)
 
 bool secrets_delete_domain_sid(const char *domain)
 {
-       return secrets_delete(domain_sid_keystr(domain));
+       return secrets_delete_entry(domain_sid_keystr(domain));
 }
 
 /************************************************************************
@@ -514,7 +514,7 @@ bool secrets_store_machine_pw_sync(const char *pass, const char *oldpass, const
                value = secrets_fetch(machine_sec_channel_type_keystr(domain), NULL);
                if (value) {
                        SAFE_FREE(value);
-                       ret = secrets_delete(machine_sec_channel_type_keystr(domain));
+                       ret = secrets_delete_entry(machine_sec_channel_type_keystr(domain));
                        if (!ret) {
                                TALLOC_FREE(frame);
                                return ret;
@@ -600,7 +600,7 @@ bool kerberos_secrets_store_des_salt( const char* salt )
 
        if ( !salt ) {
                DEBUG(8,("kerberos_secrets_store_des_salt: deleting salt\n"));
-               secrets_delete( key );
+               secrets_delete_entry( key );
                return True;
        }
 
index 0ddee99a71fb2402bb978badfcf6a48c1fcd965c..3c3b6b9e27ba8e94df5e265249996b8b1f5a275f 100644 (file)
@@ -146,7 +146,7 @@ bool secrets_store(const char *key, const void *data, size_t size)
 
 /* delete a secets database entry
  */
-bool secrets_delete(const char *key)
+bool secrets_delete_entry(const char *key)
 {
        NTSTATUS status;
        if (!secrets_init()) {
@@ -277,7 +277,7 @@ bool secrets_store_trusted_domain_password(const char* domain, const char* pwd,
 
 bool trusted_domain_password_delete(const char *domain)
 {
-       return secrets_delete(trustdom_keystr(domain));
+       return secrets_delete_entry(trustdom_keystr(domain));
 }
 
 bool secrets_store_ldap_pw(const char* dn, char* pw)
@@ -359,7 +359,7 @@ bool fetch_ldap_pw(char **dn, char** pw)
                        SAFE_FREE(*dn);
                        return False;
                }
-               if (!secrets_delete(old_style_key)) {
+               if (!secrets_delete_entry(old_style_key)) {
                        DEBUG(0,("fetch_ldap_pw: old ldap secret could not be deleted!\n"));
                }
 
index a40942cf7be3a72c6a1add3d048d095b5ed29407..3ebaac4bb8e67d77fcb07a0dc8d5b4811d144222 100644 (file)
@@ -223,7 +223,7 @@ NTSTATUS lsa_secret_delete(const char *secret_name)
                return status;
        }
 
-       if (!secrets_delete(key)) {
+       if (!secrets_delete_entry(key)) {
                talloc_free(key);
                return NT_STATUS_ACCESS_DENIED;
        }
index 34884f0fead7bfb1f6d3bc025e20b43860d6cbb5..97d582f523e107c9c177a96d637472324a701aa1 100644 (file)
@@ -156,9 +156,9 @@ static int net_setauthuser(struct net_context *c, int argc, const char **argv)
                                    "        Delete the auth user setting.\n"));
                        return 1;
                }
-               secrets_delete(SECRETS_AUTH_USER);
-               secrets_delete(SECRETS_AUTH_DOMAIN);
-               secrets_delete(SECRETS_AUTH_PASSWORD);
+               secrets_delete_entry(SECRETS_AUTH_USER);
+               secrets_delete_entry(SECRETS_AUTH_DOMAIN);
+               secrets_delete_entry(SECRETS_AUTH_PASSWORD);
                return 0;
        }