aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2015-10-09 09:14:34 +0200
committerAndreas Schneider <asn@samba.org>2015-10-27 14:54:56 +0100
commitcaff3210583e798215880b723875acf4bba188dd (patch)
treeea2719625cb065d9031e1d02e0d92f3a3e3a01ec
parente89cf7c45b57b2fba51b5c0112e1b49d90627b5c (diff)
downloaduid_wrapper-caff3210583e798215880b723875acf4bba188dd.tar.gz
uid_wrapper-caff3210583e798215880b723875acf4bba188dd.tar.xz
uid_wrapper-caff3210583e798215880b723875acf4bba188dd.zip
uwrap: Add the EINVAL check to setegid()
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
-rw-r--r--src/uid_wrapper.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/uid_wrapper.c b/src/uid_wrapper.c
index d720e53..2702bd7 100644
--- a/src/uid_wrapper.c
+++ b/src/uid_wrapper.c
@@ -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);
}