replmd_delete quick questions

tridge at tridge at
Thu Nov 12 20:17:39 MST 2009

Hi Eduardo,

 > 1 - How can I get the object's ldb_message (to use with ldb_msg_add_string)
 > if I only have the object's GUID/DN and  ldb_module/ldb_request vars?

If what you're trying to do is modify the object, you should construct
a ldb modify message. You can see an example of this quite a few
places in samba (a reasonable one would be drsuapi_add_SPNs() in

There are a few different API approaches to it. One common one is:

  - use ldb_msg_new() to get a blank ldb_message structure
  - fill in msg->dn
  - use ldb_msg_add_empty() to add a new element with a given flag,
    such as LDB_FLAG_MOD_ADD
  - allocate a set of values under el->values
  - fill in the values

Instead of using ldb_msg_add_empty() you could instead use
ldb_msg_add_string() or a similar function, but if you do then make
sure you setup the el->flags entry for any element you add.

You might also like to experiment with ldbmodify on the command line
to understand how modifies work. See lib/ldb/tests/test-modify.ldif
for an example that shows how it works.

 > 2 - I have to insert the string "\0ADEL" into the object's DN, but
 > "ldb_dn_add_child_fmt" calls "ldb_dn_validate(child)" that calls
 > "ldb_dn_explode(dn)" that modifies the string "\\0ADEL" to "\nDEL" (\\0A is
 > interpreted as the hex of a line feed and a new line appears when I print
 > the new DN). Has anyone experienced this problem?

We haven't had to deal with many encoded DNs like this before. I think
we'll probably need to modify lib/ldb to cope with it better.

I'm having a look now at what we do with DNs of that form. I'll get
back to you if I discover anything.

Cheers, Tridge

More information about the samba-technical mailing list