diff --git a/dmbbfcommon.h b/dmbbfcommon.h index fb00feaf..b124b292 100644 --- a/dmbbfcommon.h +++ b/dmbbfcommon.h @@ -10,6 +10,7 @@ */ #include +#include "dmentry.h" extern int end_session_flag; extern unsigned int upnp_in_user_mask; diff --git a/dmentry.c b/dmentry.c index b62bf3e3..f0054b74 100644 --- a/dmentry.c +++ b/dmentry.c @@ -200,10 +200,10 @@ int dm_ctx_clean_sub(struct dmctx *ctx) return 0; } -int dmentry_get_parameter_leaf_value(struct dmctx *ctx, int cmd, char *inparam) +int dmentry_get_parameter_leaf_value(struct dmctx *ctx, char *inparam) { - int err = 0, fault = 0; - bool setnotif = true; + int fault = 0; + if (!inparam) inparam = ""; ctx->in_param = inparam; @@ -211,6 +211,7 @@ int dmentry_get_parameter_leaf_value(struct dmctx *ctx, int cmd, char *inparam) fault = FAULT_9005; else fault = dm_entry_get_full_param_value(ctx); + return fault; } int dm_entry_param_method(struct dmctx *ctx, int cmd, char *inparam, char *arg1, char *arg2) diff --git a/dmentry.h b/dmentry.h index 7fd790fe..1f65939f 100644 --- a/dmentry.h +++ b/dmentry.h @@ -55,7 +55,7 @@ void dm_execute_cli_shell(int argc, char** argv, unsigned int dmtype, unsigned i void dm_execute_cli_command(char *file, unsigned int dmtype, unsigned int amd_version, unsigned int instance_mode); void wepkey_cli(int argc, char** argv); int free_dynamic_arrays(void); -int dmentry_get_parameter_leaf_value(struct dmctx *ctx, int cmd, char *inparam); +int dmentry_get_parameter_leaf_value(struct dmctx *ctx, char *inparam); #ifdef BBF_TR064 #define DM_ENTRY_UPNP_CHECK_CHANGES() \ do { \ diff --git a/libbbf_api/dmjson.c b/libbbf_api/dmjson.c index 4195b426..5c9457d2 100644 --- a/libbbf_api/dmjson.c +++ b/libbbf_api/dmjson.c @@ -300,8 +300,7 @@ void bbf_api_dmjson_get_string(char *jkey, char **jval) if (dmjson_jobj == NULL) return; - struct json_object *get_obj = json_object_object_get(dmjson_jobj, jkey); - if (get_obj) { - *jval = json_object_get_string(get_obj); - } + struct json_object *get_obj; + if (json_object_object_get_ex(dmjson_jobj, jkey, &get_obj)) + *jval = (char*)json_object_get_string(get_obj); }