Browse Source

Ignore IPs in white list. #899

pull/905/head
Max Lv 8 years ago
parent
commit
8bb961c29a
1 changed files with 8 additions and 5 deletions
  1. 13
      src/server.c

13
src/server.c

@ -1436,19 +1436,22 @@ accept_cb(EV_P_ ev_io *w, int revents)
char *peer_name = get_peer_name(serverfd);
if (peer_name != NULL) {
if (check_block_list(peer_name, 0)) {
LOGE("block all requests from %s", peer_name);
close(serverfd);
return;
}
int in_white_list = 0;
if (acl) {
if ((get_acl_mode() == BLACK_LIST && acl_match_host(peer_name) == 1)
|| (get_acl_mode() == WHITE_LIST && acl_match_host(peer_name) >= 0)) {
LOGE("Access denied from %s", peer_name);
close(serverfd);
return;
} else if (acl_match_host(peer_name) == -1) {
in_white_list = 1;
}
}
if (!in_white_list && check_block_list(peer_name, 0)) {
LOGE("block all requests from %s", peer_name);
close(serverfd);
return;
}
}
int opt = 1;

Loading…
Cancel
Save