[jcifs] Domain Controllers
MSDean at beckman.com
MSDean at beckman.com
Thu Feb 3 23:11:31 GMT 2005
Mike,
Thanks again.
Are you sure? My test program would seem to indicate that the property change is
taking effect.
In other words, if set the property to a good, then bad, then good domain, the
code succeeds.
If I set it to good, then bad, if fails (see below).
If I do this, the login will SUCCEED.
static public boolean login (String domain, String username, String
password) {
boolean isSuccessful = false;
try {
System.setProperty( "jcifs.netbios.wins",
"134.217.244.17,134.217.106.6" );
System.setProperty( "jcifs.smb.client.domain", domain );
System.setProperty( "jcifs.smb.client.domain", "BADDOMAIN" );
System.setProperty( "jcifs.smb.client.domain", domain );
// method 1
//UniAddress dc = new UniAddress( NbtAddress.getByName(
domain, 0x1c, null));
// method 2 (better)
NtlmChallenge chal = SmbSession.getChallengeForDomain();
UniAddress dc = chal.dc;
System.out.println("Test: found a domain controller: host
address=" + dc.getHostAddress() + ", hostname=" + dc.getHostName());
SmbSession.logon( dc, new NtlmPasswordAuthentication( domain,
username, password ));
isSuccessful = true;
} catch (SmbException e) {
System.err.println(e.getMessage());
} catch (UnknownHostException e) {
System.err.println(e.getMessage());
}
return isSuccessful;
}
If I do this, it will FAIL.
static public boolean login (String domain, String username, String
password) {
boolean isSuccessful = false;
try {
System.setProperty( "jcifs.netbios.wins",
"134.217.244.17,134.217.106.6" );
System.setProperty( "jcifs.smb.client.domain", domain );
System.setProperty( "jcifs.smb.client.domain", "BADDOMAIN" );
// method 1
//UniAddress dc = new UniAddress( NbtAddress.getByName(
domain, 0x1c, null));
// method 2 (better)
NtlmChallenge chal = SmbSession.getChallengeForDomain();
UniAddress dc = chal.dc;
System.out.println("Test: found a domain controller: host
address=" + dc.getHostAddress() + ", hostname=" + dc.getHostName());
SmbSession.logon( dc, new NtlmPasswordAuthentication( domain,
username, password ));
isSuccessful = true;
} catch (SmbException e) {
System.err.println(e.getMessage());
} catch (UnknownHostException e) {
System.err.println(e.getMessage());
}
return isSuccessful;
}
"Michael B Allen"
<mba2000 at ioplex.c To: MSDean at beckman.com
om> cc: jcifs at lists.samba.org
Subject: Re: [jcifs] Domain Controllers
02/03/2005 02:58
PM
MSDean at beckman.com said:
> System.setProperty( "jcifs.netbios.wins", "<IP1>,<IP2>"
> );
> System.setProperty( "jcifs.smb.client.domain", domain );
Once you access jCIFS classes that use properties they cannot be changed.
More information about the jcifs
mailing list