Browse Source

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

master
Alex 'AdUser' Z 8 years ago
parent
commit
e0f430eb8c
  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_JAIL_STATUS = 16,
CMD_JAIL_SET,
CMD_JAIL_IP_SHOW,
CMD_JAIL_IP_STATUS,
CMD_JAIL_IP_BAN,
CMD_JAIL_IP_RELEASE,
CMD_MAX_NUMBER,

8
src/commands.c

@ -53,8 +53,8 @@ struct f2b_cmd_t {
.tokens = { "jail", "<jailname>", "set", "<param>", "<value>", NULL },
.help = "Set parameter of given jail",
},
[CMD_JAIL_IP_SHOW] = {
.tokens = { "jail", "<jailname>", "show", "<ip>", NULL },
[CMD_JAIL_IP_STATUS] = {
.tokens = { "jail", "<jailname>", "status", "<ip>", NULL },
.help = "Show ip status in given jail",
},
[CMD_JAIL_IP_BAN] = {
@ -143,10 +143,10 @@ f2b_cmd_parse(const char *src, char *buf, size_t buflen) {
strlcat(buf, "\n", buflen);
return CMD_JAIL_SET;
}
if (tokenc == 4 && strcmp(tokens[2], "show") == 0) {
if (tokenc == 4 && strcmp(tokens[2], "status") == 0) {
strlcat(buf, tokens[3], buflen);
strlcat(buf, "\n", buflen);
return CMD_JAIL_IP_SHOW;
return CMD_JAIL_IP_STATUS;
}
if (tokenc == 4 && strcmp(tokens[2], "ban") == 0) {
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_SHOW && msg->type <= CMD_JAIL_IP_RELEASE)) {
if (jail && (msg->type >= CMD_JAIL_IP_STATUS && msg->type <= CMD_JAIL_IP_RELEASE)) {
if (args[1] == NULL) {
strlcpy(res, "can't find ip: no args", ressize);
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) {
f2b_jail_get_status(jail, res, ressize);
} else if (msg->type == CMD_JAIL_IP_SHOW) {
} else if (msg->type == CMD_JAIL_IP_STATUS) {
f2b_ipaddr_status(addr, res, ressize);
} else if (msg->type == CMD_JAIL_IP_BAN) {
f2b_jail_ban(jail, addr);

Loading…
Cancel
Save