remove unused g_udesc.{user,group} 89/99389/3
authorKonrad Lipinski <konrad.l@samsung.com>
Tue, 22 Nov 2016 15:43:04 +0000 (16:43 +0100)
committerKonrad Lipinski <konrad.l@samsung.com>
Thu, 24 Nov 2016 15:00:16 +0000 (16:00 +0100)
Change-Id: I767b9c7b095692466c0bb4d25cb8ed707e088a23

src/libdbuspolicy1.c

index 11817ad..d1de0ca 100644 (file)
@@ -73,9 +73,7 @@ struct kconn {
 } g_conn[2];
 
 struct udesc {
-       char user[256];
        dbus_uid_t uid;
-       char group[256];
        dbus_gid_t gid;
        char label[256];
 } g_udesc;
@@ -143,10 +141,6 @@ static uint64_t kdbus_unique_id(char const *name)
 
 static bool dbuspolicy_init_once(void)
 {
-       struct passwd pwent;
-       struct passwd *pwd;
-       struct group grent;
-       struct group *gg;
        char buf[1024];
        int attr_fd;
        int r;
@@ -155,7 +149,6 @@ static bool dbuspolicy_init_once(void)
        if (attr_fd < 0)
                return -1;
        r = read(attr_fd, buf, sizeof(buf));
-
        close(attr_fd);
 
        if (r < 0 || r >= (long int)sizeof(g_udesc.label)) /* read */
@@ -163,19 +156,7 @@ static bool dbuspolicy_init_once(void)
 
        g_udesc.uid = getuid();
        g_udesc.gid = getgid();
-
        snprintf(g_udesc.label, r + 1 /* additional byte for \0 */, "%s", buf);
-       if (getpwuid_r(g_udesc.uid, &pwent, buf, sizeof(buf), &pwd))
-               return true;
-
-       if (getgrgid_r(g_udesc.gid, &grent, buf, sizeof(buf), &gg))
-               return true;
-
-       if (!pwd || !gg)
-               return false;
-
-       snprintf(g_udesc.user, sizeof(g_udesc.user), "%s", pwd->pw_name);
-       snprintf(g_udesc.group, sizeof(g_udesc.group), "%s", gg->gr_name);
 
        __internal_init_once();