mirror of
https://github.com/samba-team/samba.git
synced 2025-08-03 04:22:09 +03:00
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 9e66df05a4
)
This commit is contained in:
committed by
Gerald (Jerry) Carter
parent
28800c54dc
commit
45c0a4874b
@ -227,6 +227,11 @@ int ldb_msg_add_string(struct ldb_message *msg,
|
|||||||
val.data = discard_const_p(uint8_t, str);
|
val.data = discard_const_p(uint8_t, str);
|
||||||
val.length = strlen(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);
|
return ldb_msg_add_value(msg, attr_name, &val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user