[Bug 62] New: I patched the iptables-restore and liblptulog for string included "," "

bugzilla-daemon@netfilter.org bugzilla-daemon@netfilter.org
Fri, 07 Mar 2003 18:35:47 +0100


https://bugzilla.netfilter.org/cgi-bin/bugzilla/show_bug.cgi?id=62

           Summary: I patched the iptables-restore and liblptulog for string
                    included "," "
           Product: iptables userspace
           Version: 1.2.7a
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: iptables-restore
        AssignedTo: laforge@netfilter.org
        ReportedBy: larycho@hanmail.net
                CC: netfilter-buglog@lists.netfilter.org


I have found the not critical bug(?).
If ulog-prefix is included the quote or space. iptables-restore can't restore 
from the saved file.
This patch use the backquote
----patch file begin ---
diff -urN iptables-1.2.7a.org/extensions/libipt_ULOG.c iptables-
1.2.7a/extensions/libipt_ULOG.c
--- iptables-1.2.7a.org/extensions/libipt_ULOG.c        Wed May 29 22:08:16 2002
+++ iptables-1.2.7a/extensions/libipt_ULOG.c    Sat Mar  8 02:09:08 2003
@@ -157,7 +157,7 @@
            = (const struct ipt_ulog_info *) target->data;

        if (strcmp(loginfo->prefix, "") != 0)
-               printf("--ulog-prefix %s ", loginfo->prefix);
+               printf("--ulog-prefix \`%s\` ", loginfo->prefix);

        if (loginfo->nl_group != ULOG_DEFAULT_NLGROUP) {
                printf("--ulog-nlgroup ");
diff -urN iptables-1.2.7a.org/iptables-restore.c iptables-1.2.7a/iptables-
restore.c
--- iptables-1.2.7a.org/iptables-restore.c      Wed Aug  7 18:07:41 2002
+++ iptables-1.2.7a/iptables-restore.c  Sat Mar  8 02:08:01 2003
@@ -262,6 +262,7 @@
                        /* the parser */
                        char *param_start, *curchar;
                        int quote_open;
+                       int backquote_open;

                        /* reset the newargv */
                        newargc = 0;
@@ -308,10 +309,20 @@
                         * longer a real hacker, but I can live with that */

                        quote_open = 0;
+                       backquote_open = 0;
                        param_start = parsestart;

                        for (curchar = parsestart; *curchar; curchar++) {
-                               if (*curchar == '"') {
+                               if (*curchar == '\`') {
+                                       if (backquote_open) {
+                                               backquote_open = 0;
+                                               *curchar = ' ';
+                                       } else {
+                                               backquote_open = 1;
+                                               param_start++;
+                                       }
+                               }
+                               if (!backquote_open && *curchar == '"') {
                                        if (quote_open) {
                                                quote_open = 0;
                                                *curchar = ' ';
@@ -325,6 +336,9 @@
                                    || * curchar == '\n') {
                                        char param_buffer[1024];
                                        int param_len = curchar-param_start;
+
+                                       if (backquote_open)
+                                               continue;

                                        if (quote_open)
                                                continue;
------------ patch file end -----



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.