URL not correctly parsed if password contains number sign ('#')

Guertler Mario <[email protected]> Thu, 4 Feb 2016 14:12:03 +0000
Newsgroups gmane.network.samba.java
Message-ID <[email protected]>
--_004_a3704c474474407b8f9dcf7931d9cf68BGHMAILzntde_
Content-Type: multipart/alternative;
	boundary="_000_a3704c474474407b8f9dcf7931d9cf68BGHMAILzntde_"

--_000_a3704c474474407b8f9dcf7931d9cf68BGHMAILzntde_
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi all,

I think I found a bug in your implementation. We are using JCIFS in many ap=
plications successfully, but if the number sign ('#') is used in password t=
hen we get problems.
I already figured out where the problem is; the passed URL string of constr=
uctor 'public SmbFile(String url)' is not correctly parsed.

The following code:

String connectString =3D"smb://user:passwort#123456789@host/share/Test/";
SmbFile polledFile =3D new SmbFile(connectString);

Results in following field variables of class SmbFile or better of class UR=
L

authority             "user:test#123456789@host"
file                         "#123456789@host/share/Test/"
path                      "#123456789@host/share/Test/"
protocol              "smb"
userInfo              "user:test#123456789"

So you can see that the file/path is not correct und the access to this fil=
e will fail because it does not exist.

Mit freundlichem Gru=DF / Best regards

Mario G=FCrtler
Senior Engineer

znt Zentren f=FCr Neue Technologien GmbH
Institut Dresden
Am Brauhaus 12
D-01099 Dresden

Hauptverwaltung und Sitz: Lena-Christ-Str. 2, 82031 Gr=FCnwald, Amtsgericht=
 M=FCnchen HRB 179019
Gesch=E4ftsf=FChrer: Bernhard Marsoner, Ulrike Birnstiel
Prokuristen: Hans Mayer, Gerhard Schrottshamer

Office:   +49 351 652 480-20
Mobile:
Fax:      +49 351 652 480-29
E-Mail:   [email protected]
Web:     http://www.znt-richter.com<http://www.znt-richter.com/>

[http://www.znt-richter.com/mlogos/logo.jpg]
Munich | Burghausen | Dresden | Villach/Austria | Singapore | Penang/Malays=
ia | San Francisco/USA

Diese E-Mail enth=E4lt vertrauliche und/oder rechtlich gesch=FCtzte Informa=
tionen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrt=FC=
mlich erhalten haben, informieren Sie bitte sofort den Absender und vernich=
ten Sie diese E-Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergab=
e dieser Mail ist nicht gestattet.
This e-mail may contain confidential and/or privileged information. If you =
are not the intended recipient (or have received this e-mail in error) plea=
se notify the sender immediately and destroy this e-mail. Any unauthorised =
copying, disclosure or distribution of the material in this e-mail is stric=
tly forbidden.


--_000_a3704c474474407b8f9dcf7931d9cf68BGHMAILzntde_
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<html xmlns:v=3D"urn:schemas-microsoft-com:vml" xmlns:o=3D"urn:schemas-micr=
osoft-com:office:office" xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" xmlns=3D"http:=
//www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Diso-8859-=
1">
<meta name=3D"Generator" content=3D"Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0cm;
	margin-bottom:.0001pt;
	font-size:11.0pt;
	font-family:"Calibri",sans-serif;
	mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:#0563C1;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-priority:99;
	color:#954F72;
	text-decoration:underline;}
span.E-MailFormatvorlage17
	{mso-style-type:personal-compose;
	font-family:"Calibri",sans-serif;
	color:windowtext;}
.MsoChpDefault
	{mso-style-type:export-only;
	font-family:"Calibri",sans-serif;
	mso-fareast-language:EN-US;}
