[arch-commits] Commit in cinnamon/trunk (2 files)

Eli Schwartz eschwartz at archlinux.org
Thu Apr 19 18:48:41 UTC 2018


    Date: Thursday, April 19, 2018 @ 18:48:37
  Author: eschwartz
Revision: 317054

upgpkg: cinnamon 3.6.7-2

backport fix for python2-pam
rebuild with cleaned-up deps

Added:
  cinnamon/trunk/0001-cs_user.py-Add-compatibility-for-multiple-pam-module.patch
Modified:
  cinnamon/trunk/PKGBUILD

-----------------------------------------------------------------+
 0001-cs_user.py-Add-compatibility-for-multiple-pam-module.patch |  105 ++++++++++
 PKGBUILD                                                        |    7 
 2 files changed, 111 insertions(+), 1 deletion(-)

Added: 0001-cs_user.py-Add-compatibility-for-multiple-pam-module.patch
===================================================================
--- 0001-cs_user.py-Add-compatibility-for-multiple-pam-module.patch	                        (rev 0)
+++ 0001-cs_user.py-Add-compatibility-for-multiple-pam-module.patch	2018-04-19 18:48:37 UTC (rev 317054)
@@ -0,0 +1,105 @@
+From b5407422e20b44936134e2e22c4fa25bcb555d75 Mon Sep 17 00:00:00 2001
+From: Eli Schwartz <eschwartz93 at gmail.com>
+Date: Tue, 6 Mar 2018 10:30:14 -0500
+Subject: [PATCH] cs_user.py: Add compatibility for multiple pam modules
+
+Rework the authentication handling to work with either backend module:
+- python pam, ctypes bindings created by Chris Atlee, available on PyPI
+  and some distros. Forked for python3 support, and available at PyPI as
+  python-pam and https://github.com/FirefighterBlu3/python-pam
+- python PyPAM, CPython binary extension, available on some other
+  distros, and referencing a dead upstream website (Debian hosts and
+  builds from *_orig.tar.gz so it is still able to be built).
+
+The current method allows importing either module without failure, but
+then spawns internal errors if pam is used instead of PyPAM due to the
+two modules containing entirely different APIs.
+
+Also re-raise internal errors and change the tooltip to indicate that
+something went wrong. If something unidentifiable happened, error
+messages should not be ruthlessly squelched -- this hindered my efforts
+to discover why pam was not working on Arch Linux in the first place.
+
+Fixes #7313
+
+(cherry picked from commit a29c68383c3758e6a6b85e9ee2b5a6b41b8147ba)
+---
+ .../cinnamon/cinnamon-settings/modules/cs_user.py  | 39 ++++++++++++++++------
+ 1 file changed, 29 insertions(+), 10 deletions(-)
+
+diff --git a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_user.py b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_user.py
+index 8e4dceea..f4e64edf 100755
+--- a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_user.py
++++ b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_user.py
+@@ -1,9 +1,10 @@
+ #!/usr/bin/python2
+ 
+ try:
+-    import PAM
++    import pam
+ except:
+-    import pam as PAM
++    import PAM
++    pam = None
+ import pexpect
+ import time
+ from random import randint
+@@ -18,6 +19,10 @@ from gi.repository import AccountsService, GLib
+ 
+ from GSettingsWidgets import *
+ 
++class PasswordError(Exception):
++    '''Exception raised when an incorrect password is supplied.'''
++    pass
++
+ 
+ class Module:
+     name = "user"
+@@ -342,22 +347,36 @@ class PasswordDialog(Gtk.Dialog):
+     def _on_show_password_toggled(self, widget):
+         self.set_passwords_visibility()
+ 
++    def auth_pam(self):
++        if not pam.authenticate(GLib.get_user_name(), self.current_password.get_text(), 'passwd'):
++            raise PasswordError("Invalid password")
++
++    def auth_PyPAM(self):
++        auth = PAM.pam()
++        auth.start('passwd')
++        auth.set_item(PAM.PAM_USER, GLib.get_user_name())
++        auth.set_item(PAM.PAM_CONV, self.pam_conv)
++        try:
++            auth.authenticate()
++            auth.acct_mgmt()
++            return True
++        except PAM.error as resp:
++            raise PasswordError("Invalid password")
++
+     def _on_current_password_changed(self, widget, event):
+         self.infobar.hide()
+         if self.current_password.get_text() != "":
+-            auth = PAM.pam()
+-            auth.start('passwd')
+-            auth.set_item(PAM.PAM_USER, GLib.get_user_name())
+-            auth.set_item(PAM.PAM_CONV, self.pam_conv)
+             try:
+-                auth.authenticate()
+-                auth.acct_mgmt()
+-            except PAM.error, resp:
++                self.auth_pam() if pam else self.auth_PyPAM()
++            except PasswordError:
+                 self.current_password.set_icon_from_stock(Gtk.EntryIconPosition.SECONDARY, Gtk.STOCK_DIALOG_WARNING)
+                 self.current_password.set_icon_tooltip_text(Gtk.EntryIconPosition.SECONDARY, _("Wrong password"))
+                 self.correct_current_password = False
+             except:
+-                print 'Internal error'
++                self.current_password.set_icon_from_stock(Gtk.EntryIconPosition.SECONDARY, Gtk.STOCK_DIALOG_WARNING)
++                self.current_password.set_icon_tooltip_text(Gtk.EntryIconPosition.SECONDARY, _("Internal Error"))
++                self.correct_current_password = False
++                raise
+             else:
+                 self.current_password.set_icon_from_stock(Gtk.EntryIconPosition.SECONDARY, None)
+                 self.correct_current_password = True
+-- 
+2.16.2
+

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2018-04-19 18:26:24 UTC (rev 317053)
+++ PKGBUILD	2018-04-19 18:48:37 UTC (rev 317054)
@@ -7,7 +7,7 @@
 
 pkgname=cinnamon
 pkgver=3.6.7
