[jcifs] NPE

Michael B Allen ioplex at gmail.com
Mon Jan 25 13:28:46 MST 2010


Hi Tony,

What is the rest of the stack trace?

Are you using this with NTLM HTTP authentication? If yes, I think this
is the error that you will get if an HTTP client tries to do NTLMv2
(which is not supported by the JCIFS NTLM HTTP authentication filter
as per the blue text at the top of the filter documentation
http://jcifs.samba.org/src/docs/ntlmhttpauth.html).

Otherwise, if you are not doing NTLM HTTP authentication, it looks
like the NtlmPasswordAuthentication object simply has no password and
thus when the SmbSession.logon() code tries to access it, you get an
NPE. You must supply a password for the SmbSession.logon() method to
work properly.

However, this is still a bug since an NPE should never be thrown even
if the password is null. I have added an entry to the TODO to throw a
more appropriate error message.

Note that the SmbSession.logon API documentation which reads "This
method does not support NTLMv2." is actually not accurate. If the
password is supplied, this function should work with any version of
NTLM (although I would like to get rid of this method at some point
since it has very little or nothing to do with CIFS and because you
can do the same thing with an SmbFile.exists() call).

Mike

-- 
Michael B Allen
Java Active Directory Integration
http://www.ioplex.com/

On Mon, Jan 25, 2010 at 11:50 AM, Tony Thompson
<Tony.Thompson at stone-ware.com> wrote:
> I am receiving a NPE with the 1.3.13 code when attempting NTLM
> authentication.  If I just switch jCIFS back to the 1.2 code, everything
> works fine.  I know there were some big NTLM changes between 1.2 and 1.3 so
> I wasn't sure what the issue might be.  Any help appreciated.
>
>
> java.lang.NullPointerException
> 	at
> jcifs.smb.NtlmPasswordAuthentication.nTOWFv1(NtlmPasswordAuthentication.java:197)
> 	at jcifs.ntlmssp.Type3Message.<init>(Type3Message.java:178)
> 	at jcifs.smb.NtlmContext.initSecContext(NtlmContext.java:119)
> 	at jcifs.smb.SmbSession.sessionSetup(SmbSession.java:354)
> 	at jcifs.smb.SmbSession.send(SmbSession.java:223)
> 	at jcifs.smb.SmbTree.treeConnect(SmbTree.java:176)
> 	at jcifs.smb.SmbSession.logon(SmbSession.java:153)
> 	at jcifs.smb.SmbSession.logon(SmbSession.java:146)
> ...


More information about the jCIFS mailing list