]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s4:dsdb: Allocate NT hash on to more appropriate memory context
authorJo Sutton <josutton@catalyst.net.nz>
Mon, 12 Feb 2024 03:25:10 +0000 (16:25 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 16 Feb 2024 02:41:36 +0000 (02:41 +0000)
The NT hash should live at least as long as the message to which it is
added.

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/dsdb/common/util.c

index e249da07e7ad167544333e6bf7bdaf29999995a9..7e39b4117d68be6564278c13bee9f1bfb28561e9 100644 (file)
@@ -2509,7 +2509,7 @@ static NTSTATUS samdb_set_password_internal(struct ldb_context *ldb, TALLOC_CTX
                        && ((ntNewHash != NULL))) {
                /* we have a password as NT hash */
                if (ntNewHash != NULL) {
-                       CHECK_RET(samdb_msg_add_hash(ldb, mem_ctx, msg,
+                       CHECK_RET(samdb_msg_add_hash(ldb, msg, msg,
                                "unicodePwd", ntNewHash));
                        el = ldb_msg_find_element(msg, "unicodePwd");
                        el->flags = LDB_FLAG_MOD_REPLACE;