[arch-commits] Commit in polkit-gnome/trunk (5 files)

Balló György bgyorgy at archlinux.org
Tue Apr 27 21:37:51 UTC 2021


    Date: Tuesday, April 27, 2021 @ 21:37:50
  Author: bgyorgy
Revision: 924839

upgpkg: polkit-gnome 0.105-6: Apply fixes from Debian (upstream is dead)

Added:
  polkit-gnome/trunk/0001-Select-the-current-user-to-authenticate-with-by-defa.patch
  polkit-gnome/trunk/0002-Auth-dialog-Make-the-label-wrap-at-70-chars.patch
  polkit-gnome/trunk/0003-Get-user-icon-from-accountsservice-instead-of-lookin.patch
  polkit-gnome/trunk/0004-Use-fresh-X11-timestamps-when-displaying-authenticat.patch
Modified:
  polkit-gnome/trunk/PKGBUILD

-----------------------------------------------------------------+
 0001-Select-the-current-user-to-authenticate-with-by-defa.patch |   78 +++++
 0002-Auth-dialog-Make-the-label-wrap-at-70-chars.patch          |   32 ++
 0003-Get-user-icon-from-accountsservice-instead-of-lookin.patch |  135 ++++++++++
 0004-Use-fresh-X11-timestamps-when-displaying-authenticat.patch |   35 ++
 PKGBUILD                                                        |   43 ++-
 5 files changed, 313 insertions(+), 10 deletions(-)

Added: 0001-Select-the-current-user-to-authenticate-with-by-defa.patch
===================================================================
--- 0001-Select-the-current-user-to-authenticate-with-by-defa.patch	                        (rev 0)
+++ 0001-Select-the-current-user-to-authenticate-with-by-defa.patch	2021-04-27 21:37:50 UTC (rev 924839)
@@ -0,0 +1,78 @@
+From: Utopia Maintenance Team
+ <pkg-utopia-maintainers at lists.alioth.debian.org>
+Date: Mon, 30 Apr 2018 17:56:52 +0000
+Subject: Select the current user to authenticate with by default
+
+Bug: http://bugzilla.gnome.org/show_bug.cgi?id=596188
+Bug-Ubuntu: https://launchpad.net/bugs/435227
+---
+ src/polkitgnomeauthenticationdialog.c | 23 ++++++++++++++---------
+ 1 file changed, 14 insertions(+), 9 deletions(-)
+
+diff --git a/src/polkitgnomeauthenticationdialog.c b/src/polkitgnomeauthenticationdialog.c
+index 743cc96..d307516 100644
+--- a/src/polkitgnomeauthenticationdialog.c
++++ b/src/polkitgnomeauthenticationdialog.c
+@@ -138,7 +138,7 @@ user_combobox_changed (GtkComboBox *widget,
+ static void
+ create_user_combobox (PolkitGnomeAuthenticationDialog *dialog)
+ {
+-  int n;
++  int n, i, selected_index = 0;
+   GtkComboBox *combo;
+   GtkTreeIter iter;
+   GtkCellRenderer *renderer;
+@@ -162,7 +162,7 @@ create_user_combobox (PolkitGnomeAuthenticationDialog *dialog)
+ 
+ 
+   /* For each user */
+-  for (n = 0; dialog->priv->users[n] != NULL; n++)
++  for (i = 0, n = 0; dialog->priv->users[n] != NULL; n++)
+     {
+       gchar *gecos;
+       gchar *real_name;
+@@ -224,6 +224,14 @@ create_user_combobox (PolkitGnomeAuthenticationDialog *dialog)
+                           USERNAME_COL, dialog->priv->users[n],
+                           -1);
+ 
++      i++;
++      if (passwd->pw_uid == getuid ())
++        {
++          selected_index = i;
++          g_free (dialog->priv->selected_user);
++          dialog->priv->selected_user = g_strdup (dialog->priv->users[n]);
++        }
++
+       g_free (real_name);
+       g_object_unref (pixbuf);
+     }
+@@ -252,8 +260,8 @@ create_user_combobox (PolkitGnomeAuthenticationDialog *dialog)
+                                       user_combobox_set_sensitive,
+                                       NULL, NULL);
+ 
+-  /* Initially select the "Select user..." ... */
+-  gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0);
++  /* Select the default user */
++  gtk_combo_box_set_active (GTK_COMBO_BOX (combo), selected_index);
+ 
+   /* Listen when a new user is selected */
+   g_signal_connect (GTK_WIDGET (combo),
+@@ -719,16 +727,13 @@ polkit_gnome_authentication_dialog_constructed (GObject *object)
+   gtk_widget_set_tooltip_markup (label, s);
+   g_free (s);
+ 
+-  if (have_user_combobox)
++  /* Disable password entry and authenticate until have a user selected */
++  if (have_user_combobox && gtk_combo_box_get_active (GTK_COMBO_BOX (dialog->priv->user_combobox)) == 0)
+     {
+-      /* ... and make the password entry and "Authenticate" button insensitive */
+       gtk_widget_set_sensitive (dialog->priv->prompt_label, FALSE);
+       gtk_widget_set_sensitive (dialog->priv->password_entry, FALSE);
+       gtk_widget_set_sensitive (dialog->priv->auth_button, FALSE);
+     }
+-  else
+-    {
+-    }
+ 
+   gtk_widget_realize (GTK_WIDGET (dialog));
+ 

Added: 0002-Auth-dialog-Make-the-label-wrap-at-70-chars.patch
===================================================================
--- 0002-Auth-dialog-Make-the-label-wrap-at-70-chars.patch	                        (rev 0)
+++ 0002-Auth-dialog-Make-the-label-wrap-at-70-chars.patch	2021-04-27 21:37:50 UTC (rev 924839)
@@ -0,0 +1,32 @@
+From: Lars Uebernickel <lars at uebernic.de>
+Date: Fri, 17 Oct 2014 15:35:25 +0200
+Subject: Auth dialog: Make the label wrap at 70 chars
+
+Because GtkWindow doesn't have a default width anymore.
+
+Bug: https://bugzilla.gnome.org/show_bug.cgi?id=738688
+Bug-Ubuntu: https://launchpad.net/bugs/1382566
+---
+ src/polkitgnomeauthenticationdialog.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/polkitgnomeauthenticationdialog.c b/src/polkitgnomeauthenticationdialog.c
+index d307516..efd4185 100644
+--- a/src/polkitgnomeauthenticationdialog.c
++++ b/src/polkitgnomeauthenticationdialog.c
+@@ -574,6 +574,7 @@ polkit_gnome_authentication_dialog_constructed (GObject *object)
+   g_free (s);
+   gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+   gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
++  gtk_label_set_max_width_chars (GTK_LABEL (label), 70);
+   gtk_box_pack_start (GTK_BOX (main_vbox), label, FALSE, FALSE, 0);
+ 
+   /* secondary message */
+@@ -601,6 +602,7 @@ polkit_gnome_authentication_dialog_constructed (GObject *object)
+     }
+   gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+   gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
++  gtk_label_set_max_width_chars (GTK_LABEL (label), 70);
+   gtk_box_pack_start (GTK_BOX (main_vbox), label, FALSE, FALSE, 0);
+ 
+   /* user combobox */

