From patchwork Sun Nov 26 10:02:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Yeryomin X-Patchwork-Id: 841325 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=65.50.211.133; helo=bombadil.infradead.org; envelope-from=lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="sgzRxh16"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yl59Q6Vxyz9s3w for ; Sun, 26 Nov 2017 21:03:33 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:Subject:Message-Id:Date:To: From:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=sOw8xNNwKJ9IwTqt7YkVmmTtFXss+Lo6zk2MgFWh7Vk=; b=sgzRxh16wfzBPS +CmEzLMtpljjWnE4MPn4k5FPTbQtjOwXd8CRD77/rBK8b40td1fAbfzP0TyLHCSWRawI/rqJjVtG4 u9gWQvb5Kk86JJ9FxYlTYH2qedVNmvo0KrMaGN6nSGtu4O8GF85JizSBFx6Crp+Jbq3cWTEUanvpm VPK8Pzp4v3vv3fmu83rkVsLb++C/NQF07NBCGzVIy2Q2axWqoXHoqKBnCNOaxmbrz1IcqVRDGOix8 4VoAU9zL68Lgwhl4qdt3ENOiN9qigKMih2Edgovxc0cceZki5MDGIb7EeBeCQGu5zR0XKu5kf4oUf 5zpJ4cIfUQVoMirRWyxA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eItmP-0000d0-Cs; Sun, 26 Nov 2017 10:03:17 +0000 Received: from [213.175.92.62] (helo=mail.pbx.lv) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eItly-0000c1-PI for lede-dev@lists.infradead.org; Sun, 26 Nov 2017 10:02:52 +0000 Received: from brain.lan (balticom-200-108.balticom.lv [83.99.200.108]) by mail.pbx.lv (MailSystem) with ESMTPSA id EB69F19CDF9 for ; Sun, 26 Nov 2017 12:02:21 +0200 (EET) From: Roman Yeryomin To: LEDE Development List Date: Sun, 26 Nov 2017 12:02:14 +0200 Message-Id: <20171126100214.24762-1-roman@advem.lv> X-Mailer: git-send-email 2.11.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171126_020251_036840_B2E365DB X-CRM114-Status: UNSURE ( 6.28 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.1 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-1.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.8 RDNS_NONE Delivered to internal network by a host with no rDNS Subject: [LEDE-DEV] [PATCH rpcd v2] sys: fix passwd path X-BeenThere: lede-dev@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "Lede-dev" Errors-To: lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Changes from v1: - use pointer to reduce compile size Signed-off-by: Roman Yeryomin --- sys.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys.c b/sys.c index 40f49ca..122191b 100644 --- a/sys.c +++ b/sys.c @@ -78,6 +78,7 @@ rpc_cgi_password_set(struct ubus_context *ctx, struct ubus_object *obj, struct blob_attr *tb[__RPC_P_MAX]; ssize_t n; int ret; + char *passwd = "/bin/passwd"; blobmsg_parse(rpc_password_policy, __RPC_P_MAX, tb, blob_data(msg), blob_len(msg)); @@ -85,7 +86,7 @@ rpc_cgi_password_set(struct ubus_context *ctx, struct ubus_object *obj, if (!tb[RPC_P_USER] || !tb[RPC_P_PASSWORD]) return UBUS_STATUS_INVALID_ARGUMENT; - if (stat("/usr/bin/passwd", &s)) + if (stat(passwd, &s)) return UBUS_STATUS_NOT_FOUND; if (!(s.st_mode & S_IXUSR)) @@ -119,7 +120,7 @@ rpc_cgi_password_set(struct ubus_context *ctx, struct ubus_object *obj, if (ret < 0) return rpc_errno_status(); - if (execl("/usr/bin/passwd", "/usr/bin/passwd", + if (execl(passwd, passwd, blobmsg_data(tb[RPC_P_USER]), NULL)) return rpc_errno_status();