|
|
@ -63,19 +63,19 @@ struct f2b_cmd_t { |
|
|
|
.tokens = { "jail", "<jailname>", "set", "<param>", "<value>", NULL }, |
|
|
|
.tokens = { "jail", "<jailname>", "set", "<param>", "<value>", NULL }, |
|
|
|
.help = "Set parameter of given jail", |
|
|
|
.help = "Set parameter of given jail", |
|
|
|
}, |
|
|
|
}, |
|
|
|
[CMD_JAIL_IP_SHOW] = { |
|
|
|
[CMD_JAIL_IP_STATUS] = { |
|
|
|
.argc = 2, .tokenc = 4, |
|
|
|
.argc = 2, .tokenc = 5, |
|
|
|
.tokens = { "jail", "<jailname>", "show", "<ip>", NULL }, |
|
|
|
.tokens = { "jail", "<jailname>", "ip", "status", "<ip>", NULL }, |
|
|
|
.help = "Show ip status in given jail", |
|
|
|
.help = "Show ip status in given jail", |
|
|
|
}, |
|
|
|
}, |
|
|
|
[CMD_JAIL_IP_BAN] = { |
|
|
|
[CMD_JAIL_IP_BAN] = { |
|
|
|
.argc = 2, .tokenc = 4, |
|
|
|
.argc = 2, .tokenc = 5, |
|
|
|
.tokens = { "jail", "<jailname>", "ban", "<ip>", NULL }, |
|
|
|
.tokens = { "jail", "<jailname>", "ip", "ban", "<ip>", NULL }, |
|
|
|
.help = "Forcefully ban some ip in given jail", |
|
|
|
.help = "Forcefully ban some ip in given jail", |
|
|
|
}, |
|
|
|
}, |
|
|
|
[CMD_JAIL_IP_RELEASE] = { |
|
|
|
[CMD_JAIL_IP_RELEASE] = { |
|
|
|
.argc = 2, .tokenc = 4, |
|
|
|
.argc = 2, .tokenc = 5, |
|
|
|
.tokens = { "jail", "<jailname>", "release", "<ip>", NULL }, |
|
|
|
.tokens = { "jail", "<jailname>", "ip", "release", "<ip>", NULL }, |
|
|
|
.help = "Forcefully release some ip in given jail", |
|
|
|
.help = "Forcefully release some ip in given jail", |
|
|
|
}, |
|
|
|
}, |
|
|
|
[CMD_JAIL_FILTER_STATS] = { |
|
|
|
[CMD_JAIL_FILTER_STATS] = { |
|
|
@ -167,18 +167,18 @@ f2b_cmd_parse(const char *src, char *buf, size_t buflen) { |
|
|
|
strlcat(buf, "\n", buflen); |
|
|
|
strlcat(buf, "\n", buflen); |
|
|
|
return CMD_JAIL_SET; |
|
|
|
return CMD_JAIL_SET; |
|
|
|
} |
|
|
|
} |
|
|
|
if (tokenc == 4 && strcmp(tokens[2], "show") == 0) { |
|
|
|
if (tokenc == 5 && strcmp(tokens[2], "ip") == 0 && strcmp(tokens[3], "status") == 0) { |
|
|
|
strlcat(buf, tokens[3], buflen); |
|
|
|
strlcat(buf, tokens[4], buflen); |
|
|
|
strlcat(buf, "\n", buflen); |
|
|
|
strlcat(buf, "\n", buflen); |
|
|
|
return CMD_JAIL_IP_SHOW; |
|
|
|
return CMD_JAIL_IP_STATUS; |
|
|
|
} |
|
|
|
} |
|
|
|
if (tokenc == 4 && strcmp(tokens[2], "ban") == 0) { |
|
|
|
if (tokenc == 5 && strcmp(tokens[2], "ip") == 0 && strcmp(tokens[3], "ban") == 0) { |
|
|
|
strlcat(buf, tokens[3], buflen); |
|
|
|
strlcat(buf, tokens[4], buflen); |
|
|
|
strlcat(buf, "\n", buflen); |
|
|
|
strlcat(buf, "\n", buflen); |
|
|
|
return CMD_JAIL_IP_BAN; |
|
|
|
return CMD_JAIL_IP_BAN; |
|
|
|
} |
|
|
|
} |
|
|
|
if (tokenc == 4 && strcmp(tokens[2], "release") == 0) { |
|
|
|
if (tokenc == 5 && strcmp(tokens[2], "ip") == 0 && strcmp(tokens[3], "release") == 0) { |
|
|
|
strlcat(buf, tokens[3], buflen); |
|
|
|
strlcat(buf, tokens[4], buflen); |
|
|
|
strlcat(buf, "\n", buflen); |
|
|
|
strlcat(buf, "\n", buflen); |
|
|
|
return CMD_JAIL_IP_RELEASE; |
|
|
|
return CMD_JAIL_IP_RELEASE; |
|
|
|
} |
|
|
|
} |
|
|
|