]> jfr.im git - solanum.git/blobdiff - ircd/s_conf.c
Add general::hide_tkdline_duration
[solanum.git] / ircd / s_conf.c
index 19ea9fd073cd3e16dc86a2d4581244398c293e2a..7a166363668487e66a8b95ea08c88aece8698639 100644 (file)
@@ -25,6 +25,7 @@
 #include "stdinc.h"
 #include "ircd_defs.h"
 #include "s_conf.h"
+#include "s_user.h"
 #include "s_newconf.h"
 #include "newconf.h"
 #include "s_serv.h"
 #include "hook.h"
 #include "s_assert.h"
 #include "authproc.h"
+#include "supported.h"
 
 struct config_server_hide ConfigServerHide;
 
 extern int yyparse(void);              /* defined in y.tab.c */
-extern char linebuf[];
-
-#ifndef INADDR_NONE
-#define INADDR_NONE ((unsigned int) 0xffffffff)
-#endif
+extern char yy_linebuf[16384];         /* defined in ircd_lexer.l */
 
 static rb_bh *confitem_heap = NULL;
 
@@ -259,7 +257,7 @@ check_client(struct Client *client_p, struct Client *source_p, const char *usern
        case NOT_AUTHORISED:
                {
                        int port = -1;
-                       port = ntohs(GET_SS_PORT(&source_p->localClient->listener->addr));
+                       port = ntohs(GET_SS_PORT(&source_p->localClient->listener->addr[0]));
 
                        ServerStats.is_ref++;
                        /* jdc - lists server name & port connections are on */
@@ -593,11 +591,11 @@ attach_conf(struct Client *client_p, struct ConfItem *aconf)
        if(IsIllegal(aconf))
                return (NOT_AUTHORISED);
 
-       if(ClassPtr(aconf))
-       {
-               if(!add_ip_limit(client_p, aconf))
-                       return (TOO_MANY_LOCAL);
-       }
+       if(s_assert(ClassPtr(aconf)))
+               return (NOT_AUTHORISED);
+
+       if(!add_ip_limit(client_p, aconf))
+               return (TOO_MANY_LOCAL);
 
        if((aconf->status & CONF_CLIENT) &&
           ConfCurrUsers(aconf) >= ConfMaxUsers(aconf) && ConfMaxUsers(aconf) > 0)
@@ -633,13 +631,16 @@ attach_conf(struct Client *client_p, struct ConfItem *aconf)
 bool
 rehash(bool sig)
 {
+       rb_dlink_node *n;
+
+       hook_data_rehash hdata = { sig };
+
        if(sig)
-       {
                sendto_realops_snomask(SNO_GENERAL, L_ALL,
                                     "Got signal SIGHUP, reloading ircd conf. file");
-       }
 
        rehash_authd();
+
        /* don't close listeners until we know we can go ahead with the rehash */
        read_conf_files(false);
 
@@ -649,6 +650,18 @@ rehash(bool sig)
                rb_strlcpy(me.info, "unknown", sizeof(me.info));
 
        open_logfiles();
+
+       RB_DLINK_FOREACH(n, local_oper_list.head)
+       {
+               struct Client *oper = n->data;
+               const char *modeparv[4];
+               modeparv[0] = modeparv[1] = oper->name;
+               modeparv[2] = "+";
+               modeparv[3] = NULL;
+               user_mode(oper, oper, 3, modeparv);
+       }
+
+       call_hook(h_rehash, &hdata);
        return false;
 }
 
@@ -677,12 +690,10 @@ set_default_conf(void)
        ServerInfo.description = NULL;
        ServerInfo.network_name = NULL;
 
-       memset(&ServerInfo.ip, 0, sizeof(ServerInfo.ip));
-       ServerInfo.specific_ipv4_vhost = 0;
-#ifdef RB_IPV6
-       memset(&ServerInfo.ip6, 0, sizeof(ServerInfo.ip6));
-       ServerInfo.specific_ipv6_vhost = 0;
-#endif
+       memset(&ServerInfo.bind4, 0, sizeof(ServerInfo.bind4));
+       SET_SS_FAMILY(&ServerInfo.bind4, AF_UNSPEC);
+       memset(&ServerInfo.bind6, 0, sizeof(ServerInfo.bind6));
+       SET_SS_FAMILY(&ServerInfo.bind6, AF_UNSPEC);
 
        AdminInfo.name = NULL;
        AdminInfo.email = NULL;
@@ -709,7 +720,6 @@ set_default_conf(void)
        ConfigFileEntry.client_exit = true;
        ConfigFileEntry.dline_with_reason = true;
        ConfigFileEntry.kline_with_reason = true;
-       ConfigFileEntry.kline_delay = 0;
        ConfigFileEntry.warn_no_nline = true;
        ConfigFileEntry.non_redundant_klines = true;
        ConfigFileEntry.stats_e_disabled = false;
@@ -810,8 +820,9 @@ set_default_conf(void)
        ServerInfo.default_max_clients = MAXCONNECTIONS;
 
        ConfigFileEntry.nicklen = NICKLEN;
-       ConfigFileEntry.certfp_method = RB_SSL_CERTFP_METH_SHA1;
+       ConfigFileEntry.certfp_method = RB_SSL_CERTFP_METH_CERT_SHA1;
        ConfigFileEntry.hide_opers_in_whois = 0;
+       ConfigFileEntry.hide_opers = 0;
 
        if (!alias_dict)
                alias_dict = rb_dictionary_create("alias", rb_strcasecmp);
@@ -866,14 +877,14 @@ validate_conf(void)
                ircd_ssl_ok = false;
        } else {
                ircd_ssl_ok = true;
-               send_new_ssl_certs(ServerInfo.ssl_cert, ServerInfo.ssl_private_key, ServerInfo.ssl_dh_params, ServerInfo.ssl_cipher_list);
+               ssld_update_config();
        }
 
        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, ServerInfo.ssl_cipher_list);
