summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2018-12-19 17:56:50 +0100
committerantirez <antirez@gmail.com>2018-12-21 11:42:52 +0100
commitd4c4a1b2a4b9483cbd7a1e4432089585d43b8be9 (patch)
tree58dfb1161c2b496a8be7196eca4fd0f8262a5cfb
parentd5cde5e8f6697a00c59a040ff9ef1c857f2f857b (diff)
downloadredis-d4c4a1b2a4b9483cbd7a1e4432089585d43b8be9.tar.gz
RESP3: Allow any command in RESP3 Pub/Sub mode.
-rw-r--r--src/server.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/server.c b/src/server.c
index c5b667886..d85e10d95 100644
--- a/src/server.c
+++ b/src/server.c
@@ -2681,8 +2681,9 @@ int processCommand(client *c) {
return C_OK;
}
- /* Only allow SUBSCRIBE and UNSUBSCRIBE in the context of Pub/Sub */
- if (c->flags & CLIENT_PUBSUB &&
+ /* Only allow a subset of commands in the context of Pub/Sub if the
+ * connection is in RESP2 mode. With RESP3 there are no limits. */
+ if ((c->flags & CLIENT_PUBSUB && c->resp == 2) &&
c->cmd->proc != pingCommand &&
c->cmd->proc != subscribeCommand &&
c->cmd->proc != unsubscribeCommand &&