From patchwork Tue May 18 19:58:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 1819 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director12.mail.ord1d.rsapps.net ([172.27.255.54]) by backend30.mail.ord1d.rsapps.net with LMTP id GGs3EyWppGB4DAAAIUCqbw (envelope-from ) for ; Wed, 19 May 2021 01:59:01 -0400 Received: from proxy5.mail.iad3a.rsapps.net ([172.27.255.54]) by director12.mail.ord1d.rsapps.net with LMTP id MG8MEyWppGDRZAAAIasKDg (envelope-from ) for ; Wed, 19 May 2021 01:59:01 -0400 Received: from smtp22.gate.iad3a ([172.27.255.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy5.mail.iad3a.rsapps.net with LMTPS id kKvKDSWppGBkWgAAhn5joQ (envelope-from ) for ; Wed, 19 May 2021 01:59:01 -0400 X-Spam-Threshold: 95 X-Spam-Score: 0 X-Spam-Flag: NO X-Virus-Scanned: OK X-Orig-To: openvpnslackdevel@openvpn.net X-Originating-Ip: [216.105.38.7] Authentication-Results: smtp22.gate.iad3a.rsapps.net; iprev=pass policy.iprev="216.105.38.7"; spf=pass smtp.mailfrom="openvpn-devel-bounces@lists.sourceforge.net" smtp.helo="lists.sourceforge.net"; dkim=fail (signature verification failed) header.d=sourceforge.net; dkim=fail (signature verification failed) header.d=sf.net; dmarc=none (p=nil; dis=none) header.from=greenie.muc.de X-Suspicious-Flag: YES X-Classification-ID: 4e869af6-b867-11eb-8bfa-5254005ae9fe-1-1 Received: from [216.105.38.7] ([216.105.38.7:33512] helo=lists.sourceforge.net) by smtp22.gate.iad3a.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 73/46-26826-429A4A06; Wed, 19 May 2021 01:59:01 -0400 Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from ) id 1ljFDq-0005Rl-CT; Wed, 19 May 2021 05:58:22 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljFDq-0005RT-0Y for openvpn-devel@lists.sourceforge.net; Wed, 19 May 2021 05:58:22 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=IFATW0Jww2HOSlA9o5NuDORbqdVWlTEp+r2IHaz4SAg=; b=YJQ791fovnfOSIVN11wGzuMv5s hIseeqXUdBJ/kspn+3NRKE7ItvUr5bCTx6nEcsdnDMcH7e1V3SxHDPUlDyabOR5U0wUlWDpSDiLsG QJj0pdz7UI4lo8DzX2aGvBwC9RkhfokL90pHhQASw3IVHfYR1DLlF/gd1t060m8YmaR8=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-Id: Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=IFATW0Jww2HOSlA9o5NuDORbqdVWlTEp+r2IHaz4SAg=; b=iV5dxRKTAyzzFkO+uDTkXM9zqg Ak2SWz6bc/QiNfPvPxA1Tq5xgwm5mVJFroGkCBRCxDt/Hk4tTs/KgXxTSec6wqP2X0PdaduNA+1gD bn3RaUtrP0VfTl2Nz80CU4bx+vdVvJvMN+rr6a6WTbMDOGGqHPu2WKpf60N+EiiCxlM4=; Received: from dhcp-174.greenie.muc.de ([193.149.48.174] helo=blue.greenie.muc.de) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.3) id 1ljFDj-0007ik-0O for openvpn-devel@lists.sourceforge.net; Wed, 19 May 2021 05:58:21 +0000 Received: from blue.greenie.muc.de (localhost [127.0.0.1]) by blue.greenie.muc.de (8.15.2/8.14.9) with ESMTP id 14J5w9o8011974 for ; Wed, 19 May 2021 07:58:09 +0200 Received: (from gert@localhost) by blue.greenie.muc.de (8.15.2/8.14.9/Submit) id 14J5w9hb011973 for openvpn-devel@lists.sourceforge.net; Wed, 19 May 2021 07:58:09 +0200 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Wed, 19 May 2021 07:58:08 +0200 Message-Id: <20210519055808.11861-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210518143218.14520-1-gert@greenie.muc.de> References: <20210518143218.14520-1-gert@greenie.muc.de> MIME-Version: 1.0 X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: muc.de] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record X-Headers-End: 1ljFDj-0007ik-0O Subject: [Openvpn-devel] [PATCH v2] Ignore leading whitespace and comment lines for peer-fingerprint. X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox 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. 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..037454f7 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; }