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