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 #include "base/memory/scoped_ptr.h"
21 int xwalk_tizen_check_group_users(void) {
24 struct group* current_g;
25 int64_t len = sysconf(_SC_GETGR_R_SIZE_MAX);
29 scoped_ptr<char[]> buffer(new char[len]);
30 err = getgrgid_r(getgid(), &grp, buffer.get(), len, ¤t_g);
32 fprintf(stderr, "group can't be determined");
33 fprintf(stderr, "launching an application will not work\n");
38 strcmp(current_g->gr_name, "users")) {
39 fprintf(stderr, "group '%s' is not allowed: ",
40 current_g ? current_g->gr_name : "<NULL>");
41 fprintf(stderr, "launching an application will not work\n");
47 int xwalk_tizen_check_user_for_xwalk_backend(void) {
50 struct group* current_g;
51 int64_t len = sysconf(_SC_GETGR_R_SIZE_MAX);
55 scoped_ptr<char[]> buffer(new char[len]);
56 err = getgrgid_r(getgid(), &grp, buffer.get(), len, ¤t_g);
58 fprintf(stderr, "group can't be determined");
59 fprintf(stderr, "launching an application will not work\n");
64 strcmp(current_g->gr_name, "users") &&
65 getuid() != tzplatform_getuid(TZ_SYS_GLOBALAPP_USER))) {
66 fprintf(stderr, "group '%s' is not allowed: ",
67 current_g ? current_g->gr_name : "<NULL>");
68 fprintf(stderr, "launching an application will not work\n");