From: "cron2 (Code Review)" Date: Tue, 18 Mar 2025 17:48:17 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641..., lstipakov@...277... Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="NXeGrixocqc="; charset=UTF-8 Subject: [Openvpn-devel] [M] Change in openvpn[master]: openvpnserv: Clean up use of TEXT() from DNS patches List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: flichtenheld , plaisthos Cc: openvpn-devel , stipa --NXeGrixocqc= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has uploaded a new patch set (#3) to the change originally created by= flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/910?usp=3Demail ) The following approvals got outdated and were removed: Code-Review+2 by cron2 Change subject: openvpnserv: Clean up use of TEXT() from DNS patches ...................................................................... openvpnserv: Clean up use of TEXT() from DNS patches 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 Message-Id: <20250318173914.24425-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg31= 161.html Signed-off-by: Gert Doering --- M src/openvpnserv/interactive.c 1 file changed, 38 insertions(+), 47 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/10/910/3 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() =3D=3D FALSE) { - MsgToEventLog(M_ERR, L"ApplyDnsSettings: sending GPOL notification= failed"); + MsgToEventLog(M_ERR, L"%s: sending GPOL notification failed", __fu= nc__); } scm =3D OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); if (scm =3D=3D NULL) { - MsgToEventLog(M_ERR, TEXT("ApplyDnsSettings: " - "OpenSCManager call failed (%lu)"), GetL= astError()); + MsgToEventLog(M_ERR, L"%s: OpenSCManager call failed (%lu)", + __func__, GetLastError()); goto out; } dnssvc =3D OpenServiceA(scm, "Dnscache", SERVICE_PAUSE_CONTINUE); if (dnssvc =3D=3D NULL) { - MsgToEventLog(M_ERR, TEXT("ApplyDnsSettings: " - "OpenService call failed (%lu)"), GetLas= tError()); + MsgToEventLog(M_ERR, L"%s: OpenService call failed (%lu)", + __func__, GetLastError()); goto out; } SERVICE_STATUS status; if (ControlService(dnssvc, SERVICE_CONTROL_PARAMCHANGE, &status) =3D= =3D 0) { - MsgToEventLog(M_ERR, TEXT("ApplyDnsSettings: " - "ControlService call failed (%lu)"), Get= LastError()); + MsgToEventLog(M_ERR, L"%s: ControlService call failed (%lu)", + __func__, GetLastError()); goto out; } @@ -1255,22 +1255,19 @@ err =3D 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'", __fu= nc__, itf_name); goto out; } err =3D 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", __fun= c__, itf_name); goto out; } if (StringFromIID(&guid, &iid_str) !=3D S_OK) { - MsgToEventLog(M_ERR, TEXT("InterfaceIdString: " - "Failed to convert itf '%s' IID"), itf_n= ame); + MsgToEventLog(M_ERR, L"%s: Failed to convert itf '%s' IID", __func= __, itf_name); err =3D 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 =3D 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 =3D RegGetValueW(key, NULL, L"SearchList", RRF_RT_REG_SZ, NULL= , list, &size); if (err) { - MsgToEventLog(M_SYSERR, TEXT("AddDnsSearchDomains: " - "could not get SearchList from re= gistry (%lu)"), err); + MsgToEventLog(M_SYSERR, L"%s: could not get SearchList from re= gistry (%lu)", + __func__, err); return FALSE; } @@ -1499,9 +1496,8 @@ size_t domlen =3D wcslen(domains); if (listlen + domlen + 2 > _countof(list)) { - MsgToEventLog(M_SYSERR, TEXT("AddDnsSearchDomains: " - "not enough space in list for sea= rch domains (len=3D%lu)"), - domlen); + MsgToEventLog(M_SYSERR, L"%s: not enough space in list for sea= rch domains (len=3D%lu)", + __func__, domlen); return FALSE; } @@ -1519,8 +1515,8 @@ err =3D RegSetValueExW(key, L"SearchList", 0, REG_SZ, (PBYTE)list, siz= e); 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 !=3D 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 =3D RegSetValueExW(key, L"SearchList", 0, REG_SZ, (PBYTE)list, siz= e); 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 =3D RegGetValueW(key, NULL, L"SearchList", RRF_RT_REG_SZ, NULL, li= st, &size); if (err) { - MsgToEventLog(M_SYSERR, TEXT("RemoveDnsSearchDomains: " - "could not get SearchList from regist= ry (%lu)"), err); + MsgToEventLog(M_SYSERR, L"%s: could not get SearchList from regist= ry (%lu)", + __func__, err); return; } PWSTR dst =3D 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 =3D RegGetValueW(key, NULL, L"InitialSearchList", RRF_RT_REG_S= Z, 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 =3D RegSetValueExW(key, L"SearchList", 0, REG_SZ, (PBYTE)list, siz= e); 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 =3D GetDnsSearchListKey(itf_name, gpol, &list_key); if (list_key =3D=3D INVALID_HANDLE_VALUE) { - MsgToEventLog(M_SYSERR, TEXT("SetDnsSearchDomains: " - "could not get search list registry k= ey")); + MsgToEventLog(M_SYSERR, L"%s: could not get search list registry k= ey", __func__); return ERROR_FILE_NOT_FOUND; } @@ -1762,9 +1756,8 @@ if (err) { *key =3D INVALID_HANDLE_VALUE; - MsgToEventLog(M_SYSERR, TEXT("GetInterfacesKey: " - "could not open interfaces registry k= ey for family %d (%lu)"), - family, err); + MsgToEventLog(M_SYSERR, L"%s: could not open interfaces registry k= ey for family %d (%lu)", + __func__, family, err); } return err ? FALSE : TRUE; @@ -1794,18 +1787,16 @@ err =3D 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 =3D RegSetValueExA(itf, "NameServer", 0, REG_SZ, (PBYTE)value, str= len(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: -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/910?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: If15862fe537496ac836fc443936ff8e7876a39c0 Gerrit-Change-Number: 910 Gerrit-PatchSet: 3 Gerrit-Owner: flichtenheld Gerrit-Reviewer: cron2 Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-CC: stipa Gerrit-MessageType: newpatchset --NXeGrixocqc= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 uploaded patch set #3 to the change originally cr= eated by flichtenheld.

View Change

The following approvals got outda= ted and were removed: Code-Review+2 by cron2

openvpnserv: Clean up use of TEXT() from DNS patches=


These are slightly different and so not covered
by my automatic = conversion script. Use __func__
to make the actual string slightly short= er.

Change-Id: If15862fe537496ac836fc443936ff8e7876a39c0
Signed-o= ff-by: Frank Lichtenheld <frank@...2641...>
Acked-by: Gert Doering= <gert@...1296...>
Message-Id: <20250318173914.24425-1-gert@...493...= 1296...>
URL: https://www.mail-archive.com/openvpn-devel@...1659...= forge.net/msg31161.html
Signed-off-by: Gert Doering <gert@...1296...&= gt;
---
M src/openvpnserv/interactive.c
1 file changed, 38 inserti= ons(+), 47 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/o=
penvpn refs/changes/10/910/3
diff --git a/src/openvpnserv/interacti=
ve.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 && ApplyGpo= lSettings() =3D=3D FALSE)
{
- MsgToEventLog(M_ERR, L"ApplyDnsSett= ings: sending GPOL notification failed");
+ MsgToEventLog(M_ERR, L"%s: sending = GPOL notification failed", __func__);
}
scm =3D OpenSCManager(NULL, NULL, SC_MANAGER_= ALL_ACCESS);
if (scm =3D=3D NULL)
= {
- MsgToEventL= og(M_ERR, TEXT("ApplyDnsSettings: "
- "OpenSCManag= er call failed (%lu)"), GetLastError());
+ MsgToEventLog(M_ERR, L"%s: OpenSCMan= ager call failed (%lu)",
+ __func__, GetLastError());
= goto out;
}

