]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
revert some slipped through patches
authorPablo Neira AyusoMaurice van der Pot <pablo@netfilter.orggriffon26@kfk4ever.com>
Mon, 16 Apr 2007 17:15:22 +0000 (17:15 +0000)
committerPablo Neira AyusoPatrick McHardy <pablo@netfilter.orgkaber@trash.net>
Mon, 16 Apr 2007 17:15:22 +0000 (17:15 +0000)
Makefile
iptables-restore.c

index e61fc6e14ffcd55bb1f809b377717d1e5ed6a37a..81e72d4c43aff25febf73c4c7c2d8945c9fbc9f1 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -17,7 +17,7 @@ endif
 IPTABLES_VERSION:=1.3.7
 OLD_IPTABLES_VERSION:=1.3.6
 
-PREFIX:=/usr
+PREFIX:=/usr/local
 LIBDIR:=$(PREFIX)/lib
 BINDIR:=$(PREFIX)/sbin
 MANDIR:=$(PREFIX)/man
index 9b8563ad4b8d8425bb535665dfb214c067d8df31..89acd73d87e1ff4cb464d3f77ff223f620992b16 100644 (file)
@@ -301,9 +301,8 @@ main(int argc, char *argv[])
                        char *parsestart;
 
                        /* the parser */
-                       char *curchar;
+                       char *param_start, *curchar;
                        int quote_open;
-                       int param_len;
 
                        /* reset the newargv */
                        newargc = 0;
@@ -350,11 +349,9 @@ main(int argc, char *argv[])
                         * longer a real hacker, but I can live with that */
 
                        quote_open = 0;
-                       param_len = 0;
+                       param_start = parsestart;
                        
                        for (curchar = parsestart; *curchar; curchar++) {
-                               char param_buffer[1024];
-
                                if (*curchar == '"') {
                                        /* quote_open cannot be true if there
                                         * was no previous character.  Thus, 
@@ -363,27 +360,30 @@ main(int argc, char *argv[])
                                            *(curchar-1) != '\\') {
                                                quote_open = 0;
                                                *curchar = ' ';
-                                       } else if (!quote_open) {
+                                       } else {
                                                quote_open = 1;
-                                               continue;
+                                               param_start++;
                                        }
                                } 
                                if (*curchar == ' '
                                    || *curchar == '\t'
                                    || * curchar == '\n') {
+                                       char param_buffer[1024];
+                                       int param_len = curchar-param_start;
 
-                                       if (quote_open) {
-                                               param_buffer[param_len++] = 
-                                                               *curchar;
+                                       if (quote_open)
                                                continue;
-                                       }
 
                                        if (!param_len) {
                                                /* two spaces? */
+                                               param_start++;
                                                continue;
                                        }
-
-                                       param_buffer[param_len] = '\0';
+                                       
+                                       /* end of one parameter */
+                                       strncpy(param_buffer, param_start,
+                                               param_len);
+                                       *(param_buffer+param_len) = '\0';
 
                                        /* check if table name specified */
                                        if (!strncmp(param_buffer, "-t", 3)
@@ -395,26 +395,9 @@ main(int argc, char *argv[])
                                        }
 
                                        add_argv(param_buffer);
-                                       param_len = 0;
+                                       param_start += param_len + 1;
                                } else {
-                                       /* Skip backslash that escapes quote: 
-                                        * the standard input does not require
-                                        * escaping. However, the output
-                                        * generated by iptables-save
-                                        * introduces bashlash to keep
-                                        * consistent with iptables
-                                        */
-                                       if (quote_open &&
-                                           *curchar == '\\' &&
-                                           *(curchar+1) == '"')
-                                               continue;
-
-                                       /* regular character, copy to buffer */
-                                       param_buffer[param_len++] = *curchar;
-
-                                       if (param_len >= sizeof(param_buffer))
-                                               exit_error(PARAMETER_PROBLEM, 
-                                                  "Parameter too long!");
+                                       /* regular character, skip */
                                }
                        }