1 /* Copyright (C) 2009 Trend Micro Inc.
4 * This program is a free software; you can redistribute it
5 * and/or modify it under the terms of the GNU General Public
6 * License (version 2) as published by the FSF - Free Software
10 /* Functions for privilege separation */
17 #include <sys/types.h>
20 #include "privsep_op.h"
21 #include "headers/os_err.h"
24 uid_t Privsep_GetUser(const char *name)
29 return ((uid_t)OS_INVALID);
35 gid_t Privsep_GetGroup(const char *name)
40 return ((gid_t)OS_INVALID);
46 int Privsep_SetUser(uid_t uid)
48 if (setuid(uid) < 0) {
53 if (seteuid(uid) < 0) {
61 int Privsep_SetGroup(gid_t gid)
63 if (setgroups(1, &gid) == -1) {
68 if (setegid(gid) < 0) {
73 if (setgid(gid) < 0) {
80 int Privsep_Chroot(const char *path)
82 if (chdir(path) < 0) {
86 if (chroot(path) < 0) {