X-Git-Url: https://jfr.im/git/irc/rqf/shadowircd.git/blobdiff_plain/206b1ee61b6657a8be3f4d7a20e993eb7358abcc..8db00894ab7750513d8750290e508b5802bc1fc5:/src/s_conf.c diff --git a/src/s_conf.c b/src/s_conf.c index 76f1f79..d35eed4 100644 --- a/src/s_conf.c +++ b/src/s_conf.c @@ -42,13 +42,13 @@ #include "hostmask.h" #include "modules.h" #include "numeric.h" -#include "s_log.h" +#include "logger.h" #include "send.h" #include "s_gline.h" -#include "patricia.h" #include "reject.h" #include "cache.h" #include "blacklist.h" +#include "sslproc.h" struct config_server_hide ConfigServerHide; @@ -83,7 +83,7 @@ static int attach_iline(struct Client *, struct ConfItem *); void init_s_conf(void) { - confitem_heap = rb_bh_create(sizeof(struct ConfItem), CONFITEM_HEAP_SIZE); + confitem_heap = rb_bh_create(sizeof(struct ConfItem), CONFITEM_HEAP_SIZE, "confitem_heap"); rb_event_addish("expire_temp_klines", expire_temp_kd, &temp_klines[TEMP_MIN], 60); rb_event_addish("expire_temp_dlines", expire_temp_kd, &temp_dlines[TEMP_MIN], 60); @@ -246,7 +246,7 @@ 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 @@ -408,13 +408,13 @@ verify_access(struct Client *client_p, const char *username) static int add_ip_limit(struct Client *client_p, struct ConfItem *aconf) { - patricia_node_t *pnode; + rb_patricia_node_t *pnode; /* If the limits are 0 don't do anything.. */ if(ConfCidrAmount(aconf) == 0 || ConfCidrBitlen(aconf) == 0) return -1; - pnode = match_ip(ConfIpLimits(aconf), (struct sockaddr *)&client_p->localClient->ip); + pnode = rb_match_ip(ConfIpLimits(aconf), (struct sockaddr *)&client_p->localClient->ip); if(pnode == NULL) pnode = make_and_lookup_ip(ConfIpLimits(aconf), (struct sockaddr *)&client_p->localClient->ip, ConfCidrBitlen(aconf)); @@ -429,7 +429,7 @@ add_ip_limit(struct Client *client_p, struct ConfItem *aconf) /* This should only happen if the limits are set to 0 */ if((unsigned long) pnode->data == 0) { - patricia_remove(ConfIpLimits(aconf), pnode); + rb_patricia_remove(ConfIpLimits(aconf), pnode); } return (0); } @@ -442,20 +442,20 @@ add_ip_limit(struct Client *client_p, struct ConfItem *aconf) static void remove_ip_limit(struct Client *client_p, struct ConfItem *aconf) { - patricia_node_t *pnode; + rb_patricia_node_t *pnode; /* If the limits are 0 don't do anything.. */ if(ConfCidrAmount(aconf) == 0 || ConfCidrBitlen(aconf) == 0) return; - pnode = match_ip(ConfIpLimits(aconf), (struct sockaddr *)&client_p->localClient->ip); + pnode = rb_match_ip(ConfIpLimits(aconf), (struct sockaddr *)&client_p->localClient->ip); if(pnode == NULL) return; pnode->data--; if(((unsigned long) pnode->data) == 0) { - patricia_remove(ConfIpLimits(aconf), pnode); + rb_patricia_remove(ConfIpLimits(aconf), pnode); } } @@ -722,7 +722,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 @@ -839,7 +839,7 @@ set_default_conf(void) ConfigFileEntry.reject_duration = 120; ConfigFileEntry.max_unknown_ip = 2; - ServerInfo.max_clients = rb_get_maxconnections() - MAX_BUFFER; + ServerInfo.default_max_clients = MAXCONNECTIONS; } #undef YES @@ -883,6 +883,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; @@ -890,7 +910,8 @@ validate_conf(void) if(!split_users || !split_servers || (!ConfigChannel.no_create_on_split && !ConfigChannel.no_join_on_split)) { - eventDelete(check_splitmode, NULL); + rb_event_delete(check_splitmode_ev); + check_splitmode_ev = NULL; splitmode = 0; splitchecking = 0; } @@ -1240,6 +1261,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;