]> jfr.im git - solanum.git/blobdiff - ircd/s_conf.c
make more snotes L_NETWIDE
[solanum.git] / ircd / s_conf.c
index 329129cbbb8c7300f24b7243df4a85d9070b4482..2aae3ddee6e11c75b8bc8572bd1fcf198f8da013 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"
@@ -266,7 +267,7 @@ check_client(struct Client *client_p, struct Client *source_p, const char *usern
                        static char ipaddr[HOSTIPLEN];
                        rb_inet_ntop_sock(&source_p->localClient->ip, ipaddr, sizeof(ipaddr));
 #endif
-                       sendto_realops_snomask(SNO_UNAUTH, L_ALL,
+                       sendto_realops_snomask(SNO_UNAUTH, L_NETWIDE,
                                        "Unauthorised client connection from "
                                        "%s!%s%s@%s [%s] on [%s/%u].",
                                        source_p->name, IsGotId(source_p) ? "" : "~",
@@ -279,9 +280,8 @@ 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,
                                source_p->localClient->listener->name, port);
-                       add_reject(client_p, NULL, NULL);
-                       exit_client(client_p, source_p, &me,
-                                   "You are not authorised to use this server");
+                       add_reject(client_p, NULL, NULL, NULL, "You are not authorised to use this server.");
+                       exit_client(client_p, source_p, &me, "You are not authorised to use this server.");
                        break;
                }
        case BANNED_CLIENT:
@@ -332,7 +332,7 @@ verify_access(struct Client *client_p, const char *username)
 
                        if(IsConfSpoofNotice(aconf))
                        {
-                               sendto_realops_snomask(SNO_GENERAL, L_ALL,
+                               sendto_realops_snomask(SNO_GENERAL, L_NETWIDE,
                                                "%s spoofing: %s as %s",
                                                client_p->name,
                                                show_ip(NULL, client_p) ? client_p->host : aconf->info.name,
@@ -363,7 +363,7 @@ verify_access(struct Client *client_p, const char *username)
                                        form_str(ERR_YOUREBANNEDCREEP),
                                        me.name, client_p->name,
                                        get_user_ban_reason(aconf));
-               add_reject(client_p, aconf->user, aconf->host);
+               add_reject(client_p, aconf->user, aconf->host, aconf, NULL);
                return (BANNED_CLIENT);
        }
 
@@ -530,6 +530,20 @@ attach_iline(struct Client *client_p, struct ConfItem *aconf)
        return (attach_conf(client_p, aconf));
 }
 
+/*
+ * deref_conf
+ *
+ * inputs      - ConfItem that is referenced by something other than a client
+ * side effects        - Decrement and free ConfItem if appropriate
+ */
+void
+deref_conf(struct ConfItem *aconf)
+{
+       aconf->clients--;
+       if(!aconf->clients && IsIllegal(aconf))
+               free_conf(aconf);
+}
+
 /*
  * detach_conf
  *
@@ -630,10 +644,12 @@ 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,
+               sendto_realops_snomask(SNO_GENERAL, L_NETWIDE,
                                     "Got signal SIGHUP, reloading ircd conf. file");
 
        rehash_authd();
@@ -648,6 +664,16 @@ rehash(bool sig)
 
        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;
 }
@@ -707,7 +733,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;
@@ -747,6 +772,7 @@ set_default_conf(void)
        ConfigFileEntry.use_propagated_bans = true;
        ConfigFileEntry.max_ratelimit_tokens = 30;
        ConfigFileEntry.away_interval = 30;
+       ConfigFileEntry.tls_ciphers_oper_only = false;
 
 #ifdef HAVE_LIBZ
        ConfigFileEntry.compression_level = 4;
@@ -779,6 +805,7 @@ set_default_conf(void)
        ConfigChannel.channel_target_change = true;
        ConfigChannel.disable_local_channels = false;
        ConfigChannel.displayed_usercount = 3;
+       ConfigChannel.opmod_send_statusmsg = false;
 
        ConfigChannel.autochanmodes = MODE_TOPICLIMIT | MODE_NOPRIVMSGS;
 
@@ -810,6 +837,7 @@ set_default_conf(void)
        ConfigFileEntry.nicklen = NICKLEN;
        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);
@@ -1110,12 +1138,17 @@ deactivate_conf(struct ConfItem *aconf, rb_dlink_node *ptr, time_t now)
                        break;
        }
        if (aconf->lifetime != 0 && now < aconf->lifetime)
+       {
                aconf->status |= CONF_ILLEGAL;
+       }
        else
        {
                if (aconf->lifetime != 0)
                        rb_dlinkDestroy(ptr, &prop_bans);
-               free_conf(aconf);
+               if (aconf->clients == 0)
+                       free_conf(aconf);
+               else
+                       aconf->status |= CONF_ILLEGAL;
        }
 }
 
@@ -1267,7 +1300,7 @@ get_oper_name(struct Client *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;
        }
 
@@ -1313,7 +1346,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. - ",
@@ -1347,7 +1381,7 @@ get_printable_kline(struct Client *source_p, struct ConfItem *aconf,
        *user = EmptyString(aconf->user) ? null : aconf->user;
        *reason = get_user_ban_reason(aconf);
 
-       if(!IsOper(source_p))
+       if(!IsOperGeneral(source_p))
                *oper_reason = NULL;
        else
        {
@@ -1402,7 +1436,7 @@ read_conf_files(bool cold)
                }
                else
                {
-                       sendto_realops_snomask(SNO_GENERAL, L_ALL,
+                       sendto_realops_snomask(SNO_GENERAL, L_NETWIDE,
                                             "Can't open file '%s' - aborting rehash!", filename);
                        return;
                }
@@ -1457,7 +1491,7 @@ clear_out_old_conf(void)
                MaxUsers(cltmp) = -1;
        }
 
-       clear_out_address_conf();
+       clear_out_address_conf(AC_CONFIG);
        clear_s_newconf();
 
        /* clean out module paths */
@@ -1501,6 +1535,14 @@ clear_out_old_conf(void)
        rb_free(ConfigFileEntry.sasl_service);
        ConfigFileEntry.sasl_service = NULL;
 
+       if (ConfigFileEntry.hidden_caps != NULL)
+       {
+               for (size_t i = 0; ConfigFileEntry.hidden_caps[i] != NULL; i++)
+                       rb_free(ConfigFileEntry.hidden_caps[i]);
+               rb_free(ConfigFileEntry.hidden_caps);
+       }
+       ConfigFileEntry.hidden_caps = NULL;
+
        /* clean out log */
        rb_free(ConfigFileEntry.fname_userlog);
        ConfigFileEntry.fname_userlog = NULL;
@@ -1534,7 +1576,7 @@ clear_out_old_conf(void)
                alias_dict = NULL;
        }
 
-       del_blacklist_all();
+       del_dnsbl_entry_all();
 
        privilegeset_mark_all_illegal();
 
@@ -1646,7 +1688,7 @@ yyerror(const char *msg)
        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'",
+       sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, "\"%s\", line %d: %s at '%s'",
                             conffilebuf, lineno + 1, msg, newlinebuf);
 
 }