From 8bb961c29afd9b1956060881283afc5c5877bcce Mon Sep 17 00:00:00 2001 From: Max Lv Date: Wed, 26 Oct 2016 10:28:49 +0800 Subject: [PATCH] Ignore IPs in white list. #899 --- src/server.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/server.c b/src/server.c index b20a4267..f203535b 100644 --- a/src/server.c +++ b/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;