From patchwork Wed Aug 3 05:40:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Quartulli X-Patchwork-Id: 2623 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director10.mail.ord1d.rsapps.net ([172.31.255.6]) by backend30.mail.ord1d.rsapps.net with LMTP id U4/GLjGX6mJoEAAAIUCqbw (envelope-from ) for ; Wed, 03 Aug 2022 11:41:37 -0400 Received: from proxy19.mail.iad3b.rsapps.net ([172.31.255.6]) by director10.mail.ord1d.rsapps.net with LMTP id yPzuLTGX6mL5EQAApN4f7A (envelope-from ) for ; Wed, 03 Aug 2022 11:41:37 -0400 Received: from smtp7.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 kO+CJTGX6mITKgAAIG4riQ (envelope-from ) for ; Wed, 03 Aug 2022 11:41:37 -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: smtp7.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=unstable.cc X-Suspicious-Flag: YES X-Classification-ID: c1fc2578-1342-11ed-8295-525400e292e5-1-1 Received: from [216.105.38.7] ([216.105.38.7:36256] helo=lists.sourceforge.net) by smtp7.gate.iad3b.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 86/41-04783-0379AE26; Wed, 03 Aug 2022 11:41:36 -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.94.2) (envelope-from ) id 1oJGU5-0000Sx-3A; Wed, 03 Aug 2022 15:40:33 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1oJGU3-0000Sj-Mi for openvpn-devel@lists.sourceforge.net; Wed, 03 Aug 2022 15:40: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: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:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=UvGBY5Lo+m5jgBthJlySCW8uLqj6S666DndZYeLfq/U=; b=KcMytfmH70lFvcsqjEshBh1sBr hMevk9ccAmPuPpiTc7DZhu/bGB3MsQJ/cSMpdtkyi8Ia4nGt3Eg0mQsyoL5CjzDUZYddU/GxHC9T+ Iu1FZjOpbSEaiaq3hntz8YIDMEwJ3P9dvVgah2AD/g9BQeK77ZrjZ+tuz/mUrx85rytk=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version: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:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=UvGBY5Lo+m5jgBthJlySCW8uLqj6S666DndZYeLfq/U=; b=V Vbq8Fhd2PFzNgeacu6X3k42bYfKbtkMze1Czw/lGXvxsoQW9xo4sUo/I+QZCe3vr3kuUb/SjFsZbK IJ3kKdRfbHdNodYoFTk1rdbYBgW241Xcc/s5Sxn/ii8N6s1w8wbhCFdtRzPg614wyI8oRSy/gtpcs ysJhz1VWBkWBjHhI=; Received: from s2.neomailbox.net ([5.148.176.60]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLS1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.94.2) id 1oJGTv-001xS2-Lt for openvpn-devel@lists.sourceforge.net; Wed, 03 Aug 2022 15:40:31 +0000 From: Antonio Quartulli To: openvpn-devel@lists.sourceforge.net Date: Wed, 3 Aug 2022 17:40:49 +0200 Message-Id: <20220803154049.1213-1-a@unstable.cc> MIME-Version: 1.0 X-Spam-Report: Spam detection software, running on the system "util-spamd-1.v13.lw.sourceforge.com", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: The authfail_extended and buf variables are only used when ENABLE_MANAGEMENT is defined. However, they are currently declared outside of any ifdefs, thus triggering a warning. Move the declaration of these 2 down, right before their usage (within the existing "#ifdef ENABLE_MANAGEMENT" block. Content analysis details: (-0.0 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record X-Headers-End: 1oJGTv-001xS2-Lt Subject: [Openvpn-devel] [PATCH] push: fix compilation with --disable-management and --enable-werror 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: Antonio Quartulli Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox The authfail_extended and buf variables are only used when ENABLE_MANAGEMENT is defined. However, they are currently declared outside of any ifdefs, thus triggering a warning. Move the declaration of these 2 down, right before their usage (within the existing "#ifdef ENABLE_MANAGEMENT" block. Fixes: ("Cleanup receive_auth_failed and simplify method") Cc: Arne Schwabe Signed-off-by: Antonio Quartulli Acked-by: Gert Doering --- src/openvpn/push.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/openvpn/push.c b/src/openvpn/push.c index d0038795..51dc8359 100644 --- a/src/openvpn/push.c +++ b/src/openvpn/push.c @@ -58,12 +58,6 @@ receive_auth_failed(struct context *c, const struct buffer *buffer) return; } - struct buffer buf = *buffer; - - /* If the AUTH_FAIL message ends with a , it is an extended message that - * contains further flags */ - bool authfail_extended = buf_string_compare_advance(&buf, "AUTH_FAILED,"); - /* Before checking how to react on AUTH_FAILED, first check if the * failed auth might be the result of an expired auth-token. * Note that a server restart will trigger a generic AUTH_FAILED @@ -95,6 +89,11 @@ receive_auth_failed(struct context *c, const struct buffer *buffer) c->sig->signal_text = "auth-failure"; } #ifdef ENABLE_MANAGEMENT + struct buffer buf = *buffer; + /* If the AUTH_FAIL message ends with a , it is an extended message that + * contains further flags */ + bool authfail_extended = buf_string_compare_advance(&buf, "AUTH_FAILED,"); + if (management) { const char *reason = NULL;