Module: kamailio
Branch: 5.3
Commit: 070efaa8497773c3a903c26d7f5f31632ad99703
URL:
https://github.com/kamailio/kamailio/commit/070efaa8497773c3a903c26d7f5f316…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2020-07-02T09:47:57+02:00
jsonrpcs: more debug messages in case field of scanning failure
(cherry picked from commit 0a4fa9594d871a41c2ef6b811e2b342ed6ccfe09)
---
Modified: src/modules/jsonrpcs/jsonrpcs_mod.c
---
Diff:
https://github.com/kamailio/kamailio/commit/070efaa8497773c3a903c26d7f5f316…
Patch:
https://github.com/kamailio/kamailio/commit/070efaa8497773c3a903c26d7f5f316…
---
diff --git a/src/modules/jsonrpcs/jsonrpcs_mod.c b/src/modules/jsonrpcs/jsonrpcs_mod.c
index d939be5d0f..9f7e5f68bb 100644
--- a/src/modules/jsonrpcs/jsonrpcs_mod.c
+++ b/src/modules/jsonrpcs/jsonrpcs_mod.c
@@ -586,8 +586,10 @@ static int jsonrpc_scan(jsonrpc_ctx_t* ctx, char* fmt, ...)
va_list ap;
str stmp;
- if(ctx->req_node==NULL)
+ if(ctx->req_node==NULL) {
+ LM_DBG("no request node\n");
return 0;
+ }
orig_fmt=fmt;
va_start(ap, fmt);
@@ -632,10 +634,14 @@ static int jsonrpc_scan(jsonrpc_ctx_t* ctx, char* fmt, ...)
*char_ptr = int2str(SRJSON_GET_ULONG(ctx->req_node),
&stmp.len);
} else {
+ LM_ERR("field is not a number to auto-convert - type %d\n",
+ ctx->req_node->type);
*char_ptr = NULL;
goto error;
}
} else {
+ LM_ERR("field is not a string - type %d\n",
+ ctx->req_node->type);
*char_ptr = NULL;
goto error;
}
@@ -650,11 +656,15 @@ static int jsonrpc_scan(jsonrpc_ctx_t* ctx, char* fmt, ...)
str_ptr->s = int2str(SRJSON_GET_ULONG(ctx->req_node),
&str_ptr->len);
} else {
+ LM_ERR("field is not a number to auto-convert - type %d\n",
+ ctx->req_node->type);
str_ptr->s = NULL;
str_ptr->len = 0;
goto error;
}
} else {
+ LM_ERR("field is not a string - type %d\n",
+ ctx->req_node->type);
str_ptr->s = NULL;
str_ptr->len = 0;
goto error;
@@ -676,8 +686,10 @@ static int jsonrpc_scan(jsonrpc_ctx_t* ctx, char* fmt, ...)
ctx->req_node = ctx->req_node->next;
}
/* error if there is still a scan char type and it is not optional */
- if(*fmt && *fmt!='*' && mandatory_param==1)
+ if(*fmt && *fmt!='*' && mandatory_param==1) {
+ LM_ERR("no more fields to scan\n");
goto error;
+ }
va_end(ap);
return (int)(fmt-orig_fmt)-modifiers;