From: Jo Sutton Date: Tue, 16 Apr 2024 02:03:05 +0000 (+1200) Subject: s4:dsdb: Store account DN as part of gMSA update structure X-Git-Tag: tdb-1.4.11~1064 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8bcefaaa5c4117ae4afc829f08ae239af7ebb00e;p=thirdparty%2Fsamba.git s4:dsdb: Store account DN as part of gMSA update structure Signed-off-by: Jo Sutton Reviewed-by: Andrew Bartlett --- diff --git a/source4/dsdb/gmsa/util.c b/source4/dsdb/gmsa/util.c index 96e3a859ce4..a34a86f0a04 100644 --- a/source4/dsdb/gmsa/util.c +++ b/source4/dsdb/gmsa/util.c @@ -810,6 +810,7 @@ static int gmsa_create_update(TALLOC_CTX *mem_ctx, struct ldb_request *old_pw_req = NULL; struct ldb_request *new_pw_req = NULL; struct ldb_request *pwd_id_req = NULL; + struct ldb_dn *account_dn = NULL; struct gmsa_update_pwd new_pwd = {}; struct gmsa_update *update = NULL; NTSTATUS status = NT_STATUS_OK; @@ -908,6 +909,12 @@ static int gmsa_create_update(TALLOC_CTX *mem_ctx, goto out; } + account_dn = ldb_dn_copy(tmp_ctx, msg->dn); + if (account_dn == NULL) { + ret = ldb_oom(ldb); + goto out; + } + update = talloc(tmp_ctx, struct gmsa_update); if (update == NULL) { ret = ldb_oom(ldb); @@ -915,6 +922,7 @@ static int gmsa_create_update(TALLOC_CTX *mem_ctx, } *update = (struct gmsa_update){ + .dn = talloc_steal(update, account_dn), .old_pw_req = talloc_steal(update, old_pw_req), .new_pw_req = talloc_steal(update, new_pw_req), .pwd_id_req = talloc_steal(update, pwd_id_req)}; diff --git a/source4/dsdb/gmsa/util.h b/source4/dsdb/gmsa/util.h index 7d5430eae28..9b7e3ee3222 100644 --- a/source4/dsdb/gmsa/util.h +++ b/source4/dsdb/gmsa/util.h @@ -31,6 +31,8 @@ #include "lib/util/time.h" struct gmsa_update { + /* The DN of the gMSA to be updated. */ + struct ldb_dn *dn; /* An optional request to set the previous password. */ struct ldb_request *old_pw_req; /* A request to set the current password. */