summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2013-08-08 13:40:40 +0200
committerJo-Philipp Wich <jow@openwrt.org>2013-08-08 13:40:40 +0200
commita7b7badd525143971464d7d75c6e0faca1c12e96 (patch)
tree885c4b884d17044919f83ddc523a7dd13ebc6cf0
parent4fb73b3febd0b368bee39c361dd58d56fb1829ca (diff)
ubus: pass current session id as ubus_rpc_session attribute to any called procedure
-rw-r--r--ubus.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/ubus.c b/ubus.c
index 8129c20..3c11246 100644
--- a/ubus.c
+++ b/ubus.c
@@ -241,7 +241,7 @@ static void uh_ubus_single_error(struct client *cl, enum rpc_error type)
ops->request_done(cl);
}
-static void uh_ubus_send_request(struct client *cl, json_object *obj, struct blob_attr *args)
+static void uh_ubus_send_request(struct client *cl, json_object *obj, const char *sid, struct blob_attr *args)
{
struct dispatch *d = &cl->dispatch;
struct dispatch_ubus *du = &d->ubus;
@@ -253,6 +253,8 @@ static void uh_ubus_send_request(struct client *cl, json_object *obj, struct blo
blobmsg_for_each_attr(cur, args, rem)
blobmsg_add_blob(&req, cur);
+ blobmsg_add_string(&req, "ubus_rpc_session", sid);
+
blob_buf_init(&du->buf, 0);
memset(&du->req, 0, sizeof(du->req));
ret = ubus_invoke_async(ctx, du->obj, du->func, req.head, &du->req);
@@ -484,7 +486,7 @@ static void uh_ubus_handle_request_object(struct client *cl, struct json_object
goto error;
}
- uh_ubus_send_request(cl, obj, data.data);
+ uh_ubus_send_request(cl, obj, data.sid, data.data);
goto out;
}
else if (!strcmp(data.method, "list")) {