[jcifs] SMB URL

Michael B. Allen miallen at eskimo.com
Tue Jul 9 17:42:29 EST 2002

On Mon, 8 Jul 2002 23:37:29 -0500
"Christopher R. Hertel" <crh at ubiqx.mn.org> wrote:

> On Tue, Jul 09, 2002 at 12:17:10AM -0400, Allen, Michael B (RSCH) wrote:
> :
> > > It would become:
> > > 
> > >   NetBIOS Name = "foo%2Ebar"
> > >       Scope ID = "what.snu.com"
> > >          Share = "share"
> > > 
> > > ...and then you would convert the %2E into a dot.
> > > 
> > 	Right, but if you "export" the decoded URL how do you know if you need
> > to re-encode a dot?
> You would export the individual fields, yes? If the NetBIOS Name field 
> contains a dot, encode it before rebuilding it into the URL.
> That is, to be able to build an SMB URL, you would need to be given each 
> field separately.  Otherwise, how do you know whether "foo;crh:bar at snu" 
> should be read as:
>   ntdomain = "foo"
>   username = "crh"
>   password = "bar"
>       host = "snu"
> or:
>   userinfo = "foo%3Bcrh%3Abar"
>       host = "snu"
> or:
>       host = "foo%3Bcrh%3Abar%40snu"
> If the user enters the string as "foo;crh:bar at snu" then you assume the
> first, because there are no escapes.  If you tare that down to it's
> components, then you need to re-escape the components as you build them
> back into a URL string.  So, if you have:
>       host = "foo.bar"
>    scopeID = "what.snu.com"
>      share = "share"
> then in order to export it as a URL string you would need to first escape
> the dot in "foo.bar" (which means knowing that it is a NetBIOS name rather 
> than a DNS name).
> I think I made that sound more convoluted than it really is.

I  think you would just need to maintain the original URL (with the escape)
and use individual decoded fields for logical operations. But this requires
a  concerted  effort  from all parts of your program; no method or function
can export anything but the original URL or it may not accurately represent
the  resource  anymore.  In  theory  it's probably possible but in practice
scope  just  isn't  worth it. Ultimately factoring scope into the authority
component  is  indeed more complex than not factoring it in. Maybe it won't
have  an  effect  on lookups but you've just pushed the complexity into the
URL  serialization  routines.  Multiplexing  that  many types of names (nbt
server,  nbt wg, nbt server w/scope, nbt workgroup w/scope, ip, and dns) in
one  field  is just bad programming. Implementors will not get it right and
SMB URLs just won't work well with scope. 


More information about the jcifs mailing list