Miscellaneous bugfixes from recent commits, and a file omitted from last commit.
[ircu2.10.12-pk.git] / ircd / m_server.c
index d092fa4f2dc9e2889ca7dd40dc2e7fc9bb0341f9..6efe6bd37c7074fdb98dfdc97c30c78f35f56ab8 100644 (file)
@@ -49,7 +49,7 @@
 #include "send.h"
 #include "userload.h"
 
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
 #include <stdlib.h>
 #include <string.h>
 
@@ -123,9 +123,9 @@ check_loop_and_lh(struct Client* cptr, struct Client *sptr, time_t *ghost, const
   /*
    * Calculate type of connect limit and applicable config item.
    */
-  lhconf = find_conf_byname(cli_confs(cptr), host, CONF_SERVER);
+  lhconf = find_conf_byname(cli_confs(cptr), cli_name(cptr), CONF_SERVER);
   assert(lhconf != NULL);
-  if (cptr == sptr)
+  if (ghost)
   {
     if (!feature_bool(FEAT_HUB))
       for (ii = 0; ii <= HighestFd; ii++)
@@ -544,6 +544,9 @@ int mr_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
   /*
    * Detect protocol
    */
+  hop = atoi(parv[2]);
+  start_timestamp = atoi(parv[3]);
+  timestamp = atoi(parv[4]);
   prot = parse_protocol(parv[5]);
   if (!prot)
     return exit_client_msg(cptr, sptr, &me, "Bogus protocol (%s)", parv[5]);
@@ -551,9 +554,6 @@ int mr_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
     return exit_new_server(cptr, sptr, host, timestamp,
                            "Incompatible protocol: %s", parv[5]);
 
-  hop = atoi(parv[2]);
-  start_timestamp = atoi(parv[3]);
-  timestamp = atoi(parv[4]);
   Debug((DEBUG_INFO, "Got SERVER %s with timestamp [%s] age %Tu (%Tu)",
         host, parv[4], start_timestamp, cli_serv(&me)->timestamp));
 
@@ -624,7 +624,8 @@ int mr_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
       }
   }
 
-  check_start_timestamp(cptr, timestamp, start_timestamp, TStime());
+  recv_time = TStime();
+  check_start_timestamp(cptr, timestamp, start_timestamp, recv_time);
   ret = server_estab(cptr, aconf);
 
   if (feature_bool(FEAT_RELIABLE_CLOCK) &&
@@ -687,6 +688,9 @@ int ms_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
   /*
    * Detect protocol
    */
+  hop = atoi(parv[2]);
+  start_timestamp = atoi(parv[3]);
+  timestamp = atoi(parv[4]);
   prot = parse_protocol(parv[5]);
   if (!prot)
     return exit_client_msg(cptr, sptr, &me, "Bogus protocol (%s)", parv[5]);
@@ -694,9 +698,6 @@ int ms_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
     return exit_new_server(cptr, sptr, host, timestamp,
                            "Incompatible protocol: %s", parv[5]);
 
-  hop = atoi(parv[2]);
-  start_timestamp = atoi(parv[3]);
-  timestamp = atoi(parv[4]);
   Debug((DEBUG_INFO, "Got SERVER %s with timestamp [%s] age %Tu (%Tu)",
         host, parv[4], start_timestamp, cli_serv(&me)->timestamp));