Commit graph

18 commits

Author SHA1 Message Date
Jo-Philipp Wich
d442d62dea plugin: fix double free in finish callback
Fixes: 37aa919 ("plugin: fix leaking invoked method name for exec plugins")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-10-29 12:01:36 +01:00
Jo-Philipp Wich
ca3e2d5e70 plugin: do not free method name separately
A previous commit changed the allocation method for the call context to
include the method name string memory directly, so we must not treat the
method member separately anymore.

Fixes: 37aa919 ("plugin: fix leaking invoked method name for exec plugins")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-10-29 09:23:30 +01:00
Yousong Zhou
02c6e1d08c exec: properly free memory on rpc_exec() error
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
[fix whitespace]
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-10-29 09:23:22 +01:00
Yousong Zhou
cc50263504 plugin: exec: properly free memory on parse error
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
2019-10-29 08:59:37 +01:00
Jo-Philipp Wich
37aa9196b6 plugin: fix leaking invoked method name for exec plugins
The invoked method name was separately duplicated from the call_context
structure. The structure itself is eventually freed by rpc_exec_reply()
but the method string it points to is lost after that.

Use calloc_a() instead to allocate the string copy buffer together with
the context structure, to ensure that all involved memory is freed.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-10-17 11:50:39 +02:00
Jo-Philipp Wich
7235f34895 plugin: store pointer to exec timeout value in the ops structure
This is required for plugins that need access to the configured execution
timeout. The global variable cannot be used as-is since we dlopen() with
RTLD_LOCAL.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-28 12:10:40 +01:00
Rafał Miłecki
9a8640183c plugin: use RTLD_LOCAL instead of RTLD_GLOBAL when loading library
RTLD_GLOBAL was used to allow plugins use each other symbols but this
facility was (most likely) never used and is a bad design anyway. If
there is a common code it should just go to a library.

Using RTLD_LOCAL on the other hand saves us from conflicting symbols
used by different plugins. An example can be iwinfo plugin using libnl.
If there appears to be another plugin using incompatible netlink
implementation this will result in a problem. Both plugins will start
using the same libnl which will break one of them.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Acked-by: Jo-Philipp Wich <jo@mein.io>
2017-11-09 15:49:15 +01:00
John Crispin
311c85e7d9 properly handle return codes
Signed-off-by: John Crispin <blogic@openwrt.org>
2015-03-28 18:36:40 +01:00
Jo-Philipp Wich
7fd4564b8a plugin: fix parsing libexec plugin output
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2014-07-04 00:06:43 +02:00
Jo-Philipp Wich
0c4e97b4e7 Extend copyright 2014-01-12 12:48:58 +00:00
Jo-Philipp Wich
6b189b2201 plugin: use blobmsg_type() instead of blob_id() 2013-09-12 13:36:49 +02:00
Jo-Philipp Wich
e0afdb10ae Move includes into subdirectory 2013-09-04 12:46:11 +02:00
Jo-Philipp Wich
059a6df1fd plugin: expose rpc_session_create_cb() and rpc_session_destroy_cb() in plugin ops; rename access to session_access 2013-09-03 12:47:06 +02:00
Jo-Philipp Wich
07c2f0a9b1 Rename from "luci-rpcd" to "rpcd" 2013-09-02 17:23:30 +02:00
Jo-Philipp Wich
3d358bb3a1 Introduce shared object plugin api 2013-09-02 15:23:04 +02:00
Jo-Philipp Wich
0b4d4aeeac Register dummy stderr callback when ivoking plugins calls to avoid filling the ustream with unread data. 2013-09-01 22:42:17 +02:00
Jo-Philipp Wich
90e8e9ca00 Rework plugin support to use incremental json parsing and rpc_exec() framework for invocation 2013-09-01 22:22:40 +02:00
Jo-Philipp Wich
a86ef267a4 Add initial plugin api support 2013-08-30 20:33:23 +02:00