Author: Kev <klmitch@mit.edu>
authorKevin L. Mitchell <klmitch@mit.edu>
Tue, 31 Jul 2001 20:23:57 +0000 (20:23 +0000)
committerKevin L. Mitchell <klmitch@mit.edu>
Tue, 31 Jul 2001 20:23:57 +0000 (20:23 +0000)
Log message:

Finally tracked down why ERROR messages from servers we're connecting to
aren't being saved: there was no handler for ERRORs from unregistered
clients!  Curiously enough, handlers.h had a declaration for one.  Anyway,
I added one, with a test for IsUserPort() so that ordinary users can't
abuse us (I hope...), and it now works fine.  Also removed an unused
variable found while trying to track down a bug that causes some servers
and users to not be sent in the BURST--I haven't yet tracked that bug down,
unfortunately.

git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@546 c9e4aea6-c8fd-4c43-8297-357d70d61c8c

ChangeLog
ircd/m_error.c
ircd/parse.c
ircd/s_serv.c

index e25fc068a14748f7d626a0f085225fa5e9913284..0ee966bec0d2d093c0c1beba2f842d4564dedd95 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2001-07-31  Kevin L. Mitchell  <klmitch@mit.edu>
+
+       * ircd/s_serv.c (server_estab): remove unused variable split
+
+       * ircd/parse.c: add mr_error to the parse table
+
+       * ircd/m_error.c (mr_error): add mr_error() to handle ERRORs from
+       unregistered connections--if IsUserPort() is true, the ERROR is
+       ignored, otherwise, the message is saved
+
 2001-07-28  Kevin L. Mitchell  <klmitch@mit.edu>
 
        * ircd/m_kill.c (ms_kill): another minor typo *sigh*
index ffe19ff6e682a8fac873fce294ffac47a8e97f32..5249a5fceea353cfc664decc58b5fc4fce108545 100644 (file)
 #include <assert.h>
 #include <string.h>
 
+/*
+ * mr_error - unregistered client message handler
+ *
+ * parv[0] = sender prefix
+ * parv[parc-1] = text
+ */
+int mr_error(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
+{
+  const char *para;
+
+  if (IsUserPort(cptr))
+    return 0; /* ignore ERROR from regular clients */
+
+  para = (parc > 1 && *parv[parc - 1] != '\0') ? parv[parc - 1] : "<>";
+
+  Debug((DEBUG_ERROR, "Received ERROR message from %s: %s", cli_name(sptr), para));
+
+  if (cptr == sptr)
+    sendto_opmask_butone(0, SNO_OLDSNO, "ERROR :from %C -- %s", cptr, para);
+  else
+    sendto_opmask_butone(0, SNO_OLDSNO, "ERROR :from %C via %C -- %s", sptr,
+                        cptr, para);
+
+  if (cli_serv(sptr))
+  {
+    MyFree(cli_serv(sptr)->last_error_msg);
+    DupString(cli_serv(sptr)->last_error_msg, para);
+  }
+
+  return 0;
+}
+
 /*
  * ms_error - server message handler
  *
index 77a37ee3f75f5719936f674bf49ca464ceeaf457..21fd15e40e74a2fdf4bce4ee8948908403c7c19f 100644 (file)
@@ -217,7 +217,7 @@ struct Message msgtab[] = {
     TOK_ERROR,
     0, MAXPARA, MFLG_SLOW | MFLG_UNREG, 0,
     /* UNREG, CLIENT, SERVER, OPER, SERVICE */
-    { m_ignore, m_ignore, ms_error, m_ignore, m_ignore }
+    { mr_error, m_ignore, ms_error, m_ignore, m_ignore }
   },
   {
     MSG_KILL,
index e7b3ddf79f62b0b55ff37eb190411a4d52f64742..f66cf0d01fa5a995e5596c0681397a3e7a87f04c 100644 (file)
@@ -97,13 +97,11 @@ int server_estab(struct Client *cptr, struct ConfItem *aconf)
 {
   struct Client* acptr = 0;
   const char*    inpath;
-  int split,     i;
+  int            i;
 
   assert(0 != cptr);
   assert(0 != cli_local(cptr));
 
-  split = (0 != ircd_strcmp(cli_name(cptr), cli_sockhost(cptr))
-      &&   0 != ircd_strncmp(cli_info(cptr), "JUPE", 4));
   inpath = cli_name(cptr);
 
   if (IsUnknown(cptr)) {
@@ -212,9 +210,6 @@ int server_estab(struct Client *cptr, struct ConfItem *aconf)
 
       if (0 == match(cli_name(&me), cli_name(acptr)))
         continue;
-      split = (MyConnect(acptr) && 
-               0 != ircd_strcmp(cli_name(acptr), cli_sockhost(acptr)) &&
-               0 != ircd_strncmp(cli_info(acptr), "JUPE", 4));
       sendcmdto_one(cli_serv(acptr)->up, CMD_SERVER, cptr,
                    "%s %d 0 %Tu %s%u %s%s +%s%s :%s", cli_name(acptr),
                    cli_hopcount(acptr) + 1, cli_serv(acptr)->timestamp,