All of lore.kernel.org
 help / color / mirror / Atom feed
* Minor modification of function dcc_parse in ip_conntrack_irc.c
@ 2004-08-10 20:34 Nix N. Nix
  2004-08-11 13:29 ` Patrick McHardy
  2004-08-19 11:27 ` Harald Welte
  0 siblings, 2 replies; 10+ messages in thread
From: Nix N. Nix @ 2004-08-10 20:34 UTC (permalink / raw)
  To: netfilter-devel

Hi!

The dcc_parse function in ip_conntrack_irc.c has a shortcoming:

\1DCC <command> <param> <ip> <port> [<size>]\1\n

...is the format of a DCC command (where <size> is optional).

dcc_parse is responsible for finding the ip and port in this string.  It
gets the string starting at <param>.  Unfortunately, so far, dcc_parse
assumed that <param> does not contain any spaces.  Thus, the module
failed to track connections implied by a string of the form

\1DCC SEND "The Big Movie.avi" 10289477 1011 37546262\1\n

I have remedied this problem by having it check whether there's a double
quote and, if so, loop on to the corresponding closing double quote
before resuming normal processing:

--- ip_conntrack_irc.c  2003-11-28 13:26:21.000000000 -0500
+++ mod.ip_conntrack_irc.c      2004-08-10 16:07:49.000000000 -0400
@@ -83,6 +83,14 @@
        ad_end_p        returns pointer to last byte of addr data */
 {
  
+       /* file names with spaces in them are double-quoted */
+       if ('"' == *data && data <= data_end - 12) {
+               *data++ ;
+               while (*data++ != '"')
+                       if (data > data_end - 12)
+                               return -1;
+       }
+
        /* at least 12: "AAAAAAAA P\1\n" */
        while (*data++ != ' ')
                if (data > data_end - 12)

This fixes the problem with spaces in file names, and does not affect
DCC CHAT, because, in those cases, <param> always= chat .

I have tested this in kernel vanilla 2.4.24.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2004-09-10 20:29 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-10 20:34 Minor modification of function dcc_parse in ip_conntrack_irc.c Nix N. Nix
2004-08-11 13:29 ` Patrick McHardy
2004-08-13 22:31   ` Nix N. Nix
2004-08-19 11:35     ` Harald Welte
2004-08-22 22:26       ` Nix N. Nix
2004-09-10 20:29         ` Nix N. Nix
2004-08-24 22:43       ` Nix N. Nix
2004-08-17 20:34   ` Nix N. Nix
2004-08-19 11:29     ` Harald Welte
2004-08-19 11:27 ` Harald Welte

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.