From 601a0f0a455441628c313ac1f8f3b456611b0cb2 Mon Sep 17 00:00:00 2001 From: Stein Magnus Jodal Date: Sat, 4 Jun 2011 19:02:20 +0200 Subject: [PATCH] You are always authenticated when MPD_SERVER_PASSWORD==None --- mopidy/frontends/mpd/dispatcher.py | 5 ++++- tests/frontends/mpd/authentication_test.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/mopidy/frontends/mpd/dispatcher.py b/mopidy/frontends/mpd/dispatcher.py index 405ca03d..4ae1e184 100644 --- a/mopidy/frontends/mpd/dispatcher.py +++ b/mopidy/frontends/mpd/dispatcher.py @@ -70,7 +70,10 @@ class MpdDispatcher(object): ### Filter: authenticate def _authenticate_filter(self, request, response, filter_chain): - if self.authenticated or settings.MPD_SERVER_PASSWORD is None: + if self.authenticated: + return self._call_next_filter(request, response, filter_chain) + elif settings.MPD_SERVER_PASSWORD is None: + self.authenticated = True return self._call_next_filter(request, response, filter_chain) else: command = request.split(' ')[0] diff --git a/tests/frontends/mpd/authentication_test.py b/tests/frontends/mpd/authentication_test.py index 03fc5718..d795d726 100644 --- a/tests/frontends/mpd/authentication_test.py +++ b/tests/frontends/mpd/authentication_test.py @@ -28,7 +28,7 @@ class AuthenticationTest(unittest.TestCase): def test_authentication_with_anything_when_password_check_turned_off(self): settings.MPD_SERVER_PASSWORD = None response = self.dispatcher.handle_request(u'any request at all') - self.assertFalse(self.dispatcher.authenticated) + self.assertTrue(self.dispatcher.authenticated) self.assert_('ACK [5@0] {} unknown command "any"' in response) def test_anything_when_not_authenticated_should_fail(self):