From patchwork Mon Jan 27 09:11:02 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 4081 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:c127:b0:5e7:b9eb:58e8 with SMTP id jm39csp2200704mab; Mon, 27 Jan 2025 01:11:23 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWUsi+beHL4IjcrOJNaVttaX+5hqPcXWnigW6boa+N3jJgjAffC5Q+ndQVQNuDD4yzL6x6rXTMBLW8=@openvpn.net X-Google-Smtp-Source: AGHT+IFcgrYrKMhReraU9209OoNmG/MfWMDKj4govM6t8n239hZFbY3se/7zv1+dkcK5owwICtbV X-Received: by 2002:a05:6871:7884:b0:29e:5bb8:fb35 with SMTP id 586e51a60fabf-2b1c0cdc98bmr20503067fac.37.1737969082933; Mon, 27 Jan 2025 01:11:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737969082; cv=none; d=google.com; s=arc-20240605; b=bz2bHrWJ0BFFvvKyxdX4iULfc1YmyeBB0bYUHb4cRLr0Tj/9CfBlDxgssUhnz5V5xL cD9KjpbXdG6RzWba6/bdbQDHNd5ETmcqEYHT7V/YxuQEHPmdm2kxGP+3iM03uR79bGzy ygg5vWAGpIjlNLFq3dfbpmKnbJsEL1YQPk710fam6lutUcxfiV/Sl4pkXojPi038+gGD M8/osv7/osBc91eEIsOhbR58fPbXFwC4hrPZ6o0sgVjVkT9K/qYD8DHqrEvBE7Goy9Sp P6WbviRFeuUXSaCy6pgoWVqByTeAQ3Tw52h6Icsv3YtKmprNCIIPGpEv3dzyeU8x6p7F 36rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=5vwf5r3zYrQGPeTZqSNQiXgP/y3G+CeGX5ff8sb0hOo=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=gJPasM9fPeXUZNkkx65c6rLRDiXdl0bNKaCGtvVrGlSdH4ggy25IqH4CAJNANLb9IN dD3ih3l8eOqaR1rgG4fqVqtyIV8zWKkL/q2sybyY1O6Epmi2YkOWAn6t9yude35XC02r 9ftoO/QaEhnizNEAd189vyHypjwqStD4tFymMWcDNF+DEjayARZTmEhk2qroqpU4nQbZ BYheA80DmnvjXRMIxNh8iMooDhUkHlLzeFvy7rL+da1BHyEDgd1KdnHRClRJX1/un3zm lUeFG0ZcUMjzoFe7dgjx5jr6VGkku78Id8j2xGJmvHNFe/MHuBwalXMSd+9nsCr1NDge W/Vg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=i8Ee55S6; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=UqNjN+kl; 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 586e51a60fabf-2b28f4afcc1si6613775fac.113.2025.01.27.01.11.22 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Jan 2025 01:11:22 -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=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=i8Ee55S6; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=UqNjN+kl; 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 [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1tcL9L-00070f-Pf; Mon, 27 Jan 2025 09:11:19 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1tcL9J-00070P-SR for openvpn-devel@lists.sourceforge.net; Mon, 27 Jan 2025 09:11:17 +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=ZZArVMECXhLz3Fge8ItpGNLwzICm6R8M6dgef+t7UtQ=; b=i8Ee55S6w1K3e1NaNpGplDdcOR TxCd87ZqTKpDK/xBtHk64L5q01CGazqMfSpF4JleGim/zeISUhQJUVXiZtvR897T5HLikvXRBhbId x3kASOHJgBmPttwlzne0YHteeNJT+cneugtUxTV4qL0qohl6IZYqgdYODJuDFkSgAhPM=; 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=ZZArVMECXhLz3Fge8ItpGNLwzICm6R8M6dgef+t7UtQ=; b=UqNjN+klsmJ8FFd+s247Vhs6iR UbFl/4CwqoWjzh8Ty4jfnXEsF0817HvzA4CGZH478PG9TvqQccbKsOb2TaFfP4eh8S+tCM7/toaX3 0cQTcm7QVQDyDwe8UtokPJm6CrvwPDth7L83QTn/ne16gNRIyzhCoe57g/FCDF6vYm0w=; Received: from dhcp-174.greenie.muc.de ([193.149.48.174] 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.95) id 1tcL9H-0004t6-Ko for openvpn-devel@lists.sourceforge.net; Mon, 27 Jan 2025 09:11:17 +0000 Received: from blue.greenie.muc.de (localhost [127.0.0.1]) by blue.greenie.muc.de (8.17.1.9/8.17.1.9) with ESMTP id 50R9B3s1026995 for ; Mon, 27 Jan 2025 10:11:03 +0100 Received: (from gert@localhost) by blue.greenie.muc.de (8.17.1.9/8.17.1.9/Submit) id 50R9B32N026994 for openvpn-devel@lists.sourceforge.net; Mon, 27 Jan 2025 10:11:03 +0100 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Mon, 27 Jan 2025 10:11:02 +0100 Message-ID: <20250127091102.26983-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.45.2 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Score: -0.0 (/) X-Spam-Report: Spam detection software, running on the system "util-spamd-1.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: From: Frank Lichtenheld In general you can't use multiple strings as argument to TEXT() since it just adds a L in front of the argument. So if you specifiy multiple arguments the later argument strings do not get the L. Content analysis details: (-0.0 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [193.149.48.174 listed in bl.score.senderscore.com] 0.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [193.149.48.174 listed in sa-accredit.habeas.com] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.0 T_SCC_BODY_TEXT_LINE No description available. X-Headers-End: 1tcL9H-0004t6-Ko Subject: [Openvpn-devel] [PATCH v1] openvpnserv: Fix some inconsistent usages of TEXT() 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?1822392669365687945?= X-GMAIL-MSGID: =?utf-8?q?1822392669365687945?= From: Frank Lichtenheld In general you can't use multiple strings as argument to TEXT() since it just adds a L in front of the argument. So if you specifiy multiple arguments the later argument strings do not get the L. This does not seem to directly cause problems with our ASCII strings, but make the usage consistent with all the other code. That will help in case we remove the usage of TEXT(). Also include tapctl/basic.h in openvpnserv to make the macro environment consistent with tapctl and openvpnmsica. Change-Id: Iea477ac96b0dbaee24ca8d097a2e1958f70c5dd3 Signed-off-by: Frank Lichtenheld Acked-by: Lev Stipakov --- 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/+/851 This mail reflects revision 1 of this Change. Acked-by according to Gerrit (reflected above): Lev Stipakov diff --git a/src/openvpnserv/CMakeLists.txt b/src/openvpnserv/CMakeLists.txt index 154e17c..ff03867 100644 --- a/src/openvpnserv/CMakeLists.txt +++ b/src/openvpnserv/CMakeLists.txt @@ -17,6 +17,7 @@ interactive.c service.c service.h validate.c validate.h + ../tapctl/basic.h ../openvpn/wfp_block.c ../openvpn/wfp_block.h openvpnserv_resources.rc ../openvpn/ring_buffer.h diff --git a/src/openvpnserv/common.c b/src/openvpnserv/common.c index 61a7296..a88a724 100644 --- a/src/openvpnserv/common.c +++ b/src/openvpnserv/common.c @@ -45,7 +45,7 @@ if (status != ERROR_SUCCESS) { SetLastError(status); - return MsgToEventLog(M_SYSERR, TEXT("Error querying registry value: HKLM\\SOFTWARE\\" PACKAGE_NAME "%ls\\%ls"), service_instance, value); + return MsgToEventLog(M_SYSERR, TEXT("Error querying registry value: HKLM\\SOFTWARE\\") TEXT(PACKAGE_NAME) TEXT("%ls\\%ls"), service_instance, value); } return ERROR_SUCCESS; @@ -63,7 +63,7 @@ TCHAR install_path[MAX_PATH]; TCHAR default_value[MAX_PATH]; - swprintf(reg_path, _countof(reg_path), TEXT("SOFTWARE\\" PACKAGE_NAME "%ls"), service_instance); + swprintf(reg_path, _countof(reg_path), TEXT("SOFTWARE\\") TEXT(PACKAGE_NAME) TEXT("%ls"), service_instance); LONG status = RegOpenKeyEx(HKEY_LOCAL_MACHINE, reg_path, 0, KEY_READ, &key); if (status != ERROR_SUCCESS) diff --git a/src/openvpnserv/interactive.c b/src/openvpnserv/interactive.c index 67f5bbc..35753b7 100644 --- a/src/openvpnserv/interactive.c +++ b/src/openvpnserv/interactive.c @@ -60,9 +60,9 @@ openvpn_service_t interactive_service = { interactive, - TEXT(PACKAGE_NAME "ServiceInteractive"), - TEXT(PACKAGE_NAME " Interactive Service"), - TEXT(SERVICE_DEPENDENCIES), + TEXT(PACKAGE_NAME) TEXT("ServiceInteractive"), + TEXT(PACKAGE_NAME) TEXT(" Interactive Service"), + SERVICE_DEPENDENCIES, SERVICE_AUTO_START }; @@ -1973,7 +1973,7 @@ } swprintf(ovpn_pipe_name, _countof(ovpn_pipe_name), - TEXT("\\\\.\\pipe\\" PACKAGE "%ls\\service_%lu"), service_instance, GetCurrentThreadId()); + TEXT("\\\\.\\pipe\\") TEXT(PACKAGE) TEXT("%ls\\service_%lu"), service_instance, GetCurrentThreadId()); ovpn_pipe = CreateNamedPipe(ovpn_pipe_name, PIPE_ACCESS_DUPLEX | FILE_FLAG_FIRST_PIPE_INSTANCE | FILE_FLAG_OVERLAPPED, PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT, 1, 128, 128, 0, NULL); @@ -2173,7 +2173,7 @@ } TCHAR pipe_name[256]; /* The entire pipe name string can be up to 256 characters long according to MSDN. */ - swprintf(pipe_name, _countof(pipe_name), TEXT("\\\\.\\pipe\\" PACKAGE "%ls\\service"), service_instance); + swprintf(pipe_name, _countof(pipe_name), TEXT("\\\\.\\pipe\\") TEXT(PACKAGE) TEXT("%ls\\service"), service_instance); HANDLE pipe = CreateNamedPipe(pipe_name, flags, PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_REJECT_REMOTE_CLIENTS, PIPE_UNLIMITED_INSTANCES, 1024, 1024, 0, &sa); diff --git a/src/openvpnserv/service.c b/src/openvpnserv/service.c index a71f5c6..054fc5f 100644 --- a/src/openvpnserv/service.c +++ b/src/openvpnserv/service.c @@ -282,8 +282,8 @@ wprintf(TEXT("-instance interactive \n") TEXT(" Runs the service as an alternate instance.\n") TEXT(" The service settings will be loaded from\n") - TEXT(" HKLM\\Software\\" PACKAGE_NAME " registry key, and the service will accept\n") - TEXT(" requests on \\\\.\\pipe\\" PACKAGE "\\service named pipe.\n")); + TEXT(" HKLM\\Software\\") TEXT(PACKAGE_NAME) TEXT(" registry key, and the service will accept\n") + TEXT(" requests on \\\\.\\pipe\\") TEXT(PACKAGE) TEXT("\\service named pipe.\n")); return 0; } diff --git a/src/openvpnserv/service.h b/src/openvpnserv/service.h index 6b559a5..da20433 100644 --- a/src/openvpnserv/service.h +++ b/src/openvpnserv/service.h @@ -37,9 +37,10 @@ #include #include #include +#include "../tapctl/basic.h" -#define APPNAME TEXT(PACKAGE "serv") -#define SERVICE_DEPENDENCIES TAP_WIN_COMPONENT_ID "\0Dhcp\0\0" +#define APPNAME TEXT(PACKAGE) TEXT("serv") +#define SERVICE_DEPENDENCIES TEXT(TAP_WIN_COMPONENT_ID) TEXT("\0Dhcp\0\0") /* * Message handling