]> jfr.im git - irc/rqf/shadowircd.git/blobdiff - src/s_conf.c
Allow clearing general::kline_reason via a rehash.
[irc/rqf/shadowircd.git] / src / s_conf.c
index 98bd9b602dafc661a69a9dad2fdb3bcb0fcd3213..11f6f2a9e96b1b9c1dbb29e0dcc4a6360cd8aa1d 100644 (file)
@@ -35,8 +35,7 @@
 #include "client.h"
 #include "common.h"
 #include "hash.h"
-#include "irc_string.h"
-#include "sprintf_irc.h"
+#include "match.h"
 #include "ircd.h"
 #include "listener.h"
 #include "hostmask.h"
@@ -51,7 +50,7 @@
 
 struct config_server_hide ConfigServerHide;
 
-extern int yyparse();          /* defined in y.tab.c */
+extern int yyparse(void);              /* defined in y.tab.c */
 extern char linebuf[];
 
 #ifndef INADDR_NONE
@@ -258,7 +257,7 @@ check_client(struct Client *client_p, struct Client *source_p, const char *usern
                        /* why ipaddr, and not just source_p->sockhost? --fl */
 #if 0
                        static char ipaddr[HOSTIPLEN];
-                       inetntop_sock(&source_p->localClient->ip, ipaddr, sizeof(ipaddr));
+                       rb_inet_ntop_sock(&source_p->localClient->ip, ipaddr, sizeof(ipaddr));
 #endif
                        sendto_realops_snomask(SNO_UNAUTH, L_ALL,
                                        "Unauthorised client connection from "
@@ -309,16 +308,18 @@ verify_access(struct Client *client_p, const char *username)
                aconf = find_address_conf(client_p->host, client_p->sockhost, 
                                        client_p->username, client_p->username,
                                        (struct sockaddr *) &client_p->localClient->ip,
-                                       client_p->localClient->ip.ss_family);
+                                       client_p->localClient->ip.ss_family,
+                                       client_p->localClient->auth_user);
        }
        else
        {
-               strlcpy(non_ident, "~", sizeof(non_ident));
-               strlcat(non_ident, username, sizeof(non_ident));
+               rb_strlcpy(non_ident, "~", sizeof(non_ident));
+               rb_strlcat(non_ident, username, sizeof(non_ident));
                aconf = find_address_conf(client_p->host, client_p->sockhost,
                                        non_ident, client_p->username,
                                        (struct sockaddr *) &client_p->localClient->ip,
-                                       client_p->localClient->ip.ss_family);
+                                       client_p->localClient->ip.ss_family,
+                                       client_p->localClient->auth_user);
        }
 
        if(aconf == NULL)
@@ -356,14 +357,14 @@ verify_access(struct Client *client_p, const char *username)
                                char *host = p+1;
                                *p = '\0';
 
-                               strlcpy(client_p->username, aconf->name,
+                               rb_strlcpy(client_p->username, aconf->name,
                                        sizeof(client_p->username));
-                               strlcpy(client_p->host, host,
+                               rb_strlcpy(client_p->host, host,
                                        sizeof(client_p->host));
                                *p = '@';
                        }
                        else
-                               strlcpy(client_p->host, aconf->name, sizeof(client_p->host));
+                               rb_strlcpy(client_p->host, aconf->name, sizeof(client_p->host));
                }
                return (attach_iline(client_p, aconf));
        }
@@ -616,9 +617,9 @@ rehash(int sig)
        read_conf_files(NO);
 
        if(ServerInfo.description != NULL)
-               strlcpy(me.info, ServerInfo.description, sizeof(me.info));
+               rb_strlcpy(me.info, ServerInfo.description, sizeof(me.info));
        else
-               strlcpy(me.info, "unknown", sizeof(me.info));
+               rb_strlcpy(me.info, "unknown", sizeof(me.info));
 
        open_logfiles();
        return (0);
@@ -771,7 +772,6 @@ set_default_conf(void)
        ConfigFileEntry.hide_error_messages = 1;
        ConfigFileEntry.dots_in_ident = 0;
        ConfigFileEntry.max_targets = MAX_TARGETS_DEFAULT;
-       ConfigFileEntry.servlink_path = rb_strdup(SLPATH);
        ConfigFileEntry.egdpool_path = NULL;
        ConfigFileEntry.use_whois_actually = YES;
        ConfigFileEntry.burst_away = NO;
@@ -819,7 +819,8 @@ set_default_conf(void)
         ConfigFileEntry.reject_after_count = 5;
        ConfigFileEntry.reject_ban_time = 300;  
        ConfigFileEntry.reject_duration = 120;
