Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Jun 2005 18:27:44 +0200
From:      Matteo Riondato <rionda@gufi.org>
To:        bug-followup@FreeBSD.org, edwin@mavetju.org, mmolteni@cisco.com, freebsd-rc@freebsd.org
Subject:   Re: kern/63954: devfs loses permissions
Message-ID:  <20050615162744.GP1053@kaiser.sig11.org>

next in thread | raw e-mail | index | archive | help
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)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050615162744.GP1053>