Bug#910367: autofs: No way to mount smb share with a dollar sign at the end

2019-03-14 Thread Mike Gabriel

Hi,

On Fri, 05 Oct 2018 14:18:08 +0200 Vincent Danjean  
wrote:

> Package: autofs
> Version: 5.1.2-1
> Severity: important
>
> Hi,
>
> Since stretch update, there is no way to automount a smb share with a 
'$' at
> the end of its name anymore. But these names are automaticcaly 
generated by

> windows when the share is hidden by default...
>
> The auto.smb script has a awk script to protect the '$' character.
> It works for the local mount path and options (cf user='...' 
parameter below),

> but not for the server path.
>
> # /etc/auto.smb nas-stbm
> -fstype=cifs,multiuser,cruid=0,sec=krb5,user="HOSTNAME\$" \
> "/GENOME$" "://nas-stbm/GENOME\$" \
> [...]
>
> I tweak /etc/auto.smb to get the options I wanted. But I tried
> to generate both version (quoted or not) :
> A: "/GENOME$" "://nas-stbm/GENOME\$"
> B: "/GENOME$" "://nas-stbm/GENOME$"
>
> Both fails.
> Running autofs in debug mode, for A, I got:
> Oct 5 13:30:50 ge91097 automount[14285]: attempting to mount entry 
/srv/cifs2/nas-stbm/GENOME$
> Oct 5 13:30:50 ge91097 automount[14285]: lookup_mount: 
lookup(program): /srv/cifs2/nas-stbm/GENOME$ -> 
-fstype=cifs,multiuser,cruid=0,sec=krb5,user=HOSTNAME\$ ://nas-stbm/GENOME\$
> Oct 5 13:30:50 ge91097 automount[14285]: parse_mount: parse(sun): 
expanded entry: -fstype=cifs,multiuser,cruid=0,sec=krb5,user=HOSTNAME\$ 
://nas-stbm/GENOME\$
> Oct 5 13:30:50 ge91097 automount[14285]: parse_mount: parse(sun): 
gathered options: fstype=cifs,multiuser,cruid=0,sec=krb5,user=HOSTNAME$
> Oct 5 13:30:50 ge91097 automount[14285]: sun_mount: parse(sun): 
mounting root /srv/cifs2/nas-stbm/GENOME$, mountpoint 
/srv/cifs2/nas-stbm/GENOME$, what //nas-stbm/GENOME\$, fstype cifs, 
options multiuser,cruid=0,sec=krb5,user=HOSTNAME$
> Oct 5 13:30:50 ge91097 automount[14285]: do_mount: 
//nas-stbm/GENOME\$ /srv/cifs2/nas-stbm/GENOME$ type cifs options 
multiuser,cruid=0,sec=krb5,user=HOSTNAME$ using module generic
> Oct 5 13:30:50 ge91097 automount[14285]: mount_mount: mount(generic): 
calling mkdir_path /srv/cifs2/nas-stbm/GENOME$
> Oct 5 13:30:50 ge91097 automount[14285]: mount_mount: mount(generic): 
calling mount -t cifs -o multiuser,cruid=0,sec=krb5,user=HOSTNAME$ 
//nas-stbm/GENOME\$ /srv/cifs2/nas-stbm/GENOME$

> => note the '\' before '$' that is kept in the server path
> [...]
> Oct 5 13:30:50 ge91097 automount[14285]: mount(generic): failed to 
mount //nas-stbm/GENOME\$ (type cifs) on /srv/cifs2/nas-stbm/GENOME$

