From 3b420034bb692eb871f914c1a90b556c86c3a9eb Mon Sep 17 00:00:00 2001 From: antirez Date: Mon, 25 Feb 2019 16:40:58 +0100 Subject: [PATCH] RESP3: allow HELLO to be used with version = 2. --- src/networking.c | 11 ++--------- src/server.h | 1 + 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/networking.c b/src/networking.c index e46e1b7fa..37d648577 100644 --- a/src/networking.c +++ b/src/networking.c @@ -2034,13 +2034,6 @@ void helloCommand(client *c) { return; } - /* Switching to protocol v2 is not allowed. But we send a specific - * error message in this case. */ - if (ver == 2) { - addReplyError(c,"Switching to RESP version 2 is not allowed."); - return; - } - /* At this point we need to be authenticated to continue. */ if (!c->authenticated) { addReplyError(c,"-NOAUTH HELLO must be called with the client already " @@ -2050,8 +2043,8 @@ void helloCommand(client *c) { return; } - /* Let's switch to RESP3 mode. */ - c->resp = 3; + /* Let's switch to the specified RESP mode. */ + c->resp = ver; addReplyMapLen(c,7); addReplyBulkCString(c,"server"); diff --git a/src/server.h b/src/server.h index 994952654..0e754e911 100644 --- a/src/server.h +++ b/src/server.h @@ -1737,6 +1737,7 @@ void ACLInit(void); #define ACL_DENIED_CMD 1 #define ACL_DENIED_KEY 2 int ACLCheckUserCredentials(robj *username, robj *password); +int ACLAuthenticateUser(client *c, robj *username, robj *password); unsigned long ACLGetCommandID(const char *cmdname); user *ACLGetUserByName(const char *name, size_t namelen); int ACLCheckCommandPerm(client *c);