From patchwork Mon Jan 25 01:56:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arne Schwabe X-Patchwork-Id: 1580 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director12.mail.ord1d.rsapps.net ([172.28.255.1]) by backend30.mail.ord1d.rsapps.net with LMTP id GPLnJkvADmBPRgAAIUCqbw (envelope-from ) for ; Mon, 25 Jan 2021 07:57:47 -0500 Received: from proxy8.mail.ord1c.rsapps.net ([172.28.255.1]) by director12.mail.ord1d.rsapps.net with LMTP id mPDIJkvADmCQawAAIasKDg (envelope-from ) for ; Mon, 25 Jan 2021 07:57:47 -0500 Received: from smtp33.gate.ord1c ([172.28.255.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy8.mail.ord1c.rsapps.net with LMTPS id WF2IJkvADmDMZgAAHz/atg (envelope-from ) for ; Mon, 25 Jan 2021 07:57:47 -0500 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: smtp33.gate.ord1c.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=rfc2549.org X-Suspicious-Flag: YES X-Classification-ID: ebf500de-5f0c-11eb-a3a7-54520067fec4-1-1 Received: from [216.105.38.7] ([216.105.38.7:41680] helo=lists.sourceforge.net) by smtp33.gate.ord1c.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 45/E6-06632-B40CE006; Mon, 25 Jan 2021 07:57:47 -0500 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 1l41QU-0004w6-Uc; Mon, 25 Jan 2021 12:57:02 +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 1l41QF-0004rs-2p for openvpn-devel@lists.sourceforge.net; Mon, 25 Jan 2021 12:56:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=References:In-Reply-To:Message-Id:Date:Subject:To: From:Sender:Reply-To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: 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=hQPZhEw9ZBYGGz58+HLUBle/7D1Gs6EfMKIWcTN9Ito=; b=clN5zz86aiCXagdMYtOxmr4/tb j39V8jrwVHqXGj4ZL93EUBaiKvPtMKtFwiA8QQLf0JOHI9O9mSy1x8YNqAmpb7roAz+DrevMGhvst BzhdeFTHrsYJHRdz+mTPfNIjrObfe+JeiBuQBwapaNEB2nCxv/SFeOcRcJjZxdggpsws=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=References:In-Reply-To:Message-Id:Date:Subject:To:From:Sender:Reply-To:Cc :MIME-Version:Content-Type:Content-Transfer-Encoding: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=hQPZhEw9ZBYGGz58+HLUBle/7D1Gs6EfMKIWcTN9Ito=; b=fMKqB7gaJRRF9+1n/fpZ9RhpUC 37caTHsPJeZKswPDR4+AjNpLgabI4myMXlyXq7rUWQxfwJAoIDb+2Bqr5qckrlLvEix3OiOOfx5JW ZagbJqEpl7zD0+wtz+S5R1NA8tBbxkbb/1iZNU2eqdgESpqteCwFsFVzsQA6gTSn+LZk=; Received: from mail.blinkt.de ([192.26.174.232]) by sfi-mx-3.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.2) id 1l41QB-006gWt-9J for openvpn-devel@lists.sourceforge.net; Mon, 25 Jan 2021 12:56:47 +0000 Received: from kamera.blinkt.de ([2001:638:502:390:20c:29ff:fec8:535c]) by mail.blinkt.de with smtp (Exim 4.94 (FreeBSD)) (envelope-from ) id 1l41Pw-0007X0-VO for openvpn-devel@lists.sourceforge.net; Mon, 25 Jan 2021 13:56:28 +0100 Received: (nullmailer pid 30420 invoked by uid 10006); Mon, 25 Jan 2021 12:56:28 -0000 From: Arne Schwabe To: openvpn-devel@lists.sourceforge.net Date: Mon, 25 Jan 2021 13:56:21 +0100 Message-Id: <20210125125628.30364-5-arne@rfc2549.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210125125628.30364-1-arne@rfc2549.org> References: <20210125125628.30364-1-arne@rfc2549.org> X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 SPF_NONE SPF: sender does not publish an SPF Record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-Headers-End: 1l41QB-006gWt-9J Subject: [Openvpn-devel] [PATCH v2 04/11] Introduce management client state for AUTH_PENDING notifications 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: , MIME-Version: 1.0 Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox This allows a UI client to display the correct state. Technically the client is still waiting for PUSH_REPLY but for every practical concern this is a different state as we are waiting for the pending authentication to finish. Signed-off-by: Arne Schwabe Acked-by: Lev Stipakov --- src/openvpn/manage.c | 3 +++ src/openvpn/manage.h | 2 ++ src/openvpn/push.c | 18 ++++++++++++++++++ 3 files changed, 23 insertions(+) diff --git a/src/openvpn/manage.c b/src/openvpn/manage.c index 98a9a4cc..df987f53 100644 --- a/src/openvpn/manage.c +++ b/src/openvpn/manage.c @@ -169,6 +169,9 @@ man_state_name(const int state) case OPENVPN_STATE_TCP_CONNECT: return "TCP_CONNECT"; + case OPENVPN_STATE_AUTH_PENDING: + return "AUTH_PENDING"; + default: return "?"; } diff --git a/src/openvpn/manage.h b/src/openvpn/manage.h index aaa3b848..2f94b10c 100644 --- a/src/openvpn/manage.h +++ b/src/openvpn/manage.h @@ -493,6 +493,8 @@ management_enable_def_auth(const struct management *man) #define OPENVPN_STATE_GET_CONFIG 9 /* Downloading configuration from server */ #define OPENVPN_STATE_RESOLVE 10 /* DNS lookup */ #define OPENVPN_STATE_TCP_CONNECT 11 /* Connecting to TCP server */ +#define OPENVPN_STATE_AUTH_PENDING 12 /* Waiting in auth-pending mode + * techhnically variant of GET_CONFIG */ #define OPENVPN_STATE_CLIENT_BASE 7 /* Base index of client-only states */ diff --git a/src/openvpn/push.c b/src/openvpn/push.c index e68fda9f..7d3cf806 100644 --- a/src/openvpn/push.c +++ b/src/openvpn/push.c @@ -248,12 +248,30 @@ parse_auth_pending_keywords(const struct buffer *buffer, if (!buf_advance(&buf, strlen("AUTH_PENDING")) || !(buf_read_u8(&buf) == ',') || !BLEN(&buf)) { +#ifdef ENABLE_MANAGEMENT + if (management) + { + management_set_state(management, OPENVPN_STATE_AUTH_PENDING, + "", NULL, NULL, NULL, NULL); + } +#endif + return; } /* parse the keywords in the same way that push options are parsed */ char line[OPTION_LINE_SIZE]; +#ifdef ENABLE_MANAGEMENT + /* Need to do the management notification with the keywords before + * buf_parse is called, as it will insert \0 bytes into the buffer */ + if (management) + { + management_set_state(management, OPENVPN_STATE_AUTH_PENDING, + BSTR(&buf), NULL, NULL, NULL, NULL); + } +#endif + while (buf_parse(&buf, ',', line, sizeof(line))) { if (sscanf(line, "timeout %u", server_timeout) != 1)