kern/63954: devfs loses permissions

Matteo Riondato rionda at gufi.org
Wed Jun 15 16:30:18 GMT 2005


The following reply was made to PR kern/63954; it has been noted by GNATS.

From: Matteo Riondato <rionda at gufi.org>
To: bug-followup at FreeBSD.org, edwin at mavetju.org, mmolteni at cisco.com,
	freebsd-rc at freebsd.org
Cc:  
Subject: Re: kern/63954: devfs loses permissions
Date: Wed, 15 Jun 2005 18:27:44 +0200

 Patch for this against /etc/rc.d/devfs follows and can be found at
 http://www.riondabsd.net/diff/devfs.diff. Please note that this patch
 includes fix for PR bin/65693 (wildcarded device names in devfs.conf
 ). I hope someone will pick this up and commit the patch.
 
 --- devfs.old	Wed Jun  8 22:50:32 2005
 +++ devfs	Wed Jun 15 14:50:37 2005
 @@ -37,25 +37,44 @@
  	read_devfs_conf
  }
  
 +
 +do_action()
 +{
 +	case "$1" in
 +	l*)	if [ -c $2 -a ! -e $3 ]; then
 +			ln -fs $2 $3
 +		fi
 +		;;
 +	o*)	if [ -c $2 ]; then
 +			chown $3 $2
 +		fi
 +		if echo $3 | grep -q : ; then
 +			uid=${3%%:*}
 +			gid=${3##*:}
 +			devfs rule add path $2 user $uid group $gid
 +			devfs rule apply path $2 user $uid group $gid
 +		else
 +			devfs rule add path $2 user $3
 +			devfs rule apply path $2 user $3
 +		fi	
 +		;;
 +	p*)	if [ -c $2 ]; then
 +			chmod $3 $2
 +		fi	
 +			devfs rule add path $2 mode $3
 +			devfs rule apply path $2 
 +		;;
 +	esac
 +}	
 +
  read_devfs_conf()
  {
  	if [ -r /etc/devfs.conf ]; then
  		cd /dev
  		while read action device parameter; do
 -			case "${action}" in
 -			l*)	if [ -c ${device} -a ! -e ${parameter} ]; then
 -					ln -fs ${device} ${parameter}
 -				fi
 -				;;
 -			o*)	if [ -c ${device} ]; then
 -					chown ${parameter} ${device}
 -				fi
 -				;;
 -			p*)	if [ -c ${device} ]; then
 -					chmod ${parameter} ${device}
 -				fi
 -				;;
 -			esac
 +			for dev_name in ${device}; do
 +				do_action ${action} ${dev_name} ${parameter} 
 +			done	
  		done < /etc/devfs.conf
  	fi
  }
 
 Best Regards
 -- 
 Rionda aka Matteo Riondato
 G.U.F.I. Staff Member (http://www.gufi.org)
 FreeSBIE Developer (http://www.freesbie.org)


More information about the freebsd-rc mailing list