[python-cups/f21] Fixed password_callback so it obtains UTF-8 password correctly (bug #1155469).

Tim Waugh twaugh at fedoraproject.org
Sat Dec 13 00:24:59 UTC 2014


commit 0bdb663e2de27e33c6add4195f3f0c2951d7dd57
Author: Tim Waugh <twaugh at redhat.com>
Date:   Sat Dec 13 00:06:44 2014 +0000

    Fixed password_callback so it obtains UTF-8 password correctly (bug #1155469).
    
    Resolves: rhbz#1155469

 python-cups-pw-callback.patch |   35 +++++++++++++++++++++++++++++++++++
 python-cups.spec              |    8 +++++++-
 2 files changed, 42 insertions(+), 1 deletions(-)
---
diff --git a/python-cups-pw-callback.patch b/python-cups-pw-callback.patch
new file mode 100644
index 0000000..d433bef
--- /dev/null
+++ b/python-cups-pw-callback.patch
@@ -0,0 +1,35 @@
+diff -up pycups-1.9.69/cupsconnection.c.pw-callback pycups-1.9.69/cupsconnection.c
+--- pycups-1.9.69/cupsconnection.c.pw-callback	2014-06-20 15:13:07.000000000 +0100
++++ pycups-1.9.69/cupsconnection.c	2014-12-13 00:05:00.559619993 +0000
+@@ -1,6 +1,6 @@
+ /*
+  * cups - Python bindings for CUPS
+- * Copyright (C) 2002, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2013  Red Hat, Inc
++ * Copyright (C) 2002, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2013, 2014  Red Hat, Inc
+  * Author: Tim Waugh <twaugh at redhat.com>
+  *
+  * This program is free software; you can redistribute it and/or modify
+@@ -362,7 +362,6 @@ password_callback (int newstyle,
+   Connection *self = NULL;
+   PyObject *args;
+   PyObject *result;
+-  const char *pwval;
+   int i;
+ 
+   debugprintf ("-> password_callback for http=%p, newstyle=%d\n",
+@@ -403,13 +402,9 @@ password_callback (int newstyle,
+   }
+ 
+   free (self->cb_password);
+-  if (result == Py_None)
++  if (result == Py_None ||
++      !UTF8_from_PyObj (&self->cb_password, result))
+     self->cb_password = NULL;
+-  else
+-  {
+-    pwval = PyBytes_AsString (result);
+-    self->cb_password = strdup (pwval);
+-  }
+ 
+   Py_DECREF (result);
+   if (!self->cb_password || !*self->cb_password)
diff --git a/python-cups.spec b/python-cups.spec
index 57272ae..6dd74be 100644
--- a/python-cups.spec
+++ b/python-cups.spec
@@ -6,9 +6,10 @@
 Summary:       Python bindings for CUPS
 Name:          python-cups
 Version:       1.9.69
-Release:       1%{?dist}
+Release:       2%{?dist}
 URL:           http://cyberelk.net/tim/software/pycups/
 Source:        http://cyberelk.net/tim/data/pycups/pycups-%{version}.tar.bz2
+Patch1:        python-cups-pw-callback.patch
 License:       GPLv2+
 Group:         Development/Languages
 BuildRequires: cups-devel
@@ -40,6 +41,7 @@ Documentation for python-cups.
 
 %prep
 %setup -q -n pycups-%{version}
+%patch1 -p1 -b .pw-callback
 
 rm -rf %{py3dir}
 cp -a . %{py3dir}
@@ -81,6 +83,10 @@ popd
 %doc examples html
 
 %changelog
+* Sat Dec 13 2014 Tim Waugh <twaugh at redhat.com> - 1.9.69-2
+- Fixed password_callback so it obtains UTF-8 password correctly
+  (bug #1155469).
+
 * Thu Dec  4 2014 Tim Waugh <twaugh at redhat.com> - 1.9.69-1
 - 1.9.69.
 


More information about the scm-commits mailing list