[jcifs] Question about userinfo encoding?

Sean Daley spdaley at gmail.com
Fri Jul 15 05:03:44 MDT 2011


Thanks Mike.  I'll take a look at that.  I had found an old discussion
on the mailing list from 2002
or so around url encoding so I felt like I was definitely missing
something here.  That looks like
it's probably the missing piece.  Currently I've now switched over to
calling URLEncoder.encode
on the username/password (and then re-converting + back to %20) and
that seems to have
worked for me but if the more standard/expected way of doing things is
with NtlmPasswordAuthentication
I'll switch over to using that.

Sean

On Thu, Jul 14, 2011 at 9:29 PM, Michael B Allen <ioplex at gmail.com> wrote:
> On Mon, Jul 11, 2011 at 2:16 PM, Sean Daley <spdaley at gmail.com> wrote:
>> According to the SmbFile javadoc, the userinfo component of the SMB
>> URL must be URL encoded but
>> then it goes on to say that JCIFS will work correctly with anything
>> but '@' and '%' encoded.  I first
>> interpreted that to mean that when using JCIFS, I should only really
>> need to worry about encoding '@'
>> and '%'.  Unfortunately we then had a password with a '#' in it and
>> the URL blew up.  When using
>> JCIFS, should we make sure that we always URL encode the userinfo
>> component?
>
> Hi Sean,
>
> Actually I don't recall what the rules are. That is because you should
> not put credentials into the URL for a number of reasons and not just
> because characters like # are reserved in URLs.
>
> The correct way to specify credentials is with the
> NtlmPasswordAuthentication class and then pass the NPA to SmbFile
> constructors.
>
> Mike
>
> --
> Michael B Allen
> Java Active Directory Integration
> http://www.ioplex.com/
>


More information about the jCIFS mailing list