From patchwork Tue Mar 18 17:39:06 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 4185 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:7046:b0:60a:d70a:d3c7 with SMTP id t6csp2978382mat; Tue, 18 Mar 2025 10:39:43 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXG6XoQ7r6jZpNn5her2HojHmfNNyHQwoyIlcXQePbdO1X69VgsDGLKQ3H41T0gxcfp9tejJVbWhW4=@openvpn.net X-Google-Smtp-Source: AGHT+IF8shQUF26XWw+j26nwK1dkmga9g4uUlI1LhLcAMW6sGwxYy6usEGCz+03+RcAUy6FWqH38 X-Received: by 2002:a05:6e02:1a2a:b0:3d3:d07d:20a3 with SMTP id e9e14a558f8ab-3d483a183c4mr156714295ab.10.1742319582912; Tue, 18 Mar 2025 10:39:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1742319582; cv=none; d=google.com; s=arc-20240605; b=Q4eGkm6GeiZxuND24JhC9F1AEXYf/tH4EGkfvcM7YnP39GOZp7mDlxtJRe9p9+HaNo 2r8c1ma3aFu4g+I/nBR63u1ohG6aM4I4w6m/9cEO06KKRaI6KG7GKzUB/ot6eFmjS7uy z3WhhqRZjGXwlH8/vy2MPUUR/kEhMKPVfD3kSdBGLDIWtdU95JqRqgsAKWcH+4KnLFkw BdNB5zIS2uwgEibMLnMEn+l8yefUYVZEND/21r6nXGeq8xct0W2beSH7yCQKteuk2WRh /6AxFxCIZa7ospAkqG+TxsZf12X0+N5hqhXR0umY9tysW/EFbrB1hQwk61ccn1bZL54t xf4Q== 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=ZlE8MgqIc3lrKRUIQy3g7DzY9qGtKDqw48N/+31ZXXs=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=Jv32+94+75f9P9A4jWk0nZe5Qg/u/hsFjPXfbC6JRtLIt0efdUk9ehh7yX/eo0eply Af+PfNE4LmfEXK8XY5noZ8w6NQb/NG0Qra+H0oicpt+7IHeiYrG/XQ9Grum7/dDPADbS jydrRyFKMeac3N0k5qVQaRDPlIUmNpEem2XKw6FATLt3Dv08iWBFIK6GK4PDaomHjANE LE9X+P7xfUlem9p8dFbVqPZ6BFhGDKBVcx50bqyrvA3tKieWq8Waz64pXxG+aAJs2rxa dU2Q9CIqHcRwu78GDnlVoZpRUZFrBxfzlmeH+omRF1IV7Mze3cqIGTYhwZhwrC9o+KkL RObw==; 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=CgMkudWP; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=IQxY6DpP; 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 8926c6da1cb9f-4f26371aed2si11009275173.36.2025.03.18.10.39.42 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Mar 2025 10:39:42 -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=CgMkudWP; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=IQxY6DpP; 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 1tuaug-0001Z0-4t; Tue, 18 Mar 2025 17:39:38 +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 1tuaue-0001Yt-R3 for openvpn-devel@lists.sourceforge.net; Tue, 18 Mar 2025 17:39:37 +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=7DV8FAJWK2va6L/qNqv+/WmUdj7wYzW2Enu/3vNWBVk=; b=CgMkudWP6eGi6S9PSZia23XRfY bgrNeJWtdqnymT0Wcu7halKiW1qj50MzROWzLlXZNj3945w9XJo/jOpgGL/S2uewicVpzNor+8UGe 0o82QSeHCi4v0XNKUNvv0XphC+ebfHYwMf5bSiE6y0tI31+Tz7wHl9ZDrPUOuiIFf4HM=; 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=7DV8FAJWK2va6L/qNqv+/WmUdj7wYzW2Enu/3vNWBVk=; b=IQxY6DpPllqnGoP6T6rsmdmfPN aDnrkfzphPkFH7zf51sASmOvWaBFSHteCazlI2iIqNG4PcwQHB1cTBtxYKBbjJJnvE5sdyje7Kxtp TFzh3JmfHV5en00kVCrsTz5d2SEVudUYeBR+CsapjHIdYDbohcwlDtrcaif2Ed8yxiFE=; 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 1tuauU-00034h-B4 for openvpn-devel@lists.sourceforge.net; Tue, 18 Mar 2025 17:39:37 +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 52IHdE8v024454 for ; Tue, 18 Mar 2025 18:39:14 +0100 Received: (from gert@localhost) by blue.greenie.muc.de (8.17.1.9/8.17.1.9/Submit) id 52IHdEYj024453 for openvpn-devel@lists.sourceforge.net; Tue, 18 Mar 2025 18:39:14 +0100 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Tue, 18 Mar 2025 18:39:06 +0100 Message-ID: <20250318173914.24425-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-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: From: Frank Lichtenheld These are slightly different and so not covered by my automatic conversion script. Use __func__ to make the actual string slightly shorter. Change-Id: If15862fe537496ac836fc443936ff8e7876a39c0 Signed-off-by: Frank Lichtenheld Acked-by: Gert Doering --- Content analysis details: (0.0 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record 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_CERTIFIED_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-trusted.bondedsender.org] X-Headers-End: 1tuauU-00034h-B4 Subject: [Openvpn-devel] [PATCH v2] openvpnserv: Clean up use of TEXT() from DNS patches 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?1826954498854226139?= X-GMAIL-MSGID: =?utf-8?q?1826954498854226139?= From: Frank Lichtenheld These are slightly different and so not covered by my automatic conversion script. Use __func__ to make the actual string slightly shorter. Change-Id: If15862fe537496ac836fc443936ff8e7876a39c0 Signed-off-by: Frank Lichtenheld Acked-by: Gert Doering --- 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/+/910 This mail reflects revision 2 of this Change. Acked-by according to Gerrit (reflected above): Gert Doering diff --git a/src/openvpnserv/interactive.c b/src/openvpnserv/interactive.c index bc53f04..50363b6 100644 --- a/src/openvpnserv/interactive.c +++ b/src/openvpnserv/interactive.c @@ -1194,30 +1194,30 @@ if (apply_gpol && ApplyGpolSettings() == FALSE) { - MsgToEventLog(M_ERR, L"ApplyDnsSettings: sending GPOL notification failed"); + MsgToEventLog(M_ERR, L"%s: sending GPOL notification failed", __func__); } scm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); if (scm == NULL) { - MsgToEventLog(M_ERR, TEXT("ApplyDnsSettings: " - "OpenSCManager call failed (%lu)"), GetLastError()); + MsgToEventLog(M_ERR, L"%s: OpenSCManager call failed (%lu)", + __func__, GetLastError()); goto out; } dnssvc = OpenServiceA(scm, "Dnscache", SERVICE_PAUSE_CONTINUE); if (dnssvc == NULL) { - MsgToEventLog(M_ERR, TEXT("ApplyDnsSettings: " - "OpenService call failed (%lu)"), GetLastError()); + MsgToEventLog(M_ERR, L"%s: OpenService call failed (%lu)", + __func__, GetLastError()); goto out; } SERVICE_STATUS status; if (ControlService(dnssvc, SERVICE_CONTROL_PARAMCHANGE, &status) == 0) { - MsgToEventLog(M_ERR, TEXT("ApplyDnsSettings: " - "ControlService call failed (%lu)"), GetLastError()); + MsgToEventLog(M_ERR, L"%s: ControlService call failed (%lu)", + __func__, GetLastError()); goto out; } @@ -1255,22 +1255,19 @@ err = InterfaceLuid(itf_name, &luid); if (err) { - MsgToEventLog(M_ERR, TEXT("InterfaceIdString: " - "failed to convert itf alias '%s'"), itf_name); + MsgToEventLog(M_ERR, L"%s: failed to convert itf alias '%s'", __func__, itf_name); goto out; } err = ConvertInterfaceLuidToGuid(&luid, &guid); if (err) { - MsgToEventLog(M_ERR, TEXT("InterfaceIdString: " - "Failed to convert itf '%s' LUID"), itf_name); + MsgToEventLog(M_ERR, L"%s: Failed to convert itf '%s' LUID", __func__, itf_name); goto out; } if (StringFromIID(&guid, &iid_str) != S_OK) { - MsgToEventLog(M_ERR, TEXT("InterfaceIdString: " - "Failed to convert itf '%s' IID"), itf_name); + MsgToEventLog(M_ERR, L"%s: Failed to convert itf '%s' IID", __func__, itf_name); err = ERROR_OUTOFMEMORY; goto out; } @@ -1420,8 +1417,8 @@ { return FALSE; } - MsgToEventLog(M_ERR, TEXT("InitialSearchListExists: " - "failed to get InitialSearchList (%lu)"), err); + MsgToEventLog(M_ERR, L"%s: failed to get InitialSearchList (%lu)", + __func__, err); } return TRUE; @@ -1456,8 +1453,8 @@ LSTATUS err = RegSetValueExW(key, L"InitialSearchList", 0, REG_SZ, (PBYTE)list, size); if (err) { - MsgToEventLog(M_ERR, TEXT("StoreInitialDnsSearchList: " - "failed to set InitialSearchList value (%lu)"), err); + MsgToEventLog(M_ERR, L"%s: failed to set InitialSearchList value (%lu)", + __func__, err); return FALSE; } @@ -1485,8 +1482,8 @@ err = RegGetValueW(key, NULL, L"SearchList", RRF_RT_REG_SZ, NULL, list, &size); if (err) { - MsgToEventLog(M_SYSERR, TEXT("AddDnsSearchDomains: " - "could not get SearchList from registry (%lu)"), err); + MsgToEventLog(M_SYSERR, L"%s: could not get SearchList from registry (%lu)", + __func__, err); return FALSE; } @@ -1499,9 +1496,8 @@ size_t domlen = wcslen(domains); if (listlen + domlen + 2 > _countof(list)) { - MsgToEventLog(M_SYSERR, TEXT("AddDnsSearchDomains: " - "not enough space in list for search domains (len=%lu)"), - domlen); + MsgToEventLog(M_SYSERR, L"%s: not enough space in list for search domains (len=%lu)", + __func__, domlen); return FALSE; } @@ -1519,8 +1515,8 @@ err = RegSetValueExW(key, L"SearchList", 0, REG_SZ, (PBYTE)list, size); if (err) { - MsgToEventLog(M_SYSERR, TEXT("AddDnsSearchDomains: " - "could not set SearchList to registry (%lu)"), err); + MsgToEventLog(M_SYSERR, L"%s: could not set SearchList to registry (%lu)", + __func__, err); return FALSE; } @@ -1551,8 +1547,8 @@ { if (err != ERROR_FILE_NOT_FOUND) { - MsgToEventLog(M_SYSERR, TEXT("ResetDnsSearchDomains: " - "could not get InitialSearchList from registry (%lu)"), err); + MsgToEventLog(M_SYSERR, L"%s: could not get InitialSearchList from registry (%lu)", + __func__, err); } goto out; } @@ -1561,8 +1557,8 @@ err = RegSetValueExW(key, L"SearchList", 0, REG_SZ, (PBYTE)list, size); if (err) { - MsgToEventLog(M_SYSERR, TEXT("ResetDnsSearchDomains: " - "could not set SearchList in registry (%lu)"), err); + MsgToEventLog(M_SYSERR, L"%s: could not set SearchList in registry (%lu)", + __func__, err); goto out; } @@ -1589,16 +1585,15 @@ err = RegGetValueW(key, NULL, L"SearchList", RRF_RT_REG_SZ, NULL, list, &size); if (err) { - MsgToEventLog(M_SYSERR, TEXT("RemoveDnsSearchDomains: " - "could not get SearchList from registry (%lu)"), err); + MsgToEventLog(M_SYSERR, L"%s: could not get SearchList from registry (%lu)", + __func__, err); return; } PWSTR dst = wcsstr(list, domains); if (!dst) { - MsgToEventLog(M_ERR, TEXT("RemoveDnsSearchDomains: " - "could not find domains in search list")); + MsgToEventLog(M_ERR, L"%s: could not find domains in search list", __func__); return; } @@ -1618,8 +1613,8 @@ err = RegGetValueW(key, NULL, L"InitialSearchList", RRF_RT_REG_SZ, NULL, initial, &size); if (err) { - MsgToEventLog(M_SYSERR, TEXT("RemoveDnsSearchDomains: " - "could not get InitialSearchList from registry (%lu)"), err); + MsgToEventLog(M_SYSERR, L"%s: could not get InitialSearchList from registry (%lu)", + __func__, err); return; } @@ -1635,8 +1630,8 @@ err = RegSetValueExW(key, L"SearchList", 0, REG_SZ, (PBYTE)list, size); if (err) { - MsgToEventLog(M_SYSERR, TEXT("RemoveDnsSearchDomains: " - "could not set SearchList in registry (%lu)"), err); + MsgToEventLog(M_SYSERR, L"%s: could not set SearchList in registry (%lu)", + __func__, err); } } @@ -1692,8 +1687,7 @@ BOOL have_list = GetDnsSearchListKey(itf_name, gpol, &list_key); if (list_key == INVALID_HANDLE_VALUE) { - MsgToEventLog(M_SYSERR, TEXT("SetDnsSearchDomains: " - "could not get search list registry key")); + MsgToEventLog(M_SYSERR, L"%s: could not get search list registry key", __func__); return ERROR_FILE_NOT_FOUND; } @@ -1762,9 +1756,8 @@ if (err) { *key = INVALID_HANDLE_VALUE; - MsgToEventLog(M_SYSERR, TEXT("GetInterfacesKey: " - "could not open interfaces registry key for family %d (%lu)"), - family, err); + MsgToEventLog(M_SYSERR, L"%s: could not open interfaces registry key for family %d (%lu)", + __func__, family, err); } return err ? FALSE : TRUE; @@ -1794,18 +1787,16 @@ err = RegOpenKeyExW(itfs, itf_id, 0, KEY_ALL_ACCESS, &itf); if (err) { - MsgToEventLog(M_SYSERR, TEXT("SetNameServersValue: " - "could not open interface key for %s family %d (%lu)"), - itf_id, family, err); + MsgToEventLog(M_SYSERR, L"%s: could not open interface key for %s family %d (%lu)", + __func__, itf_id, family, err); goto out; } err = RegSetValueExA(itf, "NameServer", 0, REG_SZ, (PBYTE)value, strlen(value) + 1); if (err) { - MsgToEventLog(M_SYSERR, TEXT("SetNameServersValue: " - "could not set name servers '%S' for %s family %d (%lu)"), - value, itf_id, family, err); + MsgToEventLog(M_SYSERR, L"%s: could not set name servers '%S' for %s family %d (%lu)", + __func__, value, itf_id, family, err); } out: