Proposed update to auto.smb
Ian Kent
maintainerHi all,
Stef Bon has reported some difficulty with the current auto.smb.
I have made a patch which demonstrates the change he is recommending and would like comments from others that use CIFS mounts.
To quote Stef, from his previous mail:
"Well, the script does (in my network) work with cifs shares, where the original auto.smb doesn't. In my case I have to add the ipaddress or it does not work. The manpage of mount.cifs says that this option has to be used rarely. But it's my experience sometimes when mounting a Win2K or WinXP machine, it does not work.
(CIFS expects the tcp name and not the netbiosname, smbfs did that)
So I cannot say it's a really "must", but at least it cannot "hurt". You're on the safe side when using the ipaddress."
Can we have some comments on the patch below please (including you Stef, since I've modified you change a bit).
Ian
autofs-5.0.3 - CIFS use ip address
From: Stef Bon <[email protected]>
It has been reported that, for a CIFS mount, in some cases the ip address of the server is needed otherwise the mount can fail.
---
samples/auto.smb | 26 +++++++++++++++++++++++++- 1 files changed, 25 insertions(+), 1 deletions(-)
samples/auto.smb +25 -1
@@ -3,7 +3,31 @@ # This file must be executable to work! chmod 755! key="$1" -opts="-fstype=cifs" + +FILESYSTEM="cifs" + +if [ "$FILESYSTEM" != "cifs" ]; then + opts="-fstype=$FILESYSTEM,guest" +else + for P in /bin /sbin /usr/bin /usr/sbin + do + if [ -x $P/nmblookup ]; then + NMBLOOKUP=$P/nmblookup + break + fi + done + + if [ -x $NMBLOOKUP ]; then + exit 1 + fi + + ipaddress=$($NMBLOOKUP $key --debug-level=0 2>>/dev/null | grep '<00>' | awk '{ print $1 }') + if [ -z "$ipaddress" ]; then + exit 1 + fi + + opts="-fstype=cifs,guest,ip=$ipaddress" +fi for P in /bin /sbin /usr/bin /usr/sbin do
Ian Kent
maintainerQuoted 16 lines · Ian Kent
Hi all,
Stef Bon has reported some difficulty with the current auto.smb.
I have made a patch which demonstrates the change he is recommending and would like comments from others that use CIFS mounts.
To quote Stef, from his previous mail:
"Well, the script does (in my network) work with cifs shares, where the original auto.smb doesn't. In my case I have to add the ipaddress or it does not work. The manpage of mount.cifs says that this option has to be used rarely. But it's my experience sometimes when mounting a Win2K or WinXP machine, it does not work.
(CIFS expects the tcp name and not the netbiosname, smbfs did that)
Quoted 7 lines
So I cannot say it's a really "must", but at least it cannot "hurt". You're on the safe side when using the ipaddress."
Can we have some comments on the patch below please (including you Stef, since I've modified you change a bit).
Ian
Sorry, the patch was not quite right.
autofs-5.0.3 - CIFS use ip address
From: Stef Bon <[email protected]>
It has been reported that, for a CIFS mount, in some cases the ip address of the server is needed otherwise the mount can fail.
---
samples/auto.smb | 26 +++++++++++++++++++++++++- 1 files changed, 25 insertions(+), 1 deletions(-)
samples/auto.smb +25 -1
@@ -3,7 +3,31 @@ # This file must be executable to work! chmod 755! key="$1" -opts="-fstype=cifs" + +FILESYSTEM="cifs" + +if [ "$FILESYSTEM" != "cifs" ]; then + opts="-fstype=$FILESYSTEM,guest" +else + for P in /bin /sbin /usr/bin /usr/sbin + do + if [ -x $P/nmblookup ]; then + NMBLOOKUP=$P/nmblookup + break + fi + done + + if [ ! -x "$NMBLOOKUP" ]; then + exit 1 + fi + + ipaddress=$($NMBLOOKUP $key --debug-level=0 2>>/dev/null | grep '<00>' | awk '{ print $1 }') + if [ -z "$ipaddress" ]; then + exit 1 + fi + + opts="-fstype=cifs,guest,ip=$ipaddress" +fi for P in /bin /sbin /usr/bin /usr/sbin do
Quoted 44 lines · Ian Kent
Quoted 16 lines · Ian Kent
Hi all,
Stef Bon has reported some difficulty with the current auto.smb.
I have made a patch which demonstrates the change he is recommending and would like comments from others that use CIFS mounts.
To quote Stef, from his previous mail:
"Well, the script does (in my network) work with cifs shares, where the original auto.smb doesn't. In my case I have to add the ipaddress or it does not work. The manpage of mount.cifs says that this option has to be used rarely. But it's my experience sometimes when mounting a Win2K or WinXP machine, it does not work.
(CIFS expects the tcp name and not the netbiosname, smbfs did that)Quoted 7 lines
So I cannot say it's a really "must", but at least it cannot "hurt". You're on the safe side when using the ipaddress."
Can we have some comments on the patch below please (including you Stef, since I've modified you change a bit).
Ian
Sorry, the patch was not quite right.
autofs-5.0.3 - CIFS use ip address
From: Stef Bon <[email protected]>
It has been reported that, for a CIFS mount, in some cases the ip address of the server is needed otherwise the mount can fail.
---samples/auto.smb | 26 +++++++++++++++++++++++++- 1 files changed, 25 insertions(+), 1 deletions(-)samples/auto.smb +0
-0
samples/auto.smb line 8
Quoted 7 lines
samples/auto.smb +3
-1@@ -3,7 +3,31 @@ # This file must be executable to work! chmod 755! key="$1" -opts="-fstype=cifs" + +FILESYSTEM="cifs" +
So, umm, when is $FILESYSTEM not going to be cifs?
Quoted 4 lines
samples/auto.smb +4
-0+if [ "$FILESYSTEM" != "cifs" ]; then + opts="-fstype=$FILESYSTEM,guest" +else + for P in /bin /sbin /usr/bin /usr/sbin
samples/auto.smb line 22
Quoted 10 lines
samples/auto.smb +10
-0+ do + if [ -x $P/nmblookup ]; then + NMBLOOKUP=$P/nmblookup + break + fi + done + + if [ ! -x "$NMBLOOKUP" ]; then + exit 1 + fi
Is it possible to not have the nmblookup program? It seems to me it would be safer to at least try the mount w/o the ip address if you can't obtain one.
samples/auto.smb line 33
Quoted 11 lines
samples/auto.smb +8
-0+ + ipaddress=$($NMBLOOKUP $key --debug-level=0 2>>/dev/null | grep '<00>' | awk '{ print $1 }') + if [ -z "$ipaddress" ]; then + exit 1 + fi + + opts="-fstype=cifs,guest,ip=$ipaddress" +fi for P in /bin /sbin /usr/bin /usr/sbin do
Can we compress these two loops that do the same thing (determine the path to the samba/cifs binaries)?
Cheers,
Jeff
Quoted 4 lines · On Monday 03 November 2008 15:16:33 Jeff Moyer wrote:
Quoted 3 lines · Ian Kent
Quoted 2 lines · Ian Kent
Hi all,
Quoted 8 lines
samples/auto.smb line 8
Quoted 5 lines
Quoted 1 line
Stef Bon has reported some difficulty with the current auto.smb.
samples/auto.smb +3
-1-opts="-fstype=cifs" + +FILESYSTEM="cifs" +So, umm, when is $FILESYSTEM not going to be cifs?
That's a good one. I thought it's a good thing to still support smbfs, which is not cifs obviously.
Quoted 10 lines
Quoted 10 lines
samples/auto.smb +10
-0+if [ "$FILESYSTEM" != "cifs" ]; then + opts="-fstype=$FILESYSTEM,guest" +else + for P in /bin /sbin /usr/bin /usr/sbin + do + if [ -x $P/nmblookup ]; then + NMBLOOKUP=$P/nmblookup + break + fi + done
Quoted 8 lines
samples/auto.smb line 22
Quoted 4 lines
samples/auto.smb +4
-0+ + if [ ! -x "$NMBLOOKUP" ]; then + exit 1 + fiIs it possible to not have the nmblookup program? It seems to me it would be safer to at least try the mount w/o the ip address if you can't obtain one.
Yes, that's also good choice. Now the script fails when nmblookup is not found, which is not always necessary.
Quoted 10 lines
Quoted 10 lines
(quoted diff) +2
-0+ + ipaddress=$($NMBLOOKUP $key --debug-level=0 2>>/dev/null | grep '<00>'| awk '{ print $1 }') + if [ -z "$ipaddress" ]; then
samples/auto.smb +5
-0+ exit 1 + fi + + opts="-fstype=cifs,guest,ip=$ipaddress" +fi
Quoted 5 lines
Quoted 2 lines
for P in /bin /sbin
/usr/bin/usr/sbin
doCan we compress these two loops that do the same thing (determine the path to the samba/cifs binaries)?
Yes possibly. But the loop to find nmblookup is only done when using cifs (see above..). Also, when combined, the loop should not stop when only one is found, but both. But yes it's possible to create one loop with some if and thens.
Stef
_______________________________________________
autofs mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/autofs