s4:password_hash LDB module - adapt the module to the new "ldb_msg_remove_attr" behaviour
authorMatthias Dieter Wallnöfer <mdw@samba.org>
Thu, 3 Jun 2010 16:35:00 +0000 (18:35 +0200)
committerMatthias Dieter Wallnöfer <mdw@samba.org>
Sun, 6 Jun 2010 21:13:15 +0000 (23:13 +0200)
source4/dsdb/samdb/ldb_modules/password_hash.c

index 58ab6f7b306ec9846e85e8b71f1658473dc44e7a..1b0b490f5fcd77820ec2fb39cbcd9a9b905bc73c 100644 (file)
@@ -2266,22 +2266,11 @@ static int password_hash_add_do_add(struct ph_context *ac)
                return LDB_ERR_OPERATIONS_ERROR;
        }
 
-       /* remove attributes that we just read into 'io' (handle also superfluous
-        * "password modify" trials - multiple attributes with the same name -
-        * on add operations) */
-       while (ldb_msg_find_element(msg, "userPassword") != NULL) {
-               ldb_msg_remove_attr(msg, "userPassword");
-       }
-       while (ldb_msg_find_element(msg, "clearTextPassword") != NULL) {
-               ldb_msg_remove_attr(msg, "clearTextPassword");
-       }
-       while (ldb_msg_find_element(msg, "unicodePwd") != NULL) {
-               ldb_msg_remove_attr(msg, "unicodePwd");
-       }
-       while (ldb_msg_find_element(msg, "dBCSPwd") != NULL) {
-               ldb_msg_remove_attr(msg, "dBCSPwd");
-       }
-
+       /* remove attributes that we just read into 'io' */
+       ldb_msg_remove_attr(msg, "userPassword");
+       ldb_msg_remove_attr(msg, "clearTextPassword");
+       ldb_msg_remove_attr(msg, "unicodePwd");
+       ldb_msg_remove_attr(msg, "dBCSPwd");
        ldb_msg_remove_attr(msg, "pwdLastSet");
 
        ldb = ldb_module_get_ctx(ac->module);
@@ -2452,7 +2441,7 @@ static int password_hash_modify(struct ldb_module *module, struct ldb_request *r
                                                       *l);
                                return LDB_ERR_CONSTRAINT_VIOLATION;
                        }
-                       ldb_msg_remove_attr(msg, *l);
+                       ldb_msg_remove_element(msg, passwordAttr);
                }
        }
        if ((del_attr_cnt > 0) && (add_attr_cnt == 0)) {