[Openvpn-devel] pull_filer: ignore leading "spaces" in option names

Message ID 20221129180534.657529-1-selva.nair@gmail.com
State Superseded
Headers show
Series [Openvpn-devel] pull_filer: ignore leading "spaces" in option names | expand

Commit Message

Selva Nair Nov. 29, 2022, 6:05 p.m. UTC
From: Selva Nair <selva.nair@gmail.com>

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.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
---
 src/openvpn/options.c | 6 ++++++
 1 file changed, 6 insertions(+)

Patch

diff --git a/src/openvpn/options.c b/src/openvpn/options.c
index b7b34c9c..94cbd659 100644
--- a/src/openvpn/options.c
+++ b/src/openvpn/options.c
@@ -5385,6 +5385,12 @@  apply_pull_filter(const struct options *o, char *line)
         return true;
     }
 
+    /* skip leading spaces matching the behaviour of parse_line */
+    while(*line && space(*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)