-pkgrel=1
+pkgrel=2
 pkgdesc="Linux desktop which provides advanced innovative features and a traditional user experience"
 arch=('x86_64')
 url="https://github.com/linuxmint/Cinnamon"
@@ -27,11 +27,13 @@
 options=('!emptydirs')
 source=("${pkgname}-${pkgver}.tar.gz::${url}/archive/${pkgver}.tar.gz"
         "${url}/commit/2dc04b8a26fa7a672c579ed62a70dca6c6e4b295.patch"
+        "0001-cs_user.py-Add-compatibility-for-multiple-pam-module.patch"
         "0001-cinanmon-settings-don-t-rely-on-the-presence-of-cinn.patch::${url}/pull/7382.patch"
         "set_wheel.patch"
         "default-theme.patch")
 sha512sums=('446e0bbf1fcda7e193735115b4c0396e24428e102b0e74d4b1e150c279d97bbf45961fe57ac08e5828f957c390c39bf385bf29ae7549f5fead2bc59389e64add'
             '9cc53e23f7a11b97cb3e03802fdece1dda77a1f809e751dd513e61436e656c1083c63304334b3b7f5c1615752f3d630e5d40b7aa7360710e86778625f480f5e6'
+            '6759926ba7e4c9d7f0cef54298107fe569fe3799d0ae78ac423c504d7f93e4577d3448caf5f3f8bacb3baaa03e8f6c6c77ad8ac06acf4fd36fd73e31a84051d5'
             'a0a9f4d25053fe96f9b1495394adb829252367099931d3f0e9bdfd2371093b4e86ff13fc945301b3a59691bbb7ee14da89e68c4ef3d8e7a1b5ec6bdedccb9137'
             '55929747b9cc1bc8893717c9fef257f8f2d560dc56849f1c74f88ed636b6f9f9997f6c4713768793b115e93482543a330b70eba672d696ea8456741ed2c71237'
             '3c460141b277df61c4546cc311fa5ecc7e7ea19a7d39a92d1d0214c37a91b4e163bc91823df7098bd2cf6fb430361cdb9839ab96abe53fe82f2a735e187de563')
@@ -42,6 +44,9 @@
     # GNOME Terminal desktop file was renamed in GNOME 3.20
     patch -p1 < ../2dc04b8a26fa7a672c579ed62a70dca6c6e4b295.patch
 
+    # Backport https://github.com/linuxmint/Cinnamon/pull/7327
+    patch -p1 < ../0001-cs_user.py-Add-compatibility-for-multiple-pam-module.patch
+
     # Check for the cc-panel module path, not for the irrelevant binary
     patch -p1 < ../0001-cinanmon-settings-don-t-rely-on-the-presence-of-cinn.patch
 



More information about the arch-commits mailing list