PolicyKit: Branch 'master'

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Nov 2 13:34:18 UTC 2023


 src/polkitbackend/polkitbackendjsauthority.cpp |   21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

New commits:
commit 4a441db99d5c4bee13b3a86a4ae78c12c023cf50
Author: Luca Boccassi <bluca at debian.org>
Date:   Sun Oct 8 19:28:34 2023 +0100

    mozjs: apply user_of_subject fix as well
    
    Same fix is needed as in the duktape case.
    
    Follow-up for 89b7a37b91

diff --git a/src/polkitbackend/polkitbackendjsauthority.cpp b/src/polkitbackend/polkitbackendjsauthority.cpp
index 8263de3..cf28b04 100644
--- a/src/polkitbackend/polkitbackendjsauthority.cpp
+++ b/src/polkitbackend/polkitbackendjsauthority.cpp
@@ -640,6 +640,17 @@ subject_to_jsval (PolkitBackendJsAuthority  *authority,
   groups = g_ptr_array_new_with_free_func (g_free);
   gids_from_dbus = polkit_unix_process_get_gids (POLKIT_UNIX_PROCESS (process));
 
+  passwd = getpwuid (uid);
+  if (passwd == NULL)
+    {
+      user_name = g_strdup_printf ("%d", (gint) uid);
+      g_warning ("Error looking up info for uid %d: %m", (gint) uid);
+    }
+  else
+    {
+      user_name = g_strdup (passwd->pw_name);
+    }
+
   /* D-Bus will give us supplementary groups too, so prefer that to looking up
    * the group from the uid. */
   if (gids_from_dbus && gids_from_dbus->len > 0)
@@ -661,19 +672,11 @@ subject_to_jsval (PolkitBackendJsAuthority  *authority,
     }
   else
     {
-      passwd = getpwuid (uid);
-      if (passwd == NULL)
-        {
-          user_name = g_strdup_printf ("%d", (gint) uid);
-          g_warning ("Error looking up info for uid %d: %m", (gint) uid);
-        }
-      else
+      if (passwd != NULL)
         {
           gid_t gids[512];
           int num_gids = 512;
 
-          user_name = g_strdup (passwd->pw_name);
-
           if (getgrouplist (passwd->pw_name,
                             passwd->pw_gid,
                             gids,


More information about the hal-commit mailing list