summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2006-09-26 01:21:34 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:20:20 -0500
commit26ece8f69772a0991a7299cdef8403a9ad1ad48a (patch)
tree37bf44b0c941b2fcb476493fd0ab3da343d00c21
parent460679fd53dd47841b685907a586721f01a38b6f (diff)
downloadsamba-26ece8f69772a0991a7299cdef8403a9ad1ad48a.tar.gz
samba-26ece8f69772a0991a7299cdef8403a9ad1ad48a.tar.bz2
samba-26ece8f69772a0991a7299cdef8403a9ad1ad48a.zip
r18910: Change ldb_msg_add_string() to not actually add an attribute if the
string is zero length. This allows callers to not have to worry about creating an invalid ldap attribute. See extensive discussion on samba-technical list :-) (This used to be commit 7a1db8c2a432b9ab59b29ee1bfce6c8fe8e981a2)
-rw-r--r--source4/lib/ldb/common/ldb_msg.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/source4/lib/ldb/common/ldb_msg.c b/source4/lib/ldb/common/ldb_msg.c
index 92c537a8fa..9fbb2cdf3e 100644
--- a/source4/lib/ldb/common/ldb_msg.c
+++ b/source4/lib/ldb/common/ldb_msg.c
@@ -227,6 +227,11 @@ int ldb_msg_add_string(struct ldb_message *msg,
val.data = discard_const_p(uint8_t, str);
val.length = strlen(str);
+ if (val.length == 0) {
+ /* allow empty strings as non-existant attributes */
+ return LDB_SUCCESS;
+ }
+
return ldb_msg_add_value(msg, attr_name, &val);
}