diff --git a/hplip-check-userperms.patch b/hplip-check-userperms.patch new file mode 100644 index 0000000..9204c0b --- /dev/null +++ b/hplip-check-userperms.patch @@ -0,0 +1,33 @@ +diff --git a/base/password.py b/base/password.py +index bd68f2a..bff9f80 100644 +--- a/base/password.py ++++ b/base/password.py +@@ -157,6 +157,28 @@ class Password(object): + log.warn("%s distro is not found in AUTH_TYPES" % distro_name) + self.__authType = 'su' + ++ # check if caller is in wheel group - use 'su' if he isnt - ++ # or if the caller is root (just for showing 'root' username) ++ # in the prompt ++ import os ++ from grp import getgrnam ++ ++ user = os.getenv('USER') ++ ++ try: ++ members = getgrnam('wheel').gr_mem ++ except KeyError: ++ try: ++ members = getgrnam('sudo').gr_mem ++ except: ++ return ++ ++ if user in members: ++ self.__authType = 'sudo' ++ else: ++ self.__authType = 'su' ++ ++ + def __getPasswordDisplayString(self): + if self.__authType == "su": + return "Please enter the root/superuser password: " diff --git a/hplip.spec b/hplip.spec index d4bc628..7acf707 100644 --- a/hplip.spec +++ b/hplip.spec @@ -7,7 +7,7 @@ Summary: HP Linux Imaging and Printing Project Name: hplip Version: 3.20.9 -Release: 3%{?dist} +Release: 4%{?dist} License: GPLv2+ and MIT and BSD and IJG and Public Domain and GPLv2+ with exceptions and ISC Url: https://developers.hp.com/hp-linux-imaging-and-printing @@ -165,6 +165,9 @@ Patch57: hplip-thread-isalive-removed.patch # the code doesn't use anything from timeb.h, so it is safe to remove it # reported upstream https://bugs.launchpad.net/hplip/+bug/1900977 Patch58: hplip-timeb-removed.patch +# non-sudoers cannot authenticate +# reported upstream https://bugs.launchpad.net/hplip/+bug/1904888 +Patch59: hplip-check-userperms.patch Requires: %{name}-libs%{?_isa} = %{version}-%{release} @@ -444,6 +447,8 @@ rm prnt/hpcups/ErnieFilter.{cpp,h} prnt/hpijs/ernieplatform.h %patch57 -p1 -b .thread-isalive-removed # timed.h is removed from glibc %patch58 -p1 -b .timed-removed +# 1899410 - non-sudoers cannot authenticate because of bad username in prompt +%patch59 -p1 -b .check-userperms sed -i.duplex-constraints \ -e 's,\(UIConstraints.* \*Duplex\),//\1,' \ @@ -778,6 +783,9 @@ rm -f %{buildroot}%{_sysconfdir}/xdg/autostart/hplip-systray.desktop %config(noreplace) %{_sysconfdir}/sane.d/dll.d/hpaio %changelog +* Thu Nov 19 2020 Zdenek Dohnal - 3.20.9-4 +- 1899410 - non-sudoers cannot authenticate because of bad username in prompt + * Thu Nov 05 2020 Zdenek Dohnal - 3.20.9-3 - make is no longer in buildroot by default