From patchwork Thu Oct 12 22:50:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Rozman X-Patchwork-Id: 32 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director1.mail.ord1d.rsapps.net ([172.30.157.6]) by backend31.mail.ord1d.rsapps.net (Dovecot) with LMTP id 4XRlCXuM4FkGdAAAgoeIoA for ; Fri, 13 Oct 2017 05:50:51 -0400 Received: from proxy7.mail.ord1d.rsapps.net ([172.30.157.46]) by director1.mail.ord1d.rsapps.net (Dovecot) with LMTP id IUQfCXuM4FncCwAANGzteQ ; Fri, 13 Oct 2017 05:50:51 -0400 Received: from smtp3.gate.ord1d ([172.30.191.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy7.mail.ord1d.rsapps.net (Dovecot) with LMTP id 8NOSAXOM4FkAMwAAMe1Fpw ; Fri, 13 Oct 2017 05:50:51 -0400 X-Spam-Threshold: 95 X-Spam-Score: 0 X-Spam-Flag: NO X-Virus-Scanned: OK X-MessageSniffer-Scan-Result: 0 X-MessageSniffer-Rules: 0-298-1001-1213-w 0-298-1001-1577-w 0-298-0-14655-f X-CMAE-Scan-Result: 0 X-CNFS-Analysis: v=2.2 cv=TKMHcBta c=1 sm=1 tr=0 a=Q8DxjiC8O3VT/NpP1XjEZQ==:117 a=Q8DxjiC8O3VT/NpP1XjEZQ==:17 a=kj9zAlcOel0A:10 a=02M-m0pO-4AA:10 a=WiVod9pSvdkA:10 a=9sSjY8p1AAAA:8 a=P_JWiMecAAAA:8 a=FP58Ms26AAAA:8 a=-eg5x02rib100QU7YUAA:9 a=CjuIK1q_8ugA:10 a=-FEs8UIgK8oA:10 a=NWVoK91CQyQA:10 a=ub54wNWiXv_DzeFsgEJW:22 a=D0-HAvA3Hk9NMREbgwuX:22 X-Orig-To: justin@openvpn.net X-Originating-Ip: [216.34.181.88] Authentication-Results: smtp3.gate.ord1d.rsapps.net; iprev=pass policy.iprev="216.34.181.88"; spf=pass smtp.mailfrom="openvpn-devel-bounces@lists.sourceforge.net" smtp.helo="lists.sourceforge.net"; dkim=fail (signature verification failed) header.d=sourceforge.net; dkim=fail (signature verification failed) header.d=sf.net; dkim=fail (signature verification failed) header.d=rozman.si; dmarc=fail (p=none; dis=none) header.from=rozman.si X-Classification-ID: fe510228-affb-11e7-a3ae-5254006d4589-1-1 Received: from [216.34.181.88] ([216.34.181.88:17959] helo=lists.sourceforge.net) by smtp3.gate.ord1d.rsapps.net (envelope-from ) (ecelerity 4.2.1.56364 r(Core:4.2.1.14)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 52/2F-32212-97C80E95; Fri, 13 Oct 2017 05:50:49 -0400 Received: from localhost ([127.0.0.1] helo=sfs-ml-3.v29.ch3.sourceforge.com) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.89) (envelope-from ) id 1e2wbq-0001pD-RB; Fri, 13 Oct 2017 09:50:26 +0000 Received: from sog-mx-2.v43.ch3.sourceforge.com ([172.29.43.192] helo=mx.sourceforge.net) by sfs-ml-3.v29.ch3.sourceforge.com with esmtps (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.89) (envelope-from ) id 1e2wbo-0001p7-HY for openvpn-devel@lists.sourceforge.net; Fri, 13 Oct 2017 09:50:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=kO5loT77ZoGM3CQPCsD9nWwJ3alOvJIUpAnioHsH+to=; b=L4IglVVdq1uFtIUg/MAwUqGfu9Xw8aWZfGJ9gHwDAd0crC8s8fQ0bk0lglArCtBQfuBMBltoNyGzL23Daln3ZQAgV3Yt2XMysJE+2XbHcONizRtp7lBCrynYUcfIjfkv3ThYraCoP7W7+0jAeUoQY8yPVZz96GBvZP7JHgMrBkc=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=kO5loT77ZoGM3CQPCsD9nWwJ3alOvJIUpAnioHsH+to=; b=CInZi2e91GHM1p1ioC3i1hhfLDgtdkHXEJKm9lGNvHd3er+vw1XwSM0WKcu4inb69XbVfUHRgXVcrIUlBFQ55qAm0e/Xhl5tvK0YHvew6ag7GuPFYakBJIT1J69X4Wdrxtk+VjMHLzNiYiCgZTjCfSM//HVcmJMEKDzGw6UOCEc=; Received-SPF: pass (sog-mx-2.v43.ch3.sourceforge.com: domain of rozman.si designates 89.212.80.145 as permitted sender) client-ip=89.212.80.145; envelope-from=simon@rozman.si; helo=amebis01.amebis.si; Received: from amebis01.amebis.si ([89.212.80.145]) by sog-mx-2.v43.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) id 1e2wbi-0006kj-SZ for openvpn-devel@lists.sourceforge.net; Fri, 13 Oct 2017 09:50:24 +0000 Received: from SR5.amebis.doma (unknown [192.168.100.253]) by amebis01.amebis.si (Postfix) with ESMTP id 10526407C1; Fri, 13 Oct 2017 11:50:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=rozman.si; s=default; t=1507888210; bh=hGLVoaLjrRiN2Td5rteCL6B58w6a0gPyGzr1PjS342E=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=WRnU1U6nTziYIM4N8op33FckeTGt7gQ5LaZDBCzsXlSKwrYtUyS3Jz8L8/OJFBsha +8HDVCAAY1ViG7ttJjlNoPADSZapeu7BoirbBPpJbtuKME3HyQbLSBtyie82tPmwPL lZj2ZKjc/vSrgvyH6JdLt2ikxqR9exmGvLAzCaDI= From: Simon Rozman To: openvpn-devel@lists.sourceforge.net Date: Fri, 13 Oct 2017 11:50:08 +0200 Message-Id: <20171013095008.8288-1-simon@rozman.si> X-Mailer: git-send-email 2.9.0.windows.1 In-Reply-To: <99D61A626FDA8A4B90A270669121BE108580F7E3@PLANJAVA.amebis.doma> References: <99D61A626FDA8A4B90A270669121BE108580F7E3@PLANJAVA.amebis.doma> X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [89.212.80.145 listed in list.dnswl.org] -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 AWL AWL: Adjusted score from AWL reputation of From: address X-Headers-End: 1e2wbi-0006kj-SZ Subject: [Openvpn-devel] [PATCH] Uniform swprintf() across MinGW and MSVC compilers 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: , MIME-Version: 1.0 Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox Legacy _snwprintf() and snwprintf() functions replaced with ISO C swprintf(). Assigning _snwprintf() return value to unused variable was also removed at one occasion. --- src/openvpn/tun.c | 2 +- src/openvpnserv/interactive.c | 20 ++++++++++---------- src/openvpnserv/validate.c | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c index 3639718..25831ce 100644 --- a/src/openvpn/tun.c +++ b/src/openvpn/tun.c @@ -4622,7 +4622,7 @@ get_adapter_index_method_1(const char *guid) DWORD index; ULONG aindex; wchar_t wbuf[256]; - _snwprintf(wbuf, SIZE(wbuf), L"\\DEVICE\\TCPIP_%S", guid); + swprintf(wbuf, SIZE(wbuf), L"\\DEVICE\\TCPIP_%S", guid); wbuf [SIZE(wbuf) - 1] = 0; if (GetAdapterIndex(wbuf, &aindex) != NO_ERROR) { diff --git a/src/openvpnserv/interactive.c b/src/openvpnserv/interactive.c index 0b57eb9..0169617 100644 --- a/src/openvpnserv/interactive.c +++ b/src/openvpnserv/interactive.c @@ -277,7 +277,7 @@ ReturnProcessId(HANDLE pipe, DWORD pid, DWORD count, LPHANDLE events) * Same format as error messages (3 line string) with error = 0 in * 0x%08x format, PID on line 2 and a description "Process ID" on line 3 */ - _snwprintf(buf, _countof(buf), L"0x%08x\n0x%08x\n%s", 0, pid, msg); + swprintf(buf, _countof(buf), L"0x%08x\n0x%08x\n%s", 0, pid, msg); buf[_countof(buf) - 1] = '\0'; WritePipeAsync(pipe, buf, wcslen(buf) * 2, count, events); @@ -403,8 +403,8 @@ ValidateOptions(HANDLE pipe, const WCHAR *workdir, const WCHAR *options) if (!CheckOption(workdir, 2, argv_tmp, &settings)) { - snwprintf(buf, _countof(buf), msg1, argv[0], workdir, - settings.ovpn_admin_group); + swprintf(buf, _countof(buf), msg1, argv[0], workdir, + settings.ovpn_admin_group); buf[_countof(buf) - 1] = L'\0'; ReturnError(pipe, ERROR_STARTUP_DATA, buf, 1, &exit_event); } @@ -422,15 +422,15 @@ ValidateOptions(HANDLE pipe, const WCHAR *workdir, const WCHAR *options) { if (wcscmp(L"--config", argv[i]) == 0 && argc-i > 1) { - snwprintf(buf, _countof(buf), msg1, argv[i+1], workdir, - settings.ovpn_admin_group); + swprintf(buf, _countof(buf), msg1, argv[i+1], workdir, + settings.ovpn_admin_group); buf[_countof(buf) - 1] = L'\0'; ReturnError(pipe, ERROR_STARTUP_DATA, buf, 1, &exit_event); } else { - snwprintf(buf, _countof(buf), msg2, argv[i], - settings.ovpn_admin_group); + swprintf(buf, _countof(buf), msg2, argv[i], + settings.ovpn_admin_group); buf[_countof(buf) - 1] = L'\0'; ReturnError(pipe, ERROR_STARTUP_DATA, buf, 1, &exit_event); } @@ -1067,7 +1067,7 @@ RegisterDNS(LPVOID unused) if (GetSystemDirectory(sys_path, MAX_PATH)) { - _snwprintf(ipcfg, MAX_PATH, L"%s\\%s", sys_path, L"ipconfig.exe"); + swprintf(ipcfg, MAX_PATH, L"%s\\%s", sys_path, L"ipconfig.exe"); ipcfg[MAX_PATH-1] = L'\0'; } @@ -1707,8 +1707,8 @@ RunOpenvpn(LPVOID p) else if (exit_code != 0) { WCHAR buf[256]; - int len = _snwprintf(buf, _countof(buf), - L"OpenVPN exited with error: exit code = %lu", exit_code); + swprintf(buf, _countof(buf), + L"OpenVPN exited with error: exit code = %lu", exit_code); buf[_countof(buf) - 1] = L'\0'; ReturnError(pipe, ERROR_OPENVPN_STARTUP, buf, 1, &exit_event); } diff --git a/src/openvpnserv/validate.c b/src/openvpnserv/validate.c index f6a97e9..653bd12 100644 --- a/src/openvpnserv/validate.c +++ b/src/openvpnserv/validate.c @@ -65,7 +65,7 @@ CheckConfigPath(const WCHAR *workdir, const WCHAR *fname, const settings_t *s) /* convert fname to full path */ if (PathIsRelativeW(fname) ) { - snwprintf(tmp, _countof(tmp), L"%s\\%s", workdir, fname); + swprintf(tmp, _countof(tmp), L"%s\\%s", workdir, fname); tmp[_countof(tmp)-1] = L'\0'; config_file = tmp; }