Added additional validation for cluster SETSLOT (#9360)

This commit is contained in:
Madelyn Olson 2021-08-12 14:59:17 -07:00 committed by GitHub
parent 2402f5a7a1
commit 0cf2df84d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4652,6 +4652,10 @@ NULL
(char*)c->argv[4]->ptr);
return;
}
if (nodeIsSlave(n)) {
addReplyError(c,"Target node is not a master");
return;
}
server.cluster->migrating_slots_to[slot] = n;
} else if (!strcasecmp(c->argv[3]->ptr,"importing") && c->argc == 5) {
if (server.cluster->slots[slot] == myself) {
@ -4664,6 +4668,10 @@ NULL
(char*)c->argv[4]->ptr);
return;
}
if (nodeIsSlave(n)) {
addReplyError(c,"Target node is not a master");
return;
}
server.cluster->importing_slots_from[slot] = n;
} else if (!strcasecmp(c->argv[3]->ptr,"stable") && c->argc == 4) {
/* CLUSTER SETSLOT <SLOT> STABLE */