version 1.2, 2007/05/25 18:35:07
|
version 1.3, 2007/05/30 20:41:27
|
|
|
#include <stdlib.h> | #include <stdlib.h> |
#include <string.h> | #include <string.h> |
#include <stdio.h> | #include <stdio.h> |
|
#include <grp.h> |
#include "Defines.h" | #include "Defines.h" |
#include "Fatal.h" | #include "Fatal.h" |
#include "Path.h" | #include "Path.h" |
|
|
int argc, | int argc, |
char** argv, | char** argv, |
const char* path, | const char* path, |
|
const char* userName, |
int uid, | int uid, |
int gid, | int gid, |
int sock) | int sock) |
|
|
Fatal(FL, "Failed to set gid to %d", gid); | Fatal(FL, "Failed to set gid to %d", gid); |
} | } |
| |
|
if (initgroups(userName, gid) != 0) |
|
{ |
|
Fatal(FL, "Failed to initialize groups for user %s", userName); |
|
} |
|
|
if (setuid(uid) != 0) | if (setuid(uid) != 0) |
{ | { |
Fatal(FL, "Failed to set uid to %d", uid); | Fatal(FL, "Failed to set uid to %d", uid); |