31 |
|
#include "sprintf_irc.h" |
32 |
|
#include "ircd.h" |
33 |
|
#include "numeric.h" |
34 |
< |
#include "s_log.h" |
34 |
> |
#include "log.h" |
35 |
|
#include "send.h" |
36 |
< |
#include "s_conf.h" |
36 |
> |
#include "conf.h" |
37 |
|
#include "memory.h" |
38 |
|
#include "s_user.h" |
39 |
|
#include "s_serv.h" |
102 |
|
* NOTE: parse() should not be called recursively by other functions! |
103 |
|
*/ |
104 |
|
static char *sender; |
105 |
< |
static char *para[MAXPARA + 1]; |
105 |
> |
static char *para[MAXPARA + 2]; /* <prefix> + <params> + NULL */ |
106 |
|
static char buffer[1024]; |
107 |
|
|
108 |
|
static int cancel_clients(struct Client *, struct Client *, char *); |
109 |
|
static void remove_unknown(struct Client *, char *, char *); |
110 |
|
static void handle_numeric(char[], struct Client *, struct Client *, int, char *[]); |
111 |
|
static void handle_command(struct Message *, struct Client *, struct Client *, unsigned int, char *[]); |
112 |
– |
static void add_msg_element(struct MessageTree *, struct Message *, const char *); |
113 |
– |
static void del_msg_element(struct MessageTree *, const char *); |
112 |
|
|
113 |
|
|
114 |
|
/* |
301 |
|
*/ |
302 |
|
static void |
303 |
|
handle_command(struct Message *mptr, struct Client *client_p, |
304 |
< |
struct Client *from, unsigned int i, char *hpara[MAXPARA]) |
304 |
> |
struct Client *from, unsigned int i, char *hpara[]) |
305 |
|
{ |
306 |
|
MessageHandler handler = 0; |
307 |
|
|
310 |
|
|
311 |
|
mptr->count++; |
312 |
|
|
315 |
– |
/* New patch to avoid server flooding from unregistered connects |
316 |
– |
* - Pie-Man 07/27/2000 */ |
317 |
– |
if (!IsRegistered(client_p)) |
318 |
– |
{ |
319 |
– |
/* if its from a possible server connection |
320 |
– |
* ignore it.. more than likely its a header thats sneaked through |
321 |
– |
*/ |
322 |
– |
if ((IsHandshake(client_p) || IsConnecting(client_p) || |
323 |
– |
IsServer(client_p)) && !(mptr->flags & MFLG_UNREG)) |
324 |
– |
return; |
325 |
– |
} |
326 |
– |
|
313 |
|
handler = mptr->handlers[client_p->handler]; |
314 |
|
|
315 |
|
/* check right amount of params is passed... --is */ |
326 |
|
"Dropping server %s due to (invalid) command '%s' " |
327 |
|
"with only %d arguments (expecting %d).", |
328 |
|
client_p->name, mptr->cmd, i, mptr->args_min); |
329 |
< |
ilog(L_CRIT, "Insufficient parameters (%d) for command '%s' from %s.", |
329 |
> |
ilog(LOG_TYPE_IRCD, "Insufficient parameters (%d) for command '%s' from %s.", |
330 |
|
i, mptr->cmd, client_p->name); |
331 |
|
exit_client(client_p, client_p, |
332 |
|
"Not enough arguments to server command."); |
336 |
|
(*handler)(client_p, from, i, hpara); |
337 |
|
} |
338 |
|
|
353 |
– |
/* clear_tree_parse() |
354 |
– |
* |
355 |
– |
* inputs - NONE |
356 |
– |
* output - NONE |
357 |
– |
* side effects - MUST MUST be called at startup ONCE before |
358 |
– |
* any other keyword routine is used. |
359 |
– |
*/ |
360 |
– |
void |
361 |
– |
clear_tree_parse(void) |
362 |
– |
{ |
363 |
– |
memset(&msg_tree, 0, sizeof(msg_tree)); |
364 |
– |
} |
365 |
– |
|
339 |
|
/* add_msg_element() |
340 |
|
* |
341 |
|
* inputs - pointer to MessageTree |
449 |
|
* side effects - none |
450 |
|
*/ |
451 |
|
static struct Message * |
452 |
< |
msg_tree_parse(const char *cmd, struct MessageTree *root) |
452 |
> |
msg_tree_parse(const char *cmd) |
453 |
|
{ |
454 |
< |
struct MessageTree *mtree = root; |
454 |
> |
struct MessageTree *mtree = &msg_tree; |
455 |
|
assert(cmd && *cmd); |
456 |
|
|
457 |
|
while (IsAlpha(*cmd) && (mtree = mtree->pointers[*cmd & (MAXPTRLEN - 1)])) |
475 |
|
assert(msg && msg->cmd); |
476 |
|
|
477 |
|
/* command already added? */ |
478 |
< |
if (msg_tree_parse(msg->cmd, &msg_tree)) |
478 |
> |
if (msg_tree_parse(msg->cmd)) |
479 |
|
return; |
480 |
|
|
481 |
|
add_msg_element(&msg_tree, msg, msg->cmd); |
505 |
|
struct Message * |
506 |
|
find_command(const char *cmd) |
507 |
|
{ |
508 |
< |
return msg_tree_parse(cmd, &msg_tree); |
508 |
> |
return msg_tree_parse(cmd); |
509 |
|
} |
510 |
|
|
511 |
|
static void |
682 |
|
t += tl; |
683 |
|
} |
684 |
|
|
685 |
< |
ircsprintf(t," :%s", parv[parc-1]); |
685 |
> |
ircsprintf(t, " :%s", parv[parc-1]); |
686 |
|
|
687 |
|
if (((target_p = find_person(client_p, parv[1])) != NULL) || |
688 |
|
((target_p = hash_find_server(parv[1])) != NULL)) |
793 |
|
|
794 |
|
in_para = (parc > 1 && *parv[1] != '\0') ? parv[1] : "<>"; |
795 |
|
|
796 |
< |
ilog(L_ERROR, "Received ERROR message from %s: %s", |
796 |
> |
ilog(LOG_TYPE_IRCD, "Received ERROR message from %s: %s", |
797 |
|
source_p->name, in_para); |
798 |
|
|
799 |
|
if (client_p == source_p) |