Browse Source

Revert "* rename command 'jail ip show' -> 'jail ip status'"

ambiguous command
master
Alex 'AdUser' Z 8 years ago
parent
commit
a342e00e70
  1. 2
      src/cmsg.h
  2. 8
      src/commands.c
  3. 4
      src/daemon.c

2
src/cmsg.h

@ -18,7 +18,7 @@ enum f2b_cmsg_type {
CMD_SHUTDOWN, CMD_SHUTDOWN,
CMD_JAIL_STATUS = 16, CMD_JAIL_STATUS = 16,
CMD_JAIL_SET, CMD_JAIL_SET,
CMD_JAIL_IP_STATUS, CMD_JAIL_IP_SHOW,
CMD_JAIL_IP_BAN, CMD_JAIL_IP_BAN,
CMD_JAIL_IP_RELEASE, CMD_JAIL_IP_RELEASE,
CMD_JAIL_REGEX_STATS, CMD_JAIL_REGEX_STATS,

8
src/commands.c

@ -53,8 +53,8 @@ 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_STATUS] = { [CMD_JAIL_IP_SHOW] = {
.tokens = { "jail", "<jailname>", "status", "<ip>", NULL }, .tokens = { "jail", "<jailname>", "show", "<ip>", NULL },
.help = "Show ip status in given jail", .help = "Show ip status in given jail",
}, },
[CMD_JAIL_IP_BAN] = { [CMD_JAIL_IP_BAN] = {
@ -151,10 +151,10 @@ 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], "status") == 0) { if (tokenc == 4 && strcmp(tokens[2], "show") == 0) {
strlcat(buf, tokens[3], buflen); strlcat(buf, tokens[3], buflen);
strlcat(buf, "\n", buflen); strlcat(buf, "\n", buflen);
return CMD_JAIL_IP_STATUS; return CMD_JAIL_IP_SHOW;
} }
if (tokenc == 4 && strcmp(tokens[2], "ban") == 0) { if (tokenc == 4 && strcmp(tokens[2], "ban") == 0) {
strlcat(buf, tokens[3], buflen); strlcat(buf, tokens[3], buflen);

4
src/daemon.c

@ -110,7 +110,7 @@ f2b_cmsg_process(const f2b_cmsg_t *msg, char *res, size_t ressize) {
} }
} }
if (jail && (msg->type >= CMD_JAIL_IP_STATUS && msg->type <= CMD_JAIL_IP_RELEASE)) { if (jail && (msg->type >= CMD_JAIL_IP_SHOW && msg->type <= CMD_JAIL_IP_RELEASE)) {
if (args[1] == NULL) { if (args[1] == NULL) {
strlcpy(res, "can't find ip: no args", ressize); strlcpy(res, "can't find ip: no args", ressize);
return; return;
@ -142,7 +142,7 @@ f2b_cmsg_process(const f2b_cmsg_t *msg, char *res, size_t ressize) {
} }
} else if (msg->type == CMD_JAIL_STATUS) { } else if (msg->type == CMD_JAIL_STATUS) {
f2b_jail_get_status(jail, res, ressize); f2b_jail_get_status(jail, res, ressize);
} else if (msg->type == CMD_JAIL_IP_STATUS) { } else if (msg->type == CMD_JAIL_IP_SHOW) {
f2b_ipaddr_status(addr, res, ressize); f2b_ipaddr_status(addr, res, ressize);
} else if (msg->type == CMD_JAIL_IP_BAN) { } else if (msg->type == CMD_JAIL_IP_BAN) {
f2b_jail_ban(jail, addr); f2b_jail_ban(jail, addr);

Loading…
Cancel
Save