From cc702dde6d49bdd45fd4324b7f626b5e8c92d0a6 Mon Sep 17 00:00:00 2001 From: ShyPike Date: Sun, 26 Jun 2011 15:56:08 +0200 Subject: [PATCH] Improve handling when user has set username/password for a server, while the server doesn't need authentication. For incorrect authentication, some servers return code '502 ... Access denied...' instead of the official '481' code. Handle that as a bad login too. --- sabnzbd/downloader.py | 2 +- sabnzbd/newswrapper.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/sabnzbd/downloader.py b/sabnzbd/downloader.py index 3b8d83a..1a68a0d 100644 --- a/sabnzbd/downloader.py +++ b/sabnzbd/downloader.py @@ -759,7 +759,7 @@ def clues_login(text): """ Check for any "failed login" clues in the response code """ text = text.lower() - for clue in ('username', 'password', 'invalid', 'authen'): + for clue in ('username', 'password', 'invalid', 'authen', 'access denied'): if clue in text: return True return False diff --git a/sabnzbd/newswrapper.py b/sabnzbd/newswrapper.py index f6868ef..65b93c3 100644 --- a/sabnzbd/newswrapper.py +++ b/sabnzbd/newswrapper.py @@ -280,6 +280,12 @@ class NewsWrapper(object): elif not self.user_ok: if code == '381': self.user_ok = True + elif code == '281': + # No login required + self.user_ok = True + self.pass_sent = True + self.pass_ok = True + self.connected = True if self.user_ok and not self.pass_sent: command = 'authinfo pass %s\r\n' % (self.server.password)