Mailinglist Archive: opensuse-buildservice (158 mails)

< Previous Next >
[opensuse-buildservice] [PATCH] conf: detect and handle blank usernames
  • From: Brandon Philips <brandon@xxxxxxxx>
  • Date: Fri, 17 Dec 2010 17:17:40 -0800
  • Message-id: <20101218011740.GA3549@xxxxxxxxxxxxxxxxxxxxx>
Fix situation where osc has added a blank username to the keyring and
update the config parse script to do the right thing and not allow blank
usernames.

I was in a very confusing situation where my keyring ended up with two
entries:

- @api.suse.de
- philipsb@xxxxxxxxxxx

And I was getting 401s because of it.

Signed-off-by: Brandon Philips <bphilips@xxxxxxx>

---
osc/conf.py | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/osc/conf.py b/osc/conf.py
index e1d74b3..780942a 100644
--- a/osc/conf.py
+++ b/osc/conf.py
@@ -769,6 +770,13 @@ def get_config(override_conffile = None,
except gnomekeyring.NoMatchError:
# Fallback to file based auth.
pass
+
+ if not user is None and len(user) == 0:
+ user = None
+ print >>sys.stderr, "Warning: blank user in the keyring for the "\
+ "api url %s.\nRun seahorse to fix the "\
+ "entry.\n" % (url)
+
# Read credentials from config
if user is None:
#FIXME: this could actually be the ideal spot to take defaults
@@ -776,6 +784,10 @@ def get_config(override_conffile = None,
user = cp.get(url, 'user', raw=True) # need to set raw to
prevent '%' expansion
password = cp.get(url, 'pass', raw=True) # especially on
password!
passwordx = cp.get(url, 'passx', raw=True) # especially on
password!
+ if user is None or len(user) == 0:
+ raise oscerr.ConfigError("user is blank for %s" % apiurl,
+ config['conffile'])
+
if password is None or password == 'your_password':
try:
password = passwordx.decode('base64').decode('bz2')
--
1.7.3.2

--
To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse-buildservice+help@xxxxxxxxxxxx

< Previous Next >
Follow Ups