Bug 6208

Summary: autofs init script doesn't work with NIS-distributed maps
Product: [Retired] Red Hat Linux Reporter: neumann
Component: autofsAssignee: Cristian Gafton <gafton>
Status: CLOSED DUPLICATE QA Contact:
Severity: medium Docs Contact:
Priority: high    
Version: 6.1   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 1999-11-01 22:36:05 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description neumann 1999-10-21 22:58:46 UTC
The init script for autofs does check for a local
auto-master file in /etc before asking the NIS server. This
is against the usual philosophy that NIS maps take
precedence over local files.

Additionally if the map from the NIS server is used the
script assumes map-type 'yp' as default what makes it
impossible to mix local and NIS maps.

Included is a patch that moves the NIS maps to the front of
the script and additionally checks if the found auto.master
map contains any maps that begin with a slash, then assuming
that a local map is wanted, setting the map type to 'file'.

--- rc.d/init.d/autofs.orig     Mon Sep 20 17:13:32 1999
+++ rc.d/init.d/autofs  Sat Oct 16 19:20:35 1999
@@ -37,6 +37,36 @@
 function getmounts()
 {
 #
+#      Next to check for YellowPage maps to be loaded
+#
+  if [ -e /usr/bin/ypcat ] && [ `ypcat -k auto.master
2>/dev/null | wc -l` -gt 0 ]
+  then
+    ypcat -k auto.master | (
+       while read dir map options
+       do
+           if [ ! -z "$dir" -a ! -z "$map" \
+                       -a x`echo "$map" | cut -c1` != 'x-'
]
+           then
+               map=`echo "$map" | sed -e 's/^auto_/auto./'`
+               if echo $options | grep -- '-t' >/dev/null
2>&1 ; then
+                   mountoptions="--timeout $(echo $options
| \
+                     sed 's/^.*-t\(imeout\)*[
\t]*\([0-9][0-9]*\).*$/\2/g')"
+               fi
+               options=`echo "$options" | sed -e '
+                 s/--*t\(imeout\)*[ \t]*[0-9][0-9]*//g
+                 s/\(^\|[ \t]\)-/\1/g'`
+               if [ x`echo "$map" | grep '^\/'` != 'x' ]
+                   then
+                        type="file"
+                    else
+                        type="yp"
+               fi
+               echo "/usr/sbin/automount $mountoptions $dir
$type $map $options $localoptions"
+           fi
+       done
+    )
+else
+#
 #      Check for local maps to be loaded
 #
 if [ -f /etc/auto.master ] ; then
@@ -87,30 +117,6 @@
                        ;;
                esac
                unset basecommand
-           fi
-       done
-    )
-else
-#
-#      Next to check for YellowPage maps to be loaded
-#
-  if [ -e /usr/bin/ypcat ] && [ `ypcat -k auto.master
2>/dev/null | wc -l` -gt 0 ]
-  then
-    ypcat -k auto.master | (
-       while read dir map options
-       do
-           if [ ! -z "$dir" -a ! -z "$map" \
-                       -a x`echo "$map" | cut -c1` != 'x-'
]
-           then
-               map=`echo "$map" | sed -e 's/^auto_/auto./'`
-               if echo $options | grep -- '-t' >/dev/null
2>&1 ; then
-                   mountoptions="--timeout $(echo $options
| \
-                     sed 's/^.*-t\(imeout\)*[
\t]*\([0-9][0-9]*\).*$/\2/g')"
-               fi
-               options=`echo "$options" | sed -e '
-                 s/--*t\(imeout\)*[ \t]*[0-9][0-9]*//g
-                 s/\(^\|[ \t]\)-/\1/g'`
-               echo "/usr/sbin/automount $mountoptions $dir
yp $map $options $localoptions"
            fi
        done
     )

Comment 1 Bill Nottingham 1999-11-01 22:36:59 UTC
*** This bug has been marked as a duplicate of 6484 ***