- char *clnts = NULL, *ap = NULL, *ret;
- struct access_info *ai, *tmp_ai;
- struct http_client *hc, *tmp_hc;
-
- list_for_each_entry_safe(ai, tmp_ai, &access_perm_list, node) {
- char *tmp = make_message("%s%s/%d ", ap? ap : "",
- inet_ntoa(ai->addr), ai->netmask);
- free(ap);
- ap = tmp;
- }
- list_for_each_entry_safe(hc, tmp_hc, &clients, node) {
- char *tmp = make_message("%s%s:%d ", clnts? clnts : "",
- CLIENT_ADDR(hc), CLIENT_PORT(hc));
- free(clnts);
- clnts = tmp;
- }
- ret = make_message(
- "http status: %s\n"
- "http tcp port: %d\n"
- "http clients: %d\n"
- "http maximal number of clients: %d%s\n"
- "http connected clients: %s\n"
- "http access %s list: %s\n",
- (self->status == SENDER_ON)? "on" : "off",
- conf.http_port_arg,
- numclients,
- conf.http_max_clients_arg,
- conf.http_max_clients_arg > 0? "" : " (unlimited)",
- clnts? clnts : "(none)",
- conf.http_default_deny_given? "allow" : "deny",
- ap? ap : "(none)"
- );
- free(ap);
- free(clnts);
- return ret;
-}
-
-static void init_access_control_list(void)
-{
- int i;
- struct sender_command_data scd;
-
- INIT_LIST_HEAD(&access_perm_list);
- for (i = 0; i < conf.http_access_given; i++) {
- char *arg = para_strdup(conf.http_access_arg[i]);
- char *p = strchr(arg, '/');
- if (!p)
- goto err;
- *p = '\0';
- if (!inet_aton(arg, &scd.addr))
- goto err;
- scd.netmask = atoi(++p);
- if (scd.netmask < 0 || scd.netmask > 32)
- goto err;
- add_perm_list_entry(&scd);
- goto success;
-err:
- PARA_CRIT_LOG("syntax error for http_access option "
- "#%d, ignoring\n", i);
-success:
- free(arg);
- continue;
- }
-}
-
-static char *http_help(void)
-{
- return make_message(
- "usage: {on|off}\n"
- "usage: {allow|deny} IP mask\n"
- "example: allow 127.0.0.1 32\n"
- );