Message type for PM_SET{,E}GID

Change-Id: I489d9290553b28361344e0cfd59c31e7e672c22c
This commit is contained in:
Lionel Sambuc 2014-05-13 14:55:47 +02:00
parent a6c5528e96
commit cc852e7783
4 changed files with 11 additions and 6 deletions

View file

@ -85,9 +85,6 @@
#define PM_SIG_SET m2_sigset /* sigset_t */
#define PM_SIG_CTX m2_p1 /* struct sigcontext * */
/* Field names for the setgid(2)/setegid(2) calls. */
#define PM_SETGID_GID m1_i1 /* gid_t */
/* Field names for the getppid(2) call. */
#define PM_GETPID_PARENT m2_i1 /* pid_t */

View file

@ -195,6 +195,13 @@ typedef struct {
} mess_lc_pm_reboot;
_ASSERT_MSG_SIZE(mess_lc_pm_reboot);
typedef struct {
gid_t gid;
uint8_t padding[52];
} mess_lc_pm_setgid;
_ASSERT_MSG_SIZE(mess_lc_pm_setgid);
typedef struct {
uid_t uid;
@ -1041,6 +1048,7 @@ typedef struct {
mess_lc_pm_priority m_lc_pm_priority;
mess_lc_pm_ptrace m_lc_pm_ptrace;
mess_lc_pm_reboot m_lc_pm_reboot;
mess_lc_pm_setgid m_lc_pm_setgid;
mess_lc_pm_setuid m_lc_pm_setuid;
mess_lc_pm_sysuname m_lc_pm_sysuname;
mess_lc_pm_time m_lc_pm_time;

View file

@ -11,7 +11,7 @@ int setgid(gid_t grp)
message m;
memset(&m, 0, sizeof(m));
m.PM_SETGID_GID = (int) grp;
m.m_lc_pm_setgid.gid = grp;
return(_syscall(PM_PROC_NR, PM_SETGID, &m));
}
@ -20,6 +20,6 @@ int setegid(gid_t grp)
message m;
memset(&m, 0, sizeof(m));
m.PM_SETGID_GID = (int) grp;
m.m_lc_pm_setgid.gid = grp;
return(_syscall(PM_PROC_NR, PM_SETEGID, &m));
}

View file

@ -123,7 +123,7 @@ int do_set()
case PM_SETGID:
case PM_SETEGID:
gid = (gid_t) m_in.PM_SETGID_GID;
gid = m_in.m_lc_pm_setgid.gid;
if (rmp->mp_realgid != gid && rmp->mp_effuid != SUPER_USER)
return(EPERM);
if(call_nr == PM_SETGID) rmp->mp_realgid = gid;