uwrap: Add the EINVAL check to setegid()
authorAndreas Schneider <asn@samba.org>
Fri, 30 Oct 2015 12:41:18 +0000 (13:41 +0100)
committerAndreas Schneider <asn@cryptomilk.org>
Thu, 5 Nov 2015 08:23:16 +0000 (09:23 +0100)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
lib/uid_wrapper/uid_wrapper.c

index d720e533e4e832a5714d993c22bf13989b01a290..2702bd7c71a29127de8840167bedd67c14883ce4 100644 (file)
@@ -1665,6 +1665,12 @@ int setegid(gid_t egid)
                return libc_setegid(egid);
        }
 
+       /* On FreeBSD the uid_t -1 is set and doesn't produce and error */
+       if (egid == (gid_t)-1) {
+               errno = EINVAL;
+               return -1;
+       }
+
        uwrap_init();
        return uwrap_setresgid(-1, egid, -1);
 }