[PATCH] s4:drs Create connection object (nTDSConnection)

Crístian Viana cristiandeives at gmail.com
Wed Nov 18 13:54:37 MST 2009


hi Tridge,

So you'll need to do a LDB_SCOPE_ONELEVEL search under our nTDSDSA object to
> find all the existing connection objects we have, and then only add missing
> ones, plus delete ones that should not be there.


I started doing the first part of this task - finding all the existing
connection objects - and I have some questions. I need to return a list of
connection objects from one function and pass it to another function to
apply the differences (add/remove the connections). how is this "list of
connection objects" represented in terms of data structure? I thought of a
pointer to an array of ldb_dn, but I can't use struct ldb_dn inside my code
because the compiler complains of "storage size of 'foo isn't known'. the
definition of that structure is on a .c file so I don't know what I should
include to use that struct. so I'm returning an array of ldb_dn pointers,
ending with NULL. I'm using talloc_realloc to resize the array memory just
like the "reps" pointer in the function kccsrv_simple_update.

you said I should search the existing connection objects with
LDB_SCOPE_ONELEVEL. in my function, I'm searching for the nTDSDSA objects
(like the one in kccsrv_simple_update), but when I set the scope to ONELEVEL
it finds nothing. I thought I should find all the nTDSDSA objects and have
an nTDSConnection for each one, based on the DN - that's why I'm returning
the DN on kccsrv_find_connections. but apparently I'm wrong, as the search
doesn't return what I want...

what type should I use to indicate return status? I see some functions
return the type int and other functions return the type NTSTATUS. I was
thinking about setting the connection list as parameter of my function and
use the return value to indicate the status of the operation. then I noticed
that some functions use LDB_SUCCESS and some use NT_STATUS_OK to say the
operation completed successfully, and that's why I came up with this
question.

Interesting! I think you should investigate this and find out why.
>

I investigated the problem but I can't find a solution to it. the process
goes very deep on the source code and when it gets to Samba events, I can't
understand it anymore. and I also found out that if I call
samdb_ntds_invocation_id() before adding the nTDSConnection object on the
domain (even if I don't add that value to the message), everything goes
fine. but I found out some [possibly] useful information

inside the function samdb_ntds_invocation_id() there's a search for the
invocationID but that search fails (that's the "goto failed" which is
showing the error). inside ldb_search, everything goes fine until the code
enters in the function ldb_wait, which is where the req->handle->status
property is changed to "No such object" (32). then it goes to
tevent_loop_once and... I couldn't follow anymore. but deep down there is
where the error happens.

the updated code is on my git repo.

cheers,

-- 
Crístian Deives dos Santos Viana [aka CD1]
Sent from Campinas, SP, Brazil


More information about the samba-technical mailing list