@page WordSection1
	{size:612.0pt 792.0pt;
	margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
	{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext=3D"edit">
<o:idmap v:ext=3D"edit" data=3D"1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=3D"DE" link=3D"#0563C1" vlink=3D"#954F72">
<div class=3D"WordSection1">
<p class=3D"MsoNormal"><span lang=3D"EN-US">Hi all,<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US"><o:p>&nbsp;</o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US">I think I found a bug in your i=
mplementation. We are using JCIFS in many applications successfully, but if=
 the number sign (&#8216;#&#8217;) is used in password then we get problems=
.
<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US">I already figured out where the=
 problem is; the passed URL string of constructor &#8216;public SmbFile(Str=
ing url)&#8217; is not correctly parsed.<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US"><o:p>&nbsp;</o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US">The following code:<o:p></o:p><=
/span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US"><o:p>&nbsp;</o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US">String connectString =3D&quot;s=
mb://user:passwort#123456789@host/share/Test/&#8221;;<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US">SmbFile polledFile =3D new SmbF=
ile(connectString);<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US"><o:p>&nbsp;</o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US">Results in following field vari=
ables of class SmbFile or better of class URL<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US"><o:p>&nbsp;</o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US">authority&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;user:test#12345678=
9@host&quot;<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US">file&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;#123456789@host/share/Test=
/&quot;<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US">path&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp; &quot;#123456789@host/share/Test/&quot;<o:p></o:p>=
</span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US">protocol&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;smb&quot;<o:p=
></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US">userInfo&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;user:test#123=
456789&quot;<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US"><o:p>&nbsp;</o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US">So you can see that the file/pa=
th is not correct und the access to this file will fail because it does not=
 exist.<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US"><o:p>&nbsp;</o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:10.0pt;font-family:&quot;Ar=
ial&quot;,sans-serif;mso-fareast-language:DE">Mit freundlichem Gru=DF / Bes=
t regards</span><span style=3D"mso-fareast-language:DE">
<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"mso-fareast-language:DE"><o:p>&nbsp;<=
/o:p></span></p>
<p class=3D"MsoNormal"><b><span style=3D"font-size:10.0pt;font-family:&quot=
;Arial&quot;,sans-serif;color:black;mso-fareast-language:DE">Mario G=FCrtle=
r<o:p></o:p></span></b></p>
<p class=3D"MsoNormal"><b><span style=3D"font-size:10.0pt;font-family:&quot=
;Arial&quot;,sans-serif;color:black;mso-fareast-language:DE">Senior Enginee=
r<o:p></o:p></span></b></p>
<p class=3D"MsoNormal"><b><span style=3D"font-size:10.0pt;font-family:&quot=
;Arial&quot;,sans-serif;color:black;mso-fareast-language:DE"><o:p>&nbsp;</o=
:p></span></b></p>
<p class=3D"MsoNormal"><span style=3D"font-size:10.0pt;font-family:&quot;Ar=
ial&quot;,sans-serif;color:black;mso-fareast-language:DE">znt Zentren f=FCr=
 Neue Technologien GmbH<br>
Institut Dresden<br>
Am Brauhaus 12<br>
D-01099 Dresden<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:10.0pt;font-family:&quot;Ar=
ial&quot;,sans-serif;color:black;mso-fareast-language:DE"><o:p>&nbsp;</o:p>=
</span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:8.0pt;font-family:&quot;Ari=
al&quot;,sans-serif;mso-fareast-language:DE">Hauptverwaltung und Sitz: Lena=
-Christ-Str. 2, 82031 Gr=FCnwald, Amtsgericht M=FCnchen HRB 179019<br>
Gesch=E4ftsf=FChrer: Bernhard Marsoner, Ulrike Birnstiel<br>
Prokuristen: Hans Mayer, Gerhard Schrottshamer<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:8.0pt;font-family:&quot;Ari=
al&quot;,sans-serif;mso-fareast-language:DE"><o:p>&nbsp;</o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10.0pt;font-=
family:&quot;Arial&quot;,sans-serif;mso-fareast-language:DE">Office:&nbsp;&=
nbsp; &#43;49 351 652 480-20<br>
Mobile:&nbsp; <br>
Fax:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#43;49 351 652 480-29<br>
E-Mail:&nbsp;&nbsp; [email protected]<br>
Web:&nbsp;&nbsp;&nbsp;&nbsp; </span><span style=3D"font-size:10.0pt;font-fa=
mily:&quot;Arial&quot;,sans-serif;color:#7F7F7F;mso-fareast-language:DE"><a=
 href=3D"http://www.znt-richter.com/"><b><span lang=3D"EN-US" style=3D"font=
-family:&quot;Times New Roman&quot;,serif;color:black">http://www.znt-richt=
er.com</span></b></a></span><span lang=3D"EN-US" style=3D"font-size:10.0pt;=
color:#7F7F7F;mso-fareast-language:DE"><o:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10.0pt;font-=
family:&quot;Arial&quot;,sans-serif;color:#7F7F7F;mso-fareast-language:DE">=
<o:p>&nbsp;</o:p></span></p>
<p class=3D"MsoNormal"><b><span style=3D"font-size:8.0pt;font-family:&quot;=
Arial&quot;,sans-serif;color:#7F7F7F;mso-fareast-language:DE"><img border=
=3D"0" width=3D"176" height=3D"30" id=3D"Bild_x0020_1" src=3D"cid:image001.=
[email protected]" alt=3D"http://www.znt-richter.com/mlogos/logo.jpg"><=
/span></b><b><span lang=3D"EN-US" style=3D"font-size:8.0pt;font-family:&quo=
t;Arial&quot;,sans-serif;color:#7F7F7F;mso-fareast-language:DE"><br>
Munich | Burghausen | Dresden | Villach/Austria | Singapore | Penang/Malays=
ia | San Francisco/USA</span></b><span lang=3D"EN-US" style=3D"font-size:10=
.0pt;font-family:&quot;Arial&quot;,sans-serif;mso-fareast-language:DE"><o:p=
></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10.0pt;font-=
family:&quot;Arial&quot;,sans-serif;mso-fareast-language:DE"><o:p>&nbsp;</o=
:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:8.0pt;font-family:&quot;Ari=
al&quot;,sans-serif;color:black;mso-fareast-language:DE">Diese E-Mail enth=
=E4lt vertrauliche und/oder rechtlich gesch=FCtzte Informationen. Wenn Sie =
nicht der richtige Adressat sind oder diese E-Mail
 irrt=FCmlich erhalten haben, informieren Sie bitte sofort den Absender und=
 vernichten Sie diese E-Mail. Das unerlaubte Kopieren sowie die unbefugte W=
eitergabe dieser Mail ist nicht gestattet.<br>
</span><span lang=3D"EN-GB" style=3D"font-size:8.0pt;font-family:&quot;Aria=
l&quot;,sans-serif;color:black;mso-fareast-language:DE">This e-mail may con=
tain confidential and/or privileged information. If you are not the intende=
d recipient (or have received this e-mail in error)
 please notify the sender immediately and destroy this e-mail. Any unauthor=
ised copying, disclosure or distribution of the material in this e-mail is =
strictly forbidden.</span><span lang=3D"EN-US" style=3D"font-size:10.0pt;fo=
nt-family:&quot;Arial&quot;,sans-serif;mso-fareast-language:DE"><o:p></o:p>=
</span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US"><o:p>&nbsp;</o:p></span></p>
</div>
</body>
</html>

--_000_a3704c474474407b8f9dcf7931d9cf68BGHMAILzntde_--

--_004_a3704c474474407b8f9dcf7931d9cf68BGHMAILzntde_
Content-Type: image/jpeg; name="image001.jpg"
Content-Description: image001.jpg
Content-Disposition: inline; filename="image001.jpg"; size=2397;
	creation-date="Thu, 04 Feb 2016 14:12:02 GMT";
	modification-date="Thu, 04 Feb 2016 14:12:02 GMT"
Content-ID: <[email protected]>
Content-Transfer-Encoding: base64

/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAoHBwkHBgoJCAkLCwoMDxkQDw4ODx4WFxIZJCAmJSMg
IyIoLTkwKCo2KyIjMkQyNjs9QEBAJjBGS0U+Sjk/QD3/2wBDAQsLCw8NDx0QEB09KSMpPT09PT09
PT09PT09PT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