From patchwork Thu Nov 12 06:32:26 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 5675 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:6022:529c:b0:11a:a05e:cb97 with SMTP id x28csp1493925lax; Wed, 11 Nov 2026 22:32:49 -0800 (PST) X-Forwarded-Encrypted: i=2; AL+hErGOsfWkNRt8ZCAFvCCvyxviaS1L3kclTZY7sCY7zaF8th5+l/5EeyNlOxBAstlT1bCxObUOz46+B2g=@openvpn.net X-Received: by 2002:a05:7022:ea55:20b0:1a9:f3d2:6262 with SMTP id a92af1059eb24-1b3c035a68fmr4045083c88.36.1794465168627; Wed, 11 Nov 2026 22:32:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1794465168; cv=none; d=google.com; s=arc-20260327; b=JGxs8zDkZj9DytvVxNC8Y2uJfKBpO88SzH+XBEZNmhL5dDFclDg0L1lifo6av1Rvnr 8gJ3VVWYWZr3RBSkeXS9eQ2md3VsylNHPNhemH1u5nDBItyXmqhb+AOUrjSu88vHWMRU O+ZIEdw1fIWlyvO88hlfnCjVjDzn56gNkzp08vM5nHpRwT5BkVH3BGn8C9+SB5626dl0 vV/5A3XDqKDUWBxnBhu44B+3TViOkTljaALvvuF9/S3n64u9J1twWhVOYHZXfC0H79JH d0P1bQgx2laxY6mN/Km6DFBrgIvKID4Q79rvDRpQ+I8iPqHa0RLp6N13/oC7/U9I0kBY GAcw== 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=6d7TWYEhOQkgt5Eu0hNZhrb5lMFosG1+JZ9I52c1R34=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=TyTNPMRM07wtSmP4EkLygktjWKFKx2Xj6qYykjd57eDxiLEMNZQKo0pCfLv4A+AolD QE5Y8SOPcRalmqcT3RiBiu4mAS2iyQCrQvv5ctMpTqCOQ5GDR7K+6j7JeiwfcwBYKA1u u7OdzP0TP6NS0mwgi0xZxfB7eSj7uxgyBmYBXm0sPiQFzWowKK97lwT+4jlaSk+bR6V0 hawjQBIcGS62Z5ck0+5jVXAOeGlOdyvzsFwXVTdsnn9/HFvBFT8uMvautFXxzb1VxoIs cLTvg6tRLTmAuF2ul1otWHoQXb+G1GmPH+dR9WzZyIl63jakP8dr1WQvxgTgOYrEgClJ ifVw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=EA7U5TW5; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=Dgz2iD15; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=Uh8rHRMM; 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-1b3b5b818casi27260804c88.45.2026.11.11.22.32.47 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Nov 2026 22:32:48 -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=EA7U5TW5; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=Dgz2iD15; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=Uh8rHRMM; 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=6d7TWYEhOQkgt5Eu0hNZhrb5lMFosG1+JZ9I52c1R34=; b=EA7U5TW5r8YWcK BIsZCNzkxI2xtX1SXEr/v4RsomWWMMNul56Wf0jJ7rPmlqKz8hYTYBaKmdI9EwFi+qDH5yHVQNzi9 X+vB5i0fZJgR2pZ1d5nUoSn8tTE7RuhEVwf1eWvyoot4WlhJceQN4+c442W2SSu5udyugQY8vnPcS QKo=; Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.100.1) (envelope-from ) id 1xROMV-0000000059l-0kNW; Thu, 12 Nov 2026 06:32:43 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.100.1) (envelope-from ) id 1xROMT-0000000059e-1k5P for openvpn-devel@lists.sourceforge.net; Thu, 12 Nov 2026 06:32: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=DgZv6POLR1N+3EKeQuzTfc0/r1dc340A5+2kvCON1I4=; b=Dgz2iD1562rRac7lC357YbGegG Mc966i7zQLQ8PxNGH0nWxQjBencGPwnjV8WgQ5qGpBGgbjxK4xb4x6HgUImjF6F2HCFbsaFd2Uoqn zt5lsDUGdoCkJv6Xkj/aay/mId159SRw25eMEmgjdM4vroZNrhi1qbrDz3xJsZG0uBHs=; 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=DgZv6POLR1N+3EKeQuzTfc0/r1dc340A5+2kvCON1I4=; b=Uh8rHRMMeqmJsf2jtwKhrjsRzJ j/ZIbGIHmBD4rCVGcI9TX7E0khTyx/VYA/QT3Ns7ylZPZF7c06NNKjPADAu3o5EjUxhQZOaO9ys/C 6+6zeYDzDvMWyDHfPRq5+X7ImkUIshCcWw3fqO06MRWjInKEpazkF4tq3gIJaBMe5IXI=; Received: from [193.149.48.129] (helo=blue.greenie.muc.de) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.100.1) id 1xROMR-000000005Z7-3aw3 for openvpn-devel@lists.sourceforge.net; Thu, 12 Nov 2026 06:32: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 6AC6WXKb024015 for ; Thu, 12 Nov 2026 07:32:33 +0100 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.2/8.18.1/Submit) id 6AC6WWFq024014 for openvpn-devel@lists.sourceforge.net; Thu, 12 Nov 2026 07:32:32 +0100 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Thu, 12 Nov 2026 07:32:26 +0100 Message-ID: <20261112063232.23999-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 When AddDnsSearchDomains() failed, SetDnsSearchDomains() still called RemoveDnsSearchDomains() with the new domains, which removes matching domains already in the search list, e.g. ones configured bef [...] 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: 1xROMR-000000005Z7-3aw3 Subject: [Openvpn-devel] [PATCH v2] openvpnserv: only remove search domains that were added 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: 1881633108800745114 X-GMAIL-MSGID: 1881633108800745114 From: Razvan Cojocaru When AddDnsSearchDomains() failed, SetDnsSearchDomains() still called RemoveDnsSearchDomains() with the new domains, which removes matching domains already in the search list, e.g. ones configured before the VPN connected. Record the undo data first, as done for NRPT rules, and drop it if adding the domains fails. Broken since ae90cbad ("dns: support multiple domains without DHCP"). Change-Id: I7ffae4da3b29521844a31d234fe6a9dd08954cf4 Signed-off-by: Razvan Cojocaru Acked-by: Antonio Quartulli Acked-by: Heiko Hund Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2161 --- 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/+/2161 This mail reflects revision 2 of this Change. Acked-by according to Gerrit (reflected above): Antonio Quartulli Heiko Hund diff --git a/src/openvpnserv/interactive.c b/src/openvpnserv/interactive.c index 81205d6..5d2abeb 100644 --- a/src/openvpnserv/interactive.c +++ b/src/openvpnserv/interactive.c @@ -1823,13 +1823,19 @@ strncpy_s(undo_data->itf_name, sizeof(undo_data->itf_name), itf_name, _TRUNCATE); undo_data->domains = wide_domains; - if (AddDnsSearchDomains(list_key, have_list, wide_domains) == FALSE - || AddListItem(&(*lists)[undo_domains], undo_data) != NO_ERROR) + /* Add undo information first in case there's no heap left */ + if (AddListItem(&(*lists)[undo_domains], undo_data) != NO_ERROR) { - RemoveDnsSearchDomains(list_key, wide_domains); free(wide_domains); free(undo_data); - undo_data = NULL; + goto out; + } + + if (!AddDnsSearchDomains(list_key, have_list, wide_domains)) + { + RemoveListItem(&(*lists)[undo_domains], CmpAny, NULL); + free(wide_domains); + free(undo_data); goto out; } }