]> jfr.im git - irc/rqf/shadowircd.git/blobdiff - modules/core/m_server.c
Much clear maxconnections stuff - ported from ratbox3.
[irc/rqf/shadowircd.git] / modules / core / m_server.c
index 408fd06fc80a2341d9cab51690fbf8dbc3c2a482..4608bdbf87b6e2013c02f7bd8a1d49ac19ed8553 100644 (file)
  */
 
 #include "stdinc.h"
-#include "tools.h"
 #include "client.h"            /* client struct */
 #include "common.h"            /* TRUE bleah */
-#include "event.h"
 #include "hash.h"              /* add_to_client_hash */
 #include "irc_string.h"
 #include "ircd.h"              /* me */
 #include "numeric.h"           /* ERR_xxx */
 #include "s_conf.h"            /* struct ConfItem */
 #include "s_newconf.h"
-#include "s_log.h"             /* log level defines */
+#include "logger.h"            /* log level defines */
 #include "s_serv.h"            /* server_estab, check_server */
 #include "s_stats.h"           /* ServerStats */
+#include "scache.h"
 #include "send.h"              /* sendto_one */
 #include "msg.h"
 #include "parse.h"
@@ -133,7 +132,7 @@ mr_server(struct Client *client_p, struct Client *source_p, int parc, const char
                break;
 
        case -2:
-               sendto_realops_snomask(SNO_GENERAL, L_ALL,
+               sendto_realops_snomask(SNO_GENERAL, is_remote_connect(client_p) ? L_NETWIDE : L_ALL,
                                     "Unauthorised server connection attempt from %s: "
                                     "Bad password for server %s",
                                     get_server_name(client_p, HIDE_IP), name);
@@ -202,7 +201,7 @@ mr_server(struct Client *client_p, struct Client *source_p, int parc, const char
 
        if(has_id(client_p) && (target_p = find_id(client_p->id)) != NULL)
        {
-               sendto_realops_snomask(SNO_GENERAL, L_ALL,
+               sendto_realops_snomask(SNO_GENERAL, is_remote_connect(client_p) ? L_NETWIDE : L_ALL,
                                     "Attempt to re-introduce SID %s from %s%s",
                                     client_p->id,
                                     EmptyString(client_p->name) ? name : "",
@@ -249,7 +248,7 @@ ms_server(struct Client *client_p, struct Client *source_p, int parc, const char
        int hop;
        int hlined = 0;
        int llined = 0;
-       dlink_node *ptr;
+       rb_dlink_node *ptr;
 
        name = parv[1];
        hop = atoi(parv[2]);
@@ -332,7 +331,7 @@ ms_server(struct Client *client_p, struct Client *source_p, int parc, const char
         * leaf. If so, close the link.
         *
         */
-       DLINK_FOREACH(ptr, hubleaf_conf_list.head)
+       RB_DLINK_FOREACH(ptr, hubleaf_conf_list.head)
        {
                hub_p = ptr->data;
 
@@ -421,10 +420,12 @@ ms_server(struct Client *client_p, struct Client *source_p, int parc, const char
 
        SetServer(target_p);
 
-       dlinkAddTail(target_p, &target_p->node, &global_client_list);
-       dlinkAddTailAlloc(target_p, &global_serv_list);
+       rb_dlinkAddTail(target_p, &target_p->node, &global_client_list);
+       rb_dlinkAddTailAlloc(target_p, &global_serv_list);
        add_to_client_hash(target_p->name, target_p);
-       dlinkAdd(target_p, &target_p->lnode, &target_p->servptr->serv->servers);
+       rb_dlinkAdd(target_p, &target_p->lnode, &target_p->servptr->serv->servers);
+
+       target_p->serv->nameinfo = scache_connect(target_p->name, target_p->info, IsHidden(target_p));
 
        sendto_server(client_p, NULL, NOCAPS, NOCAPS,
                      ":%s SERVER %s %d :%s%s",
@@ -450,7 +451,7 @@ ms_sid(struct Client *client_p, struct Client *source_p, int parc, const char *p
        struct Client *target_p;
        struct remote_conf *hub_p;
        hook_data_client hdata;
-       dlink_node *ptr;
+       rb_dlink_node *ptr;
        int hop;
        int hlined = 0;
        int llined = 0;
@@ -481,7 +482,7 @@ ms_sid(struct Client *client_p, struct Client *source_p, int parc, const char *p
                ilog(L_SERVER, "Link %s cancelled, SID %s already exists",
                        client_p->name, parv[3]);
 
-               exit_client(NULL, client_p, &me, "Server Exists");
+               exit_client(NULL, client_p, &me, "SID Exists");
                return 0;
        }
 
@@ -516,7 +517,7 @@ ms_sid(struct Client *client_p, struct Client *source_p, int parc, const char *p
         * H: allows it to introduce a server matching that mask
         * L: disallows it introducing a server matching that mask
         */
-       DLINK_FOREACH(ptr, hubleaf_conf_list.head)
+       RB_DLINK_FOREACH(ptr, hubleaf_conf_list.head)
        {
                hub_p = ptr->data;
 
@@ -567,11 +568,13 @@ ms_sid(struct Client *client_p, struct Client *source_p, int parc, const char *p
        target_p->servptr = source_p;
        SetServer(target_p);
 
-       dlinkAddTail(target_p, &target_p->node, &global_client_list);
-       dlinkAddTailAlloc(target_p, &global_serv_list);
+       rb_dlinkAddTail(target_p, &target_p->node, &global_client_list);
+       rb_dlinkAddTailAlloc(target_p, &global_serv_list);
        add_to_client_hash(target_p->name, target_p);
        add_to_id_hash(target_p->id, target_p);
-       dlinkAdd(target_p, &target_p->lnode, &target_p->servptr->serv->servers);
+       rb_dlinkAdd(target_p, &target_p->lnode, &target_p->servptr->serv->servers);
+
+       target_p->serv->nameinfo = scache_connect(target_p->name, target_p->info, IsHidden(target_p));
 
        sendto_server(client_p, NULL, CAP_TS6, NOCAPS,
                      ":%s SID %s %d %s :%s%s",