linuxload: id_change was a write only variable
Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
This commit is contained in:
parent
14322bad88
commit
331c23b5ca
@ -26,22 +26,6 @@ abi_long memcpy_to_target(abi_ulong dest, const void *src,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int in_group_p(gid_t g)
|
|
||||||
{
|
|
||||||
/* return TRUE if we're in the specified group, FALSE otherwise */
|
|
||||||
int ngroup;
|
|
||||||
int i;
|
|
||||||
gid_t grouplist[NGROUPS];
|
|
||||||
|
|
||||||
ngroup = getgroups(NGROUPS, grouplist);
|
|
||||||
for(i = 0; i < ngroup; i++) {
|
|
||||||
if(grouplist[i] == g) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int count(char ** vec)
|
static int count(char ** vec)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -57,7 +41,7 @@ static int prepare_binprm(struct linux_binprm *bprm)
|
|||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
int mode;
|
int mode;
|
||||||
int retval, id_change;
|
int retval;
|
||||||
|
|
||||||
if(fstat(bprm->fd, &st) < 0) {
|
if(fstat(bprm->fd, &st) < 0) {
|
||||||
return(-errno);
|
return(-errno);
|
||||||
@ -73,14 +57,10 @@ static int prepare_binprm(struct linux_binprm *bprm)
|
|||||||
|
|
||||||
bprm->e_uid = geteuid();
|
bprm->e_uid = geteuid();
|
||||||
bprm->e_gid = getegid();
|
bprm->e_gid = getegid();
|
||||||
id_change = 0;
|
|
||||||
|
|
||||||
/* Set-uid? */
|
/* Set-uid? */
|
||||||
if(mode & S_ISUID) {
|
if(mode & S_ISUID) {
|
||||||
bprm->e_uid = st.st_uid;
|
bprm->e_uid = st.st_uid;
|
||||||
if(bprm->e_uid != geteuid()) {
|
|
||||||
id_change = 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set-gid? */
|
/* Set-gid? */
|
||||||
@ -91,9 +71,6 @@ static int prepare_binprm(struct linux_binprm *bprm)
|
|||||||
*/
|
*/
|
||||||
if ((mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP)) {
|
if ((mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP)) {
|
||||||
bprm->e_gid = st.st_gid;
|
bprm->e_gid = st.st_gid;
|
||||||
if (!in_group_p(bprm->e_gid)) {
|
|
||||||
id_change = 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
retval = read(bprm->fd, bprm->buf, BPRM_BUF_SIZE);
|
retval = read(bprm->fd, bprm->buf, BPRM_BUF_SIZE);
|
||||||
|
Loading…
Reference in New Issue
Block a user