[jcifs] (no subject)

Christopher R. Hertel crh at ubiqx.mn.org
Thu Oct 23 14:57:40 EST 2003

On Thu, Oct 23, 2003 at 12:13:31AM -0400, Michael B Allen wrote:
> >> 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.

Ohh.  It shouldn't do that.  What type of OS is WINS running on?

> >> 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?

Just as long as the caller knows clearly when the list has been exhaused 
(so it doesn't wrap endlessly).

> >> 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.
> Again, I don't think we should be concerned with broadcast but the
> behavior will not change if the user does not set WINS.

As long as the behavior of the NbtAddress class doesn't change then I 
think we're alright.

The user may not know (or care) that jCIFS is running as a B, P, M, or H
node.  If jCIFS is in B mode, then you're right that load balancing isn't
an issue (though it's still possible to get multiple addresses back...it's
just that you can't know which is the PDC any more).

Just curious...  If running in B mode, and a group name query is sent,
does jCIFS collect all of the responses in one NbtAddress object or does 
it only return the first one (and ignore the others)?

Chris -)-----

"Implementing CIFS - the Common Internet FileSystem" ISBN: 013047116X
Samba Team -- http://www.samba.org/     -)-----   Christopher R. Hertel
jCIFS Team -- http://jcifs.samba.org/   -)-----   ubiqx development, uninq.
ubiqx Team -- http://www.ubiqx.org/     -)-----   crh at ubiqx.mn.org
OnLineBook -- http://ubiqx.org/cifs/    -)-----   crh at ubiqx.org

More information about the jcifs mailing list