[jcifs] Problem with SMBAuthentication in Mac OS X
arunize
arungi at gmail.com
Mon Aug 1 00:42:44 MDT 2011
Hi All,
I am trying SMB authentication in Mac OS X 10.6.2 with jcifs-1.3.15. I
understand that mac bundled with Samba-3.0.28a-apple. The java code for
authentication is like given below.
String hostName = InetAddress.getLocalHost().getHostName();
InetAddress[] ipList = InetAddress.getAllByName(hostName);
for(InetAddress ip : ipList) {
try {
UniAddress uniAddr = new UniAddress(ip);
NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication(
uniAddr.getHostName(), "operator", "op123");
SmbSession.logon(uniAddr, auth);
System.out.println("AUTH PASS");
}catch (Exception exep) {
exep.printStackTrace();
System.out.println("AUTH FAIL");
}
}
When I pass username that’s not available in the system it doesn't throw any
exception and prints "AUTH PASS". When I pass a valid username with valid
password (as given in the code "operator" a is valid user with password
"op123") it throws exception like
jcifs.smb.SmbAuthException: Logon failure: unknown user name or bad
password.
at jcifs.smb.SmbTransport.checkStatus(SmbTransport.java:544)
at jcifs.smb.SmbTransport.send(SmbTransport.java:661)
at jcifs.smb.SmbSession.sessionSetup(SmbSession.java:390)
at jcifs.smb.SmbSession.send(SmbSession.java:218)
at jcifs.smb.SmbTree.treeConnect(SmbTree.java:176)
at jcifs.smb.SmbSession.logon(SmbSession.java:147)
at jcifs.smb.SmbSession.logon(SmbSession.java:140)
at sample.test.SambaTest.main(SambaTest.java:34)
Kindly help me to workout of this.
Thanks
Arunagiri
--
View this message in context: http://samba.2283325.n4.nabble.com/Problem-with-SMBAuthentication-in-Mac-OS-X-tp3708977p3708977.html
Sent from the Samba - jcifs mailing list archive at Nabble.com.
More information about the jCIFS
mailing list