Commit 4014ef15 authored by Kishen Maloor's avatar Kishen Maloor

Fix handling of unique ids pi/piid

Signed-off-by: Kishen Maloor's avatarKishen Maloor <kishen.maloor@intel.com>
parent 562110ef
......@@ -45,7 +45,7 @@ static oc_device_info_t oc_device_info[OC_MAX_NUM_DEVICES];
#endif /* !OC_DYNAMIC_ALLOCATION */
static oc_platform_info_t oc_platform_info;
static bool announce_con_res = true;
static bool announce_con_res = false;
static size_t device_count = 0;
/* Although used several times in the OCF spec, "/oic/con" is not
......@@ -323,9 +323,7 @@ oc_core_add_new_device(const char *uri, const char *rt, const char *name,
OC_DISCOVERABLE, oc_core_device_handler, 0, 0, 0, 2, rt, "oic.wk.d");
}
#ifndef OC_SECURITY
oc_gen_uuid(&oc_device_info[device_count].piid);
#endif /* !OC_SECURITY */
oc_new_string(&oc_device_info[device_count].name, name, strlen(name));
oc_new_string(&oc_device_info[device_count].icv, spec_version,
......
......@@ -90,6 +90,9 @@ oc_set_immutable_device_identifier(size_t device, oc_uuid_t *piid)
if (piid && device < oc_core_get_num_devices()) {
oc_device_info_t *info = oc_core_get_device_info(device);
if (info) {
#ifdef OC_SECURITY
oc_sec_load_unique_ids(device);
#endif /* OC_SECURITY */
memcpy(info->piid.id, piid->id, sizeof(oc_uuid_t));
#ifdef OC_SECURITY
oc_sec_dump_unique_ids(device);
......
......@@ -522,7 +522,10 @@ oc_sec_load_unique_ids(size_t device)
}
}
oc_free_rep(p);
} else {
oc_sec_dump_unique_ids(device);
}
#ifdef OC_DYNAMIC_ALLOCATION
free(buf);
#endif /* OC_DYNAMIC_ALLOCATION */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment