[jcifs] Strange things with % in password

Roger rthomas at stone-ware.com
Fri Sep 1 17:55:30 GMT 2006


<%@page import="jcifs.smb.*"%>
<%@page import="java.net.*"%>

<%

String user = "administrator";

String pwd = URLEncoder.encode( "%()" );

System.out.println( pwd );

// #1
//SmbFile f1 = new SmbFile( "smb://" + user + ":" + pwd + "@10.1.1.10" );

// #2 Does not give listing...  jcifs.smb.SmbAuthException: Access is denied.
SmbFile f1 = new SmbFile( "smb://" + user + ":" + pwd + "@10.1.1.10/","/" );

String[] files = f1.list();
for( int i=0; i< files.length; i++) {
  out.println( "<br>" + files[i] );
}
%>

Both calls #1 & #2 yield java.net.MalformedURLException: For input string: "()"


Change the password to just %

call #1 works
call #2 jcifs.smb.SmbAuthException: Access is denied.

Change the password to m%m

Both calls yield jcifs.smb.SmbException: smb://administrator:m%25m@10.1.1.10
java.net.MalformedURLException: String index out of range: 18



Should I be doing some different encoding?

Roger



More information about the jcifs mailing list