From patchwork Sun May 1 21:58:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Etienne Champetier X-Patchwork-Id: 1624943 X-Patchwork-Delegate: ynezz@true.cz Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=bg/3wm6S; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=YnAc54i9; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Ks0Xg3jKGz9s0r for ; Mon, 2 May 2022 08:00:50 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=G7+Tw8NAwRNYmUWFce2DMUgnr+XTUf8YDLnnwU/q+po=; b=bg/3wm6SGmhq9V pDZzg0BeCxjYVPoGPdRxeZTWKiabD2UymDrdcERzO3loscPz5MzPoyNrPYWG1sHZPIoWfXwZYEVxW 5OnolheX2jNBuMJ76jKGgMkETyfiuwmKjmKd2of+l+kZ/MHtTUFGNnq5Xq4KabmRPtKStEBqPdDtN /s83ja6Mc5/A1dwjSRIHxkCll/K7LlMwghNDipV1Dy28SZXpPRIg/1ebyTY4MClvrSfuzvL9RHCUJ yAW/aRUKKZ8+IOUtNgOxqxGNiOVOq0dfvxOG/FctbLe0fPPppnmfRj3Q46SPxn3drzvuWXHSRsk/m HzIQvy3ZNmm3R+5A72lw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nlHaX-00H0up-9M; Sun, 01 May 2022 21:58:45 +0000 Received: from mail-qt1-x82e.google.com ([2607:f8b0:4864:20::82e]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nlHaT-00H0uV-0t for openwrt-devel@lists.openwrt.org; Sun, 01 May 2022 21:58:42 +0000 Received: by mail-qt1-x82e.google.com with SMTP id o18so10050885qtk.7 for ; Sun, 01 May 2022 14:58:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ZVolVxzEBGO5MDA6URr5009mCyf86KMZvRbRm0txIYI=; b=YnAc54i9MU0SFDhqEIfMuXRN2v9ujVATt7BLV7pvgXp/ljJIWHJcV722hnkuJzCf1E 7f/U6vZdpJ+duk8OMLsN5AGlULprxautg8iM5QYvPWZnnNN6KZNtNyiqOi4XYOfqMR/U BWAtM17ZtrnjnoIMYHn/ghHqrqReSWlN8mAzoMA20hw6k3PN+NfIkL8aR0tmEgdDKHnH S/oNBMkDP/VW845h3DZFTijsq6yHmqVwRV+s/QvFk1x0BuP3BC0Fz2lfez3i79WYMM0V LrKtWDglZqgQL+0VMKrozbFTOr2BgPyOzg/sqE5G3KIICManN0TMnPujeqZcFbiWfWiV hwdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ZVolVxzEBGO5MDA6URr5009mCyf86KMZvRbRm0txIYI=; b=OYM6FpSfEI2CuOAG4WKYw39cRHRuitXCgXQK1LvFhPNi3WTjcVLXGWZFC/yV7OWLm8 sXO0SKqA5oi/3+ZYtU52YdtoeZaLqNX2jZwnkxDmZyP5TVOWYMESIGDuJwyIxHpp105D OW9AfcvcNFF2m7sqs7XqsbqQMZ2XzLp1HbX8KF2mu1Rdmrh6rCTGZQnaFG3w4BnGK0ug X2mdAejNsLFbzLUWBYRI1p4Nq6x04UZxve3uTQf+8faZQUerdd/JjqZ4k04ZEwrn5OAt cIDbDtZ6GoQnIVBTQIwQxQvU2lj0hChVIvd+TDHI6TuY4zuduv7FjeX9EwbLFrQUyISa PQzA== X-Gm-Message-State: AOAM5338v19lyn9VaeEMFERe+iM3B1D6LmAqDLwh+c4OweCgM8NxA+4y 0IOGt9CzmOJoU3yihUIHe+E664hKhzU= X-Google-Smtp-Source: ABdhPJyhSoAlZFuBEBJJBR/f2/AHcb1nkdLox2RFg+us8Wq5wGq8Qso/4shxf7RT2U+9xb6APWYzew== X-Received: by 2002:a05:622a:1909:b0:2f3:3c03:1139 with SMTP id w9-20020a05622a190900b002f33c031139mr8194317qtc.264.1651442318323; Sun, 01 May 2022 14:58:38 -0700 (PDT) Received: from echampetier.lan ([2607:fea8:1bc0:36::d9a]) by smtp.gmail.com with ESMTPSA id f7-20020a05620a20c700b0069fc167df92sm3193542qka.82.2022.05.01.14.58.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 May 2022 14:58:37 -0700 (PDT) From: Etienne Champetier To: openwrt-devel@lists.openwrt.org Cc: Etienne Champetier Subject: [PATCH ubus] lua: add optional path filter to objects() method Date: Sun, 1 May 2022 17:58:09 -0400 Message-Id: <20220501215809.75993-1-champetier.etienne@gmail.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220501_145841_142691_3205CDF9 X-CRM114-Status: UNSURE ( 8.81 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: 'ubus list []' passes the path to ubusd, this commit fix the lua bindings to do the same Signed-off-by: Etienne Champetier --- lua/ubus.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:82e listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [champetier.etienne[at]gmail.com] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org 'ubus list []' passes the path to ubusd, this commit fix the lua bindings to do the same Signed-off-by: Etienne Champetier --- lua/ubus.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/ubus.c b/lua/ubus.c index e2bb081..07b816d 100644 --- a/lua/ubus.c +++ b/lua/ubus.c @@ -286,9 +286,10 @@ ubus_lua_objects(lua_State *L) { int rv; struct ubus_lua_connection *c = luaL_checkudata(L, 1, METANAME); + const char *path = (lua_gettop(L) >= 2) ? luaL_checkstring(L, 2) : NULL; lua_newtable(L); - rv = ubus_lookup(c->ctx, NULL, ubus_lua_objects_cb, L); + rv = ubus_lookup(c->ctx, path, ubus_lua_objects_cb, L); if (rv != UBUS_STATUS_OK) {