summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mdw@samba.org>2010-06-03 18:22:10 +0200
committerMatthias Dieter Wallnöfer <mdw@samba.org>2010-06-06 23:13:00 +0200
commit28cb8839b75ed9a023a032c195469b61224fe688 (patch)
tree5e5829644276579116c870656cbc82511d56cfd6
parent93db960fae43913a423fe1e35a60acf5ed0cc437 (diff)
downloadsamba-28cb8839b75ed9a023a032c195469b61224fe688.tar.gz
samba-28cb8839b75ed9a023a032c195469b61224fe688.tar.bz2
samba-28cb8839b75ed9a023a032c195469b61224fe688.zip
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.
-rw-r--r--source4/lib/ldb/common/ldb_msg.c5
1 files 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);
}
}