forked from pool/python-bugzilla
Accepting request 927496 from home:PSuarezHernandez:branches:devel:languages:python
- Fix problem with basic-auth patch for version higher than 3.0.0 (bsc#1098219) - Modified: * 106-basic-auth.diff OBS-URL: https://build.opensuse.org/request/show/927496 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-bugzilla?expand=0&rev=54
This commit is contained in:
@@ -2,8 +2,10 @@
|
||||
bugzilla/base.py | 8 +++++++-
|
||||
1 file changed, 7 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/bugzilla/base.py
|
||||
+++ b/bugzilla/base.py
|
||||
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,
|
||||
@@ -35,8 +37,47 @@
|
||||
raise ValueError("missing password")
|
||||
|
||||
+ if self._basic_auth:
|
||||
+ self._transport.set_basic_auth(self.user, self.password)
|
||||
+ 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()
|
||||
|
||||
|
||||
@@ -1,3 +1,11 @@
|
||||
-------------------------------------------------------------------
|
||||
Tue Oct 26 10:25:23 UTC 2021 - Pablo Suárez Hernández <pablo.suarezhernandez@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 <mcepl@suse.com>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user