[jcifs] there is a mistake in jcifs-1.2.9.jar about SmbFile constructor

Paul Ling drpaulling at msn.com
Sat Dec 9 01:08:24 GMT 2006


Hi,

I think there is a mistake in jcifs-1.2.9.jar about SmbFile Constructor that 
accept a parent SmbFile and sub name as parameter, if the parent SmbFile has 
user password and the password include the charactors "%,?, 
,\,/,#,@,^,|,<,>,`,Tab".

The reason is at jcifs.smb.Handler.parseURL(), Line 94:
        try {
            userinfo = unescape( userinfo );
        } catch( UnsupportedEncodingException uee ) {
        }

The userInfo of java.net.URL has been unescaped. it should not be unescape 
here again. BTW, the userInfo of java.net.URI is escaped.

Code Example:

URI uri = new URI("smb", "administrator:%?$ ;\\,./:#@*&!^()-+_=|~<>`", 
"10.10.1.140", -1, "/record", null, null);
SmbFile smbfile = new SmbFile(uri.toASCIIString());
SmbFile subfile = new SmbFile(smbfile, "write.txt");

you will get the following exception:
java.net.MalformedURLException: For input string: "?$"
	at java.net.URL.<init>(URL.java:601)
	at jcifs.smb.SmbFile.<init>(SmbFile.java:457)


Paul Ling
12/08/2006

_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar - get it now! 
http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/



More information about the jcifs mailing list