summaryrefslogtreecommitdiff
path: root/src/udev
diff options
context:
space:
mode:
authorKay Sievers <kay@vrfy.org>2012-12-31 04:48:44 +0100
committerKay Sievers <kay@vrfy.org>2012-12-31 04:48:44 +0100
commit1edefa4f1d7bae6cc19aa4a97238400c5a04f7a4 (patch)
tree20acb3dde5ec7a3515bee87ebe6d39ba7751835b /src/udev
parent6fe8ab6d57f24bcdbb18c8e40a3927090fbaeb0e (diff)
udev: in addition to DEVMODE, honor DEVUID, DEVGID from the uevent
Diffstat (limited to 'src/udev')
-rw-r--r--src/udev/udev-event.c6
-rw-r--r--src/udev/udev-rules.c4
-rw-r--r--src/udev/udev.h2
3 files changed, 12 insertions, 0 deletions
diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c
index b75ed33fbf..5eedf4f0df 100644
--- a/src/udev/udev-event.c
+++ b/src/udev/udev-event.c
@@ -842,6 +842,12 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules,
if (event->dev_db != NULL)
udev_node_update_old_links(dev, event->dev_db);
+ if (!event->owner_set)
+ event->uid = udev_device_get_devnode_uid(dev);
+
+ if (!event->group_set)
+ event->gid = udev_device_get_devnode_gid(dev);
+
if (!event->mode_set) {
if (udev_device_get_devnode_mode(dev) > 0) {
/* kernel supplied value */
diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c
index e6f0f5da7e..9743243a37 100644
--- a/src/udev/udev-rules.c
+++ b/src/udev/udev-rules.c
@@ -2224,6 +2224,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event
if (cur->key.op == OP_ASSIGN_FINAL)
event->owner_final = true;
udev_event_apply_format(event, rules_str(rules, cur->key.value_off), owner, sizeof(owner));
+ event->owner_set = true;
event->uid = util_lookup_user(event->udev, owner);
log_debug("OWNER %u %s:%u\n",
event->uid,
@@ -2239,6 +2240,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event
if (cur->key.op == OP_ASSIGN_FINAL)
event->group_final = true;
udev_event_apply_format(event, rules_str(rules, cur->key.value_off), group, sizeof(group));
+ event->group_set = true;
event->gid = util_lookup_group(event->udev, group);
log_debug("GROUP %u %s:%u\n",
event->gid,
@@ -2274,6 +2276,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event
break;
if (cur->key.op == OP_ASSIGN_FINAL)
event->owner_final = true;
+ event->owner_set = true;
event->uid = cur->key.uid;
log_debug("OWNER %u %s:%u\n",
event->uid,
@@ -2285,6 +2288,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event
break;
if (cur->key.op == OP_ASSIGN_FINAL)
event->group_final = true;
+ event->group_set = true;
event->gid = cur->key.gid;
log_debug("GROUP %u %s:%u\n",
event->gid,
diff --git a/src/udev/udev.h b/src/udev/udev.h
index 32779ba486..72a7623e34 100644
--- a/src/udev/udev.h
+++ b/src/udev/udev.h
@@ -49,7 +49,9 @@ struct udev_event {
bool sigterm;
bool inotify_watch;
bool inotify_watch_final;
+ bool group_set;
bool group_final;
+ bool owner_set;
bool owner_final;
bool mode_set;
bool mode_final;