projects
/
platform
/
upstream
/
iotivity.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Imported Upstream version 1.1.0
[platform/upstream/iotivity.git]
/
resource
/
provisioning
/
src
/
OCProvisioningManager.cpp
diff --git
a/resource/provisioning/src/OCProvisioningManager.cpp
b/resource/provisioning/src/OCProvisioningManager.cpp
index
8040a99
..
8a2c076
100644
(file)
--- a/
resource/provisioning/src/OCProvisioningManager.cpp
+++ b/
resource/provisioning/src/OCProvisioningManager.cpp
@@
-19,6
+19,7
@@
* *****************************************************************/
#include "ocstack.h"
* *****************************************************************/
#include "ocstack.h"
+#include "srmutility.h"
#include "base64.h"
#include "OCProvisioningManager.h"
#include "base64.h"
#include "OCProvisioningManager.h"
@@
-142,7
+143,7
@@
namespace OC
{
std::lock_guard<std::recursive_mutex> lock(*cLock);
result = OCSetOwnerTransferCallbackData(oxm, callbackData);
{
std::lock_guard<std::recursive_mutex> lock(*cLock);
result = OCSetOwnerTransferCallbackData(oxm, callbackData);
- if(result == OC_STACK_OK && (OIC_RANDOM_DEVICE_PIN
&
oxm))
+ if(result == OC_STACK_OK && (OIC_RANDOM_DEVICE_PIN
==
oxm))
{
SetInputPinCB(inputPin);
}
{
SetInputPinCB(inputPin);
}
@@
-234,7
+235,16
@@
namespace OC
PMResultList_t *results = nullptr;
ProvisionContext* context = static_cast<ProvisionContext*>(ctx);
PMResultList_t *results = nullptr;
ProvisionContext* context = static_cast<ProvisionContext*>(ctx);
- results = new PMResultList_t;
+ try
+ {
+ results = new PMResultList_t;
+ }
+ catch (std::bad_alloc& e)
+ {
+ oclog() <<"Bad alloc exception";
+ return;
+ }
+
for (int i = 0; i < nOfRes; i++)
{
results->push_back(arr[i]);
for (int i = 0; i < nOfRes; i++)
{
results->push_back(arr[i]);
@@
-270,7
+280,7
@@
namespace OC
if(!resultCallback)
{
oclog() <<"Result callback can't be null";
if(!resultCallback)
{
oclog() <<"Result callback can't be null";
- return OC_STACK_INVALID_
PARAM
;
+ return OC_STACK_INVALID_
CALLBACK
;
}
OCStackResult result;
}
OCStackResult result;
@@
-295,11
+305,16
@@
namespace OC
OCStackResult OCSecureResource::provisionACL( const OicSecAcl_t* acl,
ResultCallBack resultCallback)
{
OCStackResult OCSecureResource::provisionACL( const OicSecAcl_t* acl,
ResultCallBack resultCallback)
{
- if(!
resultCallback || !
acl)
+ if(!acl)
{
{
- oclog() <<"
Result callback or
ACL can't be null";
+ oclog() <<"ACL can't be null";
return OC_STACK_INVALID_PARAM;
}
return OC_STACK_INVALID_PARAM;
}
+ if(!resultCallback)
+ {
+ oclog() <<"result callback can not be null";
+ return OC_STACK_INVALID_CALLBACK;
+ }
OCStackResult result;
auto cLock = m_csdkLock.lock();
OCStackResult result;
auto cLock = m_csdkLock.lock();
@@
-327,7
+342,7
@@
namespace OC
if(!resultCallback)
{
oclog() << "Result calback can't be null";
if(!resultCallback)
{
oclog() << "Result calback can't be null";
- return OC_STACK_INVALID_
PARAM
;
+ return OC_STACK_INVALID_
CALLBACK
;
}
OCStackResult result;
}
OCStackResult result;
@@
-358,8
+373,8
@@
namespace OC
{
if(!resultCallback)
{
{
if(!resultCallback)
{
- oclog() << "Result cal
back can'
t be null";
- return OC_STACK_INVALID_
PARAM
;
+ oclog() << "Result cal
lback can no
t be null";
+ return OC_STACK_INVALID_
CALLBACK
;
}
OCStackResult result;
}
OCStackResult result;
@@
-391,7
+406,7
@@
namespace OC
if(!resultCallback)
{
oclog() << "Result calback can't be null";
if(!resultCallback)
{
oclog() << "Result calback can't be null";
- return OC_STACK_INVALID_
PARAM
;
+ return OC_STACK_INVALID_
CALLBACK
;
}
OCStackResult result;
}
OCStackResult result;
@@
-420,7
+435,7
@@
namespace OC
if(!resultCallback)
{
oclog() << "Result calback can't be null";
if(!resultCallback)
{
oclog() << "Result calback can't be null";
- return OC_STACK_INVALID_
PARAM
;
+ return OC_STACK_INVALID_
CALLBACK
;
}
OCStackResult result;
}
OCStackResult result;
@@
-475,18
+490,18
@@
namespace OC
std::string OCSecureResource::getDeviceID()
{
std::string OCSecureResource::getDeviceID()
{
- char base64Buff[B64ENCODE_OUT_SAFESIZE(sizeof(((OicUuid_t*)0)->id)) + 1] = {0,};
- uint32_t outLen = 0;
- B64Result b64Ret = B64_OK;
std::ostringstream deviceId("");
std::ostringstream deviceId("");
+ char *devID = nullptr;
validateSecureResource();
validateSecureResource();
- b64Ret = b64Encode(devPtr->doxm->deviceID.id, sizeof(devPtr->doxm->deviceID.id), base64Buff,
- sizeof(base64Buff), &outLen);
- if (B64_OK == b64Ret)
+ if (OC_STACK_OK == ConvertUuidToStr(&(devPtr->doxm->deviceID), &devID))
+ {
+ deviceId << devID;
+ }
+ else
{
{
-
deviceId << base64Buff
;
+
oclog() <<"Can not convert uuid to struuid"
;
}
return deviceId.str();
}
}
return deviceId.str();
}