chiark / gitweb /
nss-elogind: tweak checks when we consult PID 1 for dynamic UID/GID lookups
authorLennart Poettering <lennart@poettering.net>
Sat, 2 Dec 2017 12:07:18 +0000 (13:07 +0100)
committerSven Eden <yamakuzure@gmx.net>
Sat, 2 Dec 2017 12:07:18 +0000 (13:07 +0100)
Instead of contacting PID 1 for dynamic UID/GID lookups for all
UIDs/GIDs that do not qualify as "system" do the more precise check
instead: check if they actually qualify for the "dynamic" range.

src/basic/user-util.h

index b619239b8acbbb109b009ed05f088994f8eb6422..d97f4821aebae6f3af7ecc923fc055d107ce0ffd 100644 (file)
@@ -71,6 +71,10 @@ static inline bool uid_is_dynamic(uid_t uid) {
         return DYNAMIC_UID_MIN <= uid && uid <= DYNAMIC_UID_MAX;
 }
 
+static inline bool gid_is_dynamic(gid_t gid) {
+        return uid_is_dynamic((uid_t) gid);
+}
+
 static inline bool uid_is_system(uid_t uid) {
         return uid <= SYSTEM_UID_MAX;
 }