]> arthur.barton.de Git - ngircd-alex.git/blob - src/ngircd/parse.c
Use correct sender as target for ISUPPORT replies on "VERSION"
[ngircd-alex.git] / src / ngircd / parse.c
1 /*
2  * ngIRCd -- The Next Generation IRC Daemon
3  * Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  * Please read the file COPYING, README and AUTHORS for more information.
10  */
11
12 #include "portab.h"
13
14 /**
15  * @file
16  * IRC command parser and validator.
17  */
18
19 #include "imp.h"
20 #include <assert.h>
21 #include <stdlib.h>
22 #include <stdio.h>
23 #include <string.h>
24 #include <strings.h>
25
26 #include "ngircd.h"
27 #include "defines.h"
28 #include "conn-func.h"
29 #include "channel.h"
30 #include "log.h"
31 #include "messages.h"
32 #include "tool.h"
33
34 #include "exp.h"
35 #include "parse.h"
36
37 #include "imp.h"
38 #include "irc.h"
39 #include "irc-cap.h"
40 #include "irc-channel.h"
41 #include "irc-encoding.h"
42 #include "irc-info.h"
43 #include "irc-login.h"
44 #include "irc-metadata.h"
45 #include "irc-mode.h"
46 #include "irc-op.h"
47 #include "irc-oper.h"
48 #include "irc-server.h"
49 #include "irc-write.h"
50 #include "numeric.h"
51
52 #include "exp.h"
53 #include "conf.h"
54
55 struct _NUMERIC {
56         int numeric;
57         bool (*function) PARAMS(( CLIENT *Client, REQUEST *Request ));
58 };
59
60
61 static COMMAND My_Commands[] =
62 {
63 #define _CMD(name, func, type, min, max, penalty) \
64     { (name), (func), (type), (min), (max), (penalty), 0, 0, 0 }
65         _CMD("ADMIN", IRC_ADMIN, CLIENT_USER|CLIENT_SERVER, 0, 1, 1),
66         _CMD("AWAY", IRC_AWAY, CLIENT_USER, 0, 1, 0),
67         _CMD("CAP", IRC_CAP, CLIENT_ANY, 1, 2, 0),
68         _CMD("CONNECT", IRC_CONNECT, CLIENT_USER|CLIENT_SERVER, 0, -1, 0),
69 #ifdef STRICT_RFC
70         _CMD("DIE", IRC_DIE, CLIENT_USER, 0, 0, 0),
71 #else
72         _CMD("DIE", IRC_DIE, CLIENT_USER, 0, 1, 0),
73 #endif
74         _CMD("DISCONNECT", IRC_DISCONNECT, CLIENT_USER, 1, 1, 0),
75         _CMD("ERROR", IRC_ERROR, CLIENT_ANY, 0, -1, 0),
76         _CMD("GLINE", IRC_xLINE, CLIENT_USER|CLIENT_SERVER, 0, -1, 0),
77         _CMD("HELP", IRC_HELP, CLIENT_USER, 0, 1, 2),
78         _CMD("INFO", IRC_INFO, CLIENT_USER|CLIENT_SERVER, 0, 1, 2),
79         _CMD("INVITE", IRC_INVITE, CLIENT_USER|CLIENT_SERVER, 2, 2, 0),
80         _CMD("ISON", IRC_ISON, CLIENT_USER, 1, -1, 0),
81         _CMD("JOIN", IRC_JOIN, CLIENT_USER|CLIENT_SERVER, 1, 2, 0),
82         _CMD("KICK", IRC_KICK, CLIENT_USER|CLIENT_SERVER, 2, 3, 0),
83         _CMD("KILL", IRC_KILL, CLIENT_USER|CLIENT_SERVER, 2, 2, 0),
84         _CMD("KLINE", IRC_xLINE, CLIENT_USER|CLIENT_SERVER, 0, -1, 0),
85         _CMD("LINKS", IRC_LINKS, CLIENT_USER|CLIENT_SERVER, 0, 2, 1),
86         _CMD("LIST", IRC_LIST, CLIENT_USER|CLIENT_SERVER, 0, 2, 2),
87         _CMD("LUSERS", IRC_LUSERS, CLIENT_USER|CLIENT_SERVER, 0, 2, 1),
88         _CMD("METADATA", IRC_METADATA, CLIENT_SERVER, 3, 3, 0),
89         _CMD("MODE", IRC_MODE, CLIENT_USER|CLIENT_SERVER, 1, -1, 1),
90         _CMD("MOTD", IRC_MOTD, CLIENT_USER|CLIENT_SERVER, 0, 1, 3),
91         _CMD("NAMES", IRC_NAMES, CLIENT_USER|CLIENT_SERVER, 0, 2, 1),
92         _CMD("NICK", IRC_NICK, CLIENT_ANY, 0, -1, 0),
93         _CMD("NJOIN", IRC_NJOIN, CLIENT_SERVER, 2, 2, 0),
94         _CMD("NOTICE", IRC_NOTICE, CLIENT_ANY, 0, -1, 0),
95         _CMD("OPER", IRC_OPER, CLIENT_USER, 2, 2, 0),
96         _CMD("PART", IRC_PART, CLIENT_USER|CLIENT_SERVER, 1, 2, 0),
97         _CMD("PASS", IRC_PASS, CLIENT_ANY, 0, -1, 0),
98         _CMD("PING", IRC_PING, CLIENT_USER|CLIENT_SERVER, 0, -1, 0),
99         _CMD("PONG", IRC_PONG, CLIENT_ANY, 0, -1, 0),
100         _CMD("PRIVMSG", IRC_PRIVMSG, CLIENT_USER|CLIENT_SERVER, 0, 2, 0),
101         _CMD("QUIT", IRC_QUIT, CLIENT_ANY, 0, 1, 0),
102         _CMD("REHASH", IRC_REHASH, CLIENT_USER, 0, 0, 0),
103         _CMD("RESTART", IRC_RESTART, CLIENT_USER, 0, 0, 0),
104         _CMD("SERVER", IRC_SERVER, CLIENT_ANY, 0, -1, 0),
105         _CMD("SERVICE", IRC_SERVICE, CLIENT_ANY, 6, 6, 0),
106         _CMD("SERVLIST", IRC_SERVLIST, CLIENT_USER, 0, 2, 1),
107         _CMD("SQUERY", IRC_SQUERY, CLIENT_USER|CLIENT_SERVER, 0, 2, 0),
108         _CMD("SQUIT", IRC_SQUIT, CLIENT_USER|CLIENT_SERVER, 2, 2, 0),
109         _CMD("STATS", IRC_STATS, CLIENT_USER|CLIENT_SERVER, 0, 2, 2),
110         _CMD("SVSNICK", IRC_SVSNICK, CLIENT_SERVER, 2, 2, 0),
111         _CMD("SUMMON", IRC_SUMMON, CLIENT_USER|CLIENT_SERVER, 0, -1, 0),
112         _CMD("TIME", IRC_TIME, CLIENT_USER|CLIENT_SERVER, 0, 1, 1),
113         _CMD("TOPIC", IRC_TOPIC, CLIENT_USER|CLIENT_SERVER, 1, 2, 1),
114         _CMD("TRACE", IRC_TRACE, CLIENT_USER|CLIENT_SERVER, 0, 1, 3),
115         _CMD("USER", IRC_USER, CLIENT_ANY, 0, -1, 0),
116         _CMD("USERHOST", IRC_USERHOST, CLIENT_USER, 1, -1, 1),
117         _CMD("USERS", IRC_USERS, CLIENT_USER|CLIENT_SERVER, 0, -1, 0),
118         _CMD("VERSION", IRC_VERSION, CLIENT_USER|CLIENT_SERVER, 0, 1, 1),
119         _CMD("WALLOPS", IRC_WALLOPS, CLIENT_USER|CLIENT_SERVER, 1, 1, 0),
120         _CMD("WEBIRC", IRC_WEBIRC, CLIENT_UNKNOWN, 4, 4, 0),
121         _CMD("WHO", IRC_WHO, CLIENT_USER, 0, 2, 1),
122         _CMD("WHOIS", IRC_WHOIS, CLIENT_USER|CLIENT_SERVER, 0, -1, 1),
123         _CMD("WHOWAS", IRC_WHOWAS, CLIENT_USER|CLIENT_SERVER, 0, -1, 0),
124
125 #ifdef IRCPLUS
126         _CMD("CHANINFO", IRC_CHANINFO, CLIENT_SERVER, 0, -1, 0),
127 # ifdef ICONV
128         _CMD("CHARCONV", IRC_CHARCONV, CLIENT_USER, 1, 1, 0),
129 # endif
130 #endif
131
132 #ifndef STRICT_RFC
133         _CMD("GET",  IRC_QUIT_HTTP, CLIENT_UNKNOWN, 0, -1, 0),
134         _CMD("POST", IRC_QUIT_HTTP, CLIENT_UNKNOWN, 0, -1, 0),
135 #endif
136         _CMD(NULL, NULL, 0, 0, 0, 0) /* End-Mark */
137 #undef _CMD
138 };
139
140 static void Init_Request PARAMS(( REQUEST *Req ));
141
142 static bool Validate_Prefix PARAMS(( CONN_ID Idx, REQUEST *Req, bool *Closed ));
143 static bool Validate_Command PARAMS(( CONN_ID Idx, REQUEST *Req, bool *Closed ));
144 static bool Validate_Args PARAMS(( CONN_ID Idx, REQUEST *Req, bool *Closed ));
145
146 static bool Handle_Request PARAMS(( CONN_ID Idx, REQUEST *Req ));
147
148 static bool ScrubCTCP PARAMS((char *Request));
149
150 /**
151  * Return the pointer to the global "IRC command structure".
152  * This structure, an array of type "COMMAND" describes all the IRC commands
153  * implemented by ngIRCd and how to handle them.
154  * @return Pointer to the global command structure.
155  */
156 GLOBAL COMMAND *
157 Parse_GetCommandStruct( void )
158 {
159         return My_Commands;
160 } /* Parse_GetCommandStruct */
161
162
163 /**
164  * Parse a command ("request") received from a client.
165  * 
166  * This function is called after the connection layer received a valid CR+LF
167  * terminated line of text: we assume that this is a valid IRC command and
168  * try to do something useful with it :-)
169  *
170  * All errors are reported to the client from which the command has been
171  * received, and if the error is fatal this connection is closed down.
172  *
173  * This function is able to parse the syntax as described in RFC 2812,
174  * section 2.3.
175  *
176  * @param Idx Index of the connection from which the command has been received.
177  * @param Request NULL terminated line of text (the "command").
178  * @return true on success (valid command or "regular" error), false if a
179  *      fatal error occurred and the connection has been shut down.
180  */
181 GLOBAL bool
182 Parse_Request( CONN_ID Idx, char *Request )
183 {
184         REQUEST req;
185         char *start, *ptr;
186         bool closed;
187
188         assert( Idx >= 0 );
189         assert( Request != NULL );
190
191 #ifdef SNIFFER
192         if( NGIRCd_Sniffer ) Log( LOG_DEBUG, " <- connection %d: '%s'.", Idx, Request );
193 #endif
194
195         Init_Request( &req );
196
197         /* remove leading & trailing whitespace */
198         ngt_TrimStr( Request );
199
200         if (Conf_ScrubCTCP && ScrubCTCP(Request))
201                 return true;
202
203         if (Request[0] == ':') {
204                 /* Prefix */
205                 req.prefix = Request + 1;
206                 ptr = strchr( Request, ' ' );
207                 if( ! ptr )
208                 {
209                         LogDebug("Connection %d: Parse error: prefix without command!?", Idx);
210                         return Conn_WriteStr(Idx, "ERROR :Prefix without command");
211                 }
212                 *ptr = '\0';
213 #ifndef STRICT_RFC
214                 /* ignore multiple spaces between prefix and command */
215                 while( *(ptr + 1) == ' ' ) ptr++;
216 #endif
217                 start = ptr + 1;
218         }
219         else start = Request;
220
221         ptr = strchr( start, ' ' );
222         if( ptr )
223         {
224                 *ptr = '\0';
225 #ifndef STRICT_RFC
226                 /* ignore multiple spaces between parameters */
227                 while( *(ptr + 1) == ' ' ) ptr++;
228 #endif
229         }
230         req.command = start;
231
232         /* Arguments, Parameters */
233         if( ptr )
234         {
235                 start = ptr + 1;
236                 while( start )
237                 {
238                         if( start[0] == ':' )
239                         {
240                                 req.argv[req.argc] = start + 1;
241                                 ptr = NULL;
242                         }
243                         else
244                         {
245                                 req.argv[req.argc] = start;
246                                 ptr = strchr( start, ' ' );
247                                 if( ptr )
248                                 {
249                                         *ptr = '\0';
250 #ifndef STRICT_RFC
251                                         while( *(ptr + 1) == ' ' ) ptr++;
252 #endif
253                                 }
254                         }
255
256                         req.argc++;
257
258                         if( start[0] == ':' ) break;
259                         if( req.argc > 14 ) break;
260
261                         if( ptr ) start = ptr + 1;
262                         else start = NULL;
263                 }
264         }
265
266         if( ! Validate_Prefix( Idx, &req, &closed )) return ! closed;
267         if( ! Validate_Command( Idx, &req, &closed )) return ! closed;
268         if( ! Validate_Args( Idx, &req, &closed )) return ! closed;
269
270         return Handle_Request( Idx, &req );
271 } /* Parse_Request */
272
273
274 /**
275  * Initialize request structure.
276  * @param Req Request structure to be initialized.
277  */
278 static void
279 Init_Request( REQUEST *Req )
280 {
281         int i;
282
283         assert( Req != NULL );
284
285         Req->prefix = NULL;
286         Req->command = NULL;
287         for( i = 0; i < 15; Req->argv[i++] = NULL );
288         Req->argc = 0;
289 } /* Init_Request */
290
291
292 static bool
293 Validate_Prefix( CONN_ID Idx, REQUEST *Req, bool *Closed )
294 {
295         CLIENT *client, *c;
296
297         assert( Idx >= 0 );
298         assert( Req != NULL );
299
300         *Closed = false;
301
302         client = Conn_GetClient( Idx );
303         assert( client != NULL );
304
305         if (!Req->prefix && Client_Type(client) == CLIENT_SERVER
306             && !(Conn_Options(Idx) & CONN_RFC1459)
307             && strcasecmp(Req->command, "ERROR") != 0
308             && strcasecmp(Req->command, "PING") != 0)
309         {
310                 Log(LOG_ERR,
311                     "Received command without prefix (connection %d, command \"%s\")!?",
312                     Idx, Req->command);
313                 if (!Conn_WriteStr(Idx, "ERROR :Prefix missing"))
314                         *Closed = true;
315                 return false;
316         }
317
318         if (!Req->prefix)
319                 return true;
320
321         /* only validate if this connection is already registered */
322         if (Client_Type(client) != CLIENT_USER
323             && Client_Type(client) != CLIENT_SERVER
324             && Client_Type(client) != CLIENT_SERVICE) {
325                 /* not registered, ignore prefix */
326                 Req->prefix = NULL;
327                 return true;
328         }
329
330         /* check if client in prefix is known */
331         c = Client_Search(Req->prefix);
332         if (!c) {
333                 if (Client_Type(client) != CLIENT_SERVER) {
334                         Log(LOG_ERR,
335                             "Ignoring command with invalid prefix \"%s\" from \"%s\" (connection %d, command \"%s\")!",
336                             Req->prefix, Client_ID(client), Idx, Req->command);
337                         if (!Conn_WriteStr(Idx,
338                                            "ERROR :Invalid prefix \"%s\"",
339                                            Req->prefix))
340                                 *Closed = true;
341                         IRC_SetPenalty(client, 2);
342                 } else
343                         LogDebug("Ignoring command with invalid prefix \"%s\" from \"%s\" (connection %d, command \"%s\")!",
344                             Req->prefix, Client_ID(client), Idx, Req->command);
345                 return false;
346         }
347
348         /* check if the client named in the prefix is expected
349          * to come from that direction */
350         if (Client_NextHop(c) != client) {
351                 if (Client_Type(c) != CLIENT_SERVER) {
352                         Log(LOG_ERR,
353                             "Spoofed prefix \"%s\" from \"%s\" (connection %d, command \"%s\"), closing connection!",
354                             Req->prefix, Client_ID(client), Idx, Req->command);
355                         Conn_Close(Idx, NULL, "Spoofed prefix", true);
356                         *Closed = true;
357                 } else {
358                         Log(LOG_WARNING,
359                             "Ignoring command with spoofed prefix \"%s\" from \"%s\" (connection %d, command \"%s\")!",
360                             Req->prefix, Client_ID(client), Idx, Req->command);
361                 }
362                 return false;
363         }
364
365         return true;
366 } /* Validate_Prefix */
367
368
369 static bool
370 Validate_Command( UNUSED CONN_ID Idx, UNUSED REQUEST *Req, bool *Closed )
371 {
372         assert( Idx >= 0 );
373         assert( Req != NULL );
374         *Closed = false;
375
376         return true;
377 } /* Validate_Command */
378
379
380 static bool
381 #ifdef STRICT_RFC
382 Validate_Args(CONN_ID Idx, REQUEST *Req, bool *Closed)
383 #else
384 Validate_Args(UNUSED CONN_ID Idx, UNUSED REQUEST *Req, bool *Closed)
385 #endif
386 {
387 #ifdef STRICT_RFC
388         int i;
389 #endif
390
391         *Closed = false;
392
393 #ifdef STRICT_RFC
394         assert( Idx >= 0 );
395         assert( Req != NULL );
396
397         /* CR and LF are never allowed in command parameters.
398          * But since we do accept lines terminated only with CR or LF in
399          * "non-RFC-compliant mode" (besides the correct CR+LF combination),
400          * this check can only trigger in "strict RFC" mode; therefore we
401          * optimize it away otherwise ... */
402         for (i = 0; i < Req->argc; i++) {
403                 if (strchr(Req->argv[i], '\r') || strchr(Req->argv[i], '\n')) {
404                         Log(LOG_ERR,
405                             "Invalid character(s) in parameter (connection %d, command %s)!?",
406                             Idx, Req->command);
407                         if (!Conn_WriteStr(Idx,
408                                            "ERROR :Invalid character(s) in parameter!"))
409                                 *Closed = true;
410                         return false;
411                 }
412         }
413 #endif
414
415         return true;
416 } /* Validate_Args */
417
418
419 /* Command is a status code ("numeric") from another server */
420 static bool
421 Handle_Numeric(CLIENT *client, REQUEST *Req)
422 {
423         static const struct _NUMERIC Numerics[] = {
424                 {   5, IRC_Num_ISUPPORT },
425                 {  20, NULL },
426                 { 376, IRC_Num_ENDOFMOTD }
427         };
428         int i, num;
429         char str[COMMAND_LEN];
430         CLIENT *prefix, *target = NULL;
431
432         /* Determine target */
433         if (Req->argc > 0) {
434                 if (strcmp(Req->argv[0], "*") != 0)
435                         target = Client_Search(Req->argv[0]);
436                 else
437                         target = Client_ThisServer();
438         }
439
440         if (!target) {
441                 /* Status code without target!? */
442                 if (Req->argc > 0)
443                         Log(LOG_WARNING,
444                             "Unknown target for status code %s: \"%s\"",
445                             Req->command, Req->argv[0]);
446                 else
447                         Log(LOG_WARNING,
448                             "Unknown target for status code %s!",
449                             Req->command);
450                 return true;
451         }
452         if (target == Client_ThisServer()) {
453                 /* This server is the target of the numeric */
454                 num = atoi(Req->command);
455
456                 for (i = 0; i < (int) C_ARRAY_SIZE(Numerics); i++) {
457                         if (num == Numerics[i].numeric) {
458                                 if (!Numerics[i].function)
459                                         return CONNECTED;
460                                 return Numerics[i].function(client, Req);
461                         }
462                 }
463
464                 LogDebug("Ignored status code %s from \"%s\".",
465                          Req->command, Client_ID(client));
466                 return true;
467         }
468
469         /* Determine source */
470         if (! Req->prefix[0]) {
471                 /* Oops, no prefix!? */
472                 Log(LOG_WARNING, "Got status code %s from \"%s\" without prefix!?",
473                                                 Req->command, Client_ID(client));
474                 return true;
475         }
476
477         prefix = Client_Search(Req->prefix);
478         if (! prefix) { /* Oops, unknown prefix!? */
479                 Log(LOG_WARNING, "Got status code %s from unknown source: \"%s\"", Req->command, Req->prefix);
480                 return true;
481         }
482
483         /* Forward status code */
484         strlcpy(str, Req->command, sizeof(str));
485         for (i = 0; i < Req->argc; i++) {
486                 if (i < Req->argc - 1)
487                         strlcat(str, " ", sizeof(str));
488                 else
489                         strlcat(str, " :", sizeof(str));
490                 strlcat(str, Req->argv[i], sizeof(str));
491         }
492         return IRC_WriteStrClientPrefix(target, prefix, "%s", str);
493 }
494
495 static bool
496 Handle_Request( CONN_ID Idx, REQUEST *Req )
497 {
498         CLIENT *client;
499         bool result = true;
500         int client_type;
501         COMMAND *cmd;
502
503         assert( Idx >= 0 );
504         assert( Req != NULL );
505         assert( Req->command != NULL );
506
507         client = Conn_GetClient( Idx );
508         assert( client != NULL );
509
510         /* Numeric? */
511         client_type = Client_Type(client);
512         if ((client_type == CLIENT_SERVER ||
513              client_type == CLIENT_UNKNOWNSERVER)
514             && strlen(Req->command) == 3 && atoi(Req->command) > 1)
515                 return Handle_Numeric(client, Req);
516
517         cmd = My_Commands;
518         while (cmd->name) {
519                 if (strcasecmp(Req->command, cmd->name) != 0) {
520                         cmd++;
521                         continue;
522                 }
523
524                 if (!(client_type & cmd->type)) {
525                         if (client_type == CLIENT_USER
526                             && cmd->type & CLIENT_SERVER)
527                                 return IRC_WriteErrClient(client,
528                                                  ERR_NOTREGISTEREDSERVER_MSG,
529                                                  Client_ID(client));
530                         else
531                                 return IRC_WriteErrClient(client,
532                                                 ERR_NOTREGISTERED_MSG,
533                                                 Client_ID(client));
534                 }
535
536                 if (cmd->penalty)
537                         IRC_SetPenalty(client, cmd->penalty);
538
539                 if (Req->argc < cmd->min_argc ||
540                     (cmd->max_argc != -1 && Req->argc > cmd->max_argc))
541                         return IRC_WriteErrClient(client, ERR_NEEDMOREPARAMS_MSG,
542                                                   Client_ID(client), Req->command);
543
544                 /* Command is allowed for this client: call it and count
545                  * generated bytes in output */
546                 Conn_ResetWCounter();
547                 result = (cmd->function)(client, Req);
548                 cmd->bytes += Conn_WCounter();
549
550                 /* Adjust counters */
551                 if (client_type != CLIENT_SERVER)
552                         cmd->lcount++;
553                 else
554                         cmd->rcount++;
555                 return result;
556         }
557
558         if (client_type != CLIENT_USER &&
559             client_type != CLIENT_SERVER &&
560             client_type != CLIENT_SERVICE )
561                 return true;
562
563         /* Unknown command and registered connection: generate error: */
564         LogDebug("Connection %d: Unknown command \"%s\", %d %s,%s prefix.",
565                         Client_Conn( client ), Req->command, Req->argc,
566                         Req->argc == 1 ? "parameter" : "parameters",
567                         Req->prefix ? "" : " no" );
568
569         if (Client_Type(client) != CLIENT_SERVER)
570                 result = IRC_WriteErrClient(client, ERR_UNKNOWNCOMMAND_MSG,
571                                 Client_ID(client), Req->command);
572
573         return result;
574 } /* Handle_Request */
575
576
577 /**
578  * Check if incoming messages contains CTCP commands and should be dropped.
579  *
580  * @param Request NULL terminated incoming command.
581  * @returns true, when the message should be dropped.
582  */
583 static bool
584 ScrubCTCP(char *Request)
585 {
586         static const char me_cmd[] = "ACTION ";
587         static const char ctcp_char = 0x1;
588         bool dropCommand = false;
589         char *ptr = Request;
590         char *ptrEnd = strchr(Request, '\0');
591
592         if (Request[0] == ':' && ptrEnd > ptr)
593                 ptr++;
594
595         while (ptr != ptrEnd && *ptr != ':')
596                 ptr++;
597
598         if ((ptrEnd - ptr) > 1) {
599                 ptr++;
600                 if (*ptr == ctcp_char) {
601                         dropCommand = true;
602                         ptr++;
603                         /* allow /me commands */
604                         if ((size_t)(ptrEnd - ptr) >= strlen(me_cmd)
605                             && !strncmp(ptr, me_cmd, strlen(me_cmd)))
606                                 dropCommand = false;
607                 }
608         }
609         return dropCommand;
610 }
611
612 /* -eof- */