Code Review
/
src
/
app-framework-binder.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
afb-binding.hpp: Fix constexpr of 'binding'
[src/app-framework-binder.git]
/
src
/
afb-xreq.c
diff --git
a/src/afb-xreq.c
b/src/afb-xreq.c
index
5f6c745
..
47f2ec6
100644
(file)
--- a/
src/afb-xreq.c
+++ b/
src/afb-xreq.c
@@
-463,7
+463,7
@@
static int xreq_subscribe_eventid_cb(struct afb_request *closure, struct afb_eve
int afb_xreq_subscribe(struct afb_xreq *xreq, struct afb_eventid *eventid)
{
if (xreq->listener)
int afb_xreq_subscribe(struct afb_xreq *xreq, struct afb_eventid *eventid)
{
if (xreq->listener)
- return afb_evt_add_watch(xreq->listener, eventid);
+ return afb_evt_
eventid_
add_watch(xreq->listener, eventid);
if (xreq->queryitf->subscribe)
return xreq->queryitf->subscribe(xreq, eventid);
ERROR("no event listener, subscription impossible");
if (xreq->queryitf->subscribe)
return xreq->queryitf->subscribe(xreq, eventid);
ERROR("no event listener, subscription impossible");
@@
-486,7
+486,7
@@
static int xreq_unsubscribe_eventid_cb(struct afb_request *closure, struct afb_e
int afb_xreq_unsubscribe(struct afb_xreq *xreq, struct afb_eventid *eventid)
{
if (xreq->listener)
int afb_xreq_unsubscribe(struct afb_xreq *xreq, struct afb_eventid *eventid)
{
if (xreq->listener)
- return afb_evt_remove_watch(xreq->listener, eventid);
+ return afb_evt_
eventid_
remove_watch(xreq->listener, eventid);
if (xreq->queryitf->unsubscribe)
return xreq->queryitf->unsubscribe(xreq, eventid);
ERROR("no event listener, unsubscription impossible");
if (xreq->queryitf->unsubscribe)
return xreq->queryitf->unsubscribe(xreq, eventid);
ERROR("no event listener, unsubscription impossible");
@@
-599,6
+599,12
@@
static void *xreq_context_make_cb(struct afb_request *closure, int replace, void
return afb_context_make(&xreq->context, replace, create_value, free_value, create_closure);
}
return afb_context_make(&xreq->context, replace, create_value, free_value, create_closure);
}
+static int xreq_get_uid_cb(struct afb_request *closure)
+{
+ struct afb_xreq *xreq = from_request(closure);
+ return xreq->cred && xreq->cred->id ? (int)xreq->cred->uid : -1;
+}
+
/******************************************************************************/
static struct json_object *xreq_hooked_json_cb(struct afb_request *closure)
/******************************************************************************/
static struct json_object *xreq_hooked_json_cb(struct afb_request *closure)
@@
-803,6
+809,13
@@
static void *xreq_hooked_context_make_cb(struct afb_request *closure, int replac
return afb_hook_xreq_context_make(xreq, replace, create_value, free_value, create_closure, result);
}
return afb_hook_xreq_context_make(xreq, replace, create_value, free_value, create_closure, result);
}
+static int xreq_hooked_get_uid_cb(struct afb_request *closure)
+{
+ struct afb_xreq *xreq = from_request(closure);
+ int r = xreq_get_uid_cb(closure);
+ return afb_hook_xreq_get_uid(xreq, r);
+}
+
/******************************************************************************/
const struct afb_request_itf xreq_itf = {
/******************************************************************************/
const struct afb_request_itf xreq_itf = {
@@
-831,6
+844,7
@@
const struct afb_request_itf xreq_itf = {
.subscribe_eventid = xreq_subscribe_eventid_cb,
.unsubscribe_eventid = xreq_unsubscribe_eventid_cb,
.subcall_request = xreq_subcall_request_cb,
.subscribe_eventid = xreq_subscribe_eventid_cb,
.unsubscribe_eventid = xreq_unsubscribe_eventid_cb,
.subcall_request = xreq_subcall_request_cb,
+ .get_uid = xreq_get_uid_cb,
};
const struct afb_request_itf xreq_hooked_itf = {
};
const struct afb_request_itf xreq_hooked_itf = {
@@
-859,6
+873,7
@@
const struct afb_request_itf xreq_hooked_itf = {
.subscribe_eventid = xreq_hooked_subscribe_eventid_cb,
.unsubscribe_eventid = xreq_hooked_unsubscribe_eventid_cb,
.subcall_request = xreq_hooked_subcall_request_cb,
.subscribe_eventid = xreq_hooked_subscribe_eventid_cb,
.unsubscribe_eventid = xreq_hooked_unsubscribe_eventid_cb,
.subcall_request = xreq_hooked_subcall_request_cb,
+ .get_uid = xreq_hooked_get_uid_cb,
};
/******************************************************************************/
};
/******************************************************************************/