From 28cb8839b75ed9a023a032c195469b61224fe688 Mon Sep 17 00:00:00 2001 From: Matthias Dieter Wallnöfer Date: Thu, 3 Jun 2010 18:22:10 +0200 Subject: 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. --- source4/lib/ldb/common/ldb_msg.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source4/lib/ldb/common/ldb_msg.c b/source4/lib/ldb/common/ldb_msg.c index 59bd32090e..4d0149af8f 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); } } -- cgit