From: Gert Doering Date: Wed, 19 May 2021 15:34:15 +0200 Message-Id: <20210519133415.28627-1-gert@...1296...> In-Reply-To: <20210519055808.11861-1-gert@...1296...> References: <20210519055808.11861-1-gert@...1296...> MIME-Version: 1.0 Subject: [Openvpn-devel] [PATCH v3] Ignore leading whitespace and comment lines for peer-fingerprint. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit To: openvpn-devel@lists.sourceforge.net Cc: Gert Doering 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 --- src/openvpn/options.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/openvpn/options.c b/src/openvpn/options.c index db460796..5a6f37d7 100644 --- a/src/openvpn/options.c +++ b/src/openvpn/options.c @@ -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; } -- 2.26.3