diff options
author | Andrew Tridgell <tridge@samba.org> | 2006-09-26 01:21:34 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:14:45 -0500 |
commit | 45c0a4874bcfc25f6ab28531d771ba0198191bbe (patch) | |
tree | 013dc3efa8a1177ede262eeff0411a3060466cda /source3 | |
parent | 28800c54dc835d8a3aa97299b1df989ddfd04df2 (diff) | |
download | samba-45c0a4874bcfc25f6ab28531d771ba0198191bbe.tar.gz samba-45c0a4874bcfc25f6ab28531d771ba0198191bbe.tar.bz2 samba-45c0a4874bcfc25f6ab28531d771ba0198191bbe.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 9e66df05a4df3d3c7b02048d80e2661103d1d40a)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/lib/ldb/common/ldb_msg.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/source3/lib/ldb/common/ldb_msg.c b/source3/lib/ldb/common/ldb_msg.c index 52c6b82484..a4ba045669 100644 --- a/source3/lib/ldb/common/ldb_msg.c +++ b/source3/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 0; + } + return ldb_msg_add_value(msg, attr_name, &val); } |