Browse Source

* handler for CMD_JAIL_SET

master
Alex 'AdUser' Z 8 years ago
parent
commit
ff7cd4f35c
  1. 2
      src/daemon.c
  2. 12
      src/jail.c
  3. 9
      src/jail.h

2
src/daemon.c

@ -132,6 +132,8 @@ f2b_cmsg_process(const f2b_cmsg_t *msg, char *res, size_t ressize) {
}
} else if (msg->type == CMD_JAIL_STATUS) {
f2b_jail_cmd_status(res, ressize, jail);
} else if (msg->type == CMD_JAIL_SET) {
f2b_jail_cmd_set(res, ressize, jail, args[1], args[2]);
} else if (msg->type == CMD_JAIL_IP_STATUS) {
f2b_jail_cmd_ip_xxx(res, ressize, jail, 0, args[1]);
} else if (msg->type == CMD_JAIL_IP_BAN) {

12
src/jail.c

@ -447,6 +447,18 @@ f2b_jail_cmd_status(char *res, size_t ressize, f2b_jail_t *jail) {
jail->bancount, jail->matchcount);
}
void
f2b_jail_cmd_set(char *res, size_t ressize, f2b_jail_t *jail, const char *param, const char *value) {
assert(res != NULL);
assert(jail != NULL);
assert(param != NULL);
assert(value != NULL);
if (f2b_jail_set_param(jail, param, value))
return;
snprintf(res, ressize, "parameter not found: %s", param);
}
/**
* @brief misc operations on ip in given jail
* @param res response buffer (don't change if no error)

9
src/jail.h

@ -106,6 +106,15 @@ bool f2b_jail_stop (f2b_jail_t *jail);
* @param jail Jail pointer
*/
void f2b_jail_cmd_status (char *res, size_t ressize, f2b_jail_t *jail);
/**
* @brief Get jail status
* @param res Response buffer
* @param ressize Size of buffer above
* @param jail Jail pointer
* @param param Parameter name
* @param value Parameter value
*/
void f2b_jail_cmd_set (char *res, size_t ressize, f2b_jail_t *jail, const char *param, const char *value);
/**
* @brief ipaddr manage routine in given jail
* @param res Response buffer

Loading…
Cancel
Save