From c645cb167bfb81a8646da19457573b00534a6e7c Mon Sep 17 00:00:00 2001 From: Harikrishnan Hariharan Date: Tue, 13 Feb 2018 16:04:32 +0530 Subject: [PATCH] Define gps user and group id's for Android and LE. - Define gps user and group id's for Android and LE. - Update to use getgrnam for getting group id's. - Get group id's for child processes for LE also. Change-Id: I5365dbc1c51eb89ab66ba8652f3ed1c5dbea6eb4 CRs-Fixed: 2183710 --- pla/android/loc_pla.h | 4 ++++ pla/oe/loc_pla.h | 3 +++ utils/loc_cfg.cpp | 13 ++++++------- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/pla/android/loc_pla.h b/pla/android/loc_pla.h index 9caae737..bedb079c 100644 --- a/pla/android/loc_pla.h +++ b/pla/android/loc_pla.h @@ -41,6 +41,10 @@ extern "C" { #include #include #include +#include + +#define UID_GPS (AID_GPS) +#define GID_GPS (AID_GPS) #define LOC_PATH_GPS_CONF_STR "/vendor/etc/gps.conf" #define LOC_PATH_IZAT_CONF_STR "/vendor/etc/izat.conf" diff --git a/pla/oe/loc_pla.h b/pla/oe/loc_pla.h index 3ca1964a..50b19c2f 100644 --- a/pla/oe/loc_pla.h +++ b/pla/oe/loc_pla.h @@ -51,6 +51,9 @@ extern "C" { #define strlcpy strncpy #endif +#define UID_GPS (1021) +#define GID_GPS (1021) + #define LOC_PATH_GPS_CONF_STR "/etc/gps.conf" #define LOC_PATH_IZAT_CONF_STR "/etc/izat.conf" #define LOC_PATH_FLP_CONF_STR "/etc/flp.conf" diff --git a/utils/loc_cfg.cpp b/utils/loc_cfg.cpp index 884bb10d..3e1922cc 100644 --- a/utils/loc_cfg.cpp +++ b/utils/loc_cfg.cpp @@ -37,7 +37,7 @@ #include #include #include -#include +#include #include #include #include @@ -826,18 +826,17 @@ int loc_read_process_conf(const char* conf_file_name, uint32_t * process_count_p child_proc[j].num_groups = 0; ngroups = loc_util_split_string(conf.group_list, split_strings, MAX_NUM_STRINGS, ' '); -#ifdef __ANDROID__ for(i=0; ipw_gid; + struct group* grp = getgrnam(split_strings[i]); + if (grp) { + child_proc[j].group_list[i] = grp->gr_gid; child_proc[j].num_groups++; LOC_LOGD("%s:%d]:Group %s = %d matches child_group: %d\n", __func__, __LINE__, split_strings[i], - pwd->pw_gid,child_proc[j].group_list[i]); + grp->gr_gid,child_proc[j].group_list[i]); } } -#endif + nstrings = loc_util_split_string(conf.platform_list, split_strings, MAX_NUM_STRINGS, ' '); if(strcmp("all", split_strings[0]) == 0) { if (nstrings == 1 || (nstrings == 2 && (strcmp("exclude", split_strings[1]) == 0))) {