From patchwork Wed Nov 18 16:29:27 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 5738 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:6022:b1c3:10b0:11b:d6c:f273 with SMTP id i3-n1csp397611laq; Wed, 18 Nov 2026 08:29:44 -0800 (PST) X-Forwarded-Encrypted: i=2; AL+hErHGIA9kMpG5QWxQWIlmAJXVVmz1GdHETAE9lFN9YrXo8ZPwwhxAYDtTrVE7L08pXTdeBERfKfhInzY=@openvpn.net X-Received: by 2002:a05:701b:465f:10b0:1b2:4e2c:6838 with SMTP id a92af1059eb24-1b543be9aefmr2789916c88.15.1795019384532; Wed, 18 Nov 2026 08:29:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1795019384; cv=none; d=google.com; s=arc-20260327; b=NhJpXr6s5Up3PB4HfGV6bOMpLdP1Tk3B/GJB8iBmYwYFvJNzeAtVV7gA5ARwTv0Jf5 tT5HEIKo3+QibVW/F56aCLbJ/q8x1phcSAsIEHz5h+mY/AftVZ5HUJY7nbSh9Myxoqrj 2GcCJfbVVnw4O3KVkkMrP6kGx24UB52BisKDinzxU55HRLf4CKvH34jJd+mLi6dOOVIJ +8mFKHC/MYl8r+qErYLKmuD09IFAfitj7zampmcvVuzOg2CkMsCBLD7VKM+L4sQ+VOVv b09ovzpAnqF7hDOxyNRrmQaMryM8bPefKriSZmIJn5UEnlu8cCzW1cCeGeEDe8GWAjc6 ngfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :dkim-signature:dkim-signature:dkim-signature; bh=bIJkY50QRBxltRbYZo/dzYr2vZGh/QJLfo7XzrD/C4M=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=ht5DSaBSp7mqLIADk4qQydeO0lHGulEIoe9bmr94sewK0Qhd9c8xKU7lsMmIviqdLu QR0Y9EZDtGVVTkUiU8wOyOlIGJe5svu2SarECGfIUA7Z+TTn8rTr17UKJKAQDhC7JDxO tnILnKhuIeqw+o8uDMCwxgi/baH9dojjRkkOl9PH4EFcJoydx0SbHESGNge/zN9u+x8Y WuLchQQyURlL0m3Oqn1kMbHkkWPrrBADZOpW6wWpLF75USRIWPfrk2yeyBxi0h/Xbrkm x3mcNw92rpKYZKqUc70oFi4WZqm1IRNSUBKHU/XliljwH1TVN3kyxb0FHRy3NyGMtGSL i1oA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b="e5J/mETF"; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=NYuqcXFu; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=PjXLFd36; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=muc.de Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id a92af1059eb24-1b5448d348fsi7729058c88.48.2026.11.18.08.29.44 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Nov 2026 08:29:44 -0800 (PST) Received-SPF: pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) client-ip=216.105.38.7; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b="e5J/mETF"; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=NYuqcXFu; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=PjXLFd36; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=muc.de DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.sourceforge.net; s=beta; h=Content-Transfer-Encoding:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: Subject:MIME-Version:References:In-Reply-To:Message-ID:Date:To:From:Sender: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Unsubscribe-Post: List-Owner; bh=bIJkY50QRBxltRbYZo/dzYr2vZGh/QJLfo7XzrD/C4M=; b=e5J/mETFMQo1K7 UDNLLRnWexi0b23qagSyHHjmnFSnIxAo0Y82CnOZdct12GfRNjEv69CoXTFlCBpqMs4tTc4qMkAw/ i58cdsqcXXNhSqAcXikFg5VdwDLSR2xhwaCkoQkRRaPeHDMFIQtOvfN6RC42oWen81DRfR+HMyCUZ 2eY=; 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.100.1) (envelope-from ) id 1xTiXW-000000002oP-0Tmy; Wed, 18 Nov 2026 16:29:42 +0000 Received: from [172.30.29.66] (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.100.1) (envelope-from ) id 1xTiXV-000000002oJ-1zLa for openvpn-devel@lists.sourceforge.net; Wed, 18 Nov 2026 16:29:41 +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-Unsubscribe-Post:List-Subscribe:List-Post:List-Owner:List-Archive; bh=5hvtEy1lceULP5sIzzHjL1HV8JxRdMefU9Pl9/sa+6M=; b=NYuqcXFugrEt/tewHvw9BQCDfd mOguuKpJwL/WykliRAQtddm8mmAIFRACs5R/avCm/IG2Hvi0+Ni0aOxgMp/9XYgCqCyCrfP7S3iuK 96eUmzYqvZZNrqe9TD3skB2pvVp/T349OXMLG+YHydctI005DvDWiJ/uj6xHoxyuA0p4=; 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-Unsubscribe-Post: List-Subscribe:List-Post:List-Owner:List-Archive; bh=5hvtEy1lceULP5sIzzHjL1HV8JxRdMefU9Pl9/sa+6M=; b=PjXLFd365WsdWFq3gwK/RyM5+P BlwwVeBxdpiq1ZT0Wngu1utTXBog2ACYPmUTuuwfH1/w/51qQyUcv3RrC+slEZ/KuW9z8X4DvzWad Uf7nxve+Iw/tHkqnZbysR64OClUeSU84t1X7Zb0w75Fls5QbTV1JI9Nhrkhp6JGlP3Zg=; Received: from [193.149.48.129] (helo=blue.greenie.muc.de) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.100.1) id 1xTiXT-000000005wU-3KRG for openvpn-devel@lists.sourceforge.net; Wed, 18 Nov 2026 16:29:41 +0000 Received: from blue.greenie.muc.de (localhost [127.0.0.1]) by blue.greenie.muc.de (8.18.1/8.18.1) with ESMTP id 6AIGTWY8022675 for ; Wed, 18 Nov 2026 17:29:32 +0100 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.2/8.18.1/Submit) id 6AIGTWJY022674 for openvpn-devel@lists.sourceforge.net; Wed, 18 Nov 2026 17:29:32 +0100 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Wed, 18 Nov 2026 17:29:27 +0100 Message-ID: <20261118162932.22639-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.55.0 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Score: 1.3 (+) X-Spam-Report: Spam detection software, running on the system "sfi-spamd-1.hosts.colo.sdot.me", 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: From: Razvan Cojocaru tls_authentication_status() open-coded check_for_client_reason() for the plugin and script auth status. Call the helper instead. key_state_check_auth_failed_message_file() had no other caller, so fold [...] Content analysis details: (1.3 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.3 RDNS_NONE Delivered to internal network by a host with no rDNS X-Headers-End: 1xTiXT-000000005wU-3KRG Subject: [Openvpn-devel] [PATCH v2] ssl_verify: use check_for_client_reason() in tls_authentication_status() 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 X-GMAIL-THRID: 1882214246259060884 X-GMAIL-MSGID: 1882214246259060884 From: Razvan Cojocaru tls_authentication_status() open-coded check_for_client_reason() for the plugin and script auth status. Call the helper instead. key_state_check_auth_failed_message_file() had no other caller, so fold it into the helper. Change-Id: Ia48c1efc9a687383a1dc87edd49d8ba3eb5a87ad Signed-off-by: Razvan Cojocaru Acked-by: Frank Lichtenheld Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2217 --- This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master. Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2217 This mail reflects revision 2 of this Change. Acked-by according to Gerrit (reflected above): Frank Lichtenheld diff --git a/src/openvpn/ssl_verify.c b/src/openvpn/ssl_verify.c index 8641d15..f33a59c 100644 --- a/src/openvpn/ssl_verify.c +++ b/src/openvpn/ssl_verify.c @@ -1037,24 +1037,22 @@ } /** - * Checks if the auth failed reason file has any content and if yes it will - * be returned as string allocated in gc to the caller. - */ -static char * -key_state_check_auth_failed_message_file(const struct auth_deferred_status *ads, - struct gc_arena *gc) + * Check if the script/plugin left a message in the auth failed message + * file and relay it to the user */ +static void +check_for_client_reason(struct tls_multi *multi, const struct auth_deferred_status *ads) { - char *ret = NULL; if (ads->auth_failed_reason_file) { - struct buffer reason = buffer_read_from_file(ads->auth_failed_reason_file, gc); + struct gc_arena gc = gc_new(); + struct buffer reason = buffer_read_from_file(ads->auth_failed_reason_file, &gc); if (BLEN(&reason)) { - ret = BSTR(&reason); + auth_set_client_reason(multi, BSTR(&reason)); } + gc_free(&gc); } - return ret; } @@ -1221,21 +1219,9 @@ #endif if (failed_auth) { - struct gc_arena gc = gc_new(); const struct key_state *ks = get_primary_key(multi); - const char *plugin_message = - key_state_check_auth_failed_message_file(&ks->plugin_auth, &gc); - const char *script_message = - key_state_check_auth_failed_message_file(&ks->script_auth, &gc); - - if (plugin_message) - { - auth_set_client_reason(multi, plugin_message); - } - if (script_message) - { - auth_set_client_reason(multi, script_message); - } + check_for_client_reason(multi, &ks->plugin_auth); + check_for_client_reason(multi, &ks->script_auth); /* We have at least one session that failed authentication. There * might be still another session with valid keys. @@ -1243,7 +1229,6 @@ * with the other session (and we actually did that in earlier * version, this behaviour is really strange from a user (admin) * experience */ - gc_free(&gc); return TLS_AUTHENTICATION_FAILED; } else if (success) @@ -1305,20 +1290,6 @@ * this is the place to start. *************************************************************************** */ -/** - * Check if the script/plugin left a message in the auth failed message - * file and relay it to the user */ -static void -check_for_client_reason(struct tls_multi *multi, const struct auth_deferred_status *status) -{ - struct gc_arena gc = gc_new(); - const char *msg = key_state_check_auth_failed_message_file(status, &gc); - if (msg) - { - auth_set_client_reason(multi, msg); - } - gc_free(&gc); -} /* * Verify the user name and password using a script */