X-Git-Url: https://jfr.im/git/irc/rqf/shadowircd.git/blobdiff_plain/0cca1f52c46ee9e258ac9a41118d1a12935138ea..c4633508eeb42a635e9a1228a7e9420b833f3453:/src/s_conf.c diff --git a/src/s_conf.c b/src/s_conf.c index e34a77e..cc316e0 100644 --- a/src/s_conf.c +++ b/src/s_conf.c @@ -42,12 +42,12 @@ #include "hostmask.h" #include "modules.h" #include "numeric.h" -#include "s_log.h" +#include "logger.h" #include "send.h" -#include "s_gline.h" #include "reject.h" #include "cache.h" #include "blacklist.h" +#include "sslproc.h" struct config_server_hide ConfigServerHide; @@ -194,7 +194,7 @@ check_client(struct Client *client_p, struct Client *source_p, const char *usern source_p->name, IsGotId(source_p) ? "" : "~", source_p->username, source_p->sockhost); - ServerStats->is_ref++; + ServerStats.is_ref++; exit_client(client_p, source_p, &me, "Too many host connections (local)"); break; @@ -208,7 +208,7 @@ check_client(struct Client *client_p, struct Client *source_p, const char *usern source_p->name, IsGotId(source_p) ? "" : "~", source_p->username, source_p->sockhost); - ServerStats->is_ref++; + ServerStats.is_ref++; exit_client(client_p, source_p, &me, "Too many host connections (global)"); break; @@ -222,7 +222,7 @@ check_client(struct Client *client_p, struct Client *source_p, const char *usern source_p->name, IsGotId(source_p) ? "" : "~", source_p->username, source_p->sockhost); - ServerStats->is_ref++; + ServerStats.is_ref++; exit_client(client_p, source_p, &me, "Too many user connections (global)"); break; @@ -237,7 +237,7 @@ check_client(struct Client *client_p, struct Client *source_p, const char *usern source_p->name, IsGotId(source_p) ? "" : "~", source_p->username, source_p->sockhost); - ServerStats->is_ref++; + ServerStats.is_ref++; exit_client(client_p, source_p, &me, "No more connections allowed in your connection class"); break; @@ -245,14 +245,14 @@ check_client(struct Client *client_p, struct Client *source_p, const char *usern case NOT_AUTHORISED: { int port = -1; -#ifdef IPV6 +#ifdef RB_IPV6 if(source_p->localClient->ip.ss_family == AF_INET6) port = ntohs(((struct sockaddr_in6 *)&source_p->localClient->listener->addr)->sin6_port); else #endif port = ntohs(((struct sockaddr_in *)&source_p->localClient->listener->addr)->sin_port); - ServerStats->is_ref++; + ServerStats.is_ref++; /* jdc - lists server name & port connections are on */ /* a purely cosmetical change */ /* why ipaddr, and not just source_p->sockhost? --fl */ @@ -280,7 +280,7 @@ check_client(struct Client *client_p, struct Client *source_p, const char *usern } case BANNED_CLIENT: exit_client(client_p, client_p, &me, "*** Banned "); - ServerStats->is_ref++; + ServerStats.is_ref++; break; case 0: @@ -378,18 +378,6 @@ verify_access(struct Client *client_p, const char *username) add_reject(client_p, aconf->user, aconf->host); return (BANNED_CLIENT); } - else if(aconf->status & CONF_GLINE) - { - sendto_one_notice(client_p, ":*** G-lined"); - - if(ConfigFileEntry.kline_with_reason) - sendto_one(client_p, - form_str(ERR_YOUREBANNEDCREEP), - me.name, client_p->name, aconf->passwd); - - add_reject(client_p, aconf->user, aconf->host); - return (BANNED_CLIENT); - } return NOT_AUTHORISED; } @@ -721,7 +709,7 @@ set_default_conf(void) memset(&ServerInfo.ip, 0, sizeof(ServerInfo.ip)); ServerInfo.specific_ipv4_vhost = 0; -#ifdef IPV6 +#ifdef RB_IPV6 memset(&ServerInfo.ip6, 0, sizeof(ServerInfo.ip6)); ServerInfo.specific_ipv6_vhost = 0; #endif @@ -775,15 +763,10 @@ set_default_conf(void) ConfigFileEntry.fname_operlog = NULL; ConfigFileEntry.fname_foperlog = NULL; ConfigFileEntry.fname_serverlog = NULL; - ConfigFileEntry.fname_glinelog = NULL; ConfigFileEntry.fname_klinelog = NULL; ConfigFileEntry.fname_operspylog = NULL; ConfigFileEntry.fname_ioerrorlog = NULL; - ConfigFileEntry.glines = NO; ConfigFileEntry.use_egd = NO; - ConfigFileEntry.gline_time = 12 * 3600; - ConfigFileEntry.gline_min_cidr = 16; - ConfigFileEntry.gline_min_cidr6 = 48; ConfigFileEntry.hide_spoof_ips = YES; ConfigFileEntry.hide_error_messages = 1; ConfigFileEntry.dots_in_ident = 0; @@ -838,7 +821,7 @@ set_default_conf(void) ConfigFileEntry.reject_duration = 120; ConfigFileEntry.max_unknown_ip = 2; - ServerInfo.max_clients = maxconnections - MAX_BUFFER; + ServerInfo.default_max_clients = MAXCONNECTIONS; } #undef YES @@ -882,6 +865,26 @@ validate_conf(void) if(ServerInfo.network_desc == NULL) ServerInfo.network_desc = rb_strdup(NETWORK_DESC_DEFAULT); + if(ServerInfo.ssld_count < 1) + ServerInfo.ssld_count = 1; + + if(!rb_setup_ssl_server(ServerInfo.ssl_cert, ServerInfo.ssl_private_key, ServerInfo.ssl_dh_params)) + { + ilog(L_MAIN, "WARNING: Unable to setup SSL."); + ssl_ok = 0; + } else { + ssl_ok = 1; + send_new_ssl_certs(ServerInfo.ssl_cert, ServerInfo.ssl_private_key, ServerInfo.ssl_dh_params); + } + + if(ServerInfo.ssld_count > get_ssld_count()) + { + int start = ServerInfo.ssld_count - get_ssld_count(); + /* start up additional ssld if needed */ + start_ssldaemon(start, ServerInfo.ssl_cert, ServerInfo.ssl_private_key, ServerInfo.ssl_dh_params); + + } + if((ConfigFileEntry.client_flood < CLIENT_FLOOD_MIN) || (ConfigFileEntry.client_flood > CLIENT_FLOOD_MAX)) ConfigFileEntry.client_flood = CLIENT_FLOOD_MAX; @@ -1240,6 +1243,8 @@ clear_out_old_conf(void) rb_free(ServerInfo.network_desc); ServerInfo.network_desc = NULL; + ServerInfo.ssld_count = 1; + /* clean out AdminInfo */ rb_free(AdminInfo.name); AdminInfo.name = NULL; @@ -1377,18 +1382,18 @@ write_confitem(KlineType type, struct Client *source_p, char *user, rb_snprintf(buffer, sizeof(buffer), "\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",%ld\n", user, host, reason, oper_reason, current_date, - get_oper_name(source_p), rb_current_time()); + get_oper_name(source_p), (long int)rb_current_time()); } else if(type == DLINE_TYPE) { rb_snprintf(buffer, sizeof(buffer), "\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",%ld\n", host, - reason, oper_reason, current_date, get_oper_name(source_p), rb_current_time()); + reason, oper_reason, current_date, get_oper_name(source_p), (long int)rb_current_time()); } else if(type == RESV_TYPE) { rb_snprintf(buffer, sizeof(buffer), "\"%s\",\"%s\",\"%s\",%ld\n", - host, reason, get_oper_name(source_p), rb_current_time()); + host, reason, get_oper_name(source_p), (long int)rb_current_time()); } if(fputs(buffer, out) == -1)