RESP3: allow HELLO to be used with version = 2.

This commit is contained in:
antirez 2019-02-25 16:40:58 +01:00
parent 36d1588215
commit 3b420034bb
2 changed files with 3 additions and 9 deletions

View File

@ -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");

View File

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