Sorting objectClass and krb5Key module

tridge at tridge at
Wed Jan 4 04:28:03 GMT 2006


Just noticed a problem with the objectclass sorting module. The
ldb_next_request() interface assumes that the "struct ldb_request *"
you pass in is a valid talloc pointer, which acts a a request specific
context for other modules to use. Not many modules rely on this yet,
which is why you get away with a stack variable, but it will
definately break with some stacking orders.

If you call in at the top level, by calling ldb_request() or
ldb_search() the it will be fine as ldb_request() always copies the
request structure to ensure that a valid talloc ptr is passed down,
but by calling the ldb_next_request() function directly this is not

Is there some reason why the objectclass sorting module should not
call ldb_request() or ldb_search() ? 

I also think the reason your sorting code gets so complex is that the
ldb->schema structure is the wrong way up. What you really need is a
"tell me what the parent is of this class" structure, rather than a
"tell me what the children of this class are", which is what the
current structure gives you.

If we had a efficient "give me the parent" call, then you could use
qsort() and a function that does walks up the parent tree. If you find
the other class in the parent tree then you know its above you,
otherwise assume its below. That should be quite efficient.

Even better if we had a "how many levels to top" integer available in
ldb->schema. Then the sort would be very fast.

Cheers, Tridge

More information about the samba-technical mailing list