-       ConfigFileEntry.max_unknown_ip = 2;
+       ConfigFileEntry.throttle_count = 4;
+       ConfigFileEntry.throttle_duration = 60;
 
        ServerInfo.default_max_clients = MAXCONNECTIONS;
 }
@@ -856,9 +857,6 @@ validate_conf(void)
        if(ConfigFileEntry.ts_max_delta < TS_MAX_DELTA_MIN)
                ConfigFileEntry.ts_max_delta = TS_MAX_DELTA_DEFAULT;
 
-       if(ConfigFileEntry.servlink_path == NULL)
-               ConfigFileEntry.servlink_path = rb_strdup(SLPATH);
-
        if(ServerInfo.network_name == NULL)
                ServerInfo.network_name = rb_strdup(NETWORK_NAME_DEFAULT);
 
@@ -899,35 +897,6 @@ validate_conf(void)
        }
 }
 
-/*
- * lookup_confhost - start DNS lookups of all hostnames in the conf
- * line and convert an IP addresses in a.b.c.d number for to IP#s.
- *
- */
-
-/*
- * conf_connect_allowed
- *
- * inputs      - pointer to inaddr
- *             - int type ipv4 or ipv6
- * output      - ban info or NULL
- * side effects        - none
- */
-struct ConfItem *
-conf_connect_allowed(struct sockaddr *addr, int aftype)
-{
-       struct ConfItem *aconf = find_dline(addr, aftype);
-
-       /* DLINE exempt also gets you out of static limits/pacing... */
-       if(aconf && (aconf->status & CONF_EXEMPTDLINE))
-               return NULL;
-
-       if(aconf != NULL)
-               return aconf;
-
-       return NULL;
-}
-
 /* add_temp_kline()
  *
  * inputs        - pointer to struct ConfItem
@@ -960,7 +929,7 @@ add_temp_kline(struct ConfItem *aconf)
        }
 
        aconf->flags |= CONF_FLAGS_TEMPORARY;
-       add_conf_by_address(aconf->host, CONF_KILL, aconf->user, aconf);
+       add_conf_by_address(aconf->host, CONF_KILL, aconf->user, NULL, aconf);
 }
 
 /* add_temp_dline()
@@ -994,7 +963,7 @@ add_temp_dline(struct ConfItem *aconf)
        }
 
        aconf->flags |= CONF_FLAGS_TEMPORARY;
-       add_conf_by_address(aconf->host, CONF_DLINE, aconf->user, aconf);
+       add_conf_by_address(aconf->host, CONF_DLINE, aconf->user, NULL, aconf);
 }
 
 /* expire_tkline()
@@ -1162,7 +1131,7 @@ read_conf_files(int cold)
 
           - Gozem 2002-07-21 
         */
-       strlcpy(conffilebuf, filename, sizeof(conffilebuf));
+       rb_strlcpy(conffilebuf, filename, sizeof(conffilebuf));
 
        if((conf_fbfile_in = fopen(filename, "r")) == NULL)
        {
@@ -1262,8 +1231,8 @@ clear_out_old_conf(void)
         */
 
        /* clean out general */
-       rb_free(ConfigFileEntry.servlink_path);
-       ConfigFileEntry.servlink_path = NULL;
+       rb_free(ConfigFileEntry.kline_reason);
+       ConfigFileEntry.kline_reason = NULL;
 
        RB_DLINK_FOREACH_SAFE(ptr, next_ptr, service_list.head)
        {
@@ -1504,10 +1473,28 @@ conf_add_d_conf(struct ConfItem *aconf)
        }
        else
        {
-               add_conf_by_address(aconf->host, CONF_DLINE, NULL, aconf);
+               add_conf_by_address(aconf->host, CONF_DLINE, NULL, NULL, aconf);
        }
 }
 
+static char *
+strip_tabs(char *dest, const char *src, size_t len)
+{
+       char *d = dest;
+
+       if(dest == NULL || src == NULL)
+               return NULL;
+
+       rb_strlcpy(dest, src, len);
+
+       while(*d)
+       {
+               if(*d == '\t')
+                       *d = ' ';
+               d++;
+       }
+       return dest;
+}
 
 /*
  * yyerror
@@ -1521,7 +1508,7 @@ yyerror(const char *msg)
 {
        char newlinebuf[BUFSIZE];
 
-       strip_tabs(newlinebuf, (const unsigned char *) linebuf, strlen(linebuf));
+       strip_tabs(newlinebuf, linebuf, strlen(linebuf));
 
        sendto_realops_snomask(SNO_GENERAL, L_ALL, "\"%s\", line %d: %s at '%s'",
                             conffilebuf, lineno + 1, msg, newlinebuf);