+               start_ssldaemon(start);
        }
 
        if(ServerInfo.wsockd_count > get_wsockd_count())
@@ -919,6 +930,12 @@ validate_conf(void)
                splitmode = 0;
                splitchecking = 0;
        }
+
+       CharAttrs['&'] |= CHANPFX_C;
+       if (ConfigChannel.disable_local_channels)
+               CharAttrs['&'] &= ~CHANPFX_C;
+
+       chantypes_update();
 }
 
 /* add_temp_kline()
@@ -1257,13 +1274,13 @@ char *
 get_oper_name(struct Client *client_p)
 {
        /* +5 for !,@,{,} and null */
-       static char buffer[NICKLEN + USERLEN + HOSTLEN + HOSTLEN + 5];
+       static char buffer[NAMELEN + USERLEN + HOSTLEN + HOSTLEN + 5];
 
        if(MyOper(client_p))
        {
                snprintf(buffer, sizeof(buffer), "%s!%s@%s{%s}",
                                client_p->name, client_p->username,
-                               client_p->host, client_p->localClient->opername);
+                               client_p->host, client_p->user->opername);
                return buffer;
        }
 
@@ -1309,7 +1326,8 @@ get_user_ban_reason(struct ConfItem *aconf)
 {
        static char reasonbuf[BUFSIZE];
 
-       if (aconf->flags & CONF_FLAGS_TEMPORARY &&
+       if (!ConfigFileEntry.hide_tkdline_duration &&
+                       aconf->flags & CONF_FLAGS_TEMPORARY &&
                        (aconf->status == CONF_KILL || aconf->status == CONF_DLINE))
                snprintf(reasonbuf, sizeof reasonbuf,
                                "Temporary %c-line %d min. - ",
@@ -1609,15 +1627,15 @@ conf_add_d_conf(struct ConfItem *aconf)
        }
 }
 
-static char *
-strip_tabs(char *dest, const char *src, size_t len)
+static void
+strip_tabs(char *dest, const char *src, size_t size)
 {
        char *d = dest;
 
        if(dest == NULL || src == NULL)
-               return NULL;
+               return;
 
-       rb_strlcpy(dest, src, len);
+       rb_strlcpy(dest, src, size);
 
        while(*d)
        {
@@ -1625,7 +1643,6 @@ strip_tabs(char *dest, const char *src, size_t len)
                        *d = ' ';
                d++;
        }
-       return dest;
 }
 
 /*
@@ -1640,7 +1657,7 @@ yyerror(const char *msg)
 {
        char newlinebuf[BUFSIZE];
 
-       strip_tabs(newlinebuf, linebuf, strlen(linebuf));
+       strip_tabs(newlinebuf, yy_linebuf, sizeof(newlinebuf));
 
        ierror("\"%s\", line %d: %s at '%s'", conffilebuf, lineno + 1, msg, newlinebuf);
        sendto_realops_snomask(SNO_GENERAL, L_ALL, "\"%s\", line %d: %s at '%s'",