Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-bugzilla for openSUSE:Factory checked in at 2021-10-29 22:33:53 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-bugzilla (Old) and /work/SRC/openSUSE:Factory/.python-bugzilla.new.1890 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-bugzilla" Fri Oct 29 22:33:53 2021 rev:31 rq:927546 version:3.0.2 Changes: -------- --- /work/SRC/openSUSE:Factory/python-bugzilla/python-bugzilla.changes 2021-10-23 23:14:00.388981981 +0200 +++ /work/SRC/openSUSE:Factory/.python-bugzilla.new.1890/python-bugzilla.changes 2021-10-29 22:34:50.979696090 +0200 @@ -1,0 +2,13 @@ +Tue Oct 26 10:25:23 UTC 2021 - Pablo Su??rez Hern??ndez <pablo.suarezhernan...@suse.com> + +- Fix problem with basic-auth patch for version higher than 3.0.0 (bsc#1098219) + +- Modified: + * 106-basic-auth.diff + +------------------------------------------------------------------- +Tue Oct 26 05:50:05 UTC 2021 - Matej Cepl <mc...@suse.com> + +- Revert removing of 106-basic-auth.diff + +------------------------------------------------------------------- New: ---- 106-basic-auth.diff ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-bugzilla.spec ++++++ --- /var/tmp/diff_new_pack.hHzgrK/_old 2021-10-29 22:34:51.459696271 +0200 +++ /var/tmp/diff_new_pack.hHzgrK/_new 2021-10-29 22:34:51.463696273 +0200 @@ -27,6 +27,9 @@ Group: Development/Libraries/Python URL: https://github.com/python-bugzilla/python-bugzilla Source: https://files.pythonhosted.org/packages/source/p/python-bugzilla/python-bugzilla-%{version}.tar.gz +# PATCH-FIX-UPSTREAM 106-basic-auth.diff bsc#1098219 mc...@suse.com +# Fix basic authentication on bugzilla.suse.com +Patch0: 106-basic-auth.diff BuildRequires: %{python_module pytest} BuildRequires: %{python_module requests} BuildRequires: %{python_module setuptools} @@ -34,7 +37,7 @@ BuildRequires: python-rpm-macros Requires: python-requests Requires(post): update-alternatives -Requires(postun): update-alternatives +Requires(postun):update-alternatives Suggests: osc Conflicts: %{oldpython}-bugzillatools Obsoletes: python2-bugzilla ++++++ 106-basic-auth.diff ++++++ --- bugzilla/base.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) Index: python-bugzilla-3.0.2/bugzilla/base.py =================================================================== --- python-bugzilla-3.0.2.orig/bugzilla/base.py +++ python-bugzilla-3.0.2/bugzilla/base.py @@ -175,7 +175,8 @@ class Bugzilla(object): def __init__(self, url=-1, user=None, password=None, cookiefile=-1, sslverify=True, tokenfile=-1, use_creds=True, api_key=None, cert=None, configpaths=-1, - force_rest=False, force_xmlrpc=False, requests_session=None): + force_rest=False, force_xmlrpc=False, requests_session=None, + basic_auth=False): """ :param url: The bugzilla instance URL, which we will connect to immediately. Most users will want to specify this at @@ -212,6 +213,7 @@ class Bugzilla(object): :param requests_session: An optional requests.Session object the API will use to contact the remote bugzilla instance. This way the API user can set up whatever auth bits they may need. + :param basic_auth: Use headers with HTTP Basic authentication """ if url == -1: raise TypeError("Specify a valid bugzilla url, or pass url=None") @@ -253,6 +255,7 @@ class Bugzilla(object): self._setcookiefile(cookiefile) self._settokenfile(tokenfile) self._setconfigpath(configpaths) + self._basic_auth = basic_auth if url: self.connect(url) @@ -607,6 +610,9 @@ class Bugzilla(object): if not self.password: raise ValueError("missing password") + if self._basic_auth: + self._backend.set_basic_auth(self.user, self.password) + payload = {"login": self.user} if restrict_login: payload['restrict_login'] = True Index: python-bugzilla-3.0.2/bugzilla/_backendxmlrpc.py =================================================================== --- python-bugzilla-3.0.2.orig/bugzilla/_backendxmlrpc.py +++ python-bugzilla-3.0.2/bugzilla/_backendxmlrpc.py @@ -2,6 +2,7 @@ # See the COPYING file in the top-level directory. from logging import getLogger +import base64 import sys from xmlrpc.client import (Binary, Fault, ProtocolError, ServerProxy, Transport) @@ -136,6 +137,9 @@ class _BugzillaXMLRPCProxy(ServerProxy, self.__bugzillasession.set_token_value(ret.get('token')) return ret + def clear_token(self): + self.__bugzillasession.set_token_value(None) + class _BackendXMLRPC(_BackendBase): """ @@ -150,6 +154,16 @@ class _BackendXMLRPC(_BackendBase): def is_xmlrpc(self): return True + def set_basic_auth(self, user, password): + """ + Set basic authentication method. + + :return: + """ + b64str = base64.b64encode("{}:{}".format(user, password).encode("utf-8")) + authstr = "Basic {}".format(b64str.decode("utf-8")) + self._bugzillasession._session.headers["Authorization"] = authstr + def bugzilla_version(self): return self._xmlrpc_proxy.Bugzilla.version()