X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fafb-trace.c;h=79c7e0355a16589d6fd8f1e1894536710353db6e;hb=65353dce81a629e042800bb7b86fcd869a76727e;hp=5f8ec64cbcd36d5b9a5eccfa55cf504b0b1b1c95;hpb=7c67e966b8292961ca748e47d18ff437214cec1c;p=src%2Fapp-framework-binder.git diff --git a/src/afb-trace.c b/src/afb-trace.c index 5f8ec64c..79c7e035 100644 --- a/src/afb-trace.c +++ b/src/afb-trace.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016-2019 "IoT.bzh" + * Copyright (C) 2015-2020 "IoT.bzh" * Author José Bollo * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -199,21 +199,23 @@ static void emit(void *closure, const struct afb_hookid *hookid, const char *typ static void hook_xreq(void *closure, const struct afb_hookid *hookid, const struct afb_xreq *xreq, const char *action, const char *format, ...) { - struct json_object *cred = NULL; + struct afb_cred *cred; + struct json_object *jcred = NULL; const char *session = NULL; va_list ap; if (xreq->context.session) session = afb_session_uuid(xreq->context.session); - if (xreq->cred) - wrap_json_pack(&cred, "{si ss si si ss* ss*}", - "uid", (int)xreq->cred->uid, - "user", xreq->cred->user, - "gid", (int)xreq->cred->gid, - "pid", (int)xreq->cred->pid, - "label", xreq->cred->label, - "id", xreq->cred->id + cred = xreq->context.credentials; + if (cred) + wrap_json_pack(&jcred, "{si ss si si ss* ss*}", + "uid", (int)cred->uid, + "user", cred->user, + "gid", (int)cred->gid, + "pid", (int)cred->pid, + "label", cred->label, + "id", cred->id ); va_start(ap, format); emit(closure, hookid, "request", "{si ss ss ss so* ss*}", format, ap, @@ -221,7 +223,7 @@ static void hook_xreq(void *closure, const struct afb_hookid *hookid, const stru "api", xreq->request.called_api, "verb", xreq->request.called_verb, "action", action, - "credentials", cred, + "credentials", jcred, "session", session); va_end(ap); }