#include "ircd_chattr.h"
#include "ircd_reply.h"
#include "ircd_string.h"
-#include "map.h"
#include "msg.h"
#include "numeric.h"
#include "numnicks.h"
TOK_ERROR,
0, MAXPARA, MFLG_SLOW | MFLG_UNREG, 0,
/* UNREG, CLIENT, SERVER, OPER, SERVICE */
- { mr_error, m_ignore, ms_error, m_ignore, m_ignore }
+ { m_ignore, m_ignore, ms_error, m_ignore, m_ignore }
},
{
MSG_KILL,
TOK_PASS,
0, MAXPARA, MFLG_SLOW | MFLG_UNREG, 0,
/* UNREG, CLIENT, SERVER, OPER, SERVICE */
- { m_pass, m_registered, m_ignore, m_registered, m_ignore }
+ { mr_pass, m_registered, m_ignore, m_registered, m_ignore }
},
{
MSG_LUSERS,
TOK_OPER,
0, MAXPARA, MFLG_SLOW, 0,
/* UNREG, CLIENT, SERVER, OPER, SERVICE */
+#ifndef NOOPER
{ m_unregistered, m_oper, ms_oper, mo_oper, m_ignore }
+#else
+ { m_unregistered, m_oper, m_ignore, m_ignore, m_ignore }
+#endif
},
{
MSG_CONNECT,
/* UNREG, CLIENT, SERVER, OPER, SERVICE */
{ m_proto, m_proto, m_proto, m_proto, m_ignore }
},
+ {
+ MSG_SET,
+ TOK_SET,
+ 0, MAXPARA, MFLG_SLOW, 0,
+ /* UNREG, CLIENT, SERVER, OPER, SERVICE */
+ { m_unregistered, m_not_oper, m_ignore, mo_set, m_ignore }
+ },
+ {
+ MSG_RESET,
+ TOK_RESET,
+ 0, MAXPARA, MFLG_SLOW, 0,
+ /* UNREG, CLIENT, SERVER, OPER, SERVICE */
+ { m_unregistered, m_not_oper, m_ignore, mo_reset, m_ignore }
+ },
+ {
+ MSG_GET,
+ TOK_GET,
+ 0, MAXPARA, MFLG_SLOW, 0,
+ /* UNREG, CLIENT, SERVER, OPER, SERVICE */
+ { m_unregistered, m_not_oper, m_ignore, mo_get, m_ignore }
+ },
+ /* This command is an alias for QUIT during the unregistered part of
+ * of the server. This is because someone jumping via a broken web
+ * proxy will send a 'POST' as their first command - which we will
+ * obviously disconnect them immediately for, stopping people abusing
+ * open gateways
+ */
+ {
+ MSG_POST,
+ TOK_POST,
+ 0, MAXPARA, MFLG_SLOW, 0,
+ /* UNREG, CLIENT, SERVER, OPER, SERVICE */
+ { m_quit, m_ignore, m_ignore, m_ignore, m_ignore }
+ },
{ 0 }
};
int ii;
struct Message **msgtab_tok;
struct Message **msgtok;
-
+
for (i = 0; msg->cmd; ++i, ++msg)
continue;
qsort(msgtab, i, sizeof(struct Message),
struct Message* mptr;
MessageHandler handler = 0;
- Debug((DEBUG_DEBUG, "Parsing: %s", buffer));
+ Debug((DEBUG_DEBUG, "Client Parsing: %s", buffer));
if (IsDead(cptr))
return 0;
- para[0] = from->name;
+ para[0] = cli_name(from);
for (ch = buffer; *ch == ' '; ch++); /* Eat leading spaces */
if (*ch == ':') /* Is any client doing this ? */
{
{
ServerStats->is_empt++;
Debug((DEBUG_NOTICE, "Empty message from host %s:%s",
- cptr->name, from->name));
+ cli_name(cptr), cli_name(from)));
return (-1);
}
}
para[++i] = NULL;
++mptr->count;
-#if 0
- /*
- * The "unregistered command check" was ugly and mildly inefficient.
- * I fixed it. :) --Shadow
- */
- if (!IsUser(cptr) && 0 == (mptr->flags & MFLG_UNREG)) {
- if (0 == (mptr->flags & MFLG_IGNORE))
- sendto_one(from, ":%s %d * %s :Register first.", /* XXX DEAD */
- me.name, ERR_NOTREGISTERED, ch);
- return -1;
- }
-#endif
- handler = mptr->handlers[cptr->handler];
+
+ handler = mptr->handlers[cli_handler(cptr)];
assert(0 != handler);
#ifndef IDLE_FROM_MSG
if (IsUser(cptr) && handler != m_ping && handler != m_ignore)
- from->user->last = CurrentTime;
+ cli_user(from)->last = CurrentTime;
#endif
return (*handler) (cptr, from, i, para);
int paramcount;
struct Message* mptr;
- Debug((DEBUG_DEBUG, "Parsing: %s", buffer));
-
-#ifdef GODMODE
- len = strlen(buffer);
- sdbflag = 1;
- if (len > 402)
- {
- char c = buffer[200];
- buffer[200] = 0;
- sendto_ops("RCV:%-8.8s(%.4d): \"%s...%s\"",
- cptr->name, len, buffer, &buffer[len - 200]);
- buffer[200] = c;
- }
- else
- sendto_ops("RCV:%-8.8s(%.4d): \"%s\"", cptr->name, len, buffer);
- sdbflag = 0;
-#endif /* GODMODE */
+ Debug((DEBUG_DEBUG, "Server Parsing: %s", buffer));
if (IsDead(cptr))
return 0;
- para[0] = from->name;
+ para[0] = cli_name(from);
/*
* A server ALWAYS sends a prefix. When it starts with a ':' it's the
if (!from)
{
Debug((DEBUG_NOTICE, "Unknown prefix (%s)(%s) from (%s)",
- para[0], buffer, cptr->name));
+ para[0], buffer, cli_name(cptr)));
++ServerStats->is_unpf;
while (*ch == ' ')
ch++;
*/
if (ch[1] == 'Q')
{
- para[0] = cptr->name;
+ para[0] = cli_name(cptr);
from = cptr;
}
else
return 0;
}
- else if (from->from != cptr)
+ else if (cli_from(from) != cptr)
{
++ServerStats->is_wrdi;
Debug((DEBUG_NOTICE, "Fake direction: Message (%s) coming from (%s)",
- buffer, cptr->name));
+ buffer, cli_name(cptr)));
return 0;
}
}
struct Client *server;
/* Kill the unknown numeric prefix upstream if
* it's server still exists: */
- if ((server = FindNServer(numeric_prefix)) && server->from == cptr)
+ if ((server = FindNServer(numeric_prefix)) && cli_from(server) == cptr)
sendcmdto_one(&me, CMD_KILL, cptr, "%s :%s (Unknown numeric nick)",
- numeric_prefix, me.name);
+ numeric_prefix, cli_name(&me));
}
/*
* Things that must be allowed to travel
}
/* Let para[0] point to the name of the sender */
- para[0] = from->name;
+ para[0] = cli_name(from);
- if (from->from != cptr)
+ if (cli_from(from) != cptr)
{
ServerStats->is_wrdi++;
Debug((DEBUG_NOTICE, "Fake direction: Message (%s) coming from (%s)",
- buffer, cptr->name));
+ buffer, cli_name(cptr)));
return 0;
}
}
{
ServerStats->is_empt++;
Debug((DEBUG_NOTICE, "Empty message from host %s:%s",
- cptr->name, from->name));
+ cli_name(cptr), cli_name(from)));
return (-1);
}
if (len == 3 && IsDigit(*ch))
{
numeric = (*ch - '0') * 100 + (*(ch + 1) - '0') * 10 + (*(ch + 2) - '0');
- paramcount = MAXPARA;
+ paramcount = 2; /* destination, and the rest of it */
ServerStats->is_num++;
mptr = NULL; /* Init. to avoid stupid compiler warning :/ */
}
* The rest is single parameter--can
* include blanks also.
*/
- para[++i] = s + 1;
+ if (numeric)
+ para[++i] = s; /* preserve the colon to make do_numeric happy */
+ else
+ para[++i] = s + 1;
break;
}
para[++i] = s;
return (do_numeric(numeric, (*buffer != ':'), cptr, from, i, para));
mptr->count++;
- return (*mptr->handlers[cptr->handler]) (cptr, from, i, para);
+ return (*mptr->handlers[cli_handler(cptr)]) (cptr, from, i, para);
}