adding initgroups() to support multiple user groups

ulab-original
ilsimo 18 years ago
parent 34277e8e01
commit 5a6f8dfea5

@ -951,6 +951,17 @@ g_setgid(int pid)
#endif #endif
} }
/*****************************************************************************/
int
g_initgroups(const char* user, int gid)
{
#if defined(_WIN32)
return 0;
#else
return initgroups(user ,gid);
#endif
}
/*****************************************************************************/ /*****************************************************************************/
int int
g_setuid(int pid) g_setuid(int pid)

@ -157,6 +157,8 @@ g_fork(void);
int int
g_setgid(int pid); g_setgid(int pid);
int int
g_initgroups(const char* user, int gid);
int
g_setuid(int pid); g_setuid(int pid);
int int
g_waitchild(void); g_waitchild(void);

@ -27,6 +27,9 @@
#include "sesman.h" #include "sesman.h"
#include "sys/types.h"
#include "grp.h"
extern unsigned char g_fixedkey[8]; extern unsigned char g_fixedkey[8];
/******************************************************************************/ /******************************************************************************/
@ -70,6 +73,8 @@ env_set_user(char* username, char* passwd_file, int display)
if (error == 0) if (error == 0)
{ {
error = g_setgid(pw_gid); error = g_setgid(pw_gid);
g_initgroups(username,pw_gid);
if (error == 0) if (error == 0)
{ {
uid = pw_uid; uid = pw_uid;

Loading…
Cancel
Save