From patchwork Wed Jul 12 09:54:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arne Schwabe X-Patchwork-Id: 3284 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7300:1496:b0:d7:3b0f:3938 with SMTP id b22csp4252717dyh; Wed, 12 Jul 2023 02:55:17 -0700 (PDT) X-Google-Smtp-Source: APBJJlFc2a7MOSBY5kL+WgVaYy42lWEsFh2uOTgOAb0iEkjEOSOsb+Y5ASUh7M1Ei+dKC5a02PjS X-Received: by 2002:a17:903:268a:b0:1b5:561a:5ca9 with SMTP id jf10-20020a170903268a00b001b5561a5ca9mr14195799plb.50.1689155717472; Wed, 12 Jul 2023 02:55:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689155717; cv=none; d=google.com; s=arc-20160816; b=nQTPbT/MKP5cyFf33ZmgI686Zt3J4bmp7jZqpVBGhbJ481dNfgcgOuR0h53vpmEhV2 UTw7T9uqSnjYmbxV+LlHepgDxbKEED2zrQrM0ic1JKD9OxhaWsNPiKLmQ+XdiPXLa8ug ZnRPT+XNaBCt2M1+M2FP6NT9LHxmgziAK0Lf2ARDbqa9l/GpqJZHKL2ZYwodCrVtKkS+ Z3pMr7jURkM/PVcG34lEP93KS0yYSAua+VKDZi7UZ2wzyRdEmnvkdT0X8QwimIkArWHL jLTBaJZmqCket9oum/KO9c3T/NP1eOTUMYfpi0FBFSt8gfsi8O+zuAI2IuUBVqrboD4l IwOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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; bh=dT/536ebSRWeaUtdyLSL8C2ImuT/MCdRyQkNxcP70Eg=; fh=upowIstEaPvyXBxHFaCeSfbprOF7d6h3Rt41IfheAVg=; b=UG+riH5ChFhBMjFOtIFluUZ+57BlJTGnDut64AcqICHtTPLz/iJMl9zcYfPquZnipr huxsvC5GBKbwsiv0kd2roLOTNVV/ezAP/2Itm57sXR0zuAttgvlXRiXblM7Hh/guoyjm ds/SycOijYQJ5fbbv596OSJ/wz7VQcEF3mS8SR9Y2D2TJx4pkRh3L/4W987yuAu9TzJC ZN4CCg1MrCHpvhuVSHl7uWaYGJZkuU5atZ52djule7Eh4oxd8DRZhU0gVe6lL+Y8faVr UQQ2u0Vxz7EqHvhdjDOBpk/pKR7MAeeuXW8E0GmNVsw5DFw9aRHqlAFHIr9t/nP+NNEw CRyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b="QTHV/Tlj"; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=L7N8pGp1; 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 Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id j13-20020a170902da8d00b001b9e36ed387si3155509plx.525.2023.07.12.02.55.17 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Jul 2023 02:55:17 -0700 (PDT) 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=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b="QTHV/Tlj"; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=L7N8pGp1; 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 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.95) (envelope-from ) id 1qJWY8-0001X0-UR; Wed, 12 Jul 2023 09:54:20 +0000 Received: from [172.30.20.202] (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.95) (envelope-from ) id 1qJWY7-0001Wu-KM for openvpn-devel@lists.sourceforge.net; Wed, 12 Jul 2023 09:54:19 +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-Subscribe:List-Post:List-Owner:List-Archive; bh=lxKYsIVsIyL2P0qYL/sJTtJqZJGlYDhs8++lClPmwac=; b=QTHV/TljbVRAYlz0mRGE3YNGk5 dPlP5+6paP43sVYnbIUOZwGCUmMoI9duARzFhTxJTMr5fTegVd+k0Z773+2FAs735nLwL1ewb0Ngp A4J4IUHTgUZwaap8vmVcjtigJamEMjMG30kmJ21pkpLANZeWKoXBmXV/o1zt9NxKzfbk=; 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-Subscribe: List-Post:List-Owner:List-Archive; bh=lxKYsIVsIyL2P0qYL/sJTtJqZJGlYDhs8++lClPmwac=; b=L7N8pGp1GwY9YV6H2hpa+DCFBJ EPiVQiGA+EWfUm0TsU1YkZp7a+7WD3/AEKou63uyfv9+k/JMCXS+H1BPs1MEGIXjiZV2xWaLGxL4w 4N71rus6zBIlaq0yzplewychu+LfHxD9IfMk6lztTMvwIVuf3LrAVvTe6BlJMH3mRdxU=; Received: from mail.blinkt.de ([192.26.174.232]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1qJWY6-005M1T-Nc for openvpn-devel@lists.sourceforge.net; Wed, 12 Jul 2023 09:54:19 +0000 Received: from kamera.blinkt.de ([2001:638:502:390:20c:29ff:fec8:535c]) by mail.blinkt.de with smtp (Exim 4.95 (FreeBSD)) (envelope-from ) id 1qJWY0-000PsL-7d for openvpn-devel@lists.sourceforge.net; Wed, 12 Jul 2023 11:54:12 +0200 Received: (nullmailer pid 570152 invoked by uid 10006); Wed, 12 Jul 2023 09:54:12 -0000 From: Arne Schwabe To: openvpn-devel@lists.sourceforge.net Date: Wed, 12 Jul 2023 11:54:12 +0200 Message-Id: <20230712095412.570106-1-arne@rfc2549.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230704140805.3851328-1-arne@rfc2549.org> References: <20230704140805.3851328-1-arne@rfc2549.org> MIME-Version: 1.0 X-Spam-Score: 0.2 (/) X-Spam-Report: Spam detection software, running on the system "util-spamd-2.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: This function is needed to commpile on win32 as run_command.c defines it on Unix Linux but on windows it is defined in win32.c which pulls in too many other unresolvable symbols. Patch v2: Also add mock_win32_execve.c to automake files Content analysis details: (0.2 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 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 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.0 T_SCC_BODY_TEXT_LINE No description available. X-Headers-End: 1qJWY6-005M1T-Nc Subject: [Openvpn-devel] [PATCH v2] Mock openvpn_exece on win32 also for test_tls_crypt 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: =?utf-8?q?1770499319232890497?= X-GMAIL-MSGID: =?utf-8?q?1771208145706001605?= This function is needed to commpile on win32 as run_command.c defines it on Unix Linux but on windows it is defined in win32.c which pulls in too many other unresolvable symbols. Patch v2: Also add mock_win32_execve.c to automake files Change-Id: I8c8fe298eb30e211279f3fc010584b9d3bc14b4a Signed-off-by: Arne Schwabe Acked-by: Frank Lichtenheld --- CMakeLists.txt | 2 ++ tests/unit_tests/openvpn/Makefile.am | 3 +- tests/unit_tests/openvpn/mock_win32_execve.c | 37 ++++++++++++++++++++ tests/unit_tests/openvpn/test_pkt.c | 8 ----- 4 files changed, 41 insertions(+), 9 deletions(-) create mode 100644 tests/unit_tests/openvpn/mock_win32_execve.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 597dc9074..2d0cd5dd0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -679,6 +679,7 @@ if (BUILD_TESTING) ) target_sources(test_pkt PRIVATE + tests/unit_tests/openvpn/mock_win32_execve.c src/openvpn/argv.c src/openvpn/base64.c src/openvpn/crypto_mbedtls.c @@ -740,6 +741,7 @@ if (BUILD_TESTING) -Wl,--wrap=buffer_write_file -Wl,--wrap=rand_bytes) target_sources(test_tls_crypt PRIVATE + tests/unit_tests/openvpn/mock_win32_execve.c src/openvpn/argv.c src/openvpn/base64.c src/openvpn/crypto_mbedtls.c diff --git a/tests/unit_tests/openvpn/Makefile.am b/tests/unit_tests/openvpn/Makefile.am index dbf658ac7..6b56f8480 100644 --- a/tests/unit_tests/openvpn/Makefile.am +++ b/tests/unit_tests/openvpn/Makefile.am @@ -83,7 +83,7 @@ packet_id_testdriver_SOURCES = test_packet_id.c mock_msg.c mock_msg.h \ pkt_testdriver_CFLAGS = @TEST_CFLAGS@ \ -I$(top_srcdir)/include -I$(top_srcdir)/src/compat -I$(top_srcdir)/src/openvpn pkt_testdriver_LDFLAGS = @TEST_LDFLAGS@ -pkt_testdriver_SOURCES = test_pkt.c mock_msg.c mock_msg.h \ +pkt_testdriver_SOURCES = test_pkt.c mock_msg.c mock_msg.h mock_win32_execve.c \ $(top_srcdir)/src/openvpn/argv.c \ $(top_srcdir)/src/openvpn/base64.c \ $(top_srcdir)/src/openvpn/buffer.c \ @@ -110,6 +110,7 @@ tls_crypt_testdriver_LDFLAGS = @TEST_LDFLAGS@ \ -Wl,--wrap=parse_line \ -Wl,--wrap=rand_bytes tls_crypt_testdriver_SOURCES = test_tls_crypt.c mock_msg.c mock_msg.h \ + mock_win32_execve.c \ $(top_srcdir)/src/openvpn/argv.c \ $(top_srcdir)/src/openvpn/base64.c \ $(top_srcdir)/src/openvpn/buffer.c \ diff --git a/tests/unit_tests/openvpn/mock_win32_execve.c b/tests/unit_tests/openvpn/mock_win32_execve.c new file mode 100644 index 000000000..4d37ebe33 --- /dev/null +++ b/tests/unit_tests/openvpn/mock_win32_execve.c @@ -0,0 +1,37 @@ +/* + * OpenVPN -- An application to securely tunnel IP networks + * over a single TCP/UDP port, with support for SSL/TLS-based + * session authentication and key exchange, + * packet encryption, packet authentication, and + * packet compression. + * + * Copyright (C) 2023 OpenVPN Inc + * Copyright (C) 2023 Arne Schwabe + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include "config.h" +#include "syshead.h" + +#include "win32.h" + +#ifdef _WIN32 +int +openvpn_execve(const struct argv *a, const struct env_set *es, const unsigned int flags) +{ + ASSERT(0); +} +#endif diff --git a/tests/unit_tests/openvpn/test_pkt.c b/tests/unit_tests/openvpn/test_pkt.c index 5a53f702e..9f49ee7bd 100644 --- a/tests/unit_tests/openvpn/test_pkt.c +++ b/tests/unit_tests/openvpn/test_pkt.c @@ -69,14 +69,6 @@ print_link_socket_actual(const struct link_socket_actual *act, struct gc_arena * return "dummy print_link_socket_actual from unit test"; } -#ifdef _WIN32 -int -openvpn_execve(const struct argv *a, const struct env_set *es, const unsigned int flags) -{ - ASSERT(0); -} -#endif - struct test_pkt_context { struct tls_auth_standalone tas_tls_auth; struct tls_auth_standalone tas_crypt;