diff options
author | Harikrishnan Hariharan <hahariha@codeaurora.org> | 2018-02-13 16:04:32 +0530 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2018-03-01 02:58:14 -0800 |
commit | c645cb167bfb81a8646da19457573b00534a6e7c (patch) | |
tree | eff78befb4e94cf37bbc37b6eca967f2a15d288c | |
parent | 25bf85b355027f133118521786f833cf785bef04 (diff) | |
download | gps-c645cb167bfb81a8646da19457573b00534a6e7c.tar.gz |
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
-rw-r--r-- | pla/android/loc_pla.h | 4 | ||||
-rw-r--r-- | pla/oe/loc_pla.h | 3 | ||||
-rw-r--r-- | 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 9caae73..bedb079 100644 --- a/pla/android/loc_pla.h +++ b/pla/android/loc_pla.h @@ -41,6 +41,10 @@ extern "C" { #include <cutils/properties.h> #include <cutils/threads.h> #include <cutils/sched_policy.h> +#include <private/android_filesystem_config.h> + +#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 3ca1964..50b19c2 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 884bb10..3e1922c 100644 --- a/utils/loc_cfg.cpp +++ b/utils/loc_cfg.cpp @@ -37,7 +37,7 @@ #include <ctype.h> #include <unistd.h> #include <time.h> -#include <pwd.h> +#include <grp.h> #include <errno.h> #include <loc_cfg.h> #include <loc_pla.h> @@ -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; i<ngroups; i++) { - struct passwd* pwd = getpwnam(split_strings[i]); - if (pwd) { - child_proc[j].group_list[i] = pwd->pw_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))) { |