summaryrefslogtreecommitdiffstats
path: root/4a-hal
diff options
context:
space:
mode:
authorJonathan Aillet <jonathan.aillet@iot.bzh>2018-06-12 11:17:32 +0200
committerJonathan Aillet <jonathan.aillet@iot.bzh>2018-10-08 15:53:53 +0200
commit6e0fa9d1548c6a329f5d2d0d9afe5c298bd4a9e3 (patch)
tree67f1cb4e84550e8904a3ba251b2e91b75c2aa270 /4a-hal
parentadde996d8572a566c3461076a74326734053cf79 (diff)
Auithorize sending empty json to verbs
Auithorize sending empty json to hal-manager 'loaded 'verb and to hal 'info' verb. Change-Id: Id664b0335ad80f88392dd24cd910016deaad25e3 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
Diffstat (limited to '4a-hal')
-rw-r--r--4a-hal/4a-hal-controllers/4a-hal-controllers-cb.c6
-rw-r--r--4a-hal/4a-hal-manager/4a-hal-manager-cb.c18
2 files changed, 11 insertions, 13 deletions
diff --git a/4a-hal/4a-hal-controllers/4a-hal-controllers-cb.c b/4a-hal/4a-hal-controllers/4a-hal-controllers-cb.c
index 67df3b6..cc7b7ff 100644
--- a/4a-hal/4a-hal-controllers/4a-hal-controllers-cb.c
+++ b/4a-hal/4a-hal-controllers/4a-hal-controllers-cb.c
@@ -533,11 +533,9 @@ void HalCtlsInfo(AFB_ReqT request)
requestJson = AFB_ReqJson(request);
if(! requestJson) {
- AFB_ReqFail(request, "info_data", "Can't get request json");
- return;
+ AFB_ReqNotice(request, "%s: Can't get request json", __func__);
}
-
- if(json_object_is_type(requestJson, json_type_object) && json_object_get_object(requestJson)->count > 0) {
+ else if(json_object_is_type(requestJson, json_type_object) && json_object_get_object(requestJson)->count > 0) {
apiToCall = currentCtlHalData->ctlHalSpecificData->mixerApiName;
if(! apiToCall) {
AFB_ReqFail(request, "mixer_api", "Can't get mixer api");
diff --git a/4a-hal/4a-hal-manager/4a-hal-manager-cb.c b/4a-hal/4a-hal-manager/4a-hal-manager-cb.c
index f0ab0bd..f16950c 100644
--- a/4a-hal/4a-hal-manager/4a-hal-manager-cb.c
+++ b/4a-hal/4a-hal-manager/4a-hal-manager-cb.c
@@ -61,7 +61,7 @@ void HalMgrPing(AFB_ReqT request)
void HalMgrLoaded(AFB_ReqT request)
{
- int requestJsonErr, requestOptionValue;
+ int requestJsonErr = 0, requestOptionValue;
uint64_t cpt, numberOfLoadedApi;
char cardIdString[10];
@@ -84,12 +84,6 @@ void HalMgrLoaded(AFB_ReqT request)
return;
}
- requestJson = AFB_ReqJson(request);
- if(! requestJson) {
- AFB_ReqFail(request, "request_json", "Can't get request json");
- return;
- }
-
numberOfLoadedApi = HalUtlGetNumberOfHalInList(&HalMgrGlobalData->first);
if(! numberOfLoadedApi) {
AFB_ReqSuccess(request, NULL, "No Hal Api loaded");
@@ -104,8 +98,14 @@ void HalMgrLoaded(AFB_ReqT request)
currentHalData = HalMgrGlobalData->first;
- // Get request option
- requestJsonErr = wrap_json_unpack(requestJson, "{s:i}", "verbose", &requestOptionValue);
+ requestJson = AFB_ReqJson(request);
+ if(! requestJson) {
+ AFB_ReqNotice(request, "%s: Can't get request json", __func__);
+ }
+ else {
+ // Get request option
+ requestJsonErr = wrap_json_unpack(requestJson, "{s:i}", "verbose", &requestOptionValue);
+ }
// Case if request key is 'verbose' and value is bigger than 0
if(! requestJsonErr && requestOptionValue > 0) {