Package: mdadm
Version: 1.9.0-2.2
Severity: minor
Tags: patch

mdadm --auto creates devices with root:root:0600 permissions where
MAKEDEV uses root:disk:0660. The attached patches fix that. Thanks
for considering.

-- System Information:
Debian Release: 3.1
  APT prefers testing
  APT policy: (600, 'testing'), (98, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Kernel: Linux 2.6.11-cirrus
Locale: LANG=en_GB, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)

Versions of packages mdadm depends on:
ii  debconf                     1.4.45       Debian configuration management sy
ii  libc6                       2.3.2.ds1-21 GNU C Library: Shared libraries an
ii  makedev                     2.3.1-77     creates device files in /dev

-- 
 .''`.     martin f. krafft <[EMAIL PROTECTED]>
: :'  :    proud Debian developer, admin, user, and author
`. `'`
  `-  Debian - when you have better things to do than fixing a system
 
Invalid/expired PGP subkeys? Use subkeys.pgp.net as keyserver!
 
you can't assign IP address 127.0.0.1 to the loopback adapter,
because it is a reserved address for loopback devices.
                                  -- micro$oft windoze xp professional
--- mdadm-1.9.0/mdopen.c        2005-05-22 18:10:47.316269147 +0200
+++ mdopen.c    2005-05-22 18:11:02.225756986 +0200
@@ -64,8 +64,10 @@
                        stb2 = stb;
                }
                mknod(name, S_IFBLK | 0600, makedev(major, minor+i));
+               stb2.st_uid = 0;
+               stb2.st_gid = 6; /* group disk */
                chown(name, stb2.st_uid, stb2.st_gid);
-               chmod(name, stb2.st_mode & 07777);
+               chmod(name, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP); /* 0660 */
        }
 }
 
@@ -77,6 +79,7 @@
  * or is currently in-use, we remove the device, but remember the owner and 
mode.
  * If it now doesn't exist, we find a new md array and create the device.
  * Default ownership is user=0, group=0 perm=0600
+ * Debian ownership is user=0, group=6, perm=0660
  */
 int open_mddev(char *dev, int autof)
 {
@@ -201,10 +204,12 @@
                                fprintf(stderr, Name ": failed to create %s\n", 
dev);
                                return -1;
                        }
-                       if (must_remove) {
-                               chown(dev, stb.st_uid, stb.st_gid);
-                               chmod(dev, stb.st_mode & 07777);
-                       }
+
+                       stb.st_uid = 0;
+                       stb.st_gid = 6; /* group disk */
+                       chown(dev, stb.st_uid, stb.st_gid);
+                       chmod(dev, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP); /* 
0660 */
+
                        make_parts(dev,autof);
                }
        }
--- mdadm-1.9.0/util.c  2005-05-22 18:02:24.581951386 +0200
+++ util.c      2005-05-22 18:11:53.407132203 +0200
@@ -638,6 +638,9 @@
                if (errno != EEXIST)
                        return NULL;
 
+       chown(devname, 0, 6); /* group disk */
+       chmod(devname, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP); /* 0660 */
+
        if (stat(devname, &stb) == 0
            && (S_IFMT&stb.st_mode) == S_IFBLK
            && (stb.st_rdev == rdev))

Attachment: signature.asc
Description: Digital signature

Reply via email to