Added: 0003-Get-user-icon-from-accountsservice-instead-of-lookin.patch
===================================================================
--- 0003-Get-user-icon-from-accountsservice-instead-of-lookin.patch	                        (rev 0)
+++ 0003-Get-user-icon-from-accountsservice-instead-of-lookin.patch	2021-04-27 21:37:50 UTC (rev 924839)
@@ -0,0 +1,135 @@
+From: Marc Deslauriers <marc.deslauriers at canonical.com>
+Date: Mon, 30 Apr 2018 18:03:22 +0000
+Subject: Get user icon from accountsservice instead of looking in ~/.face
+
+Bug: https://bugzilla.gnome.org/show_bug.cgi?id=669857
+Bug-Ubuntu: https://launchpad.net/bugs/928249
+---
+ src/polkitgnomeauthenticationdialog.c | 107 ++++++++++++++++++++++++++++++----
+ 1 file changed, 97 insertions(+), 10 deletions(-)
+
+diff --git a/src/polkitgnomeauthenticationdialog.c b/src/polkitgnomeauthenticationdialog.c
+index efd4185..565da87 100644
+--- a/src/polkitgnomeauthenticationdialog.c
++++ b/src/polkitgnomeauthenticationdialog.c
+@@ -135,6 +135,102 @@ user_combobox_changed (GtkComboBox *widget,
+     }
+ }
+ 
++static GdkPixbuf *
++get_user_icon (char *username)
++{
++  GError *error;
++  GDBusConnection *connection;
++  GVariant *find_user_result;
++  GVariant *get_icon_result;
++  GVariant *icon_result_variant;
++  const gchar *user_path;
++  const gchar *icon_filename;
++  GdkPixbuf *pixbuf;
++
++  error = NULL;
++  connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error);
++
++  if (connection == NULL)
++    {
++      g_warning ("Unable to connect to system bus: %s", error->message);
++      g_error_free (error);
++      return NULL;
++    }
++
++  find_user_result = g_dbus_connection_call_sync (connection,
++                                          "org.freedesktop.Accounts",
++                                          "/org/freedesktop/Accounts",
++                                          "org.freedesktop.Accounts",
++                                          "FindUserByName",
++                                          g_variant_new ("(s)",
++                                          username),
++                                          G_VARIANT_TYPE ("(o)"),
++                                          G_DBUS_CALL_FLAGS_NONE,
++                                          -1,
++                                          NULL,
++                                          &error);
++
++  if (find_user_result == NULL)
++    {
++      g_warning ("Accounts couldn't find user: %s", error->message);
++      g_error_free (error);
++      return NULL;
++    }
++
++  user_path = g_variant_get_string (g_variant_get_child_value (find_user_result, 0),
++                                    NULL);
++
++  get_icon_result = g_dbus_connection_call_sync (connection,
++                                                 "org.freedesktop.Accounts",
++                                                 user_path,
++                                                 "org.freedesktop.DBus.Properties",
++                                                 "Get",
++                                                 g_variant_new ("(ss)",
++                                                                "org.freedesktop.Accounts.User",
++                                                                "IconFile"),
++                                                 G_VARIANT_TYPE ("(v)"),
++                                                 G_DBUS_CALL_FLAGS_NONE,
++                                                 -1,
++                                                 NULL,
++                                                 &error);
++
++  g_variant_unref (find_user_result);
++
++  if (get_icon_result == NULL)
++    {
++      g_warning ("Accounts couldn't find user icon: %s", error->message);
++      g_error_free (error);
++      return NULL;
++    }
++
++  g_variant_get_child (get_icon_result, 0, "v", &icon_result_variant);
++  icon_filename = g_variant_get_string (icon_result_variant, NULL);
++
++  if (icon_filename == NULL)
++    {
++      g_warning ("Accounts didn't return a valid filename for user icon");
++      pixbuf = NULL;
++    }
++  else
++    {
++      /* TODO: we probably shouldn't hard-code the size to 16x16 */
++      pixbuf = gdk_pixbuf_new_from_file_at_size (icon_filename,
++                                                 16,
++                                                 16,
++                                                 &error);
++      if (pixbuf == NULL)
++        {
++          g_warning ("Couldn't open user icon: %s", error->message);
++          g_error_free (error);
++        }
++    }
++
++  g_variant_unref (icon_result_variant);
++  g_variant_unref (get_icon_result);
++
++  return pixbuf;
++}
++
+ static void
+ create_user_combobox (PolkitGnomeAuthenticationDialog *dialog)
+ {
+@@ -197,16 +293,7 @@ create_user_combobox (PolkitGnomeAuthenticationDialog *dialog)
+       g_free (gecos);
+ 
+       /* Load users face */
+-      pixbuf = NULL;
+-      if (passwd->pw_dir != NULL)
+-        {
+-          gchar *path;
+-          path = g_strdup_printf ("%s/.face", passwd->pw_dir);
+-          /* TODO: we probably shouldn't hard-code the size to 16x16 */
+-          pixbuf = gdk_pixbuf_new_from_file_at_scale (path, 16, 16, TRUE, NULL);
+-          g_free (path);
+-        }
+-
++      pixbuf = get_user_icon (dialog->priv->users[n]);
+       /* fall back to avatar-default icon */
+       if (pixbuf == NULL)
+         {

Added: 0004-Use-fresh-X11-timestamps-when-displaying-authenticat.patch
===================================================================
--- 0004-Use-fresh-X11-timestamps-when-displaying-authenticat.patch	                        (rev 0)
+++ 0004-Use-fresh-X11-timestamps-when-displaying-authenticat.patch	2021-04-27 21:37:50 UTC (rev 924839)
@@ -0,0 +1,35 @@
+From: Jeffrey Knockel <jeff250 at gmail.com>
+Date: Mon, 30 Apr 2018 18:05:20 +0000
+Subject: Use fresh X11 timestamps when displaying authentication dialog
+
+This circumvents focus-stealing prevention.
+
+Bug: https://bugzilla.gnome.org/show_bug.cgi?id=676076
+Bug-Debian: https://bugs.debian.org/684300
+Bug-Ubuntu: https://launchpad.net/bugs/946171
+---
+ src/polkitgnomeauthenticator.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/src/polkitgnomeauthenticator.c b/src/polkitgnomeauthenticator.c
+index 23163b4..e57d76e 100644
+--- a/src/polkitgnomeauthenticator.c
++++ b/src/polkitgnomeauthenticator.c
+@@ -26,6 +26,7 @@
+ #include <sys/types.h>
+ #include <pwd.h>
+ #include <glib/gi18n.h>
++#include <gdk/gdkx.h>
+ 
+ #include <polkit/polkit.h>
+ #include <polkitagent/polkitagent.h>
+@@ -306,7 +307,8 @@ session_request (PolkitAgentSession *session,
+     }
+ 
+   gtk_widget_show_all (GTK_WIDGET (authenticator->dialog));
+-  gtk_window_present (GTK_WINDOW (authenticator->dialog));
++  gtk_window_present_with_time (GTK_WINDOW (authenticator->dialog),
++                                gdk_x11_get_server_time (gtk_widget_get_window (GTK_WIDGET (authenticator->dialog))));
+   password = polkit_gnome_authentication_dialog_run_until_response_for_prompt (POLKIT_GNOME_AUTHENTICATION_DIALOG (authenticator->dialog),
+                                                                                modified_request,
+                                                                                echo_on,

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2021-04-27 21:07:39 UTC (rev 924838)
+++ PKGBUILD	2021-04-27 21:37:50 UTC (rev 924839)
@@ -4,22 +4,45 @@
 
 pkgname=polkit-gnome
 pkgver=0.105
-pkgrel=5
-pkgdesc="Legacy polkit authentication agent for GNOME"
+pkgrel=6
+pkgdesc='Legacy polkit authentication agent for GNOME'
 arch=('x86_64')
-url="https://www.freedesktop.org/wiki/Software/polkit/"
+url='https://gitlab.gnome.org/Archive/policykit-gnome'
 license=('LGPL')
-depends=('polkit' 'gtk3')
+depends=('gtk3' 'polkit')
 makedepends=('intltool')
-source=(https://download.gnome.org/sources/$pkgname/$pkgver/$pkgname-$pkgver.tar.xz
-        polkit-gnome-authentication-agent-1.desktop)
-sha512sums=('eae2504959bca6f2b53dbad1b743fc0414b82897e62623af80ee74c4080a10d6b07a4c90151ee1264891f27373321b8697ac8a747cba5254c765b4cd9161bd42'
-            '8b24b7a39556e6a17284e052baa7af81237401e4010049839871ea5487643c92b2600f513213b9003a1a452492540e1d1cf6a5faf7a2ce5a28ad4f00e4b835aa')
+source=("https://download.gnome.org/sources/$pkgname/$pkgver/$pkgname-$pkgver.tar.xz"
+        'polkit-gnome-authentication-agent-1.desktop'
+        '0001-Select-the-current-user-to-authenticate-with-by-defa.patch'
+        '0002-Auth-dialog-Make-the-label-wrap-at-70-chars.patch'
+        '0003-Get-user-icon-from-accountsservice-instead-of-lookin.patch'
+        '0004-Use-fresh-X11-timestamps-when-displaying-authenticat.patch')
+sha256sums=('1784494963b8bf9a00eedc6cd3a2868fb123b8a5e516e66c5eda48df17ab9369'
+            '5074c723a4eab274830587d799ba781ff57f4fbe4ac99fbdc5aac5009c441ee7'
+            'b989f1c7e30f2f9f9ef03f1a06db708d83c4945ee242ca573e7d66b64bf7037f'
+            '41afbd11bdf4633dc619675862078c23e4b200c888da1569d030c502999b25d8'
+            '4ee38d2dae6e592040c41ba07caa284135dc232feef5a30acb42c0e28340adce'
+            'a6888623ce218543e1abd4cfe36653860ec7c3b443d00d4204e7de9b97d1eadf')
 
+prepare() {
+  cd $pkgname-$pkgver
+
+  # Select the current user to authenticate with by default
+  patch -Np1 -i ../0001-Select-the-current-user-to-authenticate-with-by-defa.patch
+
+  # Auth dialog: Make the label wrap at 70 chars
+  patch -Np1 -i ../0002-Auth-dialog-Make-the-label-wrap-at-70-chars.patch
+
+  # Get user icon from accountsservice instead of looking in ~/.face
+  patch -Np1 -i ../0003-Get-user-icon-from-accountsservice-instead-of-lookin.patch
+
+  # Use fresh X11 timestamps when displaying authentication dialog
+  patch -Np1 -i ../0004-Use-fresh-X11-timestamps-when-displaying-authenticat.patch
+}
+
 build() {
   cd $pkgname-$pkgver
-  ./configure --prefix=/usr --sysconfdir=/etc \
-      --localstatedir=/var --libexecdir=/usr/lib/polkit-gnome
+  ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --libexecdir=/usr/lib/$pkgname
   make
 }
 



More information about the arch-commits mailing list