Commit 61275e23 authored by Vadym Riznyk's avatar Vadym Riznyk Committed by Randeep

[IOT-2494] SVR DB Editor : Add cred edit features

Add Cred add symmetric key pair
Add Cred modification

TrustCA cert is saved in cred->publicdata
instead of optional data.
(see https://gerrit.iotivity.org/gerrit/#/c/21983/)

[IOT-2494] SVR DB Editor : Clean codes

Fix typo, memleak
Remove unnecessary codes.

New Feature: https://jira.iotivity.org/browse/IOT-2494Signed-off-by: default avatarSangjoon Je <sangjoon.je@samsung.com>
Change-Id: I487786c432c7d51ead84d08fca0326d34b10e27a
Signed-off-by: default avatarVadym Riznyk <v.riznyk@samsung.com>
parent 8d9a0c44
# ****************************************************************** #******************************************************************
# #
# Copyright 2015 Samsung Electronics All Rights Reserved. # Copyright 2015 Samsung Electronics All Rights Reserved.
# #
...@@ -44,8 +44,6 @@ tools_env.PrependUnique(CPPPATH=[ ...@@ -44,8 +44,6 @@ tools_env.PrependUnique(CPPPATH=[
'#/resource/oc_logger/include', '#/resource/oc_logger/include',
'#/resource/csdk/connectivity/api', '#/resource/csdk/connectivity/api',
'#/resource/csdk/connectivity/inc/pkix', '#/resource/csdk/connectivity/inc/pkix',
'#/resource/include',
'#/resource/include/internal',
'#/resource/csdk/security/provisioning/include', '#/resource/csdk/security/provisioning/include',
'#/resource/csdk/security/provisioning/include/internal' '#/resource/csdk/security/provisioning/include/internal'
]) ])
......
...@@ -39,9 +39,9 @@ static char g_svrDbPath[SVR_DB_PATH_LENGTH]; ...@@ -39,9 +39,9 @@ static char g_svrDbPath[SVR_DB_PATH_LENGTH];
typedef enum OperationType typedef enum OperationType
{ {
SVR_PRINT_ALL = 1, SVR_PRINT_ALL = 1,
SVR_EDIT_CRED = 2, SVR_EDIT_CRED,
SVR_EDIT_ACL = 3, SVR_EDIT_ACL,
SVR_EDIT_DOXM = 4, SVR_EDIT_DOXM,
SVR_EDIT_PSTAT = 5, SVR_EDIT_PSTAT = 5,
EXIT = 99 EXIT = 99
} OperationType_t; } OperationType_t;
......
...@@ -482,7 +482,6 @@ static int InputResources(OicSecRsrc_t *resources) ...@@ -482,7 +482,6 @@ static int InputResources(OicSecRsrc_t *resources)
if (NULL == interfaces[i] ) if (NULL == interfaces[i] )
{ {
PRINT_ERR("Failed InputString"); PRINT_ERR("Failed InputString");
interfaceLen = i;
OICFree(href); OICFree(href);
for (size_t j = 0; j < typeLen; j++) for (size_t j = 0; j < typeLen; j++)
{ {
...@@ -492,7 +491,7 @@ static int InputResources(OicSecRsrc_t *resources) ...@@ -492,7 +491,7 @@ static int InputResources(OicSecRsrc_t *resources)
for (size_t j = 0; j < i; j++) for (size_t j = 0; j < i; j++)
{ {
OICFree(interfaces[i]); OICFree(interfaces[j]);
} }
OICFree(interfaces); OICFree(interfaces);
return -1; return -1;
...@@ -543,8 +542,10 @@ static uint16_t InputAccessPermission(void) ...@@ -543,8 +542,10 @@ static uint16_t InputAccessPermission(void)
for (int ret = 0; 1 != ret; ) for (int ret = 0; 1 != ret; )
{ {
ret = scanf("%c", &ans); ret = scanf("%c", &ans);
for ( ; 0x20 <= getchar(); ); // for removing overflow garbages if ('\n' != ans)
// '0x20<=code' is character region {
while ('\n' != getchar());
}
} }
if ('y' == ans || 'Y' == ans || 'n' == ans || 'N' == ans) if ('y' == ans || 'Y' == ans || 'n' == ans || 'N' == ans)
{ {
......
...@@ -101,8 +101,7 @@ int InputNumber(const char *infoText) ...@@ -101,8 +101,7 @@ int InputNumber(const char *infoText)
for (int ret = 0; 1 != ret; ) for (int ret = 0; 1 != ret; )
{ {
ret = scanf("%d", &inputValue); ret = scanf("%d", &inputValue);
for ( ; 0x20 <= getchar(); ); // for removing overflow garbages while ('\n' != getchar());
// '0x20<=code' is character region
} }
return inputValue; return inputValue;
...@@ -116,8 +115,7 @@ char *InputString(const char *infoText) ...@@ -116,8 +115,7 @@ char *InputString(const char *infoText)
for (int ret = 0; 1 != ret; ) for (int ret = 0; 1 != ret; )
{ {
ret = scanf("%1024s", tmpStr); ret = scanf("%1024s", tmpStr);
for ( ; 0x20 <= getchar(); ); // for removing overflow garbages while ('\n' != getchar());
// '0x20<=code' is character region
} }
return OICStrdup(tmpStr); return OICStrdup(tmpStr);
...@@ -145,6 +143,10 @@ int InputUuid(OicUuid_t *uuid) ...@@ -145,6 +143,10 @@ int InputUuid(OicUuid_t *uuid)
{ {
strUuid[strLen - 1] = '\0'; strUuid[strLen - 1] = '\0';
} }
else
{
while ('\n' != getchar());
}
if (0 == strncmp(strUuid, STR_UUID_ZERO, sizeof(STR_UUID_ZERO))) if (0 == strncmp(strUuid, STR_UUID_ZERO, sizeof(STR_UUID_ZERO)))
{ {
......
...@@ -356,7 +356,7 @@ static int InputSct(OicSecCredType_t *sct) ...@@ -356,7 +356,7 @@ static int InputSct(OicSecCredType_t *sct)
{ {
unsigned int sel = 0; unsigned int sel = 0;
OicSecCredType_t tmpSct = 0; OicSecCredType_t tmpSct = 0;
PRINT_PROG("\nInput the Supported Credential Types\n");
for (;;) for (;;)
{ {
for (size_t i = 0; i < DOXM_SCT_CNT; i++) for (size_t i = 0; i < DOXM_SCT_CNT; i++)
...@@ -397,8 +397,10 @@ static bool InputOwned(void) ...@@ -397,8 +397,10 @@ static bool InputOwned(void)
for (int ret = 0; 1 != ret; ) for (int ret = 0; 1 != ret; )
{ {
ret = scanf("%c", &ans); ret = scanf("%c", &ans);
for ( ; 0x20 <= getchar(); ); // for removing overflow garbages if ('\n' != ans)
// '0x20<=code' is character region {
while ('\n' != getchar());
}
} }
if ('y' == ans || 'Y' == ans || 'n' == ans || 'N' == ans) if ('y' == ans || 'Y' == ans || 'n' == ans || 'N' == ans)
{ {
......
...@@ -283,8 +283,10 @@ static unsigned int InputDpm(void) ...@@ -283,8 +283,10 @@ static unsigned int InputDpm(void)
for (int ret = 0; 1 != ret; ) for (int ret = 0; 1 != ret; )
{ {
ret = scanf("%c", &ans); ret = scanf("%c", &ans);
for ( ; 0x20 <= getchar(); ); // for removing overflow garbages if ('\n' != ans)
// '0x20<=code' is character region {
while ('\n' != getchar());
}
} }
if ('y' == ans || 'Y' == ans || 'n' == ans || 'N' == ans) if ('y' == ans || 'Y' == ans || 'n' == ans || 'N' == ans)
{ {
...@@ -323,8 +325,10 @@ static unsigned int InputDpom() ...@@ -323,8 +325,10 @@ static unsigned int InputDpom()
for (int ret = 0; 1 != ret; ) for (int ret = 0; 1 != ret; )
{ {
ret = scanf("%c", &ans); ret = scanf("%c", &ans);
for ( ; 0x20 <= getchar(); ); // for removing overflow garbages if ('\n' != ans)
// '0x20<=code' is character region {
while ('\n' != getchar());
}
} }
if ('y' == ans || 'Y' == ans || 'n' == ans || 'N' == ans) if ('y' == ans || 'Y' == ans || 'n' == ans || 'N' == ans)
{ {
......
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