[SCM] Samba Shared Repository - branch master updated

Matthias Dieter Wallnöfer mdw at samba.org
Sun Jun 6 15:41:21 MDT 2010


The branch, master has been updated
       via  98b98a2... s4:password_hash LDB module - adapt the module to the new "ldb_msg_remove_attr" behaviour
       via  28cb883... ldb:ldb_msg_remove_attr - provide a better implementation
      from  93db960... s4:samldb LDB module - this codepart isn't needed due to the objectclass LDB module

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 98b98a29f6502422fb6e4bd8c16b5731e2c9c553
Author: Matthias Dieter Wallnöfer <mdw at samba.org>
Date:   Thu Jun 3 18:35:00 2010 +0200

    s4:password_hash LDB module - adapt the module to the new "ldb_msg_remove_attr" behaviour

commit 28cb8839b75ed9a023a032c195469b61224fe688
Author: Matthias Dieter Wallnöfer <mdw at samba.org>
Date:   Thu Jun 3 18:22:10 2010 +0200

    ldb:ldb_msg_remove_attr - provide a better implementation
    
    We can have some special (bad) messages which contain multiple message elements
    for the same attribute. The AD password change ones are such an example.

-----------------------------------------------------------------------

Summary of changes:
 source4/dsdb/samdb/ldb_modules/password_hash.c |   23 ++++++-----------------
 source4/lib/ldb/common/ldb_msg.c               |    5 +++--
 2 files changed, 9 insertions(+), 19 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/dsdb/samdb/ldb_modules/password_hash.c b/source4/dsdb/samdb/ldb_modules/password_hash.c
index 58ab6f7..1b0b490 100644
--- a/source4/dsdb/samdb/ldb_modules/password_hash.c
+++ b/source4/dsdb/samdb/ldb_modules/password_hash.c
@@ -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)) {
diff --git a/source4/lib/ldb/common/ldb_msg.c b/source4/lib/ldb/common/ldb_msg.c
index 59bd320..4d0149a 100644
--- a/source4/lib/ldb/common/ldb_msg.c
+++ b/source4/lib/ldb/common/ldb_msg.c
@@ -798,8 +798,9 @@ void ldb_msg_remove_element(struct ldb_message *msg, struct ldb_message_element
 */
 void ldb_msg_remove_attr(struct ldb_message *msg, const char *attr)
 {
-	struct ldb_message_element *el = ldb_msg_find_element(msg, attr);
-	if (el) {
+	struct ldb_message_element *el;
+
+	while ((el = ldb_msg_find_element(msg, attr)) != NULL) {
 		ldb_msg_remove_element(msg, el);
 	}
 }


-- 
Samba Shared Repository


More information about the samba-cvs mailing list