#include "hostmask.h"
#include "sslproc.h"
#include "hash.h"
+#include "s_assert.h"
+#include "logger.h"
#ifndef INADDR_NONE
#define INADDR_NONE ((unsigned int) 0xffffffff)
inetport(struct Listener *listener)
{
rb_fde_t *F;
- int ret;
int opt = 1;
/*
return 0;
}
- if((ret = rb_listen(F, RATBOX_SOMAXCONN)))
+ if(rb_listen(F, RATBOX_SOMAXCONN, listener->defer_accept))
{
ilog_error("listen()");
rb_close(F);
* the format "255.255.255.255"
*/
void
-add_listener(int port, const char *vhost_ip, int family, int ssl)
+add_listener(int port, const char *vhost_ip, int family, int ssl, int defer_accept)
{
struct Listener *listener;
struct rb_sockaddr_storage vaddr;
listener->F = NULL;
listener->ssl = ssl;
+ listener->defer_accept = defer_accept;
if(inetport(listener))
listener->active = 1;
char buf[BUFSIZE];
struct ConfItem *aconf;
static time_t last_oper_notice = 0;
+ int len;
if(listener->ssl && (!ssl_ok || !get_ssld_count()))
{
rb_write(F, "ERROR :All connections in use\r\n", 32);
rb_close(F);
- /* Re-register a new IO request for the next accept .. */
return 0;
}
if(ConfigFileEntry.dline_with_reason)
{
- if (rb_snprintf(buf, sizeof(buf), "ERROR :*** Banned: %s\r\n", aconf->passwd) >= (int)(sizeof(buf)-1))
+ len = rb_snprintf(buf, sizeof(buf), "ERROR :*** Banned: %s\r\n", get_user_ban_reason(aconf));
+ if (len >= (int)(sizeof(buf)-1))
{
buf[sizeof(buf) - 3] = '\r';
buf[sizeof(buf) - 2] = '\n';