Skip to contentSkip to conversation

Bug#279561: smbfs multimount broken

PATCH Arthur Korn 1 participant 1 message Nov 3, 2004 Kernel automounter

lore
Share & tools
lore
#0 lore raw

Package: autofs
Version: 4.1.3-4
Severity: minor
Tags: patch

You should file all bugs to the BTS, since else I have to ... or I'll most probably forget about it.

Maybe it could be changed to detect double slashes "//"? This would be compatible with the old behaviour (which is as SUN does I suppose), but admittedly limited to SMBfs.

ciao, 2ri

----- Forwarded message from Elmar Pruesse <[email protected]> -----

Date: Wed, 03 Nov 2004 16:51:08 +0100
To: [email protected]
From: Elmar Pruesse <[email protected]>
Subject: debian, autofs 4.1.3-4, smbfs multimount broken, patch

hi Arthur,

I hope you don't mind me mailing you directly instead of fileing a bug report, etc.

The the code in parse_sun.c that "tokenizes" multimount lines got broken when the possibilty to use server names containing whitespace was added. It assumes that whitespace followed by a "/" indicates a new mountpoint. Since smbfs mounts also start with a "/", this makes it impossible to use smbfs in multimounts. (Escaping doesn't work either, tried that).

I propose (patch attached) changing the syntax of multimount smbfs mountpoints to match those of ordinary smbfs mounts.

Ordninary smbfsmount:
/mysmbmount -fstype=smbfs ://smbserver/dir

Multimount in version three:
/multimount -fstype=smbfs /one //smbserver/one /two //smbserver/two

Proposed syntax:
/multimount -fstype=smbfs /one ://smbserver/one /two ://smbserver/two

It's the shortest patch I could come up with. The syntax change is minimal, resolves an inconsistency and the way it used to work is broken anyway.

In case anyone is interested I also attached a modified version of the auto.net example which uses smblclient instead of showmount and can be used to dynamically access public smb shares.

By the way: Is there any reason, apart from noone having written it, why
there is no support for ghosting from program maps?

regards,
Elmar

modules/parse_sun.c +5 -2
diff -rNu autofs-4.1.3.orig/modules/parse_sun.c autofs-4.1.3/modules/parse_sun.c
@@ -618,7 +618,7 @@
 {
 	struct parse_context *ctxt = (struct parse_context *) context;
 	char *pmapent, *options;
-	const char *p, *q;
+	const char *p, *q, *r;
 	int mapent_len, rv;
 	int optlen;
 
@@ -716,9 +716,12 @@
 			while (*q && *q != '/') {
 				l = chunklen(q, 1);
 				q += l;
+				r = q;
 				q = skipspace(q);
 			}
-			l = q - p;
+			if (*p == ':') 
+			  	p++;	/* Sun escape for entries starting with / */
+			l = r - p;
 
 			loc = dequote(p, l);
 			loclen = strlen(loc);

#!/bin/sh

key="$1"
opts="-fstype=smbfs"

for SMBCLIENT in /{,usr/}{,s}bin/smbclient; do [ -x $SMBCLIENT ] && break; done [ -x $SMBCLIENT ] || exit 1

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

	BEGIN	{ ORS=""; first=1 }
	/Disk/	{ if (first) { print opts; first=0 }; print " \\\n\t /" $2, "://" key "/" $2 }
	END 	{ if (!first) print "\n"; else exit 1 }
	'

----- End forwarded message -----

Signature · 3 lines
Secure email, spread GPG, clearsign all mail. http://www.gnupg.org
.
I didn't know it was impossible when I did it.

_______________________________________________
autofs mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/autofs