>
> For B, I got:
> Oct 5 13:43:17 ge91097 automount[15058]: lookup_mount: 
lookup(program): /srv/cifs2/nas-stbm/GENOME$ -> 
-fstype=cifs,multiuser,cruid=0,sec=krb5,user=HOSTNAME\$ ://nas-stbm/GENOME$
> Oct 5 13:43:17 ge91097 automount[15058]: parse_mount: parse(sun): 
expanded entry: -fstype=cifs,multiuser,cruid=0,sec=krb5,user=HOSTNAME\$ 
://nas-stbm/GENOME
> Oct 5 13:43:17 ge91097 automount[15058]: parse_mount: parse(sun): 
gathered options: fstype=cifs,multiuser,cruid=0,sec=krb5,user=HOSTNAME$
> Oct 5 13:43:17 ge91097 automount[15058]: sun_mount: parse(sun): 
mounting root /srv/cifs2/nas-stbm/GENOME$, mountpoint 
/srv/cifs2/nas-stbm/GENOME$, what //nas-stbm/GENOME, fstype cifs, 
options multiuser,cruid=0,sec=krb5,user=HOSTNAME$
> Oct 5 13:43:17 ge91097 automount[15058]: do_mount: //nas-stbm/GENOME 
/srv/cifs2/nas-stbm/GENOME$ type cifs options 
multiuser,cruid=0,sec=krb5,user=HOSTNAME$ using module generic
> Oct 5 13:43:17 ge91097 automount[15058]: mount_mount: mount(generic): 
calling mkdir_path /srv/cifs2/nas-stbm/GENOME$
> Oct 5 13:43:17 ge91097 automount[15058]: mount_mount: mount(generic): 
calling mount -t cifs -o multiuser,cruid=0,sec=krb5,user=HOSTNAME$ 
//nas-stbm/GENOME /srv/cifs2/nas-stbm/GENOME$

> => note the missing '$' in the server path
> [...]
> Oct 5 13:43:17 ge91097 automount[15058]: mount(generic): failed to 
mount //nas-stbm/GENOME (type cifs) on /srv/cifs2/nas-stbm/GENOME$

>
>
> I workaround the problem by renaming /sbin/mount.cifs into 
mount.cifs.real

> and writing the following script in /sbin/mount.cifs:
> #!/bin/bash
> SHARE="${1/\\\$/\$}"
> shift
> exec "$0".real "$SHARE" "$@"
>
>
> Please, propose a way (whatever it is) to quote the share name.

This is interesting. The double quote feature for the "$" sign in 
locations got added in 2007 [1].


Maybe a regression?

Mike

[1] 
https://git.kernel.org/pub/scm/linux/storage/autofs/autofs.git/commit/?id=3243d2ffbe53eb3fe24e03b239ffcc5cb21e75e4




Bug#910367: autofs: No way to mount smb share with a dollar sign at the end

2018-10-05 Thread Vincent Danjean
Package: autofs
Version: 5.1.2-1
Severity: important

  Hi,

  Since stretch update, there is no way to automount a smb share with a '$' at
the end of its name anymore. But these names are automaticcaly generated by
windows when the share is hidden by default...

  The auto.smb script has a awk script to protect the '$' character.
It works for the local mount path and options (cf user='...' parameter below),
but not for the server path.

# /etc/auto.smb nas-stbm
-fstype=cifs,multiuser,cruid=0,sec=krb5,user="HOSTNAME\$" \
"/GENOME$" "://nas-stbm/GENOME\$" \
[...]

I tweak /etc/auto.smb to get the options I wanted. But I tried
to generate both version (quoted or not) :
A:   "/GENOME$" "://nas-stbm/GENOME\$"
B:   "/GENOME$" "://nas-stbm/GENOME$"

Both fails.
Running autofs in debug mode, for A, I got:
Oct  5 13:30:50 ge91097 automount[14285]: attempting to mount entry 
/srv/cifs2/nas-stbm/GENOME$
Oct  5 13:30:50 ge91097 automount[14285]: lookup_mount: lookup(program): 
/srv/cifs2/nas-stbm/GENOME$ -> 
-fstype=cifs,multiuser,cruid=0,sec=krb5,user=HOSTNAME\$ ://nas-stbm/GENOME\$
Oct  5 13:30:50 ge91097 automount[14285]: parse_mount: parse(sun): expanded 
entry: -fstype=cifs,multiuser,cruid=0,sec=krb5,user=HOSTNAME\$ 
://nas-stbm/GENOME\$
Oct  5 13:30:50 ge91097 automount[14285]: parse_mount: parse(sun): gathered 
options: fstype=cifs,multiuser,cruid=0,sec=krb5,user=HOSTNAME$
Oct  5 13:30:50 ge91097 automount[14285]: sun_mount: parse(sun): mounting root 
/srv/cifs2/nas-stbm/GENOME$, mountpoint /srv/cifs2/nas-stbm/GENOME$, what 
//nas-stbm/GENOME\$, fstype cifs, options 
multiuser,cruid=0,sec=krb5,user=HOSTNAME$
Oct  5 13:30:50 ge91097 automount[14285]: do_mount: //nas-stbm/GENOME\$ 
/srv/cifs2/nas-stbm/GENOME$ type cifs options 
multiuser,cruid=0,sec=krb5,user=HOSTNAME$ using module generic
Oct  5 13:30:50 ge91097 automount[14285]: mount_mount: mount(generic): calling 
mkdir_path /srv/cifs2/nas-stbm/GENOME$
Oct  5 13:30:50 ge91097 automount[14285]: mount_mount: mount(generic): calling 
mount -t cifs -o multiuser,cruid=0,sec=krb5,user=HOSTNAME$ //nas-stbm/GENOME\$ 
/srv/cifs2/nas-stbm/GENOME$
=> note the '\' before '$' that is kept in the server path
[...]
Oct  5 13:30:50 ge91097 automount[14285]: mount(generic): failed to mount 
//nas-stbm/GENOME\$ (type cifs) on /srv/cifs2/nas-stbm/GENOME$

