[patch] ldb_msg_add_string()
tridge at samba.org
tridge at samba.org
Mon Sep 25 05:28:21 GMT 2006
Simo,
> well actually I am more concerned about things like:
>
> ldb_msg_add_empty(ldb, "comment", LDB_FLAG_MOD_REPLACE);
>
> and then forgetting to really set the new value.
that's true, but it's not relevant for my patch :-)
If you do the above, and forget to set the value, then the check in
ldb_msg_sanity_check() will still kick in. I'm not proposing to change
that check, I'm just proposing to apply exactly the patch I posted
(the change to ldb_msg_add_string()).
> See the ldb_msg_add_empty() example.
lets see if you can find another example :-)
> I have to think about this, maybe we can silently discard an empty
> attribute but give out a level 0 debug error.
> That might be a good enough compromise.
hmmm, no, I don't think thats a good idea.
Maybe you could look at my patch again? Perhaps you didn't notice that
it doesn't actually add an empty attribute to the message?
Cheers, Tridge
PS: Here it is again for easy reference:
Index: common/ldb_msg.c
===================================================================
--- common/ldb_msg.c (revision 18835)
+++ common/ldb_msg.c (working copy)
@@ -227,6 +227,11 @@
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);
}
More information about the samba-technical
mailing list