Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb29e6af

Browse files
michaelpqpull[bot]
authored andcommitted
Replace loading of ldap_start_tls_sA() by direct function call
This change impacts the backend-side code in charge of starting a LDAPTLS session. It is a bit sad that it is not possible to unify the WIN32and non-WIN32 code paths, but the different number of arguments for bothdiscard this possibility.This is similar to47bd0b3, where this replaces the last functionloading that seems worth it, any others being either environment orversion-dependent.Reported-by: Thomas MunroReviewed-by: Thomas MunroDiscussion:https://postgr.es/m/Yx0rxpNgDh8tN4XA@paquier.xyz
1 parent834ef11 commitb29e6af

File tree

1 file changed

+1
-50
lines changed

1 file changed

+1
-50
lines changed

‎src/backend/libpq/auth.c

Lines changed: 1 addition & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -135,14 +135,6 @@ static intCheckBSDAuth(Port *port, char *user);
135135
#else
136136
#include<winldap.h>
137137

138-
/* Correct header from the Platform SDK */
139-
typedef
140-
ULONG(*__ldap_start_tls_sA) (INPLDAPExternalHandle,
141-
OUTPULONGServerReturnValue,
142-
OUTLDAPMessage**result,
143-
INPLDAPControlA*ServerControls,
144-
INPLDAPControlA*ClientControls
145-
);
146138
#endif
147139

148140
staticintCheckLDAPAuth(Port*port);
@@ -2348,48 +2340,7 @@ InitializeLDAPConnection(Port *port, LDAP **ldap)
23482340
#ifndefWIN32
23492341
if ((r=ldap_start_tls_s(*ldap,NULL,NULL))!=LDAP_SUCCESS)
23502342
#else
2351-
static__ldap_start_tls_sA_ldap_start_tls_sA=NULL;
2352-
2353-
if (_ldap_start_tls_sA==NULL)
2354-
{
2355-
/*
2356-
* Need to load this function dynamically because it may not exist
2357-
* on Windows, and causes a load error for the whole exe if
2358-
* referenced.
2359-
*/
2360-
HANDLEldaphandle;
2361-
2362-
ldaphandle=LoadLibrary("WLDAP32.DLL");
2363-
if (ldaphandle==NULL)
2364-
{
2365-
/*
2366-
* should never happen since we import other files from
2367-
* wldap32, but check anyway
2368-
*/
2369-
ereport(LOG,
2370-
(errmsg("could not load library \"%s\": error code %lu",
2371-
"WLDAP32.DLL",GetLastError())));
2372-
ldap_unbind(*ldap);
2373-
returnSTATUS_ERROR;
2374-
}
2375-
_ldap_start_tls_sA= (__ldap_start_tls_sA) (pg_funcptr_t)GetProcAddress(ldaphandle,"ldap_start_tls_sA");
2376-
if (_ldap_start_tls_sA==NULL)
2377-
{
2378-
ereport(LOG,
2379-
(errmsg("could not load function _ldap_start_tls_sA in wldap32.dll"),
2380-
errdetail("LDAP over SSL is not supported on this platform.")));
2381-
ldap_unbind(*ldap);
2382-
FreeLibrary(ldaphandle);
2383-
returnSTATUS_ERROR;
2384-
}
2385-
2386-
/*
2387-
* Leak LDAP handle on purpose, because we need the library to
2388-
* stay open. This is ok because it will only ever be leaked once
2389-
* per process and is automatically cleaned up on process exit.
2390-
*/
2391-
}
2392-
if ((r=_ldap_start_tls_sA(*ldap,NULL,NULL,NULL,NULL))!=LDAP_SUCCESS)
2343+
if ((r=ldap_start_tls_s(*ldap,NULL,NULL,NULL,NULL))!=LDAP_SUCCESS)
23932344
#endif
23942345
{
23952346
ereport(LOG,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp