bbf: cannot get new objects exposed via json files if root path contains '.{i}.' at the end

This commit is contained in:
Amin Ben Ramdhane 2021-05-18 13:08:54 +01:00
parent bc5a18aca8
commit 9d116f7577
2 changed files with 6 additions and 4 deletions

View file

@ -97,7 +97,8 @@ static void generate_prefixobj_and_obj_full_obj(char *full_obj, char **prefix_ob
{
char *pch = NULL, *pchr = NULL, *tmp_obj = NULL;
char *str = dmstrdupjson(full_obj);
char *full_object = replace_str(full_obj, ".{i}.", ".");
char *str = dmstrdupjson(full_object);
for (pch = strtok_r(str, ".", &pchr); pch != NULL; pch = strtok_r(NULL, ".", &pchr)) {
if (pchr != NULL && *pchr != '\0') {
if (*prefix_obj == NULL) {
@ -112,7 +113,8 @@ static void generate_prefixobj_and_obj_full_obj(char *full_obj, char **prefix_ob
*obj = dmstrdupjson(pch);
}
}
if(str) dmfreejson(str);
dmfreejson(str);
dmfree(full_object);
}
static char *generate_obj_without_instance(char *full_obj, bool is_obj)

View file

@ -1,5 +1,5 @@
{
"Device.X_IOPSYS_EU_Dropbear.": {
"Device.X_IOPSYS_EU_Dropbear.{i}.": {
"type": "object",
"protocols": [
"cwmp",
@ -36,7 +36,7 @@
"option": {
"name": "dropbearalias"
},
"path":"/etc/bbfdm",
"path":"/etc/bbfdm"
}
}
]