[jcifs] Re: SMB URL encoding/decoding
Michael B Allen
mballen at erols.com
Sun Feb 24 06:54:57 EST 2002
On Sat, 23 Feb 2002 15:38:23 +0100
James Nord <teilo at teilo.net> wrote:
> >>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
> >component.
> >
>
> >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 |
>
> "&" | "=" | "+" | "$" | "," )
>
> </SNIP>
>
> 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
So if my password is 'mba at 2foo' I have to do:
smb://miallen:mba%402foo@server/c$/My Documents/seti at home.txt
I don't know. The URL decoding/encoding issue deserves work but a *lot*
of people have '@' signs in their password. Is '\' reserved? Maybe that
could be confiscated as a cheesy escape so we can do:
smb://miallen:mba\@2foo@server/c$/My Documents/seti at home.txt
The language lawers would probably baulk at that one.
In hindsight it is compelling considering that damn '@' sign is the
whole reason we need to escape everything.
> with the / following the server.
> why not use this as the delim
>
> smb://user:pass@server/
> 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?
>
> Comments?
Chris?
>
> /James
>
>
>
>
--
May The Source be with you.
More information about the jcifs
mailing list