chiark / gitweb /
util: skip incomplete ucred information in getpeersec()
authorLennart Poettering <lennart@poettering.net>
Mon, 24 Nov 2014 20:21:24 +0000 (21:21 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 25 Nov 2014 13:28:34 +0000 (14:28 +0100)
src/shared/util.c

index 0166052..b1ba0ed 100644 (file)
@@ -6482,6 +6482,10 @@ int getpeercred(int fd, struct ucred *ucred) {
          * to namespacing issues */
         if (u.pid <= 0)
                 return -ENODATA;
+        if (u.uid == (uid_t) -1)
+                return -ENODATA;
+        if (u.gid == (gid_t) -1)
+                return -ENODATA;
 
         *ucred = u;
         return 0;