From patchwork Sun Nov 29 17:13:28 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 5813 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:6022:91c9:10b0:11b:d6c:f273 with SMTP id tl9-n1csp11763122lad; Sun, 29 Nov 2026 09:13:45 -0800 (PST) X-Forwarded-Encrypted: i=2; AL+hErHeZcCPAu/xDEigiAog2nkND8yg+xYmQxq3rI/ayHFFBciofGK2j3jWyH1FHgbPjtrbLeLT22sOhCc=@openvpn.net X-Received: by 2002:a05:7300:6d03:b0:381:9b9c:6140 with SMTP id 5a478bee46e88-3856fd5bf5emr42144529eec.23.1795972425263; Sun, 29 Nov 2026 09:13:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1795972425; cv=none; d=google.com; s=arc-20260327; b=ioy3kk4A/hnu35qs8DW9JGtJig67byOA24L/qY1nyQ2CnLXUoSxCL6symvJOLZc/QM DzutQbBovpWVxHv7Ud2fIA/zgdRM70QXJxDTAR1RnKfIgVNl0y1qZWFiNXT/claH8btm vBsEdRiW/l2qk2QsoUj+ag171ozkLzWoh8IXnwgksrN+dA9aPgFJeUZicQ2hSkyp2nFj jrcSl6Ks2u38yOCthNhcfixdtKZ/1cu6AbMuagY+GUW1fB+g4xXGfQDT1z8gTuNT/juu oc79Ioe/Fu8GaMy8cp0nqjiNeKd+PlPcelTdhCNYVlkd75r1GrXy+Pc5blJOa6iaLrEy FF9g== 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=kA+pp6jTZ/und3lfsPR3E8SEV4oaah2a89EMR102udA=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=Pb9UFScJvJ0tLCEYLPquizs6b2zeSz2JMR/hC8jrjxX8Qz88t0S4Rhq52rSY8mbksm KK8IwD8/uQ1Da5Rt8Cl7Syhv1dJ+Ldlnl6qEmAFyU9vqnxW4298MBmpb2GhStY+6TzKl +Jqc8/92TBpDStbQiDcvy2JYSUSp2kkMdq8TjJw8/X7d855oA3Nex11fTOdQS/g+rLJb ha7rtF0PN2RHn7RTT3hb03JLiWr5qQeQNtuJ5/ZP12HQXLwX/ZDGvgiMIQm8rfk+4VL2 HFSSU+xKh66Tekvr3xz4eQiM9Rf254PVWFsQ7NzQaa3yRqwBhUaLLu154mJzb8YdGYON EJTg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=TKM2AQ3i; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=h66TGvJA; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=cfbgdh4l; 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 5a478bee46e88-38564768160si122317561eec.3.2026.11.29.09.13.44 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 29 Nov 2026 09:13:45 -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=TKM2AQ3i; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=h66TGvJA; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=cfbgdh4l; 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=kA+pp6jTZ/und3lfsPR3E8SEV4oaah2a89EMR102udA=; b=TKM2AQ3iBjkQ0k eL6vv93SRxHDt4Q/fn7/ZewOW51i8Tqzh0vAcFEfqGJuLcOq8Q2HsULZb5fRU951u29HEyHYCSWYK 1fZYVPN932+nqgDBJOu93gHlM3mjgzZyeQqOUT+usn4fhftJJuTuXg3Z/wFWxVEYKDUWjqjeGmMAw hJc=; Received: from [127.0.0.1] (helo=sfs-ml-3.v29.lw.sourceforge.com) by sfs-ml-3.v29.lw.sourceforge.com with esmtp (Exim 4.100.1) (envelope-from ) id 1xXiT9-0000000068L-3mS7; Sun, 29 Nov 2026 17:13:43 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-3.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.100.1) (envelope-from ) id 1xXiT7-0000000068D-39LX for openvpn-devel@lists.sourceforge.net; Sun, 29 Nov 2026 17:13: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=5ow+MHCBlouHhAB7y1PU9+Vid4SWbTGji14ZTyf6nQI=; b=h66TGvJAXiwhmCyBAvIbrT7raq SwYWdSvFJv7l/0AAreMqauNoX9fX30c7ZQ7GzUFSaM28sOPyDBSj5feQsAvKSqPreewMLW9IxHUVj nDF5fd3gOuChwjGpmXKne2ppJcEMXdms6KUleMINFTIWtHgjPTAuBKQduOqZqQoRnc0Y=; 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=5ow+MHCBlouHhAB7y1PU9+Vid4SWbTGji14ZTyf6nQI=; b=cfbgdh4ljQG6q5BBzBQtaC3S7U KQExUG9a3X6Vxv0JYxrjVKepdVqwvIAL17Tpd2Iz+7ygl/yFFdJ1ZrLddKjz6RIjdH0rXYMvlwCG9 qWVH0N/3RMDVRH8TiXxA3l+2bmAFg39y+ILaz7xw9bAXJ+Yd2GvU3bVu+lPtSL9iklyk=; 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 1xXiT6-000000003v3-1k2r for openvpn-devel@lists.sourceforge.net; Sun, 29 Nov 2026 17:13: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 6ATHDXZ5015386 for ; Sun, 29 Nov 2026 18:13:33 +0100 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.2/8.18.1/Submit) id 6ATHDX1H015385 for openvpn-devel@lists.sourceforge.net; Sun, 29 Nov 2026 18:13:33 +0100 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Sun, 29 Nov 2026 18:13:28 +0100 Message-ID: <20261129171333.15374-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-2.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 Log failures to create or disconnect the first pipe instance with their own messages, instead of falling through to the generic one. This makes a pipe name already in use distinguishable, and logs the [...] 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: 1xXiT6-000000003v3-1k2r Subject: [Openvpn-devel] [PATCH v1] openvpnserv: report pipe creation errors where they happen 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: 1883213581882378039 X-GMAIL-MSGID: 1883213581882378039 From: Razvan Cojocaru Log failures to create or disconnect the first pipe instance with their own messages, instead of falling through to the generic one. This makes a pipe name already in use distinguishable, and logs the error before CloseHandleEx() can clobber it. Change-Id: Id795de7dfe1324fb00660b6f8a9043732aa3e84c Signed-off-by: Razvan Cojocaru Acked-by: Heiko Hund Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2356 --- 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/+/2356 This mail reflects revision 1 of this Change. Acked-by according to Gerrit (reflected above): Heiko Hund diff --git a/src/openvpnserv/interactive.c b/src/openvpnserv/interactive.c index 1cb191a..a381fa1 100644 --- a/src/openvpnserv/interactive.c +++ b/src/openvpnserv/interactive.c @@ -4066,35 +4066,34 @@ swprintf(pipe_name, _countof(pipe_name), L"\\\\.\\pipe\\" _L(PACKAGE) L"%ls\\service", service_instance); + HANDLE pipe = INVALID_HANDLE_VALUE; + static HANDLE blocker = INVALID_HANDLE_VALUE; if (blocker == INVALID_HANDLE_VALUE) { blocker = CreateNamedPipe(pipe_name, flags | FILE_FLAG_FIRST_PIPE_INSTANCE, mode, PIPE_UNLIMITED_INSTANCES, 1024, 1024, 0, &sa); - if (blocker != INVALID_HANDLE_VALUE && !DisconnectNamedPipe(blocker)) + if (blocker == INVALID_HANDLE_VALUE) { - DWORD error = GetLastError(); + MsgToEventLog(M_SYSERR, L"Could not create first instance of named pipe"); + goto out; + } + if (!DisconnectNamedPipe(blocker)) + { + MsgToEventLog(M_SYSERR, L"Could not disconnect first instance of named pipe"); CloseHandleEx(&blocker); - SetLastError(error); + goto out; } } - /* Without the first instance, fail and try again with the next call */ - HANDLE pipe = INVALID_HANDLE_VALUE; - if (blocker != INVALID_HANDLE_VALUE) - { - pipe = CreateNamedPipe(pipe_name, flags, mode, PIPE_UNLIMITED_INSTANCES, 1024, 1024, 0, - &sa); - } - - LocalFree(sd); - + pipe = CreateNamedPipe(pipe_name, flags, mode, PIPE_UNLIMITED_INSTANCES, 1024, 1024, 0, &sa); if (pipe == INVALID_HANDLE_VALUE) { MsgToEventLog(M_SYSERR, L"Could not create named pipe"); - return INVALID_HANDLE_VALUE; } +out: + LocalFree(sd); return pipe; }