For B, I got:
Oct  5 13:43:17 ge91097 automount[15058]: lookup_mount: lookup(program): 
/srv/cifs2/nas-stbm/GENOME$ -> 
-fstype=cifs,multiuser,cruid=0,sec=krb5,user=HOSTNAME\$ ://nas-stbm/GENOME$
Oct  5 13:43:17 ge91097 automount[15058]: parse_mount: parse(sun): expanded 
entry: -fstype=cifs,multiuser,cruid=0,sec=krb5,user=HOSTNAME\$ 
://nas-stbm/GENOME
Oct  5 13:43:17 ge91097 automount[15058]: parse_mount: parse(sun): gathered 
options: fstype=cifs,multiuser,cruid=0,sec=krb5,user=HOSTNAME$
Oct  5 13:43:17 ge91097 automount[15058]: sun_mount: parse(sun): mounting root 
/srv/cifs2/nas-stbm/GENOME$, mountpoint /srv/cifs2/nas-stbm/GENOME$, what 
//nas-stbm/GENOME, fstype cifs, options 
multiuser,cruid=0,sec=krb5,user=HOSTNAME$
Oct  5 13:43:17 ge91097 automount[15058]: do_mount: //nas-stbm/GENOME 
/srv/cifs2/nas-stbm/GENOME$ type cifs options 
multiuser,cruid=0,sec=krb5,user=HOSTNAME$ using module generic
Oct  5 13:43:17 ge91097 automount[15058]: mount_mount: mount(generic): calling 
mkdir_path /srv/cifs2/nas-stbm/GENOME$
Oct  5 13:43:17 ge91097 automount[15058]: mount_mount: mount(generic): calling 
mount -t cifs -o multiuser,cruid=0,sec=krb5,user=HOSTNAME$ //nas-stbm/GENOME 
/srv/cifs2/nas-stbm/GENOME$
=> note the missing '$' in the server path
[...]
Oct  5 13:43:17 ge91097 automount[15058]: mount(generic): failed to mount 
//nas-stbm/GENOME (type cifs) on /srv/cifs2/nas-stbm/GENOME$


I workaround the problem by renaming /sbin/mount.cifs into mount.cifs.real
and writing the following script in /sbin/mount.cifs:
#!/bin/bash
SHARE="${1/\\\$/\$}"
shift
exec "$0".real "$SHARE" "$@"


  Please, propose a way (whatever it is) to quote the share name.

  Regards,
Vincent



-- System Information:
Debian Release: buster/sid
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'unstable'), (500, 'testing'), 
(500, 'stable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386, armel, mipsel

Kernel: Linux 4.17.0-3-amd64 (SMP w/4 CPU cores)
Locale: LANG=fr_FR.utf8, LC_CTYPE=fr_FR.utf8 (charmap=UTF-8), 
LANGUAGE=fr_FR.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages autofs depends on:
ii  libc62.27-6
ii  libxml2  2.9.4+dfsg1-7+b1
ii  ucf  3.0038

Versions of packages autofs recommends:
ii  e2fsprogs   1.44.4-2
ii  kmod25-1
ii  nfs-common  1:1.3.4-2.2

autofs suggests no packages.

-- no debconf information