From: "cron2 (Code Review)" Date: Fri, 10 Oct 2025 10:53:53 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641..., lstipakov@...277... Message-ID: <7d23d487c02236a795c902116a5691bc1a5a1498-EmailReplacePatchSet-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="ku3LWAsOFPQ="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: socks: Fix conversion warnings with MinGW List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: flichtenheld , plaisthos , stipa Cc: openvpn-devel --ku3LWAsOFPQ= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has uploaded a new patch set (#2) to the change originally created by= flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1262?usp=3Demail ) The following approvals got outdated and were removed: Code-Review+2 by stipa Change subject: socks: Fix conversion warnings with MinGW ...................................................................... socks: Fix conversion warnings with MinGW The winsock2 APIs are a bit weird at times... Change-Id: I977bab08cb614c2d59c34ceebc112f3add9bd168 Signed-off-by: Frank Lichtenheld Acked-by: Lev Stipakov Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1262 Message-Id: <20251010095706.3779-1-gert@...1296...> URL: https://sourceforge.net/p/openvpn/mailman/message/59244802/ Signed-off-by: Gert Doering --- M src/openvpn/socks.c 1 file changed, 11 insertions(+), 17 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/62/1262/2 diff --git a/src/openvpn/socks.c b/src/openvpn/socks.c index 85bbde5..1a75daf 100644 --- a/src/openvpn/socks.c +++ b/src/openvpn/socks.c @@ -80,11 +80,6 @@ free(sp); } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - static bool socks_proxy_recv_char(char *c, const char *name, socket_descriptor_t sd, struct event_timeout *server_poll_timeout, @@ -98,7 +93,8 @@ tv.tv_sec =3D get_server_poll_remaining_time(server_poll_timeout); tv.tv_usec =3D 0; - const int status =3D select(sd + 1, &reads, NULL, NULL, &tv); + /* NB: first argument ignored on Windows where socket_descriptor_t != =3D int */ + const int status =3D select((int)sd + 1, &reads, NULL, NULL, &tv); get_signal(signal_received); if (*signal_received) @@ -139,10 +135,7 @@ volatile int *signal_received) { char to_send[516]; - char buf[2]; - int len =3D 0; struct user_pass creds; - ssize_t size; bool ret =3D false; CLEAR(creds); @@ -161,9 +154,10 @@ int sret =3D snprintf(to_send, sizeof(to_send), "\x01%c%s%c%s", (int)s= trlen(creds.username), creds.username, (int)strlen(creds.password), creds= .password); - ASSERT(sret <=3D sizeof(to_send)); + ASSERT(sret >=3D 0 && sret <=3D sizeof(to_send)); - size =3D send(sd, to_send, strlen(to_send), MSG_NOSIGNAL); + /* NB: int because Windows APIs */ + ssize_t size =3D send(sd, to_send, (int)strlen(to_send), MSG_NOSIGNAL); if (size !=3D strlen(to_send)) { @@ -172,6 +166,8 @@ goto cleanup; } + int len =3D 0; + char buf[2]; while (len < 2) { char c; @@ -419,8 +415,10 @@ buf[5 + len + 1] =3D (char)(port & 0xff); { - const ssize_t size =3D send(sd, buf, 5 + len + 2, MSG_NOSIGNAL); - if ((int)size !=3D 5 + (int)len + 2) + /* int because Windows APIs */ + int send_len =3D 5 + (int)len + 2; + const ssize_t size =3D send(sd, buf, send_len, MSG_NOSIGNAL); + if (size !=3D send_len) { msg(D_LINK_ERRORS | M_ERRNO, "establish_socks_proxy_passthru: TCP port write failed on = send()"); @@ -443,10 +441,6 @@ return; } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif - void establish_socks_proxy_udpassoc(struct socks_proxy_info *p, socket_descriptor_t ctrl_sd, /* already ope= n to proxy */ -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1262?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings?usp=3Demail Gerrit-MessageType: newpatchset Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I977bab08cb614c2d59c34ceebc112f3add9bd168 Gerrit-Change-Number: 1262 Gerrit-PatchSet: 2 Gerrit-Owner: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-Reviewer: stipa Gerrit-CC: openvpn-devel --ku3LWAsOFPQ= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 upl= oaded patch set #2 to the change originally created by flichtenhel= d.

View Change

The following approvals got outdated and were remove= d: Code-Review+2 by stipa

socks: Fix conversion warnings with=
 MinGW

The winsock2 APIs are a bit weird at times...

Change-I= d: I977bab08cb614c2d59c34ceebc112f3add9bd168
Signed-off-by: Frank Lichte= nheld <frank@...2641...>
Acked-by: Lev Stipakov <lstipakov@...1665...= 77...>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1262
Mes= sage-Id: <20251010095706.3779-1-gert@...1296...>
URL: https://sour= ceforge.net/p/openvpn/mailman/message/59244802/
Signed-off-by: Gert Doer= ing <gert@...1296...>
---
M src/openvpn/socks.c
1 file chang= ed, 11 insertions(+), 17 deletions(-)

git pull s=
sh://gerrit.openvpn.net:29418/openvpn refs/changes/62/1262/2
diff -=
-git a/src/openvpn/socks.c b/src/openvpn/socks.c
index 85bb= de5..1a75daf 100644
--- a/src/openvpn/socks.c
+++ b/src/openvpn/socks.c
@@ -80,11 +80,6 @@
<= span> free(sp);
}

-#if defined(__GNUC__) || defined(__clang= __)
-#pragma GCC diagno= stic push
-#pragma GCC = diagnostic ignored "-Wconversion"
-#endif
-
static bool
socks_proxy_recv_char= (char *c, const char *name, socket_descriptor_t sd,
= struct event_timeout *server_poll_timeout,
= @@ -98,7 +93,8 @@
tv.tv_sec =3D get_server_poll_remain= ing_time(server_poll_timeout);
tv.tv_usec =3D 0;

- const= int status =3D select(sd + 1, &reads, NULL, NULL, &tv);
= + /* NB: first argument igno= red on Windows where socket_descriptor_t !=3D int */
+ const int status =3D select((int)sd += 1, &reads, NULL, NULL, &tv);

= get_signal(signal_received);
if (*signal_received)
@@ -139,10 +135,7 @@
= volatile int *signal_received)
{
= char to_send[516];
-= char buf[2];
- i= nt len =3D 0;
struct user_pass creds;
- ssize_t size;
= bool ret =3D false;

CLEAR(creds);
@@ -161,9 +154,10 @@

= int sret =3D snprintf(to_send, sizeof(to_send), "\x01%c%s%c%s", (= int)strlen(creds.username),
creds.= username, (int)strlen(creds.password), creds.password);
- ASSERT(sret <=3D sizeof(to_send));=
+ ASSERT(sret >= ;=3D 0 && sret <=3D sizeof(to_send));
- size =3D send(sd, to_send,= strlen(to_send), MSG_NOSIGNAL);
+ /* NB: int because Windows APIs */
+ ssize_t size =3D send(sd, to_send, (i= nt)strlen(to_send), MSG_NOSIGNAL);

i= f (size !=3D strlen(to_send))
{
@@ -17= 2,6 +166,8 @@
goto cleanup;
}=

+ = int len =3D 0;
+ = char buf[2];
while (len < 2)
= {
char c;
@@ -419,8 +415,10 @@
buf[5 + len + 1] =3D (char)(port & 0xff);
=
{
- const ssize_t size =3D send(sd, buf, 5 + len + 2, MSG_NOSI= GNAL);
- if ((in= t)size !=3D 5 + (int)len + 2)
+ /* int because Windows APIs */
+ int send_len =3D 5 + (int)len + 2;

+ const ssize_t s= ize =3D send(sd, buf, send_len, MSG_NOSIGNAL);
+ if (size !=3D send_len)
= {
msg(D_LINK_ERRORS | M_ERRNO,=
"establish_socks_proxy_passthru: TCP port w= rite failed on send()");
@@ -443,10 +441,6 @@ return;
}

-#if defined(__GNUC__) || defined(__clan= g__)
-#pragma GCC diagn= ostic pop
-#endif
-
void
establish_socks_proxy_udpassoc(struct socks_proxy_info *p,
socket_descriptor_t ctrl_sd, /= * already open to proxy */

To view, vis= it chang= e 1262. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I977bab08cb614c2d59c34ceebc1= 12f3add9bd168
Gerrit-Change-Number: 1262
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <frank@...2723...= .>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-Reviewer: stipa <lstipakov@...277...= >
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
= --ku3LWAsOFPQ=--