projects
/
project
/
rpcd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
session: remove redundant key attribute to rpc_session_set()
[project/rpcd.git]
/
plugin.c
diff --git
a/plugin.c
b/plugin.c
index
33266b3
..
532fa15
100644
(file)
--- a/
plugin.c
+++ b/
plugin.c
@@
-1,7
+1,7
@@
/*
* rpcd - UBUS RPC server
*
/*
* rpcd - UBUS RPC server
*
- * Copyright (C) 2013 Jo-Philipp Wich <jow@openwrt.org>
+ * Copyright (C) 2013
-2014
Jo-Philipp Wich <jow@openwrt.org>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@
-16,7
+16,7
@@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include
"plugin.h"
+#include
<rpcd/plugin.h>
static struct blob_buf buf;
static struct blob_buf buf;
@@
-108,12
+108,9
@@
rpc_plugin_call_finish_cb(struct blob_buf *blob, int stat, void *priv)
{
if (c->obj)
{
{
if (c->obj)
{
- if (json_object_get_type(c->obj) == json_type_object ||
- json_object_get_type(c->obj) == json_type_array)
- {
- blobmsg_add_json_element(blob, NULL, c->obj);
+ if (json_object_get_type(c->obj) == json_type_object &&
+ blobmsg_add_object(blob, c->obj))
rv = UBUS_STATUS_OK;
rv = UBUS_STATUS_OK;
- }
json_object_put(c->obj);
}
json_object_put(c->obj);
}
@@
-194,7
+191,7
@@
rpc_plugin_parse_signature(struct blob_attr *sig, struct ubus_method *method)
struct blob_attr *attr;
struct blobmsg_policy *policy = NULL;
struct blob_attr *attr;
struct blobmsg_policy *policy = NULL;
- if (!sig || blob
_id
(sig) != BLOBMSG_TYPE_TABLE)
+ if (!sig || blob
msg_type
(sig) != BLOBMSG_TYPE_TABLE)
return false;
n_attr = 0;
return false;
n_attr = 0;
@@
-213,7
+210,7
@@
rpc_plugin_parse_signature(struct blob_attr *sig, struct ubus_method *method)
blobmsg_for_each_attr(attr, sig, rem)
{
blobmsg_for_each_attr(attr, sig, rem)
{
- type = blob
_id
(attr);
+ type = blob
msg_type
(attr);
if (type == BLOBMSG_TYPE_INT32)
{
if (type == BLOBMSG_TYPE_INT32)
{
@@
-327,7
+324,9
@@
rpc_plugin_parse_exec(const char *name, int fd)
if (!obj_type)
return NULL;
if (!obj_type)
return NULL;
- asprintf((char **)&obj_type->name, "luci-rpc-plugin-%s", name);
+ if (asprintf((char **)&obj_type->name, "luci-rpc-plugin-%s", name) < 0)
+ return NULL;
+
obj_type->methods = methods;
obj_type->n_methods = n_method;
obj_type->methods = methods;
obj_type->n_methods = n_method;
@@
-401,8
+400,10
@@
out:
static LIST_HEAD(plugins);
static const struct rpc_daemon_ops ops = {
static LIST_HEAD(plugins);
static const struct rpc_daemon_ops ops = {
- .access = rpc_session_access,
- .exec = rpc_exec,
+ .session_access = rpc_session_access,
+ .session_create_cb = rpc_session_create_cb,
+ .session_destroy_cb = rpc_session_destroy_cb,
+ .exec = rpc_exec,
};
static int
};
static int
@@
-411,7
+412,7
@@
rpc_plugin_register_library(struct ubus_context *ctx, const char *path)
struct rpc_plugin *p;
void *dlh;
struct rpc_plugin *p;
void *dlh;
- dlh = dlopen(path, RTLD_LAZY | RTLD_
GLOB
AL);
+ dlh = dlopen(path, RTLD_LAZY | RTLD_
LOC
AL);
if (!dlh)
return UBUS_STATUS_UNKNOWN_ERROR;
if (!dlh)
return UBUS_STATUS_UNKNOWN_ERROR;