From patchwork Fri Oct 10 09:57:00 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 4495 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:7d42:b0:72f:f16c:e055 with SMTP id fr2csp176463mab; Fri, 10 Oct 2025 02:57:19 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX+sY82SFv2UTwB6KoV4vozxwi4NymELogbr4HSofEA4ZY2Z3bbTJ5GaWv+t3sS8+EAsn1dIEJV9vI=@openvpn.net X-Google-Smtp-Source: AGHT+IG477FgNbaafV0ANq+99g1DwO9UOpAMVnvAeYJfAAZvk2RvrmdatUx5AjTLUyCQeYRGcvc0 X-Received: by 2002:a05:6808:4fd4:b0:43f:7287:a5cb with SMTP id 5614622812f47-4417b3260f5mr5156267b6e.21.1760090239427; Fri, 10 Oct 2025 02:57:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1760090239; cv=none; d=google.com; s=arc-20240605; b=MglUxThOODNotlaHRCpe/23WTgNh7yIF95kgi3Vc7k38Dx2btG2p+gkNWyrYQkHBI2 lUk7r3FoBdgiX79MnSQr/X9HChmJDrknFbXsoUoWM4hkP9Ynbi66z3E0iT3Bhe40pfHu 42e/FPhu7epCdwZJVxUH3mnOi36IcviP4GoJMoMmus8hBFqj+5i1RAjUYTwcuULw45Fo y145BEDsvuV5USCrWd6x6xCTC9ah4B1wbQAs0kuFG7S1U4w/FbODLttcocv6mi1FMesG eBkUnrOHkDt8WmUCKpJwGgMOwx2V4jI+Lp3TcNoC5Tmu4awOoi2WVzmQsX1NZfY8xWjZ 7GjA== 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:dkim-signature; bh=StWBMkKZ6iiSJewtVX/6i8lvQQVO7wvlizHjbg4dNaY=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=YRLaX8OxAEWbvuMouJHdSGI1nzjbee/Iin4SK/CaS57BYK2ZY6ryMIJ7E9q//hYnBx qLGVveZMKDZrxeY3XivUIAAzCn7MAV3l5gb1tjV/wg11yrasKR3FQLe7+Zaq3M//WeOb h7C0qodlDDzPq1QgDb3rJJoxatexQutev6Jc4hoPMabTAc/FvfG68tP2VB07wz0Udril /1iUX7vk+TbC0GBXm1mh1K+FiVwFl01/Rj/UIKbtJxQmn0DXpwwaRN7tGtGuuRUsHYem dY7992/SsqoxoVkH3ujor7J4j6ix8KB8SKjNg4zAfcZ+o5KbFsW9KTjk8dzpCCjJu8CZ Eb4Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=QqZqHrtm; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=FF6KL1sC; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=IRLmkifF; 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 5614622812f47-4419898d3fasi409340b6e.156.2025.10.10.02.57.19 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 Oct 2025 02:57:19 -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=pass header.i=@lists.sourceforge.net header.s=beta header.b=QqZqHrtm; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=FF6KL1sC; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=IRLmkifF; 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 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.sourceforge.net; s=beta; h=Content-Transfer-Encoding:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: Subject:MIME-Version:References:In-Reply-To:Message-ID:Date:To:From:Sender: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=StWBMkKZ6iiSJewtVX/6i8lvQQVO7wvlizHjbg4dNaY=; b=QqZqHrtmyBCugVvNdFOP9S5kBv 2NW4WTx38SpHQ4stFKnRrc3Y5HGA60uHl6PBVviIjSDANq39e0xRhPFk2t/bxSASNW/aFmKcfBqaT m+Do9TxKsvBg5QaScmGtmgXcP0MZHmIUNrSudWav72SXN1KaUDyZLExxA/fBJrMyQdcU=; Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1v79sB-00033j-IE; Fri, 10 Oct 2025 09:57:15 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1v79sA-00033U-Ju for openvpn-devel@lists.sourceforge.net; Fri, 10 Oct 2025 09:57:14 +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=i58kTXEHU81DIdPD+b0xYeYDPEJ8xBZW6tBFaUsPf2c=; b=FF6KL1sCM/mff+tXz5p+BdvMjM 0bCoDRb8iL90XmYxPrayToAkwgJ0+Xkm2lJq5zHyC4oIz9V6BUW7O3/bm//DA7o+Wo8x9HRKU1z6T VOv/DYMGVvEn1EV7x3UDb7O484/jQ8593ZUZVX5S9JWkhpS8HQtHHvW7rrmOn8I/lFy4=; 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=i58kTXEHU81DIdPD+b0xYeYDPEJ8xBZW6tBFaUsPf2c=; b=IRLmkifFnaX7QB8rrymn7o0UZM 8Bi6aobZzsh7PaF6Ofo9gPZO+xJ13la4Ytq9AUwBcK8sGCdjfldQ3NyaEE2QCc68StRjTtLf4W1KV LOM8HKBbDQAaslugcLCZ5M2yyDmwYzpIO03P4G9R31mgoRT/NQt4+N7DWf8rdp+zH9jc=; Received: from [193.149.48.134] (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 1v79s9-0004O6-8z for openvpn-devel@lists.sourceforge.net; Fri, 10 Oct 2025 09:57:14 +0000 Received: from blue.greenie.muc.de (localhost [127.0.0.1]) by blue.greenie.muc.de (8.18.1/8.18.1) with ESMTP id 59A9v6Aa003797 for ; Fri, 10 Oct 2025 11:57:06 +0200 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.1/8.18.1/Submit) id 59A9v6T9003796 for openvpn-devel@lists.sourceforge.net; Fri, 10 Oct 2025 11:57:06 +0200 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Fri, 10 Oct 2025 11:57:00 +0200 Message-ID: <20251010095706.3779-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.49.1 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Score: 1.3 (+) X-Spam-Report: Spam detection software, running on the system "sfi-spamd-1.hosts.colo.sdot.me", 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 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/open [...] Content analysis details: (1.3 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.3 RDNS_NONE Delivered to internal network by a host with no rDNS X-Headers-End: 1v79s9-0004O6-8z Subject: [Openvpn-devel] [PATCH v1] socks: Fix conversion warnings with MinGW 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?1845588382498262902?= X-GMAIL-MSGID: =?utf-8?q?1845588382498262902?= From: Frank Lichtenheld 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 --- 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/+/1262 This mail reflects revision 1 of this Change. Acked-by according to Gerrit (reflected above): Lev Stipakov 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 = get_server_poll_remaining_time(server_poll_timeout); tv.tv_usec = 0; - const int status = select(sd + 1, &reads, NULL, NULL, &tv); + /* NB: first argument ignored on Windows where socket_descriptor_t != int */ + const int status = 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 = 0; struct user_pass creds; - ssize_t size; bool ret = false; CLEAR(creds); @@ -161,9 +154,10 @@ int sret = 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 <= sizeof(to_send)); + ASSERT(sret >= 0 && sret <= sizeof(to_send)); - size = send(sd, to_send, strlen(to_send), MSG_NOSIGNAL); + /* NB: int because Windows APIs */ + ssize_t size = send(sd, to_send, (int)strlen(to_send), MSG_NOSIGNAL); if (size != strlen(to_send)) { @@ -172,6 +166,8 @@ goto cleanup; } + int len = 0; + char buf[2]; while (len < 2) { char c; @@ -419,8 +415,10 @@ buf[5 + len + 1] = (char)(port & 0xff); { - const ssize_t size = send(sd, buf, 5 + len + 2, MSG_NOSIGNAL); - if ((int)size != 5 + (int)len + 2) + /* int because Windows APIs */ + int send_len = 5 + (int)len + 2; + const ssize_t size = send(sd, buf, send_len, MSG_NOSIGNAL); + if (size != 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 open to proxy */