dnssvc =3D OpenServiceA(scm, "Dnscache", SERVICE_PAUSE_CONT= INUE);
if (dnssvc =3D=3D NULL)
{<= /span>
- MsgToEventLog(= M_ERR, TEXT("ApplyDnsSettings: "
- "OpenService ca= ll failed (%lu)"), GetLastError());
+ MsgToEventLog(M_ERR, L"%s: OpenService ca= ll failed (%lu)",
- MsgToEventLog(M_ERR= , TEXT("ApplyDnsSettings: "
- "ControlService call= failed (%lu)"), GetLastError());
+ MsgToEventLog(M_ERR, L"%s: ControlService c= all failed (%lu)",
+ __func__, GetLastError());
= goto out;
}

@@ -1= 255,22 +1255,19 @@
err =3D InterfaceLuid(itf_name, &am= p;luid);
if (err)
{
- MsgToEventLog(M_ERR, TEXT(&= quot;InterfaceIdString: "

- "failed to convert itf alia= s '%s'"), itf_name);
+ MsgToEventLog(M_ERR, L"%s: failed to convert itf= alias '%s'", __func__, itf_name);
go= to out;
}
err =3D ConvertInterfac= eLuidToGuid(&luid, &guid);
if (err)
= {
- M= sgToEventLog(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) !=3D 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 =3D ERROR_OUTOFMEMORY;
= goto out;
}
@@ -1420,8 +1417,8 @@=
{
return FALSE;
}
= - MsgToEventLog(M_ERR, TEXT("InitialSearchListExists: "
- = "failed to get InitialSearchList (%lu)"), err);<= br>+ MsgToEventLog(M_ERR= , L"%s: failed to get InitialSearchList (%lu)",
+ __func__, err);=
}

return TRUE;=
@@ -1456,8 +1453,8 @@
LSTATUS err =3D= RegSetValueExW(key, L"InitialSearchList", 0, REG_SZ, (PBYTE)list= , size);
if (err)
{
- MsgToEventLog(M_ERR, TEXT(&= quot;StoreInitialDnsSearchList: "

- "failed to set Init= ialSearchList value (%lu)"), err);
+ MsgToEventLog(M_ERR, L"%s: failed to set I= nitialSearchList value (%lu)",
+ __func__, err);
= return FALSE;
}

= @@ -1485,8 +1482,8 @@
err =3D RegGetValueW(key, NU= LL, L"SearchList", RRF_RT_REG_SZ, NULL, list, &size);<= br> if (err)
{
- MsgToEventLog(M_SYSERR, TEXT(&q= uot;AddDnsSearchDomains: "
- "could not get Sear= chList from registry (%lu)"), err);
+ MsgToEventLog(M_SYSERR, L"%s: could n= ot get SearchList from registry (%lu)",
+ __func__, err); return FALSE;
}

@@ -1499,9 +1496,8 @@
size_t = domlen =3D wcslen(domains);
if (listlen + domlen += 2 > _countof(list))
{
- MsgToEventLog(M_SYSERR, TEXT("= ;AddDnsSearchDomains: "
- "not enough space in l= ist for search domains (len=3D%lu)"),
- domlen);
+ MsgToEventLog(M_SYSERR, L&q= uot;%s: not enough space in list for search domains (len=3D%lu)",
+ = __func__, domlen);
return FALSE;
<= span> }


@@ -1519,8 +1515,8 @@
err =3D RegSetValueExW(key, L"SearchList", 0, R= EG_SZ, (PBYTE)list, size);
if (err)
= {
- MsgToEven= tLog(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 @@
{
<= span> if (err !=3D ERROR_FILE_NOT_FOUND)

{=
- MsgToEven= tLog(M_SYSERR, TEXT("ResetDnsSearchDomains: "
- = "could not get InitialSearchList from registry (%lu)"), err);
+ MsgToEventL= og(M_SYSERR, L"%s: could not get InitialSearchList from registry (%lu)= ",
+ = __func__, err);
}
= goto out;
}
@@ -1561,8 +1557,8 = @@
err =3D RegSetValueExW(key, L"SearchList"= , 0, REG_SZ, (PBYTE)list, size);
if (err)
{

- Msg= ToEventLog(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;
}
<= span>

@@ -1589,16 +1585,15 @@
err =3D= 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: cou= ld not get SearchList from registry (%lu)",
+ __func__, err); return;
}
PWSTR dst =3D 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__);<= br> return;
}
@@ -1618,8 +1613,8 @@
err =3D RegGetValueW= (key, NULL, L"InitialSearchList", RRF_RT_REG_SZ, NULL, initial, &= amp;size);
if (err)
{
- MsgToEventLog= (M_SYSERR, TEXT("RemoveDnsSearchDomains: "
- &q= uot;could not get InitialSearchList from registry (%lu)"), err);

+ MsgToEventLog= (M_SYSERR, L"%s: could not get InitialSearchList from registry (%lu)&q= uot;,
+ = __func__, err);
return;
= }

@@ -1635,8 +1630,8 @@
err =3D RegSetValueExW(key, L"SearchList", 0, = REG_SZ, (PBYTE)list, size);
if (err)
= {
- MsgToEve= ntLog(M_SYSERR, TEXT("RemoveDnsSearchDomains: "
- &q= uot;could not set SearchList in registry (%lu)"), err);
+ MsgToEventLog(M_SYSERR, L&= quot;%s: could not set SearchList in registry (%lu)",

+ __func__, err)= ;
}
}

@@ -1692,8 +1687,7 @@
BOOL have_list =3D GetDnsSear= chListKey(itf_name, gpol, &list_key);
if (list_key= =3D=3D 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 regi= stry key", __func__);
return ERROR_FILE_NOT_F= OUND;
}

@@ -1762,9 += 1756,8 @@
if (err)
{
*key =3D INVALID_HANDLE_VALUE;
- MsgToEventLog(M_SYSERR, TEXT("GetInterfa= cesKey: "
- = "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 =3D RegOpenKeyExW(itfs, itf_id, 0, KEY_ALL_ACCESS, &itf);

if (err)
{
- MsgToEventLog(M_SYSERR, TEXT("Set= NameServersValue: "
- itf_id, family, err);
+ MsgToEventLog(M_SYSERR, L"%s= : could not open interface key for %s family %d (%lu)",
+ __func__, it= f_id, family, err);
goto out;
= }

err =3D RegSetValueExA(itf, "= ;NameServer", 0, REG_SZ, (PBYTE)value, strlen(value) + 1);
<= span> if (err)
{
- MsgToEventLog(M_SYSERR, TEXT("SetNameServe= rsValue: "
- = "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)&qu= ot;,
+ = __func__, value, itf_id, family, err);
}=

out:

To vi= ew, visit change 910. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: If15862fe537496ac836fc443936= ff8e7876a39c0
Gerrit-Change-Number: 910
Gerrit-PatchSet: 3
Gerrit-Owner: flichtenheld <frank@...2723...= .>
Gerrit-Reviewer: cron2 <gert@...1296...>=
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-CC: stipa <lstipakov@...277...> <= /div>
Gerrit-MessageType: newpatchset
--NXeGrixocqc=--