[jcifs] (no subject)

Michael B Allen mba2000 at ioplex.com
Thu Oct 23 14:13:31 EST 2003


>> Actually there is another *very easy* solution to this problem. The
>> NetBIOS 0x1C group name lookup returns a list of domain controllers. As
>> it
>> is we just read the first and return that.
>
> Note that the first is always the PDC.  The rest are BDCs.  I *think* that
> the BDC entries are ordered with the most recent refresh at the top of the
> list.

I noticed in the list of ~15 address for my domain at work that the first
and third were the same. Mmm.

>
>> I have modified the
>> NameServicePacket.readResourceRecordWireFormat() method to decode more
>> of
>> the list depending on the value of a static 'addrIndex' member. IOW, if
>> a
>> NetBIOS name lookup returns more than one name, the code will pick the
>> next address in the list or reset addrIndex to 0 if it reached the end.
>
> Um... "if a NetBIOS name lookcup returns more than one" IP address.
>
> If I read this correctly, the method will, if called repeatedly, enumerate
> the IPs in the list, yes?  Checking addrIndex will let you know when
> you're at the end of the list.  Have I got that straight.

Right. The addrIndex member starts out at 0. With each query it returns
the address at that index but not before incrementing addrIndex. When a
query enumerates the entire list before reaching addrIndex, addrIndex is
reset to 0 and the last address is returned.

But it sounds like maybe we should also limit the value of addrIndex so
that only the first N addresses are ever used?

>> Now I just have to modify the NtlmHttpFilter to do an
>> NbtAddress.getByName( domain, 0x1C, null ) lookup instead of the usual
>> 0x20 lookup.
>
> If you do a broadcast query, you will only get local LAN DCs.  That's
> okay.  It's just that you'll get zero or more packets instead of a single
> response (with multiple IPs) from an NBNS.

Well I don't think the user is concerned with load balancing between
domain controllers if they don't bother to set WINS.

>
>> The effect will be that a different domain controller will be
>> returned with each NTLM http negotiation and sessions will be
>> distributed
>> evenly across them. The change is about 5 lines of code so unless this
>> trips up Chris' NetBIOS sensors I think 0.7.15 is coming up ...
>
> Only the caveat about broadcast vs. NBNS queries.  As long as there's a
> way to specifically retrieve the first entry if there are multiple
> entries, I think this'll work.

Again, I don't think we should be concerned with broadcast but the
behavior will not change if the user does not set WINS.

Mike

-- 
A program should be written to  model the concepts of the task it
performs rather than the physical world or a process because this
maximizes the  potential for it  to be applied  to tasks that are
conceptually similar and, more  important, to tasks that have not
yet been conceived.



More information about the jcifs mailing list