Skip to contentSkip to conversation

Windows administrative shares broken by v5

DISCUSSION Sandra Bonus 2 participants 2 messages Jan 22, 2007 – Jan 23, 2007 Kernel automounter

lore
Share & tools
lore
#0 lore raw

That certainly seems to work

I think I'd tried quoting both the mount point and the mount device but not just the mount device as you have pointed out.

Thanks

----- Original Message ----
From: Ian Kent <[email protected]>
To: Sandra Bonus <[email protected]>
Cc: [email protected]
Sent: Monday, January 22, 2007 6:18:27 PM
Subject: Re: [autofs] Windows administrative shares broken by v5

On Mon, 2007-01-22 at 16:13 +0900, Ian Kent wrote:

I'm being a bit hasty here.
We'll need to do some testing with this.
See below.

Quoted 22 lines
Quoted 22 lines
Quoted 22 lines

# $Id: auto.smb,v 1.3 2005/04/05 13:02:09 raven Exp $

# matthews improved auto.smb file
# under Fedora Core 4 it successfully mounts all shares in my network
# including shares ending in $

. /opt/maj/standard

# This file must be executable to work! chmod 755! key="$1" opts="-fstype=cifs,username=$SMB_USER,password=$SMB_PASSWORD"

for P in /bin /sbin /usr/bin /usr/sbin
do
if [ -x $P/smbclient ]
then
SMBCLIENT=$P/smbclient
break
fi
done

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines

[ -x $SMBCLIENT ] || exit 1

$SMBCLIENT -U $SMB_USER%$SMB_PASSWORD -gNL $key 2>/dev/null| awk -v key="$key" -v opts="$opts" -F'|' -- '

        BEGIN   { ORS=""; first=1 }
        /Disk/  { if (first) { print opts; first=0 }
        sub(/ /, "\\ ", $2)

This line is no longer needed

Keep this line as well or the keys won't preserve the spaces.

Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
        dir=$2
        sub ("\\$","\\$",dir)
        print " \\\n\t /" dir, "://" key "/" dir 

The updated print encloses each mount entry in double quotes

Quoted 3 lines
        }
        END     { if (!first) print "\n"; else exit 1 }
        '
Quoted 11 lines
Quoted 6 lines

$SMBCLIENT -U $SMB_USER%$SMB_PASSWORD -gNL $key 2>/dev/null| awk -v key="$key" -v opts="$opts" -F'|' -- '

    BEGIN   { ORS=""; first=1 }
    /Disk/  { if (first) { print opts; first=0 }
    dir=$2
    sub ("\\$","\\$",dir)
    print " \\\n\t /" $2, "\"://" key "/" $2 "\"";

oops, that should be

      print " \\\n\t /" dir, "\"://" key "/" dir "\""
Quoted 3 lines
    }
    END     { if (!first) print "\n"; else exit 1 }
    '

____________________________________________________________________________________
Don't get soaked. Take a quick peak at the forecast with the Yahoo! Search weather shortcut.
http://tools.search.yahoo.com/shortcuts/#loc_weather

maintainer
#1 lore raw
Quoted 3 lines · Sandra Bonus

That certainly seems to work

I think I'd tried quoting both the mount point and the mount device but not just the mount device as you have pointed out.

That's good.
At least you have something that will work for now.

In my testing I've found an inconsistency with the handling of the double quotes. The quoting both didn't work. I think I've fixed that but "$" in the mount location (the share) still needs to be double quoted. I need to do some more testing on this to be sure I handle double quotes in a consistent manner. So there will likely be a further change.

Quoted 79 lines

Thanks

----- Original Message ----
From: Ian Kent <[email protected]>
To: Sandra Bonus <[email protected]>
Cc: [email protected]
Sent: Monday, January 22, 2007 6:18:27 PM
Subject: Re: [autofs] Windows administrative shares broken by v5

On Mon, 2007-01-22 at 16:13 +0900, Ian Kent wrote:

I'm being a bit hasty here.
We'll need to do some testing with this.
See below.

Quoted 22 lines
Quoted 22 lines
Quoted 22 lines

# $Id: auto.smb,v 1.3 2005/04/05 13:02:09 raven Exp $

# matthews improved auto.smb file
# under Fedora Core 4 it successfully mounts all shares in my network
# including shares ending in $

. /opt/maj/standard

# This file must be executable to work! chmod 755! key="$1" opts="-fstype=cifs,username=$SMB_USER,password=$SMB_PASSWORD"

for P in /bin /sbin /usr/bin /usr/sbin
do
if [ -x $P/smbclient ]
then
SMBCLIENT=$P/smbclient
break
fi
done

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines

[ -x $SMBCLIENT ] || exit 1

$SMBCLIENT -U $SMB_USER%$SMB_PASSWORD -gNL $key 2>/dev/null| awk -v key="$key" -v opts="$opts" -F'|' -- '

        BEGIN   { ORS=""; first=1 }
        /Disk/  { if (first) { print opts; first=0 }
        sub(/ /, "\\ ", $2)

This line is no longer needed

Keep this line as well or the keys won't preserve the spaces.

Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
        dir=$2
        sub ("\\$","\\$",dir)
        print " \\\n\t /" dir, "://" key "/" dir 

The updated print encloses each mount entry in double quotes

Quoted 3 lines
        }
        END     { if (!first) print "\n"; else exit 1 }
        '
Quoted 11 lines
Quoted 6 lines

$SMBCLIENT -U $SMB_USER%$SMB_PASSWORD -gNL $key 2>/dev/null| awk -v key="$key" -v opts="$opts" -F'|' -- '

    BEGIN   { ORS=""; first=1 }
    /Disk/  { if (first) { print opts; first=0 }
    dir=$2
    sub ("\\$","\\$",dir)
    print " \\\n\t /" $2, "\"://" key "/" $2 "\"";

oops, that should be

      print " \\\n\t /" dir, "\"://" key "/" dir "\""
Quoted 3 lines
    }
    END     { if (!first) print "\n"; else exit 1 }
    '

____________________________________________________________________________________
Don't get soaked. Take a quick peak at the forecast with the Yahoo! Search weather shortcut.
http://tools.search.yahoo.com/shortcuts/#loc_weather