You are always authenticated when MPD_SERVER_PASSWORD==None

This commit is contained in:
Stein Magnus Jodal 2011-06-04 19:02:20 +02:00
parent d5a13ae1ca
commit 601a0f0a45
2 changed files with 5 additions and 2 deletions

View File

@ -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]

View File

@ -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):