File 0016-obfuscated-password-support-in-oscrc.patch of Package python-bugzilla
From b8de888a2b4aad939ff4373893210334e581f270 Mon Sep 17 00:00:00 2001
From: Michal Vyskocil <mvyskocil@suse.cz>
Date: Wed, 26 Aug 2009 11:08:36 +0200
Subject: [PATCH 16/19] 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.7.4.1