From: Brad Hubbard Date: Fri, 1 Mar 2019 04:33:58 +0000 (+1000) Subject: pybind/mgr/restful: Decode the output of b64decode X-Git-Tag: v14.2.0~45^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f00958f4a262c549e5ff0cda3e8a71d2bfa10dad;p=ceph.git pybind/mgr/restful: Decode the output of b64decode Need to decode the b64decode output before calling split. b64decode("YWRtaW46NzYxMmJlMTEtYjJmZS00NTA5LTlhY2ItMjYzZGQwZjJmMjUx") b'admin:7612be11-b2fe-4509-9acb-263dd0f2f251' b64decode("YWRtaW46NzYxMmJlMTEtYjJmZS00NTA5LTlhY2ItMjYzZGQwZjJmMjUx").decode() 'admin:7612be11-b2fe-4509-9acb-263dd0f2f251' Fixes: http://tracker.ceph.com/issues/38522 Signed-off-by: Brad Hubbard --- diff --git a/src/pybind/mgr/restful/decorators.py b/src/pybind/mgr/restful/decorators.py index 03a9448298c1..abf36e339ab5 100644 --- a/src/pybind/mgr/restful/decorators.py +++ b/src/pybind/mgr/restful/decorators.py @@ -18,7 +18,7 @@ def auth(f): response.headers['WWW-Authenticate'] = 'Basic realm="Login Required"' return {'message': 'auth: No HTTP username/password'} - username, password = b64decode(request.authorization[1]).split(':') + username, password = b64decode(request.authorization[1]).decode('utf-8').split(':') # Check that the username exists if username not in context.instance.keys: