From: Stefan Metzmacher Date: Mon, 22 May 2017 10:21:37 +0000 (+0200) Subject: s3:secrets: make use of secrets_delete() in secrets_store_machine_pw_sync() X-Git-Tag: tdb-1.3.14~115 X-Git-Url: http://git.samba.org/samba.git/?a=commitdiff_plain;h=c5ded1123797b2bd152b0989e24eba7cae6a5792;p=sfrench%2Fsamba-autobuild%2F.git s3:secrets: make use of secrets_delete() in secrets_store_machine_pw_sync() BUG: https://bugzilla.samba.org/show_bug.cgi?id=12782 Signed-off-by: Stefan Metzmacher Reviewed-by: Andreas Schneider --- diff --git a/source3/passdb/machine_account_secrets.c b/source3/passdb/machine_account_secrets.c index 7f19c65392a..6b89e2527f9 100644 --- a/source3/passdb/machine_account_secrets.c +++ b/source3/passdb/machine_account_secrets.c @@ -478,7 +478,6 @@ bool secrets_store_machine_pw_sync(const char *pass, const char *oldpass, const uint8_t last_change_time_store[4]; TALLOC_CTX *frame = talloc_stackframe(); uint8_t sec_channel_bytes[4]; - void *value; if (delete_join) { secrets_delete_machine_password_ex(domain); @@ -496,11 +495,7 @@ bool secrets_store_machine_pw_sync(const char *pass, const char *oldpass, const if (oldpass) { ret = secrets_store(machine_prev_password_keystr(domain), oldpass, strlen(oldpass)+1); } else { - value = secrets_fetch_prev_machine_password(domain); - if (value) { - SAFE_FREE(value); - ret = secrets_delete_prev_machine_password(domain); - } + ret = secrets_delete(machine_prev_password_keystr(domain)); } if (!ret) { TALLOC_FREE(frame); @@ -511,14 +506,10 @@ bool secrets_store_machine_pw_sync(const char *pass, const char *oldpass, const /* We delete this and instead have the read code fall back to * a default based on server role, as our caller can't specify * this with any more certainty */ - value = secrets_fetch(machine_sec_channel_type_keystr(domain), NULL); - if (value) { - SAFE_FREE(value); - ret = secrets_delete_entry(machine_sec_channel_type_keystr(domain)); - if (!ret) { - TALLOC_FREE(frame); - return ret; - } + ret = secrets_delete(machine_sec_channel_type_keystr(domain)); + if (!ret) { + TALLOC_FREE(frame); + return ret; } } else { SIVAL(&sec_channel_bytes, 0, secure_channel_type);