X-Git-Url: https://jfr.im/git/irc/rqf/shadowircd.git/blobdiff_plain/212380e3f42f585dc1ea927402252eb943f91f7b..54015b5fea2584a35aa605ebe37217010b448cff:/src/listener.c diff --git a/src/listener.c b/src/listener.c index 7ed9a69..7b92a6c 100644 --- a/src/listener.c +++ b/src/listener.c @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * - * $Id: listener.c 1675 2006-06-15 22:32:23Z jilles $ + * $Id: listener.c 3446 2007-05-14 22:21:16Z jilles $ */ #include "stdinc.h" @@ -194,7 +194,11 @@ inetport(listener_t *listener) } } - + /* + * At one point, we enforced a strange arbitrary limit here. + * We no longer do this, and just check if the fd is valid or not. + * -nenolod + */ if(fd == -1) { report_error("opening listener socket %s:%s", @@ -202,14 +206,7 @@ inetport(listener_t *listener) get_listener_name(listener), errno); return 0; } - else if((HARD_FDLIMIT - 10) < fd) - { - report_error("no more connections left for listener %s:%s", - get_listener_name(listener), - get_listener_name(listener), errno); - comm_close(fd); - return 0; - } + /* * XXX - we don't want to do all this crap for a listener * set_sock_opts(listener); @@ -480,6 +477,9 @@ add_connection(listener_t *listener, int fd, struct sockaddr *sai) if(check_reject(new_client)) return; + if(add_unknown_ip(new_client)) + return; + start_auth(new_client); } @@ -488,14 +488,13 @@ static void accept_connection(int pfd, void *data) { static time_t last_oper_notice = 0; - struct irc_sockaddr_storage sai; socklen_t addrlen = sizeof(sai); int fd; listener_t *listener = data; - struct ConfItem *aconf; - char buf[BUFSIZE]; - + struct ConfItem *aconf; + char buf[BUFSIZE]; + s_assert(listener != NULL); if(listener == NULL) return; @@ -525,8 +524,9 @@ accept_connection(int pfd, void *data) /* * check for connection limit + * TBD: this is stupid... either we have a socket or we don't. -nenolod */ - if((MAXCONNECTIONS - 10) < fd) + if((comm_get_maxconnections() - 10) < fd) { ++ServerStats->is_ref; /* @@ -554,19 +554,19 @@ accept_connection(int pfd, void *data) { ServerStats->is_ref++; - if(ConfigFileEntry.dline_with_reason) - { - if (ircsnprintf(buf, sizeof(buf), "ERROR :*** Banned: %s\r\n", aconf->passwd) >= (sizeof(buf)-1)) - { - buf[sizeof(buf) - 3] = '\r'; - buf[sizeof(buf) - 2] = '\n'; - buf[sizeof(buf) - 1] = '\0'; - } - } - else - ircsprintf(buf, "ERROR :You have been D-lined.\r\n"); + if(ConfigFileEntry.dline_with_reason) + { + if (ircsnprintf(buf, sizeof(buf), "ERROR :*** Banned: %s\r\n", aconf->passwd) >= (sizeof(buf)-1)) + { + buf[sizeof(buf) - 3] = '\r'; + buf[sizeof(buf) - 2] = '\n'; + buf[sizeof(buf) - 1] = '\0'; + } + } + else + ircsprintf(buf, "ERROR :You have been D-lined.\r\n"); - write(fd, buf, strlen(buf)); + write(fd, buf, strlen(buf)); comm_close(fd); /* Re-register a new IO request for the next accept .. */