]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
pull-filter: ignore leading "spaces" in option names
authorSelva Nair <selva.nair@gmail.com>
Wed, 30 Nov 2022 10:55:02 +0000 (05:55 -0500)
committerGert Doering <gert@greenie.muc.de>
Wed, 30 Nov 2022 12:35:09 +0000 (13:35 +0100)
It seems sometimes comma-separated pulled options have
an offending leading space. Not sure whether that is an error,
but the change here matches the behaviour of option parsing.

v2: fix typo in commit message
v3: space() --> isspace()

Signed-off-by: Selva Nair <selva.nair@gmail.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20221130105502.662374-1-selva.nair@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg25582.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit f02946ff9900a37dd36f61748173d53eca01adf9)

src/openvpn/options.c

index 20d1273f37ce83da2ed268ff5e2a42d4a0077e70..048bef75940b296cffbe4d8d805e1373e51465b1 100644 (file)
@@ -5001,6 +5001,12 @@ apply_pull_filter(const struct options *o, char *line)
         return true;
     }
 
+    /* skip leading spaces matching the behaviour of parse_line */
+    while (isspace(*line))
+    {
+        line++;
+    }
+
     for (f = o->pull_filter_list->head; f; f = f->next)
     {
         if (f->type == PUF_TYPE_ACCEPT && strncmp(line, f->pattern, f->size) == 0)