This change adds /pstat.dos state check to protect credentials modifications in read-only states.
Change-Id: I9a3402e458db8c5fa62a5a0fa0e08c1dd432ceaf
Signed-off-by: Aleksey Volkov <a.volkov@samsung.com>
bool found = false;
+ OicSecDostype_t dos;
+
+ VERIFY_SUCCESS(TAG, OC_STACK_OK == GetDos(&dos), ERROR);
+ if ((DOS_RESET == dos.state) ||
+ (DOS_RFNOP == dos.state))
+ {
+ OIC_LOG_V(ERROR, TAG, "%s /cred resource is read-only in RESET and RFNOP.", __func__);
+ result = OC_EH_NOT_ACCEPTABLE;
+ goto exit;
+ }
+
//leave IOT-1936 fix for preconfig pin
#if ((defined(__WITH_DTLS__) || defined(__WITH_TLS__)) && defined(MULTIPLE_OWNER))
LL_FOREACH_SAFE(gCred, cred, tempCred)
{
result = OC_STACK_OK;
}
-
+exit:
return result;
}