Skip to contentSkip to conversation

Maps may be accidentally used from local directory

PATCH New Chris Feist 1 participant 1 message Nov 3, 2004 Kernel automounter

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Maps may be accidentally used from local directory

If you have a file/program in your current directory with the name of a map listed in auto.master, the init script may use that file/program instead of the one in /etc.

For example:
cat auto.master
/home auto.home

if you have the file auto.home in your current directory, the init script will use that instead of the one in /etc/ or yp. This patch makes sure that a map is an absolute pathname (begins with a /) before checking anywhere but /etc.

Thanks,
Chris

samples/rc.autofs.in renamed from samples/rc.autofs.in.orig +2 -2
@@ -199,12 +199,12 @@ function getmounts()
 		maptype=`echo $map | cut -f1 -d:`
 		# Handle degenerate map specifiers
 		if [ "$maptype" = "$map" ] ; then
-		    if [ -x "$map" ]; then
+		    if `echo $map | grep -q "^/"` && [ -x "$map" ]; then
 			maptype=program
 		    elif [ -x "/etc/$map" ]; then
 			maptype=program
 			map=`echo /etc/$map | sed 's^//^/^g'`
-		    elif [ -f "$map" ]; then
+		    elif `echo $map | grep -q "^/"` && [ -f "$map" ]; then
 			maptype=file
 		    elif [ "$map" = "hesiod" -o "$map" = "userhome" ] ; then
 			maptype=$map

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