Merge pull request #7041 from hwware/trackingfix

CLIENT TRACKING Command Fix: Add More Checking for OPTIN/OPTOUT mode
This commit is contained in:
Salvatore Sanfilippo 2020-04-02 11:22:30 +02:00 committed by GitHub
commit 8d6dc136e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2326,6 +2326,25 @@ NULL
return; 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); enableTracking(c,redir,options,prefix,numprefix);
} else if (!strcasecmp(c->argv[2]->ptr,"off")) { } else if (!strcasecmp(c->argv[2]->ptr,"off")) {
disableTracking(c); disableTracking(c);