util: skip incomplete ucred information in getpeersec()

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
This commit is contained in:
Lennart Poettering 2014-11-24 21:21:24 +01:00 committed by Anthony G. Basile
parent 805a4489ec
commit e6511db5d5

View File

@ -1480,6 +1480,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;