X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fafb-calls.c;h=a859cd3a55c9c0c0160abbe32e28436aab9eaf8c;hb=65353dce81a629e042800bb7b86fcd869a76727e;hp=958b9a87f5d3c643300a8bdccd6f71f407bc11bb;hpb=74a7ebbea3d36158aabbda85d2aeb5a1b3a9daa9;p=src%2Fapp-framework-binder.git diff --git a/src/afb-calls.c b/src/afb-calls.c index 958b9a87..a859cd3a 100644 --- a/src/afb-calls.c +++ b/src/afb-calls.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"); @@ -27,7 +27,6 @@ #include #include "afb-calls.h" -#include "afb-cred.h" #include "afb-evt.h" #include "afb-export.h" #include "afb-hook.h" @@ -169,7 +168,6 @@ static void callreq_destroy_cb(struct afb_xreq *xreq) afb_context_disconnect(&callreq->xreq.context); json_object_put(callreq->xreq.json); - afb_cred_unref(callreq->xreq.cred); free(callreq); } @@ -282,24 +280,25 @@ static struct callreq *callreq_create( errno = ENOMEM; } else { afb_xreq_init(&callreq->xreq, &afb_calls_xreq_itf); - callreq->xreq.context.validated = 1; api2 = (char*)&callreq[1]; callreq->xreq.request.called_api = memcpy(api2, api, lenapi);; verb2 = &api2[lenapi]; callreq->xreq.request.called_verb = memcpy(verb2, verb, lenverb); callreq->xreq.json = args; callreq->mode = mode; - if (caller) { - export = afb_export_from_api_x3(caller->request.api); + if (!caller) + afb_export_context_init(export, &callreq->xreq.context); + else { + if (flags & afb_req_x2_subcall_api_session) + afb_export_context_init(export, &callreq->xreq.context); + else + afb_context_subinit(&callreq->xreq.context, &caller->context); if (flags & afb_req_x2_subcall_on_behalf) - callreq->xreq.cred = afb_cred_addref(caller->cred); + afb_context_on_behalf_other_context(&callreq->xreq.context, &caller->context); callreq->xreq.caller = caller; afb_xreq_unhooked_addref(caller); + export = afb_export_from_api_x3(caller->request.api); } - if (caller && (flags & afb_req_x2_subcall_api_session)) - afb_context_subinit(&callreq->xreq.context, &caller->context); - else - afb_export_context_init(export, &callreq->xreq.context); callreq->export = export; callreq->flags = flags; }