Commit 60138901 authored by Kishen Maloor's avatar Kishen Maloor

oc_cloud:fix cloud_deregistered_internal()

Signed-off-by: Kishen Maloor's avatarKishen Maloor <kishen.maloor@intel.com>
parent 45b46ab3
Pipeline #743 passed with stage
in 6 minutes and 33 seconds
...@@ -231,7 +231,8 @@ cloud_deregistered_internal(oc_client_response_t *data) ...@@ -231,7 +231,8 @@ cloud_deregistered_internal(oc_client_response_t *data)
{ {
cloud_api_param_t *p = (cloud_api_param_t *)data->user_data; cloud_api_param_t *p = (cloud_api_param_t *)data->user_data;
oc_cloud_context_t *ctx = p->ctx; oc_cloud_context_t *ctx = p->ctx;
if (data->code >= OC_STATUS_SERVICE_UNAVAILABLE) { if (data->code < OC_STATUS_BAD_REQUEST ||
data->code >= OC_STATUS_SERVICE_UNAVAILABLE) {
ctx->store.status = OC_CLOUD_DEREGISTERED; ctx->store.status = OC_CLOUD_DEREGISTERED;
} else if (data->code >= OC_STATUS_BAD_REQUEST) { } else if (data->code >= OC_STATUS_BAD_REQUEST) {
cloud_set_last_error(ctx, CLOUD_ERROR_RESPONSE); cloud_set_last_error(ctx, CLOUD_ERROR_RESPONSE);
......
...@@ -1086,12 +1086,14 @@ oc_sec_decode_cred(oc_rep_t *rep, oc_sec_cred_t **owner, bool from_storage, ...@@ -1086,12 +1086,14 @@ oc_sec_decode_cred(oc_rep_t *rep, oc_sec_cred_t **owner, bool from_storage,
oc_sec_cred_t *cr = oc_sec_get_cred_by_credid(credid, device); oc_sec_cred_t *cr = oc_sec_get_cred_by_credid(credid, device);
if (cr) { if (cr) {
cr->owner_cred = owner_cred; cr->owner_cred = owner_cred;
} /* Obtain a handle to the owner credential entry where that
/* Obtain a handle to the owner credential entry where that applies * applies
*/ */
if (credtype == OC_CREDTYPE_PSK && privatedata_size == 0 && owner) { if (credtype == OC_CREDTYPE_PSK && privatedata_size == 0 &&
*owner = cr; owner) {
(*owner)->owner_cred = true; *owner = cr;
(*owner)->owner_cred = true;
}
} }
} }
creds_array = creds_array->next; creds_array = creds_array->next;
......
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