From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Buesch Date: Sat, 05 Feb 2005 13:26:09 +0000 Subject: [PATCH, UDEV] fix permission inconsistency in relation to symlinks. Message-Id: <200502051426.14173.mbuesch@freenet.de> MIME-Version: 1 Content-Type: multipart/mixed; boundary="nextPart4214576.U48oNeXvD7" List-Id: To: linux-hotplug@vger.kernel.org --nextPart4214576.U48oNeXvD7 Content-Type: multipart/mixed; boundary="Boundary-01=_xlMBCru5cQoHeMV" Content-Transfer-Encoding: 7bit Content-Disposition: inline --Boundary-01=_xlMBCru5cQoHeMV Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi, This fixes a rules.d permission apply inconsistency. Here's an example of what happens without the patch: =46irst case without the patch: KERNEL=3D"hd*", GROUP=3D"disk", MODE=3D"0660" KERNEL=3D"hdc", SYMLINK=3D"cdrecorder", MODE=3D"0666" mb@lfs:~$ ls -la /dev/hdc=20 brw-rw---- 1 root disk 22, 0 Feb 5 14:08 /dev/hdc Second case without the patch: KERNEL=3D"hd*", GROUP=3D"disk", MODE=3D"0660" KERNEL=3D"hdc", MODE=3D"0666" mb@lfs:~$ ls -la /dev/hdc=20 brw-rw-rw- 1 root disk 22, 0 Feb 5 14:08 /dev/hdc With the patch applied: KERNEL=3D"hd*", GROUP=3D"disk", MODE=3D"0660" KERNEL=3D"hdc", SYMLINK=3D"cdrecorder", MODE=3D"0666" mb@lfs:~$ ls -la /dev/hdc=20 brw-rw-rw- 1 root disk 22, 0 Feb 5 14:08 /dev/hdc =2D-=20 Regards Michael Buesch [ http://www.tuxsoft.de.vu ] =3D=3D=3D=3D=3D namedev.c 1.173 vs edited =3D=3D=3D=3D=3D =2D-- 1.173/namedev.c 2004-12-21 17:41:02 +01:00 +++ edited/namedev.c 2005-02-05 14:04:44 +01:00 @@ -716,14 +716,16 @@ list_for_each_entry(dev, &config_device_list, node) { dbg("process rule"); if (match_rule(udev, dev, class_dev, sysfs_device) =3D=3D 0) { =2D if (dev->name[0] =3D=3D '\0' && dev->symlink[0] =3D=3D '\0') { + + if (dev->name[0] =3D=3D '\0' && dev->symlink[0] =3D=3D '\0' && + dev->mode =3D=3D 0000 && dev->owner[0] =3D=3D '\0' && dev->group[0]= =3D=3D '\0') { /* empty name, symlink, perms will not create any node */ =2D if (dev->mode =3D=3D 0000 && dev->owner[0] =3D=3D '\0' && dev->group= [0] =3D=3D '\0') { =2D info("configured rule in '%s[%i]' applied, '%s' is ignored", =2D dev->config_file, dev->config_line, udev->kernel_name); =2D return -1; =2D } + info("configured rule in '%s[%i]' applied, '%s' is ignored", + dev->config_file, dev->config_line, udev->kernel_name); + return -1; + } =20 + if (dev->name[0] =3D=3D '\0') { /* apply permissions only rule values */ if (dev->mode !=3D 0000) { udev->mode =3D dev->mode; --Boundary-01=_xlMBCru5cQoHeMV Content-Type: text/x-diff; charset="us-ascii"; name="udev_fix_symlink_and_perms.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="udev_fix_symlink_and_perms.diff" =3D=3D=3D=3D=3D namedev.c 1.173 vs edited =3D=3D=3D=3D=3D =2D-- 1.173/namedev.c 2004-12-21 17:41:02 +01:00 +++ edited/namedev.c 2005-02-05 14:04:44 +01:00 @@ -716,14 +716,16 @@ list_for_each_entry(dev, &config_device_list, node) { dbg("process rule"); if (match_rule(udev, dev, class_dev, sysfs_device) =3D=3D 0) { =2D if (dev->name[0] =3D=3D '\0' && dev->symlink[0] =3D=3D '\0') { + + if (dev->name[0] =3D=3D '\0' && dev->symlink[0] =3D=3D '\0' && + dev->mode =3D=3D 0000 && dev->owner[0] =3D=3D '\0' && dev->group[0]= =3D=3D '\0') { /* empty name, symlink, perms will not create any node */ =2D if (dev->mode =3D=3D 0000 && dev->owner[0] =3D=3D '\0' && dev->group= [0] =3D=3D '\0') { =2D info("configured rule in '%s[%i]' applied, '%s' is ignored", =2D dev->config_file, dev->config_line, udev->kernel_name); =2D return -1; =2D } + info("configured rule in '%s[%i]' applied, '%s' is ignored", + dev->config_file, dev->config_line, udev->kernel_name); + return -1; + } =20 + if (dev->name[0] =3D=3D '\0') { /* apply permissions only rule values */ if (dev->mode !=3D 0000) { udev->mode =3D dev->mode; --Boundary-01=_xlMBCru5cQoHeMV-- --nextPart4214576.U48oNeXvD7 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (GNU/Linux) iD8DBQBCBMl2FGK1OIvVOP4RAgM/AJ96N+lP73xFU/oV3VP05OI/K9r6xQCeJkAj RymtFZsUMOj2EG6jGLtm2kU= =Q7AV -----END PGP SIGNATURE----- --nextPart4214576.U48oNeXvD7-- ------------------------------------------------------- This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting Tool for open source databases. Create drag-&-drop reports. Save time by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. Download a FREE copy at http://www.intelliview.com/go/osdn_nl _______________________________________________ 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