1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-27 14:04:05 +03:00

s4:dsdb/common: only pass the DSDB_CONTROL_PASSWORD_HASH_VALUES_OID if required

This should give the password_hash module a chance to detect if the called
was the cleartext password or not.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
This commit is contained in:
Stefan Metzmacher 2012-12-10 23:56:47 +01:00
parent 18a306e2f2
commit 7c6b10fbb0

View File

@ -1978,6 +1978,7 @@ NTSTATUS samdb_set_password(struct ldb_context *ldb, TALLOC_CTX *mem_ctx,
struct ldb_request *req;
struct dsdb_control_password_change_status *pwd_stat = NULL;
int ret;
bool hash_values = false;
NTSTATUS status = NT_STATUS_OK;
#define CHECK_RET(x) \
@ -2013,6 +2014,7 @@ NTSTATUS samdb_set_password(struct ldb_context *ldb, TALLOC_CTX *mem_ctx,
el = ldb_msg_find_element(msg, "unicodePwd");
el->flags = LDB_FLAG_MOD_REPLACE;
}
hash_values = true;
} else {
/* the password wasn't specified correctly */
talloc_free(msg);
@ -2050,13 +2052,15 @@ NTSTATUS samdb_set_password(struct ldb_context *ldb, TALLOC_CTX *mem_ctx,
return NT_STATUS_NO_MEMORY;
}
}
ret = ldb_request_add_control(req,
DSDB_CONTROL_PASSWORD_HASH_VALUES_OID,
true, NULL);
if (ret != LDB_SUCCESS) {
talloc_free(req);
talloc_free(msg);
return NT_STATUS_NO_MEMORY;
if (hash_values) {
ret = ldb_request_add_control(req,
DSDB_CONTROL_PASSWORD_HASH_VALUES_OID,
true, NULL);
if (ret != LDB_SUCCESS) {
talloc_free(req);
talloc_free(msg);
return NT_STATUS_NO_MEMORY;
}
}
ret = ldb_request_add_control(req,
DSDB_CONTROL_PASSWORD_CHANGE_STATUS_OID,