mirror of
https://github.com/openSUSE/osc.git
synced 2024-12-27 02:16:12 +01:00
conf: detect and handle blank usernames
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@api.suse.de And I was getting 401s because of it. Signed-off-by: Brandon Philips <bphilips@suse.de>
This commit is contained in:
parent
0f73fb86a4
commit
51d2436023
11
osc/conf.py
11
osc/conf.py
@ -769,6 +769,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 +783,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')
|
||||
|
Loading…
Reference in New Issue
Block a user