Bug 34388 - autofs init.d script can include inappropriate --timeout argument to automount
autofs init.d script can include inappropriate --timeout argument to automount
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: autofs (Show other bugs)
7.0
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Nalin Dahyabhai
Brock Organ
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-04-02 18:44 EDT by J Desrochers
Modified: 2007-04-18 12:32 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2001-04-02 18:44:47 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description J Desrochers 2001-04-02 18:44:43 EDT
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 5.0; Windows NT)


In processing the automount points the init.d/autofs
script does not clear the previous timeout arguments found
in variable thisdaemonoptions; this can lead to incorrect
settings for some mount points.

Reproducible: Always
Steps to Reproduce:
1.Create /etc/auto.misc if not already present.
2.Create or edit /etc/auto.master so it contains:
    /misc     /etc/auto.misc   --timeout=60
    /csim     /etc/auto.misc
3.Start or restart the autofs via its init.d script.


Actual Results:  $ /sbin/service autofs status
Configured Mount Points:
------------------------
/usr/sbin/automount --timeout 60 /misc file /etc/auto.misc
/usr/sbin/automount --timeout 60 /csim file /etc/auto.misc


Expected Results:  $ /sbin/service autofs status
Configured Mount Points:
------------------------
/usr/sbin/automount --timeout 60 /misc file /etc/auto.misc
/usr/sbin/automount /csim file /etc/auto.misc


The mountoptions variable is no longer used by this script,
though it is still set. Here is a context diff rework...

*** autofs.OLD	Mon Apr  2 18:36:35 2001
--- autofs	Thu Mar 29 20:01:36 2001
***************
*** 100,155 ****
      getrawmounts | (
  	while read dir map options
  	do
!             # These checks screen out duplicates and skip over 
directories
!             # where the map is '-'.
  	    if [ ! -z "$dir" -a ! -z "$map" \
! 			-a x`echo "$map" | cut -c1` != 'x-' \
!                         -a "`echo "$knownmaps" | grep $dir/`" = "" ]
  	    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
!                 # Break up the maptype and map, if the map type is 
specified
!                 maptype=`echo $map | cut -f1 -d:`
!                 # Handle degenerate map specifiers
!                 if [ "$maptype" = "$map" ] ; then
!                     if [ -x "$map" ]; then
!                         maptype=program
!                     elif [ -x "/etc/$map" ]; then
!                         maptype=program
!                         map=`echo /etc/$map | sed 's^//^/^g'`
!                     elif [ -f "$map" ]; then
!                         maptype=file
!                     elif [ -f "/etc/$map" ]; then
!                         maptype=file
!                         map=`echo /etc/$map | sed 's^//^/^g'`
!                     elif [ "$map" = "hesiod" -o "$map" = "userhome" ] ; 
then
!                         maptype=$map
!                         map=
!                     else
!                         maptype=yp
!                         map=`basename $map | sed s/^auto_/auto./`
!                     fi
!                 fi
!                 if echo $options | grep -- '-t' >/dev/null 2>&1 ; then
!                     thisdaemonoptions="$(echo "$daemonoptions $options" 
|\
!                     sed 's/--*t\(imeout\)*[ \t=]*\([0-9][0-9]*\).*$/--
timeout \2/g')"
!                 fi
!                 # Collect all other options, converting -rwsize, et al 
to rwsize
!                 options=`echo "$options" | sed -e '
!                   s/[ \t]*--*t\(imeout\)*[ \t=]*[0-9][0-9]*//g'`
!                 map=`echo "$map" | cut -f2- -d:`
!                 if [ "$maptype" = "file" ] ; then
!                         if [ -f "/etc/$map" ]; then
!                                 map=`echo /etc/$map | sed 's^//^/^g'`
!                         fi
!                 fi
  
!                echo "$DAEMON $thisdaemonoptions $dir $maptype $map 
$options $localoptions" | sed 's/  / /g'
              fi
!             knownmaps=" $dir/ $knownmaps"
  	done
      )
  fi
--- 100,150 ----
      getrawmounts | (
  	while read dir map options
  	do
! 	    # These checks screen out duplicates and skip over directories
! 	    # where the map is '-'.
  	    if [ ! -z "$dir" -a ! -z "$map" \
! 			-a x`echo "$map" | cut -c1` != "x-" \
! 			-a "`echo "$knownmaps" | grep " $dir "`" = "" ]
  	    then
  		map=`echo "$map" | sed -e 's/^auto_/auto./'`
! 		# Break up the maptype and map, if the map type is 
specified
! 		maptype=`echo "$map" | cut -f1 -d:`
! 		map=`echo "$map" | cut -f2- -d:`
! 		# Handle degenerate map specifiers
! 		if [ "$maptype" = "$map" ]; then
! 		    if [ -x "$map" ]; then
! 			maptype=program
! 		    elif [ -x "/etc/$map" ]; then
! 			maptype=program
! 			map=`echo /etc/$map | sed 's^//^/^g'`
! 		    elif [ -f "$map" ]; then
! 			maptype=file
! 		    elif [ -f "/etc/$map" ]; then
! 			maptype=file
! 			map=`echo /etc/$map | sed 's^//^/^g'`
! 		    elif [ "$map" = "hesiod" -o "$map" = "userhome" ]; then
! 			maptype=$map
! 			map=
! 		    else
! 			maptype=yp
! 			map=`basename $map`
! 		    fi
  		fi
! 		if [ "$maptype" = "file" ]; then
! 		    if [ -f "/etc/$map" ]; then
! 			map=`echo /etc/$map | sed 's^//^/^g'`
! 		    fi
! 		fi
! 		# Greedily capture last timeout, if present, from defaults 
or given options.
! 		thisdaemonoptions=`echo "$daemonoptions $options" |
! 		    sed -n 's/.*[ \t]*--*t\(imeout\)*[ \t=][ \t=]*\([0-9]
[0-9]*\).*/--timeout \2/p'`
! 		# Drop timeout from given options.
! 		options=`echo "$options" |
! 		    sed 's/[ \t]*--*t\(imeout\)*[ \t=][ \t=]*\([0-9][0-9]
*\)//g'`
  
! 		echo "$DAEMON $thisdaemonoptions $dir $maptype $map 
$options $localoptions" | sed 's/  / /g'
              fi
! 	    knownmaps=" $dir$knownmaps"
  	done
      )
  fi
Comment 1 Nalin Dahyabhai 2001-08-28 19:17:46 EDT
This should be fixed in autofs-3.1.7-20 and later.  Thanks!

Note You need to log in before you can comment on or make changes to this bug.