[jcifs] Reporting a bug on NtlmPasswordAuthentication when using Android

Michael B Allen ioplex at gmail.com
Mon Sep 19 15:19:47 MDT 2011


On Sun, Sep 18, 2011 at 6:29 AM, paulo louro <paulo_louro at msn.com> wrote:
> Hello,
> I hope this is the right way to report a bug, if not my apologies.
> The problem is related with the implementation of the string.indexOf('@')
> method on Android API. In the function NtlmPasswordAuthentication in the
> jcifs.smb.NtlmPasswordAuthentication.java class. when creating and
> authentication without the username or password ( = null) then the indexOf
> was generating the NullPointerException. To solve the following issue i
> included a simple check on the username against null. If im not mistaking
> this is needed when a GUEST connection is needed to the server. /** * Create
> an <tt>NtlmPasswordAuthentication</tt> object from a * domain, username, and
> password. Parameters that are <tt>null</tt> * will be substituted with
> <tt>jcifs.smb.client.domain</tt>, * <tt>jcifs.smb.client.username</tt>,

Hi Paulo,

Not sure what happened to the formatting of this message in gmail but
yes, this is the right place to report a bug.

You almost certainly do not want to use the "GUEST" account. That
account has been disabled on servers since the late 90's. What you
really want is NtlmPasswordAuthentication.ANONYMOUS which is
equivalent to new NtlmPasswordAuthentication("", "", "") (which of
course would pass the indexOf call without throwing an NPE).

But regardless I have just modified the code at my end to check for a
null username just as you did above since it's a totally harmless
change and no code should throw an NPE (or any RuntimeException).

Thanks for the feedback.

Mike

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


More information about the jCIFS mailing list