Public bug reported:

Binary package hint: autofs5

This bug is not in autofs itself, but instead is in smbclient.
Surely a separate bug report should be fired against smbclient but this bug may 
be relatively easy workarounded in autofs5 auto.smb/auto.cifs maps.

Problem with smbclient may be easily demonstrated by examining the
following output:

r...@linuxws03:/etc# LANG="en+US.UTF-8" smbclient -N -gL linuxws03
Domain=[WG] OS=[Unix] Server=[Samba 3.4.7]
Disk|print$|Printer Drivers
IPC|IPC$|IPC Service (linuxws03 server (Samba, Ubuntu))
Disk|документы|
Disk|documents|
Domain=[WG] OS=[Unix] Server=[Samba 3.4.7]
Server|WGOFFICE|Office Linux Server (Samba 3.0.9-1.3E.16)
Server|LINUXWS03|linuxws03 server (Samba, Ubuntu)
Workgroup|WG|WGOFFICE

r...@linuxws03:/etc# LANG="C" smbclient -N -gL linuxws03
Domain=[WG] OS=[Unix] Server=[Samba 3.4.7]
Disk|print$|Printer Drivers
IPC|IPC$|IPC Service (linuxws03 server (Samba, Ubuntu))
Disk|Disk|documents|
Domain=[WG] OS=[Unix] Server=[Samba 3.4.7]
Server|WGOFFICE|Office Linux Server (Samba 3.0.9-1.3E.16)
Server|LINUXWS03|linuxws03 server (Samba, Ubuntu)
Workgroup|WG|WGOFFICE

As you can see, the share named "документы" (this is russian word
meaning "documents") gets lost when smbclient is being executed with "C"
locale resulting in totally incorrect output "Disk|Disk|documents|" - in
fact this should be two lines, one for "Disk|документы|" somehow mangled
to be ASCII-friendly, and another one for "Disk|documents|". Yes, this
is a bug in smbclient that should be reported at a separate bug report.
To workaround this bug one may always use UFT-8 locale when running
smbclient and optionally converting the output using something like "
iconv -f utf8 -t ascii -c | grep -v 'Disk||' ".

My approach was for to modify auto.smb/auto.cifs by adding 'export
LANG="en_US.UTF-8"' to the top of the file in order to fetch correct
shares list. Then some modifications should be done to the awk script
parsing the output:

$SMBCLIENT $smbopts -gL $key 2>/dev/null| awk -v key="$key" -v 
opts="$mountopts" -F'|' -- '
        BEGIN   { ORS=""; first=1; }
        /Disk/  {
                    if (first) {
                        print opts
                        first=0
                    }
                    gsub(/ /, "\\ ", $2)
                    sub(/\$/, "\\$", $2)
                    print " \\\n\t \"/" $2 "\" \"://" key "/" $2 "\""
                }
        END     {
                    if (!first)
                        print "\n"
                    else
                        exit 1
                }
        '

This would allow to mount shares with utf-8 names, including ones that
contain space characters in their names.

** Affects: autofs5 (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: auto.cifs auto.smb autofs autofs5 smbclient utf8

-- 
autofs5 may fail if map contains utf8 characters
https://bugs.launchpad.net/bugs/668933
You received this bug notification because you are a member of Ubuntu
Server Team, which is subscribed to autofs5 in ubuntu.

-- 
Ubuntu-server-bugs mailing list
Ubuntu-server-bugs@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/ubuntu-server-bugs

Reply via email to