Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oRoV1-0000mo-Ni for pgsql-hackers@arkaria.postgresql.org; Sat, 27 Aug 2022 05:36:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oRoU0-0001b3-PJ for pgsql-hackers@arkaria.postgresql.org; Sat, 27 Aug 2022 05:35:48 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oRoTy-0001UL-UO for pgsql-hackers@lists.postgresql.org; Sat, 27 Aug 2022 05:35:48 +0000 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oRoTr-00078N-IO for pgsql-hackers@lists.postgresql.org; Sat, 27 Aug 2022 05:35:45 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 1297D3200922; Sat, 27 Aug 2022 01:35:36 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Sat, 27 Aug 2022 01:35:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm1; t=1661578536; x=1661664936; bh=vlK7lwprcv lowYX97SGwAkdBXfZa6eu/3PRvXKkDuOw=; b=sV4A5F4/4RA0g133XcO43on13L AibF4owUbqlzfFYQ+uqbn5JM6as5rkmQz6wgcAnhdDsB2KOv4IucoiXRsEyIjJ11 yCJjIsx0CDZo9G7QkeWAF+DV4C43v35g/Xz59gqy63eZYM3mWhiJls6ywT27KDxy lDjM6ggiaiwixatTNoP8jRLgtQr5Z+LKExRPnmZIMO/VKkn/ww8Vk5GYPZHZP+nW Ba6aVcLqjTWp7H1j/C/ReX8LwmjXc9Y4hPixDjxBGzTk4Ts/35XN53J+7bcXk58w aGDgvXKu8ZA7etFZgZ/Bzxr+vFsj/7HmuFfIsRQtk497GyR84H9JW2/ZCMwA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1661578536; x=1661664936; bh=vlK7lwprcvlowYX97SGwAkdBXfZa 6eu/3PRvXKkDuOw=; b=EApEgirUYqTa76fbQZtuI1p6NTnUm/NGQKNxTmOhSzZp eVwcHuwGto7gyaRVhZxzb1SXjI0DQbxa4sdYRyZVhH4sf2PYOQxH0aRdUWv5t5Or yvIX+hmX6SJsRpBCKaYf6zvOV463gwBQLi6jVJ0/bowbcmxng0HfzrEeojB8a6hg 82RlOd/UAG4vBIWmJOLddyJsNF97Q0lREAf2eTWLWrxdI07i3BtBfIXm+VVyia8e tIo59cpYtPk4LaT7HeNclHiXGkgjlU1SU8RZIC7mwVpounOP81hy7zVPKLIPKxiv u7u4q0f4Do7pNwiIucteO1hmm8mrWCmgMugdZRV7Rg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdejiedgleekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne gfrhhlucfvnfffucdljedtmdenucfjughrpeffhffvvefukfhfgggtuggjsehgtderredt tddvnecuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesph grqhhuihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepteelieefudffhffhtdetleeg geegfffhkeeuveetiefgudduvedutefggeeivdejnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiih ii X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 27 Aug 2022 01:35:33 -0400 (EDT) Date: Sat, 27 Aug 2022 14:35:25 +0900 From: Michael Paquier To: Justin Pryzby Cc: Andrew Dunstan , Thomas Munro , Daniel Gustafsson , Juan =?iso-8859-1?Q?Jos=E9_Santamar=EDa?= Flecha , pgsql-hackers@lists.postgresql.org Subject: Re: Bump MIN_WINNT to 0x0600 (Vista) as minimal runtime in 16~ Message-ID: References: <503cc622-ea4d-0a78-ff0c-2c757b97149e@dunslane.net> <20220826112637.GD2342@telsasoft.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="TjfGAIw6f/iOFoJF" Content-Disposition: inline In-Reply-To: <20220826112637.GD2342@telsasoft.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --TjfGAIw6f/iOFoJF Content-Type: multipart/mixed; boundary="sj1UTf0WjyxXoUPP" Content-Disposition: inline --sj1UTf0WjyxXoUPP Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Aug 26, 2022 at 06:26:37AM -0500, Justin Pryzby wrote: > If I'm not wrong, there's some lingering comments which could be removed since > 495ed0ef2. It seems to me that you are right. I have not thought about looking at references to NT. Good catches! > src/bin/pg_ctl/pg_ctl.c: * on NT4. That way, we don't break on NT4. > src/bin/pg_ctl/pg_ctl.c: * On NT4, or any other system not containing the required functions, will > src/bin/pg_ctl/pg_ctl.c: * NT4 doesn't have CreateRestrictedToken, so just call ordinary > src/port/dirmod.c: * Win32 (NT4 and newer). > src/backend/port/win32/socket.c: /* No error, zero bytes (win2000+) or error+WSAEWOULDBLOCK (<=nt4) */ There is also a reference to Nt4 in win32.c, for a comment that is irrelevant now, so it can be IMO removed. There may be a point in enforcing CreateProcess() if CreateRestrictedToken() cannot be loaded, but that would be a security issue if Windows goes crazy as we should always expect the function, so this had better return an error. So, what do you think about the attached? -- Michael --sj1UTf0WjyxXoUPP Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="win32-more-cleanup.patch" Content-Transfer-Encoding: quoted-printable diff --git a/src/backend/port/win32/socket.c b/src/backend/port/win32/socke= t.c index 52944a0d33..130b60af22 100644 --- a/src/backend/port/win32/socket.c +++ b/src/backend/port/win32/socket.c @@ -495,7 +495,7 @@ pgwin32_send(SOCKET s, const void *buf, int len, int fl= ags) return -1; } =20 - /* No error, zero bytes (win2000+) or error+WSAEWOULDBLOCK (<=3Dnt4) */ + /* No error, zero bytes */ =20 if (pgwin32_waitforsinglesocket(s, FD_WRITE | FD_CLOSE, INFINITE) =3D=3D= 0) return -1; diff --git a/src/port/dirmod.c b/src/port/dirmod.c index 2818bfd2e9..ae6301dd6c 100644 --- a/src/port/dirmod.c +++ b/src/port/dirmod.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * This includes replacement versions of functions that work on - * Win32 (NT4 and newer). + * Windows. * * IDENTIFICATION * src/port/dirmod.c diff --git a/src/bin/pg_ctl/pg_ctl.c b/src/bin/pg_ctl/pg_ctl.c index 73e20081d1..20d2a04b7f 100644 --- a/src/bin/pg_ctl/pg_ctl.c +++ b/src/bin/pg_ctl/pg_ctl.c @@ -1726,9 +1726,7 @@ pgwin32_doRunAsService(void) =20 /* * Mingw headers are incomplete, and so are the libraries. So we have to l= oad - * a whole lot of API functions dynamically. Since we have to do this anyw= ay, - * also load the couple of functions that *do* exist in mingw headers but = not - * on NT4. That way, we don't break on NT4. + * a whole lot of API functions dynamically. */ typedef BOOL (WINAPI * __CreateRestrictedToken) (HANDLE, DWORD, DWORD, PSI= D_AND_ATTRIBUTES, DWORD, PLUID_AND_ATTRIBUTES, DWORD, PSID_AND_ATTRIBUTES, = PHANDLE); typedef BOOL (WINAPI * __IsProcessInJob) (HANDLE, HANDLE, PBOOL); @@ -1768,9 +1766,6 @@ InheritStdHandles(STARTUPINFO *si) * * Returns 0 on success, non-zero on failure, same as CreateProcess(). * - * On NT4, or any other system not containing the required functions, will - * launch the process under the current token without doing any modificati= ons. - * * NOTE! Job object will only work when running as a service, because it's * automatically destroyed when pg_ctl exits. */ @@ -1815,14 +1810,9 @@ CreateRestrictedProcess(char *cmd, PROCESS_INFORMATI= ON *processInfo, bool as_ser =20 if (_CreateRestrictedToken =3D=3D NULL) { - /* - * NT4 doesn't have CreateRestrictedToken, so just call ordinary - * CreateProcess - */ - write_stderr(_("%s: WARNING: cannot create restricted tokens on this pla= tform\n"), progname); - if (Advapi32Handle !=3D NULL) - FreeLibrary(Advapi32Handle); - return CreateProcess(NULL, cmd, NULL, NULL, FALSE, 0, NULL, NULL, &si, p= rocessInfo); + /* Log error if we cannot get the function */ + write_stderr(_("%s: WARNING: could not locate object function to create = restricted token\n"), progname); + return 0; } =20 /* Open the current token to use as a base for the restricted one */ diff --git a/src/interfaces/libpq/win32.c b/src/interfaces/libpq/win32.c index e57b602476..447f64c072 100644 --- a/src/interfaces/libpq/win32.c +++ b/src/interfaces/libpq/win32.c @@ -271,10 +271,6 @@ struct MessageDLL * Returns a description of the socket error by first trying * to find it in the lookup table, and if that fails, tries * to load any of the winsock dlls to find that message. - * The DLL thing works from Nt4 (spX ?) up, but some special - * versions of winsock might have this as well (seen on Win98 SE - * special install) / Magnus Naeslund (mag@fbab.net) - * */ =20 const char * --sj1UTf0WjyxXoUPP-- --TjfGAIw6f/iOFoJF Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmMJrRwACgkQnvQgOdby QH2yEg//R90bturBtOIR35puzNo7xPwpdUHOlB4A1Hr+0DWglJwnx5jDSOkFdraX oJPj9g9CWeTMxNI+TpDA+QCDfrGkbXLeshsysbAmL7op6tpPCWh5DNgN7L0FAB9z 9oXiF5Gu0SzOWBHntAzhuicmP+D84zjKbwlmUJTvWAi7SGKO/U9TmysptAKeyKHz a1KpoRSrfNqqXB4gInb+tfahdgdxK/ZUoL4kmcx4BZFPHX95zj7Ejkev0oL/szm1 GYgvnARloL4tVp1/WFNKT+rHEQqoX9/KVKEqhdDrzMbu5Z+D2KHLrl+63pgFQu/G kKsxyNvyGNGT90edPIF3sdBdNzhgGMlNzyySaCPz1iCKDdPvrlWPTVlledWmqarq sNP0fzHH8HpTaOwunN9LPyAvE6mLs3SE7ILBBYxpzuIruI1bvCDydBMe56qlDMZO zRsWbrBJDg+pTKNxDZyijyOLSLuknhyzWSAuxiWfzWJnDWZftuh5hlqSDnZ7+pJq ioT54HdY1yy/cQUpQxLNN+nmjRYYnPsJenpD0nXT+DwIFWqY86D3X30W494kpQUN yjKqWPq98Zs1uqD7aQXjRcYaOHvlFj7plTyeq7hC96oZ9eu38FqN7jmQE+QvSndP VSMPZWv6k/TGmE3eBIGxNuxuqq7HGfT0m1yLZkH7HsR2U3T6RXc= =VM5H -----END PGP SIGNATURE----- --TjfGAIw6f/iOFoJF--