From patchwork Wed May 19 03:34:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 1820 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director15.mail.ord1d.rsapps.net ([172.31.255.6]) by backend30.mail.ord1d.rsapps.net with LMTP id iH//ERkUpWAfTQAAIUCqbw (envelope-from ) for ; Wed, 19 May 2021 09:35:21 -0400 Received: from proxy19.mail.iad3b.rsapps.net ([172.31.255.6]) by director15.mail.ord1d.rsapps.net with LMTP id SIR8ERkUpWAfcAAAIcMcQg (envelope-from ) for ; Wed, 19 May 2021 09:35:21 -0400 Received: from smtp18.gate.iad3b ([172.31.255.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy19.mail.iad3b.rsapps.net with LMTPS id kIQhCxkUpWCDPgAAIG4riQ (envelope-from ) for ; Wed, 19 May 2021 09:35:21 -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: smtp18.gate.iad3b.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: 0df1ab94-b8a7-11eb-ab9c-5254009ad1d4-1-1 Received: from [216.105.38.7] ([216.105.38.7:41306] helo=lists.sourceforge.net) by smtp18.gate.iad3b.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 34/B7-30931-81415A06; Wed, 19 May 2021 09:35:20 -0400 Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from ) id 1ljMLJ-0003Vt-A6; Wed, 19 May 2021 13:34:33 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljMLH-0003VY-NU for openvpn-devel@lists.sourceforge.net; Wed, 19 May 2021 13:34:31 +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:Cc:To:From:Sender:Reply-To: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=8QIzuOMHSdh8NVtUlMBX5r1H+6mt47lwImVW3Yh1urU=; b=iAFL5yoVf/8NFHR2BYUQGLcwhU OOdswfx+NNjToRJP9c381J9+GP6R4sQJ6ax6uB7RtxfkJK8QkZYxpqJa/LDkVp8+rILAOk5Qfu9ZM wMhZq2VMiIYbo7Ouq9gIbVf7W+jViRlOvQt4oNWUtXE/xx/NJUim8f3avIxVGKV2YbfU=; 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:Cc:To:From:Sender:Reply-To: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=8QIzuOMHSdh8NVtUlMBX5r1H+6mt47lwImVW3Yh1urU=; b=NhK1PU7h+rgOvwsbJNt26xxajm PMLkNnQbS8dqBTxtklejHPnPdfKK3kM0Ay9vhIz3tXhGUvsiy3m0Ni3a8wbS56sY+jFs4v9QBrZFF GLs3biNDbDYZ3Hb0xXW+Z/EBqb3lFdE+OB+7IBQUv03+XJSQPOtqYcnKX8B6IhXCwTdA=; Received: from dhcp-174.greenie.muc.de ([193.149.48.174] helo=blue.greenie.muc.de) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.2) id 1ljML9-00F57G-Br for openvpn-devel@lists.sourceforge.net; Wed, 19 May 2021 13:34:32 +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 14JDYGoA028675; Wed, 19 May 2021 15:34:16 +0200 Received: (from gert@localhost) by blue.greenie.muc.de (8.15.2/8.14.9/Submit) id 14JDYFS8028674; Wed, 19 May 2021 15:34:15 +0200 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Wed, 19 May 2021 15:34:15 +0200 Message-Id: <20210519133415.28627-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210519055808.11861-1-gert@greenie.muc.de> References: <20210519055808.11861-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: 1ljML9-00F57G-Br Subject: [Openvpn-devel] [PATCH v3] 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: , Cc: Gert Doering 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. v3: we want == Signed-off-by: Gert Doering Acked-by: selva.nair@gmail.com --- 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; }