pgsql: Replace load of functions by direct calls for some WIN32

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема pgsql: Replace load of functions by direct calls for some WIN32
Дата
Msg-id E1oWTDK-0024x7-U4@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Replace load of functions by direct calls for some WIN32

This commit changes the following code paths to do direct system calls
to some WIN32 functions rather than loading them from an external
library, shaving some code in the process:
- Creation of restricted tokens in pg_ctl.c, introduced by a25cd81.
- QuerySecurityContextToken() in auth.c for SSPI authentication in the
backend, introduced in d602592.
- CreateRestrictedToken() in src/common/.  This change is similar to the
case of pg_ctl.c.

Most of these functions were loaded rather than directly called because,
as mentioned in the code comments, MinGW headers were not declaring
them.  I have double-checked the recent MinGW code, and all the
functions changed here are declared in its headers, so this change
should be safe.  Note that I do not have a MinGW environment at hand so
I have not tested it directly, but that MSVC was fine with the change.
The buildfarm will tell soon enough if this change is appropriate or not
for a much broader set of environments.

A few code paths still use GetProcAddress() to load some functions:
- LDAP authentication for ldap_start_tls_sA(), where I am not confident
that this change would work.
- win32env.c and win32ntdll.c where we have a per-MSVC version
dependency for the name of the library loaded.
- crashdump.c for MiniDumpWriteDump() and EnumDirTree(), where direct
calls were not able to work after testing.

Reported-by: Thomas Munro
Reviewed-by: Justin Prysby
Discussion: https://postgr.es/m/CA+hUKG+BMdcaCe=P-EjMoLTCr3zrrzqbcVE=8h5LyNsSVHKXZA@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/47bd0b3fa601642b6cfbe79ad956d4a9fc835ba1

Modified Files
--------------
src/backend/libpq/auth.c      |  29 +--------
src/bin/pg_ctl/pg_ctl.c       | 137 ++++++++++++------------------------------
src/common/restricted_token.c |  39 +++---------
3 files changed, 47 insertions(+), 158 deletions(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Amit Kapila
Дата:
Сообщение: Re: pgsql: Raise a warning if there is a possibility of data from multiple
Следующее
От: Tom Lane
Дата:
Сообщение: Re: pgsql: Raise a warning if there is a possibility of data from multiple