Replicas aren't allowed to run the replicaof command

This commit is contained in:
Israel Lot
2019-03-12 18:29:12 -05:00
parent dd9616c1be
commit cc81c04185
+8
View File
@@ -2154,6 +2154,14 @@ void slaveofCommand(client *c) {
} else {
PORT_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;