Commit 666d1d5c authored by Abhishek Pandey's avatar Abhishek Pandey Committed by Nathan Heldt-Sheller

[Easy Setup] Check required properties for UPDATE

[IOT-3252]
https://jira.iotivity.org/browse/IOT-3252

Per the WiFiConf Schema, for an UPDATE request:
 "required":["tnn", "wat", "wet"]

This means that all three of these Properties must be in every
UPDATE request. If they are not there, the Device is supposed
to reject the request with a 4.xx error. However, IoTivity
responds with a 2.04 Changed response instead currently.

This patch fixes above issue by checking the POST request
for required properties (tnn, wat, wet). If any of these
are not included in POST request, it will be rejected.

Change-Id: I00f02c93cd273a02706c85c5d236584d45d6ca77
Signed-off-by: default avatarAbhishek Pandey <abhi.siso@samsung.com>
parent 010440ea
......@@ -587,6 +587,16 @@ OCEntityHandlerResult updateWiFiConfResource(OCRepPayload* input)
return OC_EH_BAD_REQ;
}
// If payload does not contain all required properties, then the request is
// considered as a bad request.
if (OCRepPayloadIsNull(input, OC_RSRVD_ES_SSID) ||
OCRepPayloadIsNull(input, OC_RSRVD_ES_AUTHTYPE) ||
OCRepPayloadIsNull(input, OC_RSRVD_ES_ENCTYPE))
{
OIC_LOG(ERROR, ES_RH_TAG, "Required property for Update is missing!");
return OC_EH_BAD_REQ;
}
OCEntityHandlerResult ehResult = OC_EH_ERROR;
ESWiFiConfData* wiFiData = (ESWiFiConfData*) OICMalloc(sizeof(ESWiFiConfData));
if (wiFiData == NULL)
......
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