Skip to content
Snippets Groups Projects
Commit 02b33a75 authored by Konstantin Osipov's avatar Konstantin Osipov
Browse files

iproto: accept MP_STR *and* MP_BIN as type for authentication scramble

Accept MP_STR *and* MP_BIN as type for authentication scramble key
in IPROTO_AUTH packet.
Some codecs automatically pack non-utf-8 strings as MP_BIN. A scramble
is just an octect stream, so can (by chance) be both a utf-8 stream
and a binary stream, depending on the random seed.
parent 7b26c80b
No related merge requests found
......@@ -61,7 +61,18 @@ authenticate(const char *user_name, uint32_t len,
"authentication request body");
}
mp_next(&tuple); /* Skip authentication mechanism. */
scramble = mp_decode_str(&tuple, &scramble_len);
if (mp_typeof(*tuple) == MP_STR) {
scramble = mp_decode_str(&tuple, &scramble_len);
} else if (mp_typeof(*tuple) == MP_BIN) {
/*
* scramble is not a character stream, so some
* codecs automatically pack it as MP_BIN
*/
scramble = mp_decode_bin(&tuple, &scramble_len);
} else {
tnt_raise(ClientError, ER_INVALID_MSGPACK,
"authentication scramble");
}
if (scramble_len != SCRAMBLE_SIZE) {
/* Authentication mechanism, data. */
tnt_raise(ClientError, ER_INVALID_MSGPACK,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment