Commit 366409bf authored by Aleksey's avatar Aleksey Committed by Nathan Heldt-Sheller

[IOT-2726] /cred fix for CT1.7.8.11

This patch fixes `4.00 Bad Request` error on
/oic/sec/cred CON UPDATE request in CT1.7.8.11

This adds an additional check of the incoming credential
subjectid for OwnerPSK generation. Before, credresource
tried to generate owner psk for any subjectid in case if
doxm->owner value already saved, but doxm->owned flag
not yet set in true.
This led to an error at the POST handler return.

Change-Id: If2b683ee417bb058f954734ff0c1b64e145c9a6b
Signed-off-by: Aleksey's avatarAleksey Volkov <>
parent add093b1
......@@ -2153,7 +2153,11 @@ static OCEntityHandlerResult HandleNewCredential(OCEntityHandlerRequest *ehReque
#if defined(__WITH_DTLS__) || defined(__WITH_TLS__)
OicUuid_t emptyUuid = {.id={0}};
const OicSecDoxm_t *doxm = GetDoxmResourceData();
if(NO_SECURITY_MODE != cred->credType && doxm && false == doxm->owned && memcmp(&(doxm->owner), &emptyUuid, sizeof(OicUuid_t)) != 0)
if( NO_SECURITY_MODE != cred->credType
&& doxm
&& false == doxm->owned
&& memcmp(&(doxm->owner), &emptyUuid, sizeof(OicUuid_t)) != 0
&& memcmp(&(doxm->owner), &cred->subject, sizeof(OicUuid_t)) == 0 )
//in case of owner PSK
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