]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
allow --monitor to be run by non-privileged use.
authorNeilBrown <neilb@suse.de>
Thu, 22 Dec 2011 20:42:23 +0000 (07:42 +1100)
committerNeilBrown <neilb@suse.de>
Thu, 22 Dec 2011 20:42:23 +0000 (07:42 +1100)
Providing --no-sharing is given, monitoring should be permitted.

Unfortunately the kernel current rejects GET_DISK_INFO and
GET_ARRAY_INFO for non-privileged users which is unjustified.
The info is available in sysfs and we could get it from there,
but for now, require the kernel to be fixed.

Reported-by: Raphael Hertzog <hertzog@debian.org>
Signed-off-by: NeilBrown <neilb@suse.de>
mdadm.c

diff --git a/mdadm.c b/mdadm.c
index c6a887a87b1065ed9168a85e3e1dfdd25b6c50d3..f07fac2abb674ea10ea6c779112a9db71c065310 100644 (file)
--- a/mdadm.c
+++ b/mdadm.c
@@ -1209,7 +1209,8 @@ int main(int argc, char *argv[])
                require_homehost = 0;
        }
 
-       if ((mode != MISC || devmode != 'E') &&
+       if (!((mode == MISC && devmode == 'E')
+             || (mode == MONITOR && spare_sharing == 0)) &&
            geteuid() != 0) {
                fprintf(stderr, Name ": must be super-user to perform this action\n");
                exit(1);