Fix being able to connect to a local daemon from another user account

This commit is contained in:
Andrew Resch 2009-01-16 20:11:05 +00:00
parent 0fa9b491c5
commit 32be4ed4ad
1 changed files with 7 additions and 1 deletions

View File

@ -131,9 +131,15 @@ def get_localhost_auth_uri(uri):
:param uri: the uri to add the authentication info to
:returns: a localhost uri containing authentication information or None if the information is not available
"""
u = urlparse.urlsplit(uri)
# If there is already a username in this URI, let's just return it since
# the user has provided credentials.
if u.username:
return uri
auth_file = deluge.configmanager.get_config_dir("auth")
if os.path.exists(auth_file):
u = urlparse.urlsplit(uri)
for line in open(auth_file):
try:
username, password = line.strip().split(":")