1 // Copyright (c) 2013 Intel Corporation. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "xwalk/application/tools/tizen/xwalk_tizen_user.h"
14 #include <sys/types.h>
17 #include <tzplatform_config.h>
19 int xwalk_tizen_check_group_users(void) {
23 struct group* current_g;
24 int64_t len = sysconf(_SC_GETGR_R_SIZE_MAX);
27 buffer = reinterpret_cast<char*>(malloc((size_t)len));
31 err = getgrgid_r(getgid(), &grp, buffer, len, ¤t_g);
33 fprintf(stderr, "group can't be determined");
34 fprintf(stderr, "launching an application will not work\n");
40 strcmp(current_g->gr_name, "users")) {
41 fprintf(stderr, "group '%s' is not allowed :",
42 current_g ? current_g->gr_name : "<NULL>");
43 fprintf(stderr, "launching an application will not work\n");
50 int xwalk_tizen_check_user_for_xwalk_backend(void) {
54 struct group* current_g;
55 int64_t len = sysconf(_SC_GETGR_R_SIZE_MAX);
58 buffer = reinterpret_cast<char*>(malloc((size_t)len));
62 err = getgrgid_r(getgid(), &grp, buffer, len, ¤t_g);
64 fprintf(stderr, "group can't be determined");
65 fprintf(stderr, "launching an application will not work\n");
71 strcmp(current_g->gr_name, "users") &&
72 getuid() != tzplatform_getuid(TZ_SYS_GLOBALAPP_USER))) {
73 fprintf(stderr, "group '%s' is not allowed :",
74 current_g ? current_g->gr_name : "<NULL>");
75 fprintf(stderr, "launching an application will not work\n");