[jcifs] NtlmAuthenticator.requestNtlmPasswordAuthentication not always called

Orlin Hristov orlin.hristov at gmail.com
Thu Sep 15 08:49:31 MDT 2011

Hi There,

I tried to trap SmbAuthException extending NtlmAuthenticator.
I followed your 
example posted at: http://jcifs.samba.org/src/docs/authhandler.html but,
as soon as I start testing it, 
I found that the library not always traps SmbAuthException! 
For example:

SmbFile f = new SmbFile("smb://ws01/"); // ws01 - server 
f.list(); //throws "jcifs.smb.SmbAuthException: 
Logon failure: unknown user name or bad password.".

SmbFile f = new SmbFile("smb://ws01/c$/");
f.list(); //traps SmbAuthException and calls
my getNtlmPasswordAuthentication method.

After some debugging I found that 
NtlmAuthenticator.requestNtlmPasswordAuthentication won't be called
if the 'share' member of SmbFile class is null. 
Probably this is reasonable, but I will be 
thankful if you give me any idea how to workaround it in my code.

Thanks for the great library!

More information about the jCIFS mailing list