diff options
author | Salvatore Sanfilippo <antirez@gmail.com> | 2020-04-02 11:22:30 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-02 11:22:30 +0200 |
commit | 8d6dc136e162004b874ffa868246dde7d89d447e (patch) | |
tree | 3b8ce16e422b474b874a22b76e7687a349239321 | |
parent | b73d87f5e59ae68a2b901fe5a158d6e22840214c (diff) | |
parent | 86c76cad74f9effb861dd1fc2f7d9f761b52077f (diff) | |
download | redis-8d6dc136e162004b874ffa868246dde7d89d447e.tar.gz |
Merge pull request #7041 from hwware/trackingfix
CLIENT TRACKING Command Fix: Add More Checking for OPTIN/OPTOUT mode
-rw-r--r-- | src/networking.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/networking.c b/src/networking.c index 3c754c376..85c640e34 100644 --- a/src/networking.c +++ b/src/networking.c @@ -2326,6 +2326,25 @@ NULL return; } + if (options & CLIENT_TRACKING_OPTIN && options & CLIENT_TRACKING_OPTOUT) + { + addReplyError(c, + "You can't specify both OPTIN mode and OPTOUT mode"); + zfree(prefix); + return; + } + + if ((options & CLIENT_TRACKING_OPTIN && c->flags & CLIENT_TRACKING_OPTOUT) || + (options & CLIENT_TRACKING_OPTOUT && c->flags & CLIENT_TRACKING_OPTIN)) + { + addReplyError(c, + "You can't switch OPTIN/OPTOUT mode before disabling " + "tracking for this client, and then re-enabling it with " + "a different mode."); + zfree(prefix); + return; + } + enableTracking(c,redir,options,prefix,numprefix); } else if (!strcasecmp(c->argv[2]->ptr,"off")) { disableTracking(c); |