Set the daemon UID/GID to network_fw 30/65930/1 accepted/tizen/common/20160414.142756 accepted/tizen/ivi/20160414.092205 accepted/tizen/mobile/20160414.092231 accepted/tizen/tv/20160414.092150 accepted/tizen/wearable/20160414.092141 submit/tizen/20160414.054556
authorHyuk Lee <hyuk0512.lee@samsung.com>
Thu, 14 Apr 2016 05:34:52 +0000 (14:34 +0900)
committerHyuk Lee <hyuk0512.lee@samsung.com>
Thu, 14 Apr 2016 05:34:52 +0000 (14:34 +0900)
Change-Id: I800c1560c74d0491c59663f2ca3d234932d7eeab
Signed-off-by: Hyuk Lee <hyuk0512.lee@samsung.com>
bt-share/src/bt-share-main.c

index 28f01a6..71e9920 100644 (file)
 #include "bt-share-common.h"
 #include "bt-share-cynara.h"
 
+#include <sys/types.h>
+#include <unistd.h>
+#include <grp.h>
+
 #include "bluetooth-share-api.h"
 #include "notification_internal.h"
 
@@ -333,6 +337,15 @@ int main(void)
        if (appcore_set_i18n(BT_COMMON_PKG, BT_COMMON_RES) < 0)
                return -1;
 
+       uid_t network_user = 551; /* uid of network_fw */
+       gid_t network_group = 551; /* gid of network_fw */
+
+       initgroups("network_fw", network_group);
+       ret = setgid(network_group);
+       DBG("setgid return : %d", ret);
+       ret = setuid(network_user);
+       DBG("setuid return : %d", ret);
+
        if (_bt_share_cynara_init()) {
                ERR("Failed to initialize Cynara.\n");
                return -1;