* Implemented some basics for supplementary groups support:
- The kernel stores the group IDs in the team structure. They are
correctly inherited on fork() and load_image_etc().
- Implemented getgroups() for real, i.e. it retrieves the groups
associated with the process.
- Implemented setgroups(), initgroups() and (the BSDish)
getgrouplist(). The latter two read the group information from the
"group database" /etc/group (if existing).
- Change the BIND port config, since we do have getgrouplist() now.
* The set-uid feature was broken when the path to the executable was
relative, since we used stat(), which, in the kernel, uses the kernel
IO context.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24669 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -160,7 +160,6 @@ extern gid_t getegid(void);
|
||||
extern uid_t geteuid(void);
|
||||
extern gid_t getgid(void);
|
||||
extern uid_t getuid(void);
|
||||
extern int getgroups(int groupSize, gid_t groupList[]);
|
||||
|
||||
extern int setgid(gid_t gid);
|
||||
extern int setuid(uid_t uid);
|
||||
@@ -169,6 +168,12 @@ extern int seteuid(uid_t uid);
|
||||
extern int setregid(gid_t rgid, gid_t egid);
|
||||
extern int setreuid(uid_t ruid, uid_t euid);
|
||||
|
||||
extern int getgrouplist(const char* user, gid_t baseGroup,
|
||||
gid_t* groupList, int* groupCount);
|
||||
extern int getgroups(int groupCount, gid_t groupList[]);
|
||||
extern int initgroups(const char* user, gid_t baseGroup);
|
||||
extern int setgroups(int groupCount, const gid_t* groupList);
|
||||
|
||||
extern char *getlogin(void);
|
||||
extern int getlogin_r(char *name, size_t nameSize);
|
||||
|
||||
|
||||
@@ -116,11 +116,12 @@ extern status_t _kern_get_team_usage_info(team_id team, int32 who, team_usage_i
|
||||
// user/group functions
|
||||
extern gid_t _kern_getgid(bool effective);
|
||||
extern uid_t _kern_getuid(bool effective);
|
||||
extern ssize_t _kern_getgroups(int groupSize, gid_t* groupList);
|
||||
extern status_t _kern_setregid(gid_t rgid, gid_t egid,
|
||||
bool setAllIfPrivileged);
|
||||
extern status_t _kern_setreuid(uid_t ruid, uid_t euid,
|
||||
bool setAllIfPrivileged);
|
||||
extern ssize_t _kern_getgroups(int groupCount, gid_t* groupList);
|
||||
extern status_t _kern_setgroups(int groupCount, const gid_t* groupList);
|
||||
|
||||
// signal functions
|
||||
extern status_t _kern_send_signal(pid_t tid, uint sig);
|
||||
|
||||
@@ -196,6 +196,8 @@ struct team {
|
||||
gid_t saved_set_gid;
|
||||
gid_t real_gid;
|
||||
gid_t effective_gid;
|
||||
gid_t* supplementary_groups;
|
||||
int supplementary_group_count;
|
||||
};
|
||||
|
||||
typedef int32 (*thread_entry_func)(thread_func, void *);
|
||||
|
||||
@@ -27,9 +27,10 @@ status_t update_set_id_user_and_group(struct team* team, const char* file);
|
||||
|
||||
gid_t _user_getgid(bool effective);
|
||||
uid_t _user_getuid(bool effective);
|
||||
ssize_t _user_getgroups(int groupSize, gid_t* groupList);
|
||||
status_t _user_setregid(gid_t rgid, gid_t egid, bool setAllIfPrivileged);
|
||||
status_t _user_setreuid(uid_t ruid, uid_t euid, bool setAllIfPrivileged);
|
||||
ssize_t _user_getgroups(int groupCount, gid_t* groupList);
|
||||
ssize_t _user_setgroups(int groupCount, const gid_t* groupList);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
|
||||
Reference in New Issue
Block a user