[jcifs] jcifs problem and wins resolution

andrea.lanza at frameweb.it andrea.lanza at frameweb.it
Fri Sep 27 01:54:21 EST 2002


Thank you very much, it worked !!!

I moved the PDC emulator role from SRVGE03 to SRVGE02 using NTDSUTIL
utility

The entry in the Wins Server regarding
\01\02__MSBROWSE__\02<01>
moved, pointing to the ip address of SRVGE02, reflecting the change
occurred.

At this point the broadcast for the master browser was answered, and I got
listed all workgroups and domains.

I supposed that there could be a problem of being myself (SRVGE03) the
master browser,
but what I really didn't know was that a broadcast is not answered by the
caller !

I think it colud be a good idea to implement a mechanism of checking local
netbios name table
before broadcasting for a NetBIOS name.

Thank you  again !

Andrea





                                                                                                                                       
                      Joe Bentley                                                                                                      
                      <jbentley at zonelab        To:       "'andrea.lanza at frameweb.it'" <andrea.lanza at frameweb.it>,                      
                      s.com>                    jcifs at lists.samba.org                                                                  
                      Sent by:                 cc:                                                                                     
                      jcifs-admin at lists        Subject:  RE: [jcifs] jcifs problem and wins resolution                                 
                      .samba.org                                                                                                       
                                                                                                                                       
                                                                                                                                       
                      26/09/2002 14.23                                                                                                 
                                                                                                                                       
                                                                                                                                       





> My servlet runs on the SRVGE03 Windows 2000 Server PDC,
> which also happens to be the DMB; IPCONFIG on SRVGE03 states also that
> it is an H-node, and its Wins "client" configuration points to SRVGE02,
> another
> Windows 2000 Server DC running the Wins server service.
>
> In conclusion:
> I have the  \01\02__MSBROWSE__\02<01>  entry in my Wins Server
> but even if I don't query the Wins Server:
> I have the  \01\02__MSBROWSE__\02<01> registered on my network (if I type
> NBTSTAT -n on SRVGE03 I see the entry)
> and I should get this name via Broadcast !
>
> I specified the following properties in my servlet:
>         jcifs.Config.setProperty("jcifs.netbios.wins", "192.168.69.6");
>         jcifs.Config.setProperty("jcifs.netbios.baddr",
"192.168.69.255");
>         jcifs.Config.setProperty("jcifs.resolveOrder", "WINS,DNS,BCAST");
>

I've noticed the same problem too.  It's because you are executing your
code
on the PDC and a host cannot broadcast to it self.

The problem can also be reproduced doing following:
  jcifs.Config.setProperty("jcifs.netbios.baddr", "127.0.0.1");

If you move your code off the DCs, it should work, providing that the baddr
includes at least one DC.  Yeah I know it's a lame work around.  Let me
know
if you find a better answer.

That reminds me, the global jcifs.Config.setProperty("jcifs.netbios.baddr")
design doesn't work for me.  I need to be able to pass a broadcast address
into the SmbFile("smb://") call to locally override the jcifs.netbios.baddr
setting.  My jCIFS code is sitting on a gateway machine where I need to
broadcast to separate networks that may have over-lapping domain names.
Currently a single-threaded synchronized block is required to protect the
global baddr value before a broadcast call.

Here's an example:

class CIFSDriver {

 public static String getDomainController(String domain,
  String broadcastAddress) {

  InetAddress     baddr;

  try {
   baddr = InetAddress.getByName(broadcastAddress);
  }
  catch (UnknownHostException e)
  {
   baddr = null;
  }

  try {
   return NbtAddress.getByName(domain, 0x1c, null,
    baddr).getHostAddress();
  }
  catch (UnknownHostException e)
  {
   return null;
  }
 }

 public synchronized static void listDomains(String broadcastAddress)
  throws Exception {

  String oldAddr = jcifs.Config.getProperty("baddr");
  jcifs.Config.setProperty("baddr", broadcastAddress);

  SmbFile connection = new SmbFile("smb://");
  String[] domains = connection.list();
  for (int i = 0; i < domains.length; i++)
   System.out.println(domains[i] + ":" +
    getDomainController(domains[i],
broadcastAddress));

  if (oldAddr != null)
   jcifs.Config.setProperty("baddr", oldAddr);
 }

 public static void main(String[] args) throws Exception {

  listDomains("192.168.50.255");
  listDomains("115.63.255.255");
 }
}

-joe







More information about the jcifs mailing list