diff mbox series

[ubus,1/2] lua: Use local state in ubus_lua_add()

Message ID mailman.29943.1735822308.1089.openwrt-devel@lists.openwrt.org
State New
Headers show
Series [ubus,1/2] lua: Use local state in ubus_lua_add() | expand

Commit Message

Ernestas Kulik Jan. 2, 2025, 12:48 p.m. UTC
The sender domain has a DMARC Reject/Quarantine policy which disallows
sending mailing list messages using the original "From" header.

To mitigate this problem, the original message has been wrapped
automatically by the mailing list software.
Currently, when setting __ubusobj on the table passed to ubus_lua_add(),
the global state is used. It’s not immediately apparent that it’s
intentional, so this commit changes the Lua calls to use function-local
state.

Signed-off-by: Ernestas Kulik <ernestas.k@iconn-networks.com>
---
 lua/ubus.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/lua/ubus.c b/lua/ubus.c
index 07b816d..cf2b555 100644
--- a/lua/ubus.c
+++ b/lua/ubus.c
@@ -577,9 +577,9 @@  static int ubus_lua_add(lua_State *L)
 				ubus_add_object(c->ctx, obj);
 
                                 /* allow future reference of ubus obj */
-				lua_pushstring(state,"__ubusobj");
-				lua_pushlightuserdata(state, obj);
-				lua_settable(state,-3);
+				lua_pushstring(L,"__ubusobj");
+				lua_pushlightuserdata(L, obj);
+				lua_settable(L,-3);
                         }
 		}
 		lua_pop(L, 1);