From patchwork Wed Jun 15 09:53:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Tremer X-Patchwork-Id: 5662 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4LNLGc09BJz3xqn for ; Wed, 15 Jun 2022 09:53:28 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4LNLGb3zdnz10L; Wed, 15 Jun 2022 09:53:27 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4LNLGb43n5z2ymS; Wed, 15 Jun 2022 09:53:27 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4LNLGZ353yz2xjj for ; Wed, 15 Jun 2022 09:53:26 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4LNLGY3pQQzS9; Wed, 15 Jun 2022 09:53:25 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1655286805; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=m4X7uDer8el72zDSjbncsssQdaxyQ0H5qu4CoYkCMzE=; b=iR/l3g33QKjqh4wrnQYnJ0JFYgONWLp6XUl/+SOn9vFSovDEfkxxo3BFeHUjBWFfr6Symx OB/DyBTSua0s0DBg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1655286805; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=m4X7uDer8el72zDSjbncsssQdaxyQ0H5qu4CoYkCMzE=; b=MzL50so3az1T65QtTz2JD8Sv1yZDDlWrxSG92WPQUSXZ2Pc5TBZq7V4D09hAPco/CvFgBh feRc/e9lr+iWHbvjhfBS5EY4Lrl3VsZ3kAwXzzW4HKjjrJrLtcLEkgv8vv3ptEivz3ntAH 00MDlvVU1S4fdnYAui5Iv4gOix7hy29E0bqVzSAFof9/hEBEawYQkBp6+Occxp2TBILsM0 V8d3XCcMcfd/F+8+jkFJXjfivkk25B8VVB8qfWwgfK/g6XQ39f77MAXUNCncIyxegYvtj8 T3/Ss0+mMpBT+i1wKCLrvA0DDMYsogLxcM+Ot+XDOB2SKKOG2QwvSo+uQrQxwA== From: Michael Tremer To: development@lists.ipfire.org Subject: [PATCH] misc-progs: Add path to executable to argv Date: Wed, 15 Jun 2022 09:53:20 +0000 Message-Id: <20220615095320.1972533-1-michael.tremer@ipfire.org> MIME-Version: 1.0 X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael Tremer Errors-To: development-bounces@lists.ipfire.org Sender: "Development" Otherwise, the first argument would always be swollowed :( Signed-off-by: Michael Tremer Acked-by: Peter Müller --- src/misc-progs/setuid.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/misc-progs/setuid.c b/src/misc-progs/setuid.c index 831fb1f90..17b0e7066 100644 --- a/src/misc-progs/setuid.c +++ b/src/misc-progs/setuid.c @@ -61,10 +61,8 @@ static int system_core(char* command, char** args, uid_t uid, gid_t gid, char *e if(!command) return 1; -#if 0 // Add command as first element to argv argv[argc++] = command; -#endif // Add all other arguments if (args) { @@ -138,7 +136,7 @@ int safe_system(char* command) { NULL, }; - return system_core(argv[0], argv, 0, 0, "safe_system"); + return system_core(argv[0], argv + 1, 0, 0, "safe_system"); } /* Much like safe_system but lets you specify a non-root uid and gid to run @@ -151,7 +149,7 @@ int unpriv_system(char* command, uid_t uid, gid_t gid) { NULL, }; - return system_core(argv[0], argv, uid, gid, "unpriv_system"); + return system_core(argv[0], argv + 1, uid, gid, "unpriv_system"); } /* General routine to initialise a setuid root program, and put the