Allow URL-safe base64 cephx keys to be decoded.

In these cases + and / are replaced by - and _ to prevent problems when using
the base64 strings in URLs.

Signed-off-by: Wido den Hollander <wido@widodh.nl>
Signed-off-by: Sage Weil <sage@inktank.com>
This commit is contained in:
Wido den Hollander 2012-07-05 15:29:54 +02:00 committed by Sage Weil
parent f67fe4e368
commit ea11c7f9d8

View File

@ -24,9 +24,9 @@ static int decode_bits(char c)
return c - 'a' + 26;
if (c >= '0' && c <= '9')
return c - '0' + 52;
if (c == '+')
if (c == '+' || c == '-')
return 62;
if (c == '/')
if (c == '/' || c == '_')
return 63;
if (c == '=')
return 0; /* just non-negative, please */