summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/os_calls.c11
-rw-r--r--common/os_calls.h2
-rw-r--r--sesman/env.c5
3 files changed, 18 insertions, 0 deletions
diff --git a/common/os_calls.c b/common/os_calls.c
index 48488539..6dc41e95 100644
--- a/common/os_calls.c
+++ b/common/os_calls.c
@@ -953,6 +953,17 @@ g_setgid(int pid)
/*****************************************************************************/
int
+g_initgroups(const char* user, int gid)
+{
+#if defined(_WIN32)
+ return 0;
+#else
+ return initgroups(user ,gid);
+#endif
+}
+
+/*****************************************************************************/
+int
g_setuid(int pid)
{
#if defined(_WIN32)
diff --git a/common/os_calls.h b/common/os_calls.h
index 68b70117..b28dc4ea 100644
--- a/common/os_calls.h
+++ b/common/os_calls.h
@@ -157,6 +157,8 @@ g_fork(void);
int
g_setgid(int pid);
int
+g_initgroups(const char* user, int gid);
+int
g_setuid(int pid);
int
g_waitchild(void);
diff --git a/sesman/env.c b/sesman/env.c
index 9b9de8d0..beb62dc5 100644
--- a/sesman/env.c
+++ b/sesman/env.c
@@ -27,6 +27,9 @@
#include "sesman.h"
+#include "sys/types.h"
+#include "grp.h"
+
extern unsigned char g_fixedkey[8];
/******************************************************************************/
@@ -70,6 +73,8 @@ env_set_user(char* username, char* passwd_file, int display)
if (error == 0)
{
error = g_setgid(pw_gid);
+ g_initgroups(username,pw_gid);
+
if (error == 0)
{
uid = pw_uid;