projects
/
project
/
ubus.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ubusd: fix build on non-linux systems without peercred support
[project/ubus.git]
/
libubus-obj.c
diff --git
a/libubus-obj.c
b/libubus-obj.c
index
ef10462
..
990d04b
100644
(file)
--- a/
libubus-obj.c
+++ b/
libubus-obj.c
@@
-69,7
+69,11
@@
ubus_process_invoke(struct ubus_context *ctx, struct ubus_msghdr *hdr,
req.peer = hdr->peer;
req.seq = hdr->seq;
req.object = obj->id;
req.peer = hdr->peer;
req.seq = hdr->seq;
req.object = obj->id;
-
+ if (attrbuf[UBUS_ATTR_USER] && attrbuf[UBUS_ATTR_GROUP]) {
+ req.acl.user = blobmsg_get_string(attrbuf[UBUS_ATTR_USER]);
+ req.acl.group = blobmsg_get_string(attrbuf[UBUS_ATTR_GROUP]);
+ req.acl.object = obj->name;
+ }
for (method = 0; method < obj->n_methods; method++)
if (!obj->methods[method].name ||
!strcmp(obj->methods[method].name,
for (method = 0; method < obj->n_methods; method++)
if (!obj->methods[method].name ||
!strcmp(obj->methods[method].name,
@@
-99,6
+103,7
@@
void __hidden ubus_process_obj_msg(struct ubus_context *ctx, struct ubus_msghdr_
struct blob_attr **attrbuf;
struct ubus_object *obj;
uint32_t objid;
struct blob_attr **attrbuf;
struct ubus_object *obj;
uint32_t objid;
+ void *prev_data = NULL;
attrbuf = ubus_parse_msg(buf->data);
if (!attrbuf[UBUS_ATTR_OBJID])
attrbuf = ubus_parse_msg(buf->data);
if (!attrbuf[UBUS_ATTR_OBJID])
@@
-120,7
+125,20
@@
void __hidden ubus_process_obj_msg(struct ubus_context *ctx, struct ubus_msghdr_
default:
return;
}
default:
return;
}
+
+ if (buf == &ctx->msgbuf) {
+ prev_data = buf->data;
+ buf->data = NULL;
+ }
+
cb(ctx, hdr, obj, attrbuf);
cb(ctx, hdr, obj, attrbuf);
+
+ if (prev_data) {
+ if (buf->data)
+ free(prev_data);
+ else
+ buf->data = prev_data;
+ }
}
static void ubus_add_object_cb(struct ubus_request *req, int type, struct blob_attr *msg)
}
static void ubus_add_object_cb(struct ubus_request *req, int type, struct blob_attr *msg)