Windows administrative shares broken by v5
Here's the entire script
Note that all the shares are password protected and the user/password is loaded by /opt/maj/standard This worked perfectly for autofs 4.1.4 and just stopped working after going to v5
# $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
[ -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)
dir=$2
sub ("\\$","\\$",dir)
print " \\\n\t /" dir, "://" key "/" dir
}
END { if (!first) print "\n"; else exit 1 }
'----- Original Message ----
From: Ian Kent <[email protected]>
To: Sandra Bonus <[email protected]>
Cc: [email protected]
Sent: Monday, January 22, 2007 4:22:44 PM
Subject: Re: [autofs] Windows administrative shares broken by v5
Quoted 11 lines · Sandra Bonus
I'm running fedora Core
I had made a similar patch to the one described in
http://linux.kernel.org/pipermail/autofs/2006-December/003554.htmlto allow the mounting of Windows administrative shares This was all fine on v4.1.4
However as soon as I installed v 5.0.1-0.rc3.2 this was broken and shares ending in $ could not be mounted. I played around with the output of
/etc/auto.smbfor a while but could not work out a variation that made the admin shares work again.Any ideas?
What is the patch your trying to use?
Ian
____________________________________________________________________________________
Don't pick lemons.
See all the new 2007 cars at Yahoo! Autos.
http://autos.yahoo.com/new_cars.html
Ian Kent
maintainerQuoted 28 lines · Sandra Bonus
Here's the entire script
Note that all the shares are password protected and the user/password is loaded by/opt/maj/standardThis worked perfectly for autofs 4.1.4 and just stopped working after going to v5# $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[ -x $SMBCLIENT ] || exit 1
$SMBCLIENT -U $SMB_USER%$SMB_PASSWORD -gNL $key 2>/dev/null| awk -v key="$key" -v opts="$opts" -F'|' -- '
Quoted 9 lines
BEGIN { ORS=""; first=1 }
/Disk/ { if (first) { print opts; first=0 }
sub(/ /, "\\ ", $2)
dir=$2
sub ("\\$","\\$",dir)
print " \\\n\t /" dir, "://" key "/" dir
}
END { if (!first) print "\n"; else exit 1 }
'This looks ok and "sub ("\\$","\\$",dir)" seems to provide a valid mount entry to autofs but the "\" in "\$" is being stripped somewhere causing the parse of the mount entry to fail.
Could you log a Bugzilla against FC-6 for this probelm please.
Ian
Ian Kent
maintainerQuoted 3 lines · Sandra Bonus
Here's the entire script
Note that all the shares are password protected and the user/password is loaded by/opt/maj/standardThis worked perfectly for autofs 4.1.4 and just stopped working after going to v5
Yes, this is due to the change in the way multi-mount entries are handled in version 5. This change was made in order to provide on demand mounting of these multiple mount entries instead of requiring them all to be mounted at once. This results in the "$" to end up not being quoted causing the parser to fail.
However, version 5 does support using double quotes to preserve entries (so far only in maps, not the master map itself) in addition to the usual "\" quoting. Since the "$" is special because it's used for macro substitution it needs to be double quoted.
Try change below.
Note that this won't work with version 4.
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 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
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 }
'$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 "\"";
}
END { if (!first) print "\n"; else exit 1 }
'Quoted 39 lines
----- Original Message ----
From: Ian Kent <[email protected]>
To: Sandra Bonus <[email protected]>
Cc: [email protected]
Sent: Monday, January 22, 2007 4:22:44 PM
Subject: Re: [autofs] Windows administrative shares broken by v5Quoted 11 lines · Sandra Bonus
I'm running fedora Core
I had made a similar patch to the one described in
http://linux.kernel.org/pipermail/autofs/2006-December/003554.htmlto allow the mounting of Windows administrative shares This was all fine on v4.1.4
However as soon as I installed v 5.0.1-0.rc3.2 this was broken and shares ending in $ could not be mounted. I played around with the output of
/etc/auto.smbfor a while but could not work out a variation that made the admin shares work again.Any ideas?
What is the patch your trying to use?
Ian
____________________________________________________________________________________
Don't pick lemons.
See all the new 2007 cars at Yahoo! Autos.
http://autos.yahoo.com/new_cars.html
Ian Kent
maintainerQuoted 56 lines · Ian Kent
Quoted 3 lines · Sandra Bonus
Here's the entire script
Note that all the shares are password protected and the user/password is loaded by/opt/maj/standardThis worked perfectly for autofs 4.1.4 and just stopped working after going to v5Yes, this is due to the change in the way multi-mount entries are handled in version 5. This change was made in order to provide on demand mounting of these multiple mount entries instead of requiring them all to be mounted at once. This results in the "$" to end up not being quoted causing the parser to fail.
However, version 5 does support using double quotes to preserve entries (so far only in maps, not the master map itself) in addition to the usual "\" quoting. Since the "$" is special because it's used for macro substitution it needs to be double quoted.
Try change below.
Note that this won't work with version 4.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
doneQuoted 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
Quoted 3 lines
dir=$2 sub ("\\$","\\$",dir) print " \\\n\t /" dir, "://" key "/" dirThe updated print encloses each mount entry in double quotes
Quoted 3 lines
} END { if (!first) print "\n"; else exit 1 } '
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 42 lines
} END { if (!first) print "\n"; else exit 1 } 'Quoted 39 lines
----- Original Message ----
From: Ian Kent <[email protected]>
To: Sandra Bonus <[email protected]>
Cc: [email protected]
Sent: Monday, January 22, 2007 4:22:44 PM
Subject: Re: [autofs] Windows administrative shares broken by v5Quoted 11 lines · Sandra Bonus
I'm running fedora Core
I had made a similar patch to the one described in
http://linux.kernel.org/pipermail/autofs/2006-December/003554.htmlto allow the mounting of Windows administrative shares This was all fine on v4.1.4
However as soon as I installed v 5.0.1-0.rc3.2 this was broken and shares ending in $ could not be mounted. I played around with the output of
/etc/auto.smbfor a while but could not work out a variation that made the admin shares work again.Any ideas?
What is the patch your trying to use?
Ian
____________________________________________________________________________________
Don't pick lemons.
See all the new 2007 cars at Yahoo! Autos.
http://autos.yahoo.com/new_cars.html
Ian Kent
maintainerOn 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 19 lines
Quoted 8 lines
Quoted 3 lines
dir=$2 sub ("\\$","\\$",dir) print " \\\n\t /" dir, "://" key "/" dirThe updated print encloses each mount entry in double quotes
Quoted 3 lines
} END { if (!first) print "\n"; else exit 1 } '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 } '