From patchwork Thu Jun 2 11:53:40 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 98378 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id A2270B6F9A for ; Thu, 2 Jun 2011 22:20:57 +1000 (EST) Received: from localhost ([::1]:37738 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QS6tQ-0003CX-Vr for incoming@patchwork.ozlabs.org; Thu, 02 Jun 2011 08:20:53 -0400 Received: from eggs.gnu.org ([140.186.70.92]:50839) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QS6UA-0005mR-3b for qemu-devel@nongnu.org; Thu, 02 Jun 2011 07:54:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QS6U7-0005jq-OT for qemu-devel@nongnu.org; Thu, 02 Jun 2011 07:54:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:30208) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QS6U6-0005jW-IP for qemu-devel@nongnu.org; Thu, 02 Jun 2011 07:54:42 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p52Bsfij001790 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 2 Jun 2011 07:54:41 -0400 Received: from neno.mitica (vpn1-5-74.ams2.redhat.com [10.36.5.74]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p52BsYdN015781; Thu, 2 Jun 2011 07:54:40 -0400 From: Juan Quintela To: qemu-devel@nongnu.org Date: Thu, 2 Jun 2011 13:53:40 +0200 Message-Id: <40cc2aebc5a57aced2bd09c3b3da8dde58f8a707.1307014902.git.quintela@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 05/14] linuxload: id_change was a write only variable X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Juan Quintela Reviewed-by: Peter Maydell --- linux-user/linuxload.c | 25 +------------------------ 1 files changed, 1 insertions(+), 24 deletions(-) diff --git a/linux-user/linuxload.c b/linux-user/linuxload.c index ac8c486..62ebc7e 100644 --- a/linux-user/linuxload.c +++ b/linux-user/linuxload.c @@ -26,22 +26,6 @@ abi_long memcpy_to_target(abi_ulong dest, const void *src, 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) { int i; @@ -57,7 +41,7 @@ static int prepare_binprm(struct linux_binprm *bprm) { struct stat st; int mode; - int retval, id_change; + int retval; if(fstat(bprm->fd, &st) < 0) { return(-errno); @@ -73,14 +57,10 @@ static int prepare_binprm(struct linux_binprm *bprm) bprm->e_uid = geteuid(); bprm->e_gid = getegid(); - id_change = 0; /* Set-uid? */ if(mode & S_ISUID) { bprm->e_uid = st.st_uid; - if(bprm->e_uid != geteuid()) { - id_change = 1; - } } /* Set-gid? */ @@ -91,9 +71,6 @@ static int prepare_binprm(struct linux_binprm *bprm) */ if ((mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP)) { 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);