Merge pull request #5911 from JohnSully/unstable

Replicas aren't allowed to run the replicaof command
This commit is contained in:
Salvatore Sanfilippo 2019-03-10 09:45:55 +01:00 committed by GitHub
commit 55acac04b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2038,6 +2038,14 @@ void replicaofCommand(client *c) {
} else {
long port;
if (c->flags & CLIENT_SLAVE)
{
/* If a client is already a replica they cannot run this command,
* because it involves flushing all replicas (including this client) */
addReplyError(c, "Command is not valid when client is a replica.");
return;
}
if ((getLongFromObjectOrReply(c, c->argv[2], &port, NULL) != C_OK))
return;