From: sangwook lee Date: Thu, 2 Dec 2021 18:37:18 +0000 (+0900) Subject: "Update eng/user mode for sdb root on/off" X-Git-Tag: submit/tizen_6.5/20211202.192518^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F36%2F267336%2F1;p=sdk%2Ftarget%2Fsdbd.git "Update eng/user mode for sdb root on/off" Change-Id: Ib73557d19d4675b7a70ed5df2f82b0b6cbbd5cbd Signed-off-by: sangwook lee --- diff --git a/src/default_plugin_basic.c b/src/default_plugin_basic.c index aca1943..8d6a1f4 100755 --- a/src/default_plugin_basic.c +++ b/src/default_plugin_basic.c @@ -26,6 +26,8 @@ #define LOG_TAG "SDBD_TRACE_SDB" #include "log.h" +#include + #include "sdb.h" #include "parameter.h" #include "sdbd_plugin.h" @@ -33,6 +35,31 @@ #define LOG_DIRECTORY "/home/owner/share/sdbdlog" +int get_buildtype() { + char* value = NULL; + int ret = -1; + int r = system_info_get_platform_string("http://tizen.org/system/build.type", &value); + if (r != SYSTEM_INFO_ERROR_NONE) { + E("fail to get build.type:%d\n", errno); + return -1; + } + else { + if (value != NULL) { + // check for "eng" + if (!strncmp(value, "eng", sizeof("eng") + 1)) + { + ret = 1; + } + else { // expect "user" + ret = 0; + } + free(value); + } + + } + return ret; +} + int get_plugin_capability ( parameters* in, parameters* out ) { int capability; @@ -69,7 +96,12 @@ int get_plugin_capability ( parameters* in, parameters* out ) make_string_parameter ( & ( out->array_of_parameter[0] ), "%s", PLUGIN_RET_ENABLED ); } else if ( capability == CAPABILITY_ROOT_ONOFF ) { if ( access ( "/bin/su", F_OK ) == 0 ) { - make_string_parameter ( & ( out->array_of_parameter[0] ), "%s", PLUGIN_RET_ENABLED ); + if ( get_buildtype() == 1 ) { + make_string_parameter ( & ( out->array_of_parameter[0] ), "%s", PLUGIN_RET_ENABLED ); + } + else { + make_string_parameter ( & ( out->array_of_parameter[0] ), "%s", PLUGIN_RET_DISABLED ); + } } else { make_string_parameter ( & ( out->array_of_parameter[0] ), "%s", PLUGIN_RET_DISABLED ); } @@ -379,4 +411,4 @@ int get_plugin_extra_capability ( parameters* in, parameters* out ) make_string_parameter ( & ( out->array_of_parameter[0] ), "%s", "" ); return PLUGIN_CMD_SUCCESS; -} \ No newline at end of file +}