mirror of
https://github.com/curl/curl.git
synced 2026-08-26 17:43:31 +03:00
parent
b2bccdc257
commit
89771d19d5
109 changed files with 319 additions and 324 deletions
46
lib/ldap.c
46
lib/ldap.c
|
|
@ -43,7 +43,7 @@
|
|||
*/
|
||||
|
||||
/* Wincrypt must be included before anything that could include OpenSSL. */
|
||||
#if defined(USE_WIN32_CRYPTO)
|
||||
#ifdef USE_WIN32_CRYPTO
|
||||
#include <wincrypt.h>
|
||||
/* Undefine wincrypt conflicting symbols for BoringSSL. */
|
||||
#undef X509_NAME
|
||||
|
|
@ -105,7 +105,7 @@
|
|||
struct ldap_urldesc {
|
||||
char *lud_host;
|
||||
int lud_port;
|
||||
#if defined(USE_WIN32_LDAP)
|
||||
#ifdef USE_WIN32_LDAP
|
||||
TCHAR *lud_dn;
|
||||
TCHAR **lud_attrs;
|
||||
#else
|
||||
|
|
@ -113,7 +113,7 @@ struct ldap_urldesc {
|
|||
char **lud_attrs;
|
||||
#endif
|
||||
int lud_scope;
|
||||
#if defined(USE_WIN32_LDAP)
|
||||
#ifdef USE_WIN32_LDAP
|
||||
TCHAR *lud_filter;
|
||||
#else
|
||||
char *lud_filter;
|
||||
|
|
@ -224,9 +224,9 @@ const struct Curl_handler Curl_handler_ldaps = {
|
|||
};
|
||||
#endif
|
||||
|
||||
#if defined(USE_WIN32_LDAP)
|
||||
#ifdef USE_WIN32_LDAP
|
||||
|
||||
#if defined(USE_WINDOWS_SSPI)
|
||||
#ifdef USE_WINDOWS_SSPI
|
||||
static int ldap_win_bind_auth(LDAP *server, const char *user,
|
||||
const char *passwd, unsigned long authflags)
|
||||
{
|
||||
|
|
@ -236,19 +236,19 @@ static int ldap_win_bind_auth(LDAP *server, const char *user,
|
|||
|
||||
memset(&cred, 0, sizeof(cred));
|
||||
|
||||
#if defined(USE_SPNEGO)
|
||||
#ifdef USE_SPNEGO
|
||||
if(authflags & CURLAUTH_NEGOTIATE) {
|
||||
method = LDAP_AUTH_NEGOTIATE;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#if defined(USE_NTLM)
|
||||
#ifdef USE_NTLM
|
||||
if(authflags & CURLAUTH_NTLM) {
|
||||
method = LDAP_AUTH_NTLM;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#if !defined(CURL_DISABLE_DIGEST_AUTH)
|
||||
#ifndef CURL_DISABLE_DIGEST_AUTH
|
||||
if(authflags & CURLAUTH_DIGEST) {
|
||||
method = LDAP_AUTH_DIGEST;
|
||||
}
|
||||
|
|
@ -273,7 +273,7 @@ static int ldap_win_bind_auth(LDAP *server, const char *user,
|
|||
}
|
||||
return rc;
|
||||
}
|
||||
#endif /* #if defined(USE_WINDOWS_SSPI) */
|
||||
#endif /* USE_WINDOWS_SSPI */
|
||||
|
||||
static int ldap_win_bind(struct Curl_easy *data, LDAP *server,
|
||||
const char *user, const char *passwd)
|
||||
|
|
@ -292,7 +292,7 @@ static int ldap_win_bind(struct Curl_easy *data, LDAP *server,
|
|||
curlx_unicodefree(inuser);
|
||||
curlx_unicodefree(inpass);
|
||||
}
|
||||
#if defined(USE_WINDOWS_SSPI)
|
||||
#ifdef USE_WINDOWS_SSPI
|
||||
else {
|
||||
rc = (int)ldap_win_bind_auth(server, user, passwd, data->set.httpauth);
|
||||
}
|
||||
|
|
@ -300,9 +300,9 @@ static int ldap_win_bind(struct Curl_easy *data, LDAP *server,
|
|||
|
||||
return rc;
|
||||
}
|
||||
#endif /* #if defined(USE_WIN32_LDAP) */
|
||||
#endif /* USE_WIN32_LDAP */
|
||||
|
||||
#if defined(USE_WIN32_LDAP)
|
||||
#ifdef USE_WIN32_LDAP
|
||||
#define FREE_ON_WINLDAP(x) curlx_unicodefree(x)
|
||||
#define curl_ldap_num_t ULONG
|
||||
#else
|
||||
|
|
@ -328,7 +328,7 @@ static CURLcode ldap_do(struct Curl_easy *data, bool *done)
|
|||
#ifdef LDAP_OPT_NETWORK_TIMEOUT
|
||||
struct timeval ldap_timeout = {10, 0}; /* 10 sec connection/search timeout */
|
||||
#endif
|
||||
#if defined(USE_WIN32_LDAP)
|
||||
#ifdef USE_WIN32_LDAP
|
||||
TCHAR *host = NULL;
|
||||
#else
|
||||
char *host = NULL;
|
||||
|
|
@ -358,7 +358,7 @@ static CURLcode ldap_do(struct Curl_easy *data, bool *done)
|
|||
infof(data, "LDAP local: trying to establish %s connection",
|
||||
ldap_ssl ? "encrypted" : "cleartext");
|
||||
|
||||
#if defined(USE_WIN32_LDAP)
|
||||
#ifdef USE_WIN32_LDAP
|
||||
host = curlx_convert_UTF8_to_tchar(conn->host.name);
|
||||
if(!host) {
|
||||
result = CURLE_OUT_OF_MEMORY;
|
||||
|
|
@ -516,7 +516,7 @@ static CURLcode ldap_do(struct Curl_easy *data, bool *done)
|
|||
entryIterator;
|
||||
entryIterator = ldap_next_entry(server, entryIterator), num++) {
|
||||
BerElement *ber = NULL;
|
||||
#if defined(USE_WIN32_LDAP)
|
||||
#ifdef USE_WIN32_LDAP
|
||||
TCHAR *attribute;
|
||||
#else
|
||||
char *attribute;
|
||||
|
|
@ -527,7 +527,7 @@ static CURLcode ldap_do(struct Curl_easy *data, bool *done)
|
|||
{
|
||||
char *name;
|
||||
size_t name_len;
|
||||
#if defined(USE_WIN32_LDAP)
|
||||
#ifdef USE_WIN32_LDAP
|
||||
TCHAR *dn = ldap_get_dn(server, entryIterator);
|
||||
name = curlx_convert_tchar_to_UTF8(dn);
|
||||
if(!name) {
|
||||
|
|
@ -574,7 +574,7 @@ static CURLcode ldap_do(struct Curl_easy *data, bool *done)
|
|||
attribute = ldap_next_attribute(server, entryIterator, ber)) {
|
||||
BerValue **vals;
|
||||
size_t attr_len;
|
||||
#if defined(USE_WIN32_LDAP)
|
||||
#ifdef USE_WIN32_LDAP
|
||||
char *attr = curlx_convert_tchar_to_UTF8(attribute);
|
||||
if(!attr) {
|
||||
if(ber)
|
||||
|
|
@ -837,7 +837,7 @@ static int _ldap_url_parse2(struct Curl_easy *data,
|
|||
goto quit;
|
||||
}
|
||||
|
||||
#if defined(USE_WIN32_LDAP)
|
||||
#ifdef USE_WIN32_LDAP
|
||||
/* Convert the unescaped string to a tchar */
|
||||
ludp->lud_dn = curlx_convert_UTF8_to_tchar(unescaped);
|
||||
|
||||
|
|
@ -868,7 +868,7 @@ static int _ldap_url_parse2(struct Curl_easy *data,
|
|||
const char *atp = p;
|
||||
|
||||
/* Allocate our array (+1 for the NULL entry) */
|
||||
#if defined(USE_WIN32_LDAP)
|
||||
#ifdef USE_WIN32_LDAP
|
||||
ludp->lud_attrs = calloc(count + 1, sizeof(TCHAR *));
|
||||
#else
|
||||
ludp->lud_attrs = calloc(count + 1, sizeof(char *));
|
||||
|
|
@ -896,7 +896,7 @@ static int _ldap_url_parse2(struct Curl_easy *data,
|
|||
goto quit;
|
||||
}
|
||||
|
||||
#if defined(USE_WIN32_LDAP)
|
||||
#ifdef USE_WIN32_LDAP
|
||||
/* Convert the unescaped string to a tchar */
|
||||
ludp->lud_attrs[i] = curlx_convert_UTF8_to_tchar(unescaped);
|
||||
|
||||
|
|
@ -960,7 +960,7 @@ static int _ldap_url_parse2(struct Curl_easy *data,
|
|||
goto quit;
|
||||
}
|
||||
|
||||
#if defined(USE_WIN32_LDAP)
|
||||
#ifdef USE_WIN32_LDAP
|
||||
/* Convert the unescaped string to a tchar */
|
||||
ludp->lud_filter = curlx_convert_UTF8_to_tchar(unescaped);
|
||||
|
||||
|
|
@ -1016,7 +1016,7 @@ static void _ldap_free_urldesc(LDAPURLDesc *ludp)
|
|||
if(!ludp)
|
||||
return;
|
||||
|
||||
#if defined(USE_WIN32_LDAP)
|
||||
#ifdef USE_WIN32_LDAP
|
||||
curlx_unicodefree(ludp->lud_dn);
|
||||
curlx_unicodefree(ludp->lud_filter);
|
||||
#else
|
||||
|
|
@ -1027,7 +1027,7 @@ static void _ldap_free_urldesc(LDAPURLDesc *ludp)
|
|||
if(ludp->lud_attrs) {
|
||||
size_t i;
|
||||
for(i = 0; i < ludp->lud_attrs_dups; i++) {
|
||||
#if defined(USE_WIN32_LDAP)
|
||||
#ifdef USE_WIN32_LDAP
|
||||
curlx_unicodefree(ludp->lud_attrs[i]);
|
||||
#else
|
||||
free(ludp->lud_attrs[i]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue