]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Ignore leading whitespace and comment lines for peer-fingerprint.
authorGert Doering <gert@greenie.muc.de>
Wed, 19 May 2021 13:34:15 +0000 (15:34 +0200)
committerGert Doering <gert@greenie.muc.de>
Wed, 19 May 2021 14:47:15 +0000 (16:47 +0200)
Inline peer-fingerprint blocks can benefit from a bit of structuring
by indentation or by putting comments ("# this is Alice's key").

v2: accept ';' and '#' as comment delimiter.  Fix tab-indent.
v3: we want ==

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Selva Nair <selva.nair@gmail.com>
Message-Id: <20210519133415.28627-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22404.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
src/openvpn/options.c

index db460796a25357870f0209f808f0756be54d227b..5a6f37d7d9a6b0efc690f58e8f1b8f05f5cfd0af 100644 (file)
@@ -1145,8 +1145,13 @@ parse_hash_fingerprint_multiline(const char *str, int nbytes, int msglevel,
     const char *line;
     while ((line = strsep(&lines, "\n")))
     {
-        /* skip empty lines */
-        if (strlen(line) == 0)
+        /* ignore leading whitespace */
+        while(isspace(*line))
+        {
+            line++;
+        }
+        /* skip empty lines and comment lines */
+        if (strlen(line) == 0 || *line == '#' || *line == ';')
         {
             continue;
         }