1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-29 02:50:28 +03:00

s4:dsdb/common: pass optional new_version to samdb_set_password_sid()

For trust account we need to store version number provided by the client.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Stefan Metzmacher 2015-02-05 12:09:34 +01:00
parent 1a84cb7d0b
commit aded6f6551
3 changed files with 5 additions and 1 deletions

View File

@ -2283,6 +2283,7 @@ NTSTATUS samdb_set_password(struct ldb_context *ldb, TALLOC_CTX *mem_ctx,
*/
NTSTATUS samdb_set_password_sid(struct ldb_context *ldb, TALLOC_CTX *mem_ctx,
const struct dom_sid *user_sid,
const uint32_t *new_version, /* optional for trusts */
const DATA_BLOB *new_password,
const struct samr_Password *lmNewHash,
const struct samr_Password *ntNewHash,

View File

@ -213,7 +213,7 @@ static bool kpasswdd_change_password(struct kdc_server *kdc,
/* Performs the password change */
status = samdb_set_password_sid(samdb, mem_ctx,
&session_info->security_token->sids[PRIMARY_USER_SID_INDEX],
password, NULL, NULL,
NULL, password, NULL, NULL,
oldLmHash, oldNtHash, /* this is a user password change */
&reject_reason,
&dominfo);

View File

@ -557,6 +557,7 @@ static NTSTATUS dcesrv_netr_ServerPasswordSet(struct dcesrv_call_state *dce_call
/* Using the sid for the account as the key, set the password */
nt_status = samdb_set_password_sid(sam_ctx, mem_ctx,
creds->sid,
NULL, /* Don't have version */
NULL, /* Don't have plaintext */
NULL, r->in.new_password,
NULL, oldNtHash, /* Password change */
@ -576,6 +577,7 @@ static NTSTATUS dcesrv_netr_ServerPasswordSet2(struct dcesrv_call_state *dce_cal
const char * const attrs[] = { "dBCSPwd", "unicodePwd", NULL };
struct ldb_message **res;
struct samr_Password *oldLmHash, *oldNtHash;
const uint32_t *new_version = NULL;
NTSTATUS nt_status;
DATA_BLOB new_password;
int ret;
@ -627,6 +629,7 @@ static NTSTATUS dcesrv_netr_ServerPasswordSet2(struct dcesrv_call_state *dce_cal
/* Using the sid for the account as the key, set the password */
nt_status = samdb_set_password_sid(sam_ctx, mem_ctx,
creds->sid,
new_version,
&new_password, /* we have plaintext */
NULL, NULL,
oldLmHash, oldNtHash, /* Password change */