Re: auto.smb and escaping of $ and &

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2020-06-03 at 13:55 -0300, Andreas Hasenack wrote:
> Hi,
> 
> https://kernel.googlesource.com/pub/scm/linux/storage/autofs/autofs/+/a557e6261afc87d3849b557257185ff72be15a82%5E%21/#F0
> dropped the escaping of "$", since the whole thing is later double
> quoted anyway. That fixes automounting of windows administrative
> shares (ending in "$" like "C$"):
> 
> --- autofs-5.1.6.orig/samples/auto.smb
> +++ autofs-5.1.6/samples/auto.smb
> @@ -75,8 +75,6 @@ $SMBCLIENT $smbopts -gL "$key" 2>/dev/nu
>           dir = $2
>           loc = $2
>           # Enclose mount dir and location in quotes
> -         # Double quote "$" in location as it is special
> -         gsub(/\$$/, "\\$", loc);
>           gsub(/\&/,"\\\\&",loc)
>           print " \\\n\t \"/" dir "\"", "\"://" key "/" loc "\""
>         }
> 
> I think that the escaping of "&" should also be removed, otherwise we
> get the same issue there:

Again because of the double quoting, yes, that sounds sensible to
me too.

> attempting to mount entry /cifs/localhost/a&b
> lookup_mount: lookup(program): /cifs/localhost/a&b ->
> -fstype=cifs,guest ://localhost/a\&b
> parse_mount: parse(sun): expanded entry: -fstype=cifs,guest
> ://localhost/a\&b
> parse_mount: parse(sun): gathered options: fstype=cifs,guest
> sun_mount: parse(sun): mounting root /cifs/localhost/a&b, mountpoint
> /cifs/localhost/a&b, what //localhost/a\&b, fstype cifs, options
> guest
> do_mount: //localhost/a\&b /cifs/localhost/a&b type cifs options
> guest
> using module generic
> mount_mount: mount(generic): calling mkdir_path /cifs/localhost/a&b
> mount_mount: mount(generic): calling mount -t cifs -o guest
> //localhost/a\&b /cifs/localhost/a&b
> > > mount error(2): No such file or directory
> > > Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
> mount(generic): failed to mount //localhost/a\&b (type cifs) on
> /cifs/localhost/a&b
> dev_ioctl_send_fail: token = 10
> failed to mount /cifs/localhost/a&b
> 
> $ /etc/auto.smb localhost
> -fstype=cifs,guest \
>          "/print$" "://localhost/print$" \
>          "/myshare" "://localhost/myshare" \
>          "/C$" "://localhost/C$" \
>          "/a&b" "://localhost/a\&b"
> 
> It's a bit scary to deal with $ and & in shell, so maybe I'm missing
> something, but the current auto.smb script doesn't work with shares
> that have "&" in their names.

Sounds correct to me too.

As you point out the mount fails, maybe because mount.cifs has changed
or maybe because I've had it wrong for ages, don't know.

Either way it fails now so I think I should make that change, anyone
on the list have any evidence to the contrary?

Ian




[Index of Archives]     [Linux Filesystem Development]     [Linux Ext4]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux