49 lines
1.2 KiB
Diff
49 lines
1.2 KiB
Diff
--- evms-2.5.5.orig/engine/discover.c
|
|
+++ evms-2.5.5/engine/discover.c
|
|
@@ -28,6 +28,8 @@
|
|
#include <unistd.h>
|
|
#include <sys/stat.h>
|
|
#include <sys/time.h>
|
|
+#include <sys/types.h>
|
|
+#include <grp.h>
|
|
|
|
#include "fullengine.h"
|
|
#include "discover.h"
|
|
@@ -162,9 +164,23 @@
|
|
int rc = 0;
|
|
dev_t devt = makedev(major, minor);
|
|
char dir_name[EVMS_OBJECT_NODE_PATH_LEN + EVMS_NAME_SIZE + 1];
|
|
+ struct group *disk;
|
|
|
|
LOG_PROC_ENTRY();
|
|
|
|
+ /*
|
|
+ * Debian-specific: We want all devices to be owned by the
|
|
+ * group disk, not root.
|
|
+ */
|
|
+ disk = getgrnam("disk");
|
|
+ if (disk) {
|
|
+ if (setegid(disk->gr_gid) != 0) {
|
|
+ LOG_WARNING("could not setegid to group disk (%s), continuing as group root\n", strerror(errno));
|
|
+ }
|
|
+ } else {
|
|
+ LOG_WARNING("could not find group disk (%s), continuing as group root\n", strerror(errno));
|
|
+ }
|
|
+
|
|
/* Make sure major:minor is valid. */
|
|
if (major != 0) {
|
|
switch (hasa_dev_node(name, major, minor)) {
|
|
@@ -227,6 +243,12 @@
|
|
LOG_DEBUG("Device node %s is for major %d, minor %d.\n", name, major, minor);
|
|
}
|
|
|
|
+ if (disk) {
|
|
+ if (setegid(getgid()) != 0) {
|
|
+ LOG_WARNING("could not setegid back to old group (%s)\n", strerror(errno));
|
|
+ }
|
|
+ }
|
|
+
|
|
LOG_PROC_EXIT_INT(rc);
|
|
return rc;
|
|
}
|