summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2017-04-26 17:51:47 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2017-04-26 17:51:47 +0200
commit3580f1a46e5d1a4d4baab7db790418d6bc35b679 (patch)
tree64775fa4eeb76166acc0e6236fef8079dcdf75eb
parent7e674cc7202abfae0dd07df8805a0dea743bf4be (diff)
Print credential in default request hook
Change-Id: I67af78d8838de4c5386fd62c8f3b26d1ad8fb338 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
-rw-r--r--src/afb-hook.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/afb-hook.c b/src/afb-hook.c
index 545673f4..efd2e652 100644
--- a/src/afb-hook.c
+++ b/src/afb-hook.c
@@ -32,6 +32,7 @@
#include "afb-context.h"
#include "afb-hook.h"
#include "afb-session.h"
+#include "afb-cred.h"
#include "afb-xreq.h"
#include "afb-ditf.h"
#include "verbose.h"
@@ -95,7 +96,16 @@ static void _hook_xreq_(const struct afb_xreq *xreq, const char *format, ...)
static void hook_xreq_begin_default_cb(void * closure, const struct afb_xreq *xreq)
{
- _hook_xreq_(xreq, "BEGIN");
+ if (!xreq->cred)
+ _hook_xreq_(xreq, "BEGIN");
+ else
+ _hook_xreq_(xreq, "BEGIN uid=%d gid=%d pid=%d label=%s id=%s",
+ (int)xreq->cred->uid,
+ (int)xreq->cred->gid,
+ (int)xreq->cred->pid,
+ xreq->cred->label?:"(null)",
+ xreq->cred->id?:"(null)"
+ );
}
static void hook_xreq_end_default_cb(void * closure, const struct afb_xreq *xreq)