#include "ircd.h"
#include "ircd_alloc.h"
#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_PONG,
0, MAXPARA, MFLG_SLOW | MFLG_UNREG, 0,
/* UNREG, CLIENT, SERVER, OPER, SERVICE */
- { mr_pong, m_pong, ms_pong, m_ignore, m_ignore }
+ { mr_pong, m_pong, ms_pong, m_pong, m_ignore }
},
{
MSG_ERROR,
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,
TOK_GLINE,
0, MAXPARA, MFLG_SLOW, 0,
/* UNREG, CLIENT, SERVER, OPER, SERVICE */
- { m_unregistered, m_not_oper, ms_gline, mo_gline, m_ignore }
+ { m_unregistered, m_gline, ms_gline, mo_gline, m_ignore }
},
{
MSG_JUPE,
TOK_JUPE,
0, MAXPARA, MFLG_SLOW, 0,
/* UNREG, CLIENT, SERVER, OPER, SERVICE */
+#ifdef CONFIG_OPERCMDS
{ m_unregistered, m_jupe, ms_jupe, mo_jupe, m_ignore }
+#else
+ { m_unregistered, m_jupe, ms_jupe, m_jupe, m_ignore }
+#endif /* CONFIG_OPERCMDS */
},
{
MSG_OPMODE,
/* UNREG, CLIENT, SERVER, OPER, SERVICE */
{ m_proto, m_proto, m_proto, m_proto, 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;
if (buffer[0] != '\0')
{
if (IsUser(from))
- sendto_one(from, ":%s %d %s %s :Unknown command",
- me.name, ERR_UNKNOWNCOMMAND, from->name, ch);
+ send_reply(from, ERR_UNKNOWNCOMMAND, ch);
Debug((DEBUG_ERROR, "Unknown (%s) from %s",
ch, get_client_name(cptr, HIDE_IP)));
}
*/
if (!IsUser(cptr) && 0 == (mptr->flags & MFLG_UNREG)) {
if (0 == (mptr->flags & MFLG_IGNORE))
- sendto_one(from, ":%s %d * %s :Register first.",
+ sendto_one(from, ":%s %d * %s :Register first.", /* XXX DEAD */
me.name, ERR_NOTREGISTERED, ch);
return -1;
}
int paramcount;
struct Message* mptr;
- Debug((DEBUG_DEBUG, "Parsing: %s", buffer));
+ Debug((DEBUG_DEBUG, "Server Parsing: %s", buffer));
#ifdef GODMODE
len = strlen(buffer);
/* Kill the unknown numeric prefix upstream if
* it's server still exists: */
if ((server = FindNServer(numeric_prefix)) && server->from == cptr)
- sendto_one(cptr, "%s KILL %s :%s (Unknown numeric nick)",
- NumServ(&me), numeric_prefix, me.name);
+ sendcmdto_one(&me, CMD_KILL, cptr, "%s :%s (Unknown numeric nick)",
+ numeric_prefix, me.name);
}
/*
* Things that must be allowed to travel
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;