summaryrefslogtreecommitdiffstats
path: root/prot.c
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2013-02-04 00:08:53 +0100
committermanuel <manuel@mausz.at>2013-02-04 00:08:53 +0100
commit69aec538b456402170dc723af417ba5c05389c32 (patch)
treee6f34c543f17c6392447ea337b2e2868212424d1 /prot.c
downloadqmail-69aec538b456402170dc723af417ba5c05389c32.tar.gz
qmail-69aec538b456402170dc723af417ba5c05389c32.tar.bz2
qmail-69aec538b456402170dc723af417ba5c05389c32.zip
qmail 1.03 import
Diffstat (limited to 'prot.c')
-rw-r--r--prot.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/prot.c b/prot.c
new file mode 100644
index 0000000..a38e0f9
--- /dev/null
+++ b/prot.c
@@ -0,0 +1,21 @@
1#include "hasshsgr.h"
2#include "prot.h"
3
4/* XXX: there are more portability problems here waiting to leap out at me */
5
6int prot_gid(gid) int gid;
7{
8#ifdef HASSHORTSETGROUPS
9 short x[2];
10 x[0] = gid; x[1] = 73; /* catch errors */
11 if (setgroups(1,x) == -1) return -1;
12#else
13 if (setgroups(1,&gid) == -1) return -1;
14#endif
15 return setgid(gid); /* _should_ be redundant, but on some systems it isn't */
16}
17
18int prot_uid(uid) int uid;
19{
20 return setuid(uid);
21}