[jcifs] jcifs bug?

James Nord teilo at teilo.net
Sun Feb 24 01:38:23 EST 2002

Michael B Allen wrote:

>On Sat, 23 Feb 2002 02:32:39 +0100
>James Nord <teilo at teilo.net> wrote:
>>Bernie Wieser wrote:
>>>Some user has a file called "seti at home.txt" -
>>>URL is smb://HI137/D$/Documents and Settings/ryar/seti at home.txt
>>I think that you need to URL escape that url
>Spaces are '+'. If you really want to fully encode this, I think it would be:
>>You may need to escape the second @, from my understanding of  RFC 1738 
>>you do not need to but IANAE and I'n not up-to-date on the smb URL to 
>>say this.
>Actually it's the @ sign that's important to the SMB URL. You can get
>away without decoding anything except '@' but because we must apply the
>decoding you also now have to encdode the special escape characters used
>by the URL encoding itself which are '+' and '%'.
>>(I guess usernames can contain a / so that's why everything up to the @ 
>>is callsed as "username"@home.txt
>>ftp://user:pass@foo.com/some/dir/im@home/text.txt is valid no?
>Nope. We search for the '@' from the end.
Erm why search for the @ at all (see below for explanation)

Ah anyway I see you have reserved the "@" from the smbpath.  but read 
on. It is allowed in RFC 1738 for the ftpurl (or it was last night when 
I returned from the pub :-/ )

>>But Seeing as a '/' is a reserver char in usernames/pass it would need 
>>to be escaped here?
>We don't do encoding/decoding on everything after the server

>This may not be perfectly legit according to the language
>layers but there's no way I'm going to URL encode my password and server
>names cannot have '@' signs in them so...
OK, I can follow your logic

<SNIP for reference>

smb_server    = [ [ smb_userinfo "@" ] smb_srv_name [ ":" port ] ]     

smb_userinfo  = [ ntdomain ";" ] username [ ":" password ]

username      = *( unreserved | escaped |
                         "&" | "=" | "+" | "$" | "," )

password      = *( unreserved | escaped |

                         "&" | "=" | "+" | "$" | "," )


But what happens for instance if my password is "password at foo/"?
My point is that you reservere the / and @ in anycase from user/pass so 
this is illegal in the smburl - we must encode.  so then we are left 
with the / following the server.
why not use this as the delim

everything before the first / must be [user[:pass]@]server? and as 
*both* @ and : are *reserved* you know uniqly what is user/pass/server?
And then you can unreserve @ from path alla the ftpurl?



More information about the jcifs mailing list