*
* @return a provisioning status property of Enrollee
*/
- ProvStatus getProvStatus()
+ ProvStatus getProvStatus() const
{
if(m_rep.hasAttribute(OC_RSRVD_ES_PROVSTATUS))
{
*
* @return a last error code property of Enrollee.
*/
- ESErrorCode getLastErrCode()
+ ESErrorCode getLastErrCode() const
{
if(m_rep.hasAttribute(OC_RSRVD_ES_LAST_ERRORCODE))
{
#include "oic_string.h"
#include "utlist.h"
#include "srmutility.h"
+#include "aclresource.h"
#include "internal/doxmresource.h"
namespace OIC
{
res = ESResult::ES_OK;
}
-
+ OCDeleteACLList(acl);
return res;
}
if(!rsrc)
{
OIC_LOG(DEBUG, ENROLEE_SECURITY_TAG, "createAcl: OICCalloc error return");
+ FreeRsrc(rsrc);
OCDeleteACLList(acl);
return NULL;
}
if(!rsrc->href)
{
OIC_LOG(DEBUG, ENROLEE_SECURITY_TAG, "createAcl: OICCalloc error return");
+ FreeRsrc(rsrc);
OCDeleteACLList(acl);
return NULL;
}
size_t arrLen = 1;
rsrc->typeLen = arrLen;
rsrc->types = (char**)OICCalloc(arrLen, sizeof(char*));
+ if(!rsrc->types)
+ {
+ OIC_LOG(DEBUG, ENROLEE_SECURITY_TAG, "createAcl: OICCalloc error return");
+ FreeRsrc(rsrc);
+ OCDeleteACLList(acl);
+ return NULL;
+ }
+ rsrc->types[0] = OICStrdup("rt"); // ignore
+ if(!rsrc->types[0])
+ {
+ OIC_LOG(DEBUG, ENROLEE_SECURITY_TAG, "createAcl: OICStrdup error return");
+ FreeRsrc(rsrc);
+ OCDeleteACLList(acl);
+ return NULL;
+ }
+
rsrc->interfaceLen = 1;
rsrc->interfaces = (char**)OICCalloc(arrLen, sizeof(char*));
- rsrc->types[0] = OICStrdup("rt"); // ignore
+ if(!rsrc->interfaces)
+ {
+ OIC_LOG(DEBUG, ENROLEE_SECURITY_TAG, "createAcl: OICCalloc error return");
+ FreeRsrc(rsrc);
+ OCDeleteACLList(acl);
+ return NULL;
+ }
rsrc->interfaces[0] = OICStrdup("if"); // ignore
+ if(!rsrc->interfaces[0])
+ {
+ OIC_LOG(DEBUG, ENROLEE_SECURITY_TAG, "createAcl: OICStrdup error return");
+ FreeRsrc(rsrc);
+ OCDeleteACLList(acl);
+ return NULL;
+ }
LL_APPEND(ace->resources, rsrc);
{
assert(min <= max);
- int input;
+ int input = 0;
std::cin >> input;
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
- if (!std::cin.fail() && min <= input && input <= max) return input;
+ if (!std::cin.fail() && min <= input && input <= max)
+ {
+ return input;
+ }
std::cin.clear();
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
throw std::runtime_error("Invalid Input, please try again");
}
-void printConfiguration(EnrolleeConf conf)
+void printConfiguration(const EnrolleeConf& conf)
{
cout << "===========================================" << endl;
cout << "\tDevice Name : " << conf.getDeviceName() << endl;
cout << "===========================================" << endl;
}
-void printStatus(EnrolleeStatus status)
+void printStatus(const EnrolleeStatus& status)
{
cout << "===========================================" << endl;
cout << "\tProvStatus : " << status.getProvStatus() << endl;
return -1;
}
#endif
- }catch(OCException& e)
+ }catch (const std::exception& e)
{
std::cout << "Exception in main: "<<e.what();
}
{
assert(min <= max);
- int input;
+ int input = 0;
std::cin >> input;
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
- if (!std::cin.fail() && min <= input && input <= max) return input;
+ if (!std::cin.fail() && min <= input && input <= max)
+ {
+ return input;
+ }
std::cin.clear();
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
throw std::runtime_error("Invalid Input, please try again");
}
-void printConfiguration(EnrolleeConf conf)
+void printConfiguration(const EnrolleeConf& conf)
{
cout << "===========================================" << endl;
cout << "\tDevice Name : " << conf.getDeviceName() << endl;
cout << "===========================================" << endl;
}
-void printStatus(EnrolleeStatus status)
+void printStatus(const EnrolleeStatus& status)
{
cout << "===========================================" << endl;
cout << "\tProvStatus : " << status.getProvStatus() << endl;
return -1;
}
#endif
- }catch(OCException& e)
+ }catch (const std::exception& e)
{
std::cout << "Exception in main: "<<e.what();
}