diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-11-28 20:51:01 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-11-28 20:55:04 +0100 |
commit | fed1e721fd0c81e60c77120539f34e16c2585634 (patch) | |
tree | a0bb21b49530bc896dcd2c540a582e324c6d7785 /src/bus-proxyd | |
parent | 36afca67b67984520c5c9a6ce14af51a68c7c8cf (diff) |
treewide: introduce UID_INVALID (and friends) as macro for (uid_t) -1
Diffstat (limited to 'src/bus-proxyd')
-rw-r--r-- | src/bus-proxyd/bus-policy.c | 8 | ||||
-rw-r--r-- | src/bus-proxyd/bus-proxyd.c | 20 |
2 files changed, 14 insertions, 14 deletions
diff --git a/src/bus-proxyd/bus-policy.c b/src/bus-proxyd/bus-policy.c index 13322ea514..59cc1d788b 100644 --- a/src/bus-proxyd/bus-policy.c +++ b/src/bus-proxyd/bus-policy.c @@ -668,13 +668,13 @@ static int check_policy_item(PolicyItem *i, const struct policy_check_filter *fi break; case POLICY_ITEM_USER: - if (filter->uid != (uid_t) -1) + if (filter->uid != UID_INVALID) if ((streq_ptr(i->name, "*") || (i->uid_valid && i->uid == filter->uid))) return is_permissive(i); break; case POLICY_ITEM_GROUP: - if (filter->gid != (gid_t) -1) + if (filter->gid != GID_INVALID) if ((streq_ptr(i->name, "*") || (i->gid_valid && i->gid == filter->gid))) return is_permissive(i); break; @@ -734,7 +734,7 @@ static int policy_check(Policy *p, const struct policy_check_filter *filter) { verdict = check_policy_items(p->default_items, filter); - if (filter->gid != (gid_t) -1) { + if (filter->gid != GID_INVALID) { items = hashmap_get(p->group_items, UINT32_TO_PTR(filter->gid)); if (items) { v = check_policy_items(items, filter); @@ -743,7 +743,7 @@ static int policy_check(Policy *p, const struct policy_check_filter *filter) { } } - if (filter->uid != (uid_t) -1) { + if (filter->uid != UID_INVALID) { items = hashmap_get(p->user_items, UINT32_TO_PTR(filter->uid)); if (items) { v = check_policy_items(items, filter); diff --git a/src/bus-proxyd/bus-proxyd.c b/src/bus-proxyd/bus-proxyd.c index 6dfba14695..8fb204ca59 100644 --- a/src/bus-proxyd/bus-proxyd.c +++ b/src/bus-proxyd/bus-proxyd.c @@ -969,8 +969,8 @@ static int process_policy(sd_bus *from, sd_bus *to, sd_bus_message *m, Policy *p return 0; if (from->is_kernel) { - uid_t sender_uid = (uid_t) -1; - gid_t sender_gid = (gid_t) -1; + uid_t sender_uid = UID_INVALID; + gid_t sender_gid = GID_INVALID; char **sender_names = NULL; bool granted = false; @@ -1026,8 +1026,8 @@ static int process_policy(sd_bus *from, sd_bus *to, sd_bus_message *m, Policy *p if (to->is_kernel) { _cleanup_bus_creds_unref_ sd_bus_creds *destination_creds = NULL; - uid_t destination_uid = (uid_t) -1; - gid_t destination_gid = (gid_t) -1; + uid_t destination_uid = UID_INVALID; + gid_t destination_gid = GID_INVALID; const char *destination_unique = NULL; char **destination_names = NULL; bool granted = false; @@ -1331,13 +1331,13 @@ int main(int argc, char *argv[]) { a->fake_pids_valid = true; a->fake_creds.uid = ucred.uid; - a->fake_creds.euid = (uid_t) -1; - a->fake_creds.suid = (uid_t) -1; - a->fake_creds.fsuid = (uid_t) -1; + a->fake_creds.euid = UID_INVALID; + a->fake_creds.suid = UID_INVALID; + a->fake_creds.fsuid = UID_INVALID; a->fake_creds.gid = ucred.gid; - a->fake_creds.egid = (gid_t) -1; - a->fake_creds.sgid = (gid_t) -1; - a->fake_creds.fsgid = (gid_t) -1; + a->fake_creds.egid = GID_INVALID; + a->fake_creds.sgid = GID_INVALID; + a->fake_creds.fsgid = GID_INVALID; a->fake_creds_valid = true; } |