From mboxrd@z Thu Jan 1 00:00:00 1970 From: Olaf Hering Date: Mon, 23 Feb 2004 16:39:42 +0000 Subject: Re: Permissions in udev don't work when klibc is used ? Message-Id: <20040223163942.GA29281@suse.de> List-Id: References: <200402231118.26239.remco@d-compu.dyndns.org> In-Reply-To: <200402231118.26239.remco@d-compu.dyndns.org> MIME-Version: 1.0 Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: quoted-printable To: linux-hotplug@vger.kernel.org On Mon, Feb 23, Remco wrote: > - for user and group names to work a "name conversion system" (user datab= ase +=20 > api to use it) needs to be in place. (e.g. /etc/passwd, /etc/group, ldap = and=20 > glibc, nss-api, nss_ldap)=20 > klibc hasn't got such a system / api (or it's not fully functional ?) so = only=20 > uid-s / gid-s are possible when linking against klibc. > A name conversion system might (or will ?) not be available when using in= itrd.=20 > (what about early userspace, or am I touching the TODO area too much now = ?) You can build your udev.permissions via sed, grep, awk or whatever via getent passwd and getenv group and convert the names to numbers. No need to pollute klibc with 'useless' stuff. # provide numbers because klibc has no getpwnam function # everything would belong to root PT=3D"`mktemp -q /tmp/udev.mkinitramfs.passwd.$$.XXXXXX`" GT=3D"`mktemp -q /tmp/udev.mkinitramfs.group.$$.XXXXXX`" getent passwd | sed -e 's@^\([^:]\+\):[^:]*:\([^:]*\):.*@\1:\2@' > $PT getent group | sed -e 's@^\([^:]\+\):[^:]*:\([^:]*\):.*@\1:\2@' > $GT I=3D$IFS IFS=3D: while read a b c d e ; do case "$a" in \#*|"") echo comment ;; *) dev=3D$a owner=3D"`sed -e \"/^$b:/s@^.*:@@p;d\" < $PT`" group=3D"`sed -e \"/^$c:/s@^.*:@@p;d\" < $GT`" if [ "$owner" =3D "" ] ; then owner=3D0 ; fi if [ "$group" =3D "" ] ; then group=3D0 ; fi mode=3D$d echo "$dev:$owner:$group:$mode" >> "$INITRD$udev_permissions" ;; esac done < "$udev_permissions" IFS=3D$I rm -fv $PT $GT If you find a faster solution, let us know. --=20 USB is for mice, FireWire is for men! sUse lINUX ag, n=C3=9CRNBERG ------------------------------------------------------- SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now! http://ads.osdn.com/?ad_id=1356&alloc_id438&op=3Dclick _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net Linux-hotplug-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel