14
0

Accepting request 18727 from devel:languages:python

Copy from devel:languages:python/python-bugzilla based on submit request 18727 from user mvyskocil

OBS-URL: https://build.opensuse.org/request/show/18727
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-bugzilla?expand=0&rev=2
This commit is contained in:
OBS User autobuild
2009-08-26 13:53:15 +00:00
committed by Git OBS Bridge
parent 215a3062a4
commit 06537cced8
3 changed files with 58 additions and 1 deletions

View File

@@ -0,0 +1,50 @@
From e286a5be2446a00f91bb498f0feeffae4ec3aa05 Mon Sep 17 00:00:00 2001
From: Michal Vyskocil <mvyskocil@suse.cz>
Date: Wed, 26 Aug 2009 11:08:36 +0200
Subject: [PATCH] obfuscated password support in oscrc
The osc client introduced an obfuscated passwords (not secure, but many
times requested by a community), so this patch to readconfig method adds
an ability to read passx options.
It also fixes a small (but mandatory bug) in a condition which decides
about read or not.
---
bugzilla/nvlbugzilla.py | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/bugzilla/nvlbugzilla.py b/bugzilla/nvlbugzilla.py
index 35202a4..0d88db1 100644
--- a/bugzilla/nvlbugzilla.py
+++ b/bugzilla/nvlbugzilla.py
@@ -138,11 +138,18 @@ If you want cache the cookies and speedup the repeated connections, remove it or
for cookie in self._iter_domain_cookies():
cookie.expires = 0
+ @classmethod
+ def _read_osc_password(cls, c):
+ # supports obfuscated passwords introduced in osc-0.121
+ if c.has_option(cls.obs_url, 'passx'):
+ return c.get(cls.obs_url, 'passx').decode('base64').decode('bz2')
+ return c.get(cls.obs_url, 'pass')
+
def readconfig(self, configpath=None):
super(NovellBugzilla, self).readconfig(configpath)
oscrc=os.path.expanduser('~/.oscrc')
- if not self.user and not self.password \
+ if not self.user or not self.password \
and os.path.exists(oscrc):
from ConfigParser import SafeConfigParser, NoOptionError
c = SafeConfigParser()
@@ -156,7 +163,7 @@ If you want cache the cookies and speedup the repeated connections, remove it or
try:
self.user = c.get(obs_url, 'user')
- self.password = c.get(obs_url, 'pass')
+ self.password = self._read_osc_password(c)
bugzilla.base.log.info("Read credentials from ~/.oscrc")
except NoOptionError, ne:
return
--
1.6.3.3

View File

@@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed Aug 26 09:18:54 UTC 2009 - mvyskocil@suse.cz
- Added a patch with support of obfuscated passwords introduced in osc-0.121
-------------------------------------------------------------------
Wed Jul 22 08:52:01 CEST 2009 - mvyskocil@suse.cz

View File

@@ -20,7 +20,7 @@
Name: python-bugzilla
Version: 0.5
Release: 1
Release: 2
Summary: Python library for bugzilla
Group: Development/Libraries/Python
License: GPL v2 or later
@@ -30,6 +30,7 @@ Url: https://fedorahosted.org/python-bugzilla/
Source: https://fedorahosted.org/releases/p/y/python-bugzilla/%{name}-%{version}.tar.bz2
Patch0: 0001-Use-LWPCookieJar-by-default.patch
Patch1: 0002-NovellBugzilla-implementation.patch
Patch2: 0003-obfuscated-password-support.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: python-devel
%{py_requires}
@@ -54,6 +55,7 @@ Will Woods <wwoods@redhat.com>, Oct 16 2008
%setup -q
%patch0 -p1 -b .use-lwpcookiejar-by-default
%patch1 -p1 -b .novellbugzilla-implementation
%patch2 -p1 -b .obfuscated-password
%build
export CFLAGS="%{optflags}"