[PATCH] s4: initial code for the topology algorithm

Crístian Viana cristiandeives at gmail.com
Tue Feb 9 23:13:04 MST 2010


Hi everyone,

I started to write the code to compute the DC topology in an AD domain,
based on the Microsoft documentation (MS-ADTS 7.2.2.3.4). The first patch is
attached and I'd like they get reviewed.

The algorithm is rather large, so I created a wiki page with a more
simplified version of the original document (
http://wiki.samba.org/index.php/DC_topology). This first patch has only the
initial setup functions so I thought it'd be small, but it quickly grew to
hundreds of lines of code.

I have some question/observations regarding this patch:

- I created a structure for a GUID list but I think it can be useful outside
this code and it needs a proper header file to be declared on.
- Where do I define some constants, like NTDSTRANSPORT_OPT_BRIDGES_REQUIRED?
Is there a central file for that?
- Some attributes (like siteLink) may have multiple values and I need to
search for all of them. Is the right way to do that
with ldb_msg_find_element?
- To get the attribute "schedule" from an ldb_search, I need to convert an
ldb_val to an int[]. I once asked in this mailing list how to do the
opposite and I learned that it's using the function data_blob_const. How do
I convert it the other way around? I'm still not familiar with NDR and
blobs.
- In one function I need to perform multiple ldb_search'es with different
attributes. As string array handling in C isn't so nice, I decided to create
a single array having the maximum size I'll need with multiple NULL values
and it's filled as needed. I don't know if that's the best approach or if it
even works for ldb_search, but that was the best I could think while saving
memory and code.
- The original Microsoft documentation mentions the constant
NTDSSETTINGS_OPT_W2K3_BRIDGES_REQUIRED, but I can't find any reference to it
in MSDN. When I search for that term, the single occurrence is this
documentation I'm reading. Google can find only 3 ocurrences: one being the
MS-ADTS documentation and the other two are some third-party codes which use
that constant. How can I find out more about this field? I don't even know
its value. The third-party codes I found on Google use the value (1 << 12)
for that variable, but I don't know if I can trust it. Should I e-mail
Microsoft asking them?
- I see there are functions to manipulate linked lists (dlinklist.h) but I
missed the functions to manipulate array lists, I repeated too much code
doing that. Aren't array lists a common technique in Samba?

I haven't run any of those functions yet so they may have obvious errors,
but that'll be the next thing I'll do tomorrow. By the way, I was wondering
how I'm going to make sure this code is working the way it should before it
gets completely finished.

Sorry for the long mail, I wanted to send the patch only for the functions
related to setup the data structures, but the code became too big
unexpectedly.

Cheers,

-- 
Crístian Deives dos Santos Viana [aka CD1]
Sent from Campinas, SP, Brazil
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-initial-code-for-the-topology-algorithm.patch
Type: text/x-patch
Size: 18201 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20100210/2824d93a/attachment.bin>


More information about the samba-technical mailing list