chiark / gitweb /
core, sd-bus, logind: make use of uid_is_valid() in more places
authorLennart Poettering <lennart@poettering.net>
Fri, 14 Jul 2017 16:57:04 +0000 (18:57 +0200)
committerSven Eden <yamakuzure@gmx.net>
Fri, 14 Jul 2017 16:57:04 +0000 (18:57 +0200)
src/libelogind/sd-bus/bus-creds.c
src/login/logind-dbus.c

index 3cb996171ec78d529a286e44edcd57a565fb69cc..2ea7857b56ffd9741e73e480ee26271610d9f855 100644 (file)
@@ -604,7 +604,7 @@ _public_ int sd_bus_creds_get_audit_login_uid(sd_bus_creds *c, uid_t *uid) {
         if (!(c->mask & SD_BUS_CREDS_AUDIT_LOGIN_UID))
                 return -ENODATA;
 
-        if (c->audit_login_uid == UID_INVALID)
+        if (!uid_is_valid(c->audit_login_uid))
                 return -ENXIO;
 
         *uid = c->audit_login_uid;
index 70d2b1ffc0f9c463f3d0c14c500be2857eba788b..0b0109ad39dc7fdb50ed1de34c0b8990652050fa 100644 (file)
@@ -92,7 +92,7 @@ int manager_get_user_from_creds(Manager *m, sd_bus_message *message, uid_t uid,
         assert(message);
         assert(ret);
 
-        if (uid == UID_INVALID) {
+        if (!uid_is_valid(uid)) {
                 _cleanup_(sd_bus_creds_unrefp) sd_bus_creds *creds = NULL;
 
                 /* Note that we get the owner UID of the session, not the actual client UID here! */
@@ -1147,7 +1147,7 @@ static int method_set_user_linger(sd_bus_message *message, void *userdata, sd_bu
         if (r < 0)
                 return r;
 
-        if (uid == UID_INVALID) {
+        if (!uid_is_valid(uid)) {
                 _cleanup_(sd_bus_creds_unrefp) sd_bus_creds *creds = NULL;
 
                 /* Note that we get the owner UID of the session, not the actual client UID here! */