[PATCH] s4-drs: Synchronous Implementation of generated ParentGUID - ToDo List ParentGUID fix

tridge at samba.org tridge at samba.org
Fri Nov 13 18:23:37 MST 2009

Hi Fernando,

 > This patch is an implementation, in a synchronous manner, of the generated
 > ParentGUID

Thanks for the patch!

There are a few problems with the patch that need fixing before it can
be accepted. You are quite close though!

The changes in construct_parent_guid() looks mostly good. It would be
a bit neater to move the code that puts a objectGUID into a message
into a new helper function in dsdb/common/util.c, perhaps called

The change in operational_search() is not correct. You can see what is
wrong by trying the following two searches, which should produce the
same result:

  ldbsearch -H $PREFIX/private/sam.ldb objectclass=user createtimestamp parentguid 
  ldbsearch -H $PREFIX/private/sam.ldb objectclass=user parentguid createtimestamp

If you try it with your patch, you'll see that the first search
correctly produces both the createtimestamp and parentguid attributes,
but the 2nd search only produces the parentguid. The reason is that
you are putting a NULL value into the search_attrs[] array, which
terminates the array, so the backend never sees the request for the
createtimestamp attribute.

For your changes in objectclass.c, please just remove the
objectclass_rename_callback() function, rather than using #if 0. I
know that during the tutorial I used an #if 0, but that was just to
illustrate what to remove, I didn't mean you to patch it like this.

I also suspect you could remove a bit more code from objectclass.c. If
you look in objectclass_rename() then you'll see this comment:

	/* note that the results of this search are kept and used to
	   update the parentGUID in objectclass_rename_callback() */

perhaps we could remove that search completely? You should see if you
can, making sure that everything still works (check the code
carefully, and also run "make test").

You're also getting a warning like this in your code:

 dsdb/samdb/ldb_modules/operational.c:173: warning: passing argument 3 of ‘ldb_msg_add_value’ from incompatible pointer type
 lib/ldb/include/ldb.h:1744: note: expected ‘const struct ldb_val *’ but argument is of type ‘struct datablob *’

if you remember I was a bit puzzled by this when we came across it
during our tutorial session. I've now found that the cause is that
operational.c has the wrong #include lines at the top. The
"includes.h" line should come first, as that defines the override for
the struct ldb_val to be the same as a struct datablob.

Cheers, Tridge

More information about the samba-technical mailing list