[jcifs] Re: Excluding Bogus Windows Domain Controllers

Jimmy Ray jimmyraywv at yahoo.com
Wed Mar 16 14:22:48 GMT 2005


> 
> The "Failed to negotiate with a suitable DC" message means that none of
> the DCs were good. Are you sure that was the exception? JCIFS will log a
> "Failed validate DC" exception when one bad DC is encountered but that is
> only a harmless warning. The filter should skip that one and try the next
> one. All of this should be totally transparent to the client. THe client
> should not "hang" for any noticeable amount of time or be rejected with an
> error.
> 
> Mike
> 
> 


Actually, I cant reproduce the issue reliably on the Tomcat/UNIX server.  
So...I test it in a Win/Java app running in the Elcipse 3 debugger:

import jcifs.UniAddress;
import jcifs.netbios.NbtAddress;
import jcifs.smb.NtlmPasswordAuthentication;
import jcifs.smb.SmbSession;

public class GetDCs {

    public GetDCs() {
        super();

    }

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

        String[] args = {"DOMAIN","DOMAIN;USER:PASSWORD"};
        jcifs.Config.setProperty( "jcifs.netbios.wins", "IP.1,IP.2" );
        jcifs.Config.setProperty( "jcifs.netbios.lookupRespLimit", "5");
        doTest(args);
    }
    
    private static void doTest(String argv[]) throws Exception{
        NbtAddress[] addrs = NbtAddress.getAllByName(argv[0], 0x1C, null, null);
        
        try{
            for (int i = 0; i < addrs.length-2; i++) {
                System.out.println(addrs[i]);
                UniAddress dc = new UniAddress(addrs[i]);
                NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication
(
                        argv[1]);
                SmbSession.logon(dc, auth);
                System.out.println("Logged On OK");
            }
        }catch (Exception e){
            System.out.println(e.getMessage());
        }finally{
            System.out.println("done");
        }
        
    }

}


It yeilds:
DOMAIN<1C>/Good IP.1
Logged On OK
DOMAIN<1C>/Godd IP.2
Logged On OK
DOMAIN<1C>/Good IP.3
Logged On OK
DOMAIN<1C>/Bad IP Here
Failed to negotiate
done



More information about the jcifs mailing list