From: js126.lee Date: Wed, 11 Nov 2015 06:11:05 +0000 (+0900) Subject: [IOT-825] Explicit discovery to get secure port during provisioning X-Git-Tag: 1.2.0+RC1~856 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=40a94b84c8b77a5b5911d9dbc2081c48c452fd9a;p=platform%2Fupstream%2Fiotivity.git [IOT-825] Explicit discovery to get secure port during provisioning Issue : If provisiong candidate device doedn't have any secure resource, Provisioning Tool can't get secure port. Solution : In order to get secure port, try explicit discovery with /oic/res?rt=oic.sec.doxm. instead of /oic/res Related jira : https://jira.iotivity.org/browse/IOT-825 [Patch-2] : apply Sachin's comment Change-Id: I6d6986f64af7ef24dd28ebada477613f30ee1e04 Signed-off-by: js126.lee Reviewed-on: https://gerrit.iotivity.org/gerrit/4131 Tested-by: jenkins-iotivity Reviewed-by: Sachin Agrawal --- diff --git a/resource/csdk/security/provisioning/src/pmutility.c b/resource/csdk/security/provisioning/src/pmutility.c old mode 100644 new mode 100755 index f6e2ff3..51414a6 --- a/resource/csdk/security/provisioning/src/pmutility.c +++ b/resource/csdk/security/provisioning/src/pmutility.c @@ -534,13 +534,20 @@ static OCStackApplicationResult DeviceDiscoveryHandler(void *ctx, OCDoHandle UNU DeleteDoxmBinData(ptrDoxm); return OC_STACK_KEEP_TRANSACTION; } - + char rsrc_uri[MAX_URI_LENGTH+1] = {0}; + int wr_len = snprintf(rsrc_uri, sizeof(rsrc_uri), "%s?%s=%s", + OC_RSRVD_WELL_KNOWN_URI, OC_RSRVD_RESOURCE_TYPE, OIC_RSRC_TYPE_SEC_DOXM); + if(wr_len <= 0 || (size_t)wr_len >= sizeof(rsrc_uri)) + { + OC_LOG(ERROR, TAG, "rsrc_uri_string_print failed"); + return OC_STACK_ERROR; + } //Try to the unicast discovery to getting secure port - char query[MAX_URI_LENGTH + MAX_QUERY_LENGTH] = { 0, }; + char query[MAX_URI_LENGTH+MAX_QUERY_LENGTH+1] = {0}; if(!PMGenerateQuery(false, clientResponse->devAddr.addr, clientResponse->devAddr.port, clientResponse->connType, - query, sizeof(query), OC_RSRVD_WELL_KNOWN_URI)) + query, sizeof(query), rsrc_uri)) { OC_LOG(ERROR, TAG, "DeviceDiscoveryHandler : Failed to generate query"); return OC_STACK_KEEP_TRANSACTION;