]> jfr.im git - solanum.git/blobdiff - ircd/s_newconf.c
whowas.c: store account name in whowas (#323)
[solanum.git] / ircd / s_newconf.c
index 4123312c613ca303447cf04627ac8eefaaa7ed1e..31fcc959585d91387dbd1224dbc220ef207e8b6a 100644 (file)
 #include "logger.h"
 #include "dns.h"
 
-rb_dlink_list shared_conf_list;
 rb_dlink_list cluster_conf_list;
 rb_dlink_list oper_conf_list;
-rb_dlink_list hubleaf_conf_list;
 rb_dlink_list server_conf_list;
 rb_dlink_list xline_conf_list;
 rb_dlink_list resv_conf_list;  /* nicks only! */
@@ -82,25 +80,12 @@ clear_s_newconf(void)
        rb_dlink_node *ptr;
        rb_dlink_node *next_ptr;
 
-       RB_DLINK_FOREACH_SAFE(ptr, next_ptr, shared_conf_list.head)
-       {
-               /* ptr here is ptr->data->node */
-               rb_dlinkDelete(ptr, &shared_conf_list);
-               free_remote_conf(ptr->data);
-       }
-
        RB_DLINK_FOREACH_SAFE(ptr, next_ptr, cluster_conf_list.head)
        {
                rb_dlinkDelete(ptr, &cluster_conf_list);
                free_remote_conf(ptr->data);
        }
 
-       RB_DLINK_FOREACH_SAFE(ptr, next_ptr, hubleaf_conf_list.head)
-       {
-               rb_dlinkDelete(ptr, &hubleaf_conf_list);
-               free_remote_conf(ptr->data);
-       }
-
        RB_DLINK_FOREACH_SAFE(ptr, next_ptr, oper_conf_list.head)
        {
                free_oper_conf(ptr->data);
@@ -173,31 +158,6 @@ free_remote_conf(struct remote_conf *remote_p)
        rb_free(remote_p);
 }
 
-bool
-find_shared_conf(const char *username, const char *host,
-               const char *server, int flags)
-{
-       struct remote_conf *shared_p;
-       rb_dlink_node *ptr;
-
-       RB_DLINK_FOREACH(ptr, shared_conf_list.head)
-       {
-               shared_p = ptr->data;
-
-               if(match(shared_p->username, username) &&
-                  match(shared_p->host, host) &&
-                  match(shared_p->server, server))
-               {
-                       if(shared_p->flags & flags)
-                               return true;
-                       else
-                               return false;
-               }
-       }
-
-       return false;
-}
-
 void
 propagate_generic(struct Client *source_p, const char *command,
                const char *target, int cap, const char *format, ...)
@@ -387,14 +347,14 @@ conf_connect_dns_callback(const char *result, int status, int aftype, void *data
        if(aftype == AF_INET)
        {
                if(status == 1)
-                       rb_inet_pton_sock(result, (struct sockaddr *)&server_p->connect4);
+                       rb_inet_pton_sock(result, &server_p->connect4);
 
                server_p->dns_query_connect4 = 0;
        }
        else if(aftype == AF_INET6)
        {
                if(status == 1)
-                       rb_inet_pton_sock(result, (struct sockaddr *)&server_p->connect6);
+                       rb_inet_pton_sock(result, &server_p->connect6);
 
                server_p->dns_query_connect6 = 0;
        }
@@ -418,14 +378,14 @@ conf_bind_dns_callback(const char *result, int status, int aftype, void *data)
        if(aftype == AF_INET)
        {
                if(status == 1)
-                       rb_inet_pton_sock(result, (struct sockaddr *)&server_p->bind4);
+                       rb_inet_pton_sock(result, &server_p->bind4);
 
                server_p->dns_query_bind4 = 0;
        }
        else if(aftype == AF_INET6)
        {
                if(status == 1)
-                       rb_inet_pton_sock(result, (struct sockaddr *)&server_p->bind6);
+                       rb_inet_pton_sock(result, &server_p->bind6);
 
                server_p->dns_query_bind6 = 0;
        }
@@ -543,7 +503,7 @@ set_server_conf_autoconn(struct Client *source_p, const char *name, int newval)
                else
                        server_p->flags &= ~SERVER_AUTOCONN;
 
-               sendto_realops_snomask(SNO_GENERAL, L_ALL,
+               sendto_realops_snomask(SNO_GENERAL, L_NETWIDE,
                                "%s has changed AUTOCONN for %s to %i",
                                get_oper_name(source_p), name, newval);
        }
@@ -561,7 +521,7 @@ disable_server_conf_autoconn(const char *name)
        {
                server_p->flags &= ~SERVER_AUTOCONN;
 
-               sendto_realops_snomask(SNO_GENERAL, L_ALL,
+               sendto_realops_snomask(SNO_GENERAL, L_NETWIDE,
                                "Disabling AUTOCONN for %s because of error",
                                name);
                ilog(L_SERVER, "Disabling AUTOCONN for %s because of error",
@@ -725,23 +685,44 @@ time_t
 valid_temp_time(const char *p)
 {
        time_t result = 0;
+       long current = 0;
 
-       while(*p)
-       {
-               if(IsDigit(*p))
-               {
-                       result *= 10;
-                       result += ((*p) & 0xF);
-                       p++;
-               }
-               else
+       while (*p) {
+               char *endp;
+
+               errno = 0;
+               current = strtol(p, &endp, 10);
+
+               if (errno == ERANGE)
                        return -1;
-       }
+               if (endp == p)
+                       return -1;
+
+               switch (*endp) {
+               case '\0': /* No unit was given so send it back as minutes */
+               case 'm':
+                       result += current * 60;
+                       break;
+               case 'h':
+                       result += current * 3600;
+                       break;
+               case 'd':
+                       result += current * 86400;
+                       break;
+               case 'w':
+                       result += current * 604800;
+                       break;
+               default:
+                       return -1;
+               }
 
-       if(result > (60 * 24 * 7 * 52))
-               result = (60 * 24 * 7 * 52);
+               if (*endp == '\0')
+                       break;
+
+               p = endp + 1;
+       }
 
-       return(result * 60);
+       return MIN(result, 60 * 60 * 24 * 7 * 52);
 }
 
 /* Propagated bans are expired elsewhere. */