From 827232cdf360c8669457a03622c165f0bcf4b57b Mon Sep 17 00:00:00 2001 From: Tim Waugh Date: Mon, 17 Oct 2011 10:55:57 +0100 Subject: [PATCH] Handle new CUPS 1.5 IPP error response IPP_AUTHENTICATION_CANCELED (Ubuntu #653132). --- system-config-printer-auth.patch | 55 ++++++++++++++++++++++++++++++++ system-config-printer.spec | 11 ++++++- 2 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 system-config-printer-auth.patch diff --git a/system-config-printer-auth.patch b/system-config-printer-auth.patch new file mode 100644 index 0000000..a3e52e5 --- /dev/null +++ b/system-config-printer-auth.patch @@ -0,0 +1,55 @@ +diff -up system-config-printer-1.3.7/asyncipp.py.auth system-config-printer-1.3.7/asyncipp.py +--- system-config-printer-1.3.7/asyncipp.py.auth 2011-10-03 11:37:17.000000000 +0100 ++++ system-config-printer-1.3.7/asyncipp.py 2011-10-17 10:52:52.844802724 +0100 +@@ -379,8 +379,14 @@ class _IPPAuthOperation: + forbidden = False + if type (exc) == cups.IPPError: + (e, m) = exc.args ++ try: ++ ipp_auth_canceled = cups.IPP_AUTHENTICATION_CANCELED ++ except AttributeError: ++ # requires pycups 1.9.60 ++ ipp_auth_canceled = 4096 + if (e == cups.IPP_NOT_AUTHORIZED or +- e == cups.IPP_FORBIDDEN): ++ e == cups.IPP_FORBIDDEN or ++ e == ipp_auth_canceled): + forbidden = (e == cups.IPP_FORBIDDEN) + elif e == cups.IPP_SERVICE_UNAVAILABLE: + return self._reconnect_error (conn, exc) +diff -up system-config-printer-1.3.7/authconn.py.auth system-config-printer-1.3.7/authconn.py +--- system-config-printer-1.3.7/authconn.py.auth 2011-09-26 16:39:20.000000000 +0100 ++++ system-config-printer-1.3.7/authconn.py 2011-10-17 10:52:34.736129998 +0100 +@@ -1,6 +1,6 @@ + #!/usr/bin/python + +-## Copyright (C) 2007, 2008, 2009, 2010 Red Hat, Inc. ++## Copyright (C) 2007, 2008, 2009, 2010, 2011 Red Hat, Inc. + ## Author: Tim Waugh + + ## This program is free software; you can redistribute it and/or modify +@@ -241,8 +241,15 @@ class Connection: + except cups.IPPError, (e, m): + if self._use_pk and m == 'pkcancel': + raise cups.IPPError (0, _("Operation canceled")) ++ try: ++ ipp_auth_canceled = cups.IPP_AUTHENTICATION_CANCELED ++ except AttributeError: ++ # requires pycups 1.9.60 ++ ipp_auth_canceled = 4096 ++ + if not self._cancel and (e == cups.IPP_NOT_AUTHORIZED or +- e == cups.IPP_FORBIDDEN): ++ e == cups.IPP_FORBIDDEN or ++ e == ipp_auth_canceled): + self._failed (e == cups.IPP_FORBIDDEN) + elif not self._cancel and e == cups.IPP_SERVICE_UNAVAILABLE: + if self._lock: +@@ -264,6 +271,7 @@ class Connection: + if self._cancel and not self._cannot_auth: + raise cups.IPPError (0, _("Operation canceled")) + ++ debugprint ("%s: %s" % (e, m)) + raise + except cups.HTTPError, (s,): + if not self._cancel: diff --git a/system-config-printer.spec b/system-config-printer.spec index 455047b..7f70c59 100644 --- a/system-config-printer.spec +++ b/system-config-printer.spec @@ -1,12 +1,13 @@ Summary: A printer administration tool Name: system-config-printer Version: 1.3.7 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2+ URL: http://cyberelk.net/tim/software/system-config-printer/ Group: System Environment/Base Source0: http://cyberelk.net/tim/data/system-config-printer/1.3/%{name}-%{version}.tar.xz Patch1: system-config-printer-no-applet-in-gnome.patch +Patch2: system-config-printer-auth.patch BuildRequires: cups-devel >= 1.2 BuildRequires: desktop-file-utils >= 0.2.92 BuildRequires: gettext-devel @@ -71,6 +72,10 @@ printers. # Don't start the applet in GNOME. %patch1 -p1 -b .no-applet-in-gnome +# Handle new CUPS 1.5 IPP error response IPP_AUTHENTICATION_CANCELED +# (Ubuntu #653132). +%patch2 -p1 -b .auth + %build %configure --with-udev-rules @@ -197,6 +202,10 @@ if [ $1 -ge 1 ] ; then fi %changelog +* Mon Oct 17 2011 Tim Waugh 1.3.7-2 +- Handle new CUPS 1.5 IPP error response IPP_AUTHENTICATION_CANCELED + (Ubuntu #653132). + * Wed Oct 5 2011 Tim Waugh 1.3.7-1 - 1.3.7: - Show private job attributes for "my jobs" (bug #742279).