s4:password_hash - Fix up request message pointers
authorMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
Tue, 16 Feb 2010 18:48:46 +0000 (19:48 +0100)
committerMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
Sun, 21 Feb 2010 20:43:48 +0000 (21:43 +0100)
For add requests we need the add request messages, for modify requests we need
the modify request messages.

source4/dsdb/samdb/ldb_modules/password_hash.c

index cd588211da11d1f7ec998331e15cfbce1e4d6e4a..3cefa184e5dae2c401cd62e42ef8aadaba9fdceb 100644 (file)
@@ -1689,10 +1689,10 @@ static int password_hash_add(struct ldb_module *module, struct ldb_request *req)
        /* If no part of this ADD touches the userPassword, or the NT
         * or LM hashes, then we don't need to make any changes.  */
 
-       sambaAttr = ldb_msg_find_element(req->op.mod.message, "userPassword");
-       clearTextPasswordAttr = ldb_msg_find_element(req->op.mod.message, "clearTextPassword");
-       ntAttr = ldb_msg_find_element(req->op.mod.message, "unicodePwd");
-       lmAttr = ldb_msg_find_element(req->op.mod.message, "dBCSPwd");
+       sambaAttr = ldb_msg_find_element(req->op.add.message, "userPassword");
+       clearTextPasswordAttr = ldb_msg_find_element(req->op.add.message, "clearTextPassword");
+       ntAttr = ldb_msg_find_element(req->op.add.message, "unicodePwd");
+       lmAttr = ldb_msg_find_element(req->op.add.message, "dBCSPwd");
 
        if ((!sambaAttr) && (!clearTextPasswordAttr) && (!ntAttr) && (!lmAttr)) {
                return ldb_next_request(module, req);
@@ -1884,13 +1884,13 @@ static int password_hash_modify(struct ldb_module *module, struct ldb_request *r
        }
 
        /* nobody must touch password Histories */
-       if (ldb_msg_find_element(req->op.add.message, "ntPwdHistory")) {
+       if (ldb_msg_find_element(req->op.mod.message, "ntPwdHistory")) {
                return LDB_ERR_UNWILLING_TO_PERFORM;
        }
-       if (ldb_msg_find_element(req->op.add.message, "lmPwdHistory")) {
+       if (ldb_msg_find_element(req->op.mod.message, "lmPwdHistory")) {
                return LDB_ERR_UNWILLING_TO_PERFORM;
        }
-       if (ldb_msg_find_element(req->op.add.message, "supplementalCredentials")) {
+       if (ldb_msg_find_element(req->op.mod.message, "supplementalCredentials")) {
                return LDB_ERR_UNWILLING_TO_PERFORM;
        }