From 59600ba2b200c0e9223317c51f29fdb515902ff7 Mon Sep 17 00:00:00 2001 From: "Kevin L. Mitchell" Date: Tue, 31 Jul 2001 20:23:57 +0000 Subject: [PATCH] Author: Kev 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 | 10 ++++++++++ ircd/m_error.c | 32 ++++++++++++++++++++++++++++++++ ircd/parse.c | 2 +- ircd/s_serv.c | 7 +------ 4 files changed, 44 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index e25fc06..0ee966b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2001-07-31 Kevin L. Mitchell + + * 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 * ircd/m_kill.c (ms_kill): another minor typo *sigh* diff --git a/ircd/m_error.c b/ircd/m_error.c index ffe19ff..5249a5f 100644 --- a/ircd/m_error.c +++ b/ircd/m_error.c @@ -96,6 +96,38 @@ #include #include +/* + * 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 * diff --git a/ircd/parse.c b/ircd/parse.c index 77a37ee..21fd15e 100644 --- a/ircd/parse.c +++ b/ircd/parse.c @@ -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, diff --git a/ircd/s_serv.c b/ircd/s_serv.c index e7b3ddf..f66cf0d 100644 --- a/ircd/s_serv.c +++ b/ircd/s_serv.c @@ -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, -- 2.20.1