Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ntlm: fix condition for curl_ntlm_core usage #36

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1326,7 +1326,7 @@ endif()

# NTLM support requires crypto function adaptions from various SSL libs
# TODO alternative SSL libs tests for SSP1, GNUTLS, NSS
if(NOT CURL_DISABLE_CRYPTO_AUTH AND (USE_OPENSSL OR USE_WINDOWS_SSPI OR USE_DARWINSSL OR USE_MBEDTLS OR USE_WIN32_CRYPTO))
if(NOT CURL_DISABLE_CRYPTO_AUTH AND (USE_OPENSSL OR USE_DARWINSSL OR USE_MBEDTLS OR USE_WIN32_CRYPTO))
set(use_ntlm ON)
else()
set(use_ntlm OFF)
Expand Down Expand Up @@ -1364,7 +1364,7 @@ _add_if("Kerberos" NOT CURL_DISABLE_CRYPTO_AUTH AND
(HAVE_GSSAPI OR USE_WINDOWS_SSPI))
# NTLM support requires crypto function adaptions from various SSL libs
# TODO alternative SSL libs tests for SSP1, GNUTLS, NSS
_add_if("NTLM" use_ntlm)
_add_if("NTLM" use_ntlm OR USE_WINDOWS_SSPI)
# TODO missing option (autoconf: --enable-ntlm-wb)
_add_if("NTLM_WB" use_ntlm AND NOT CURL_DISABLE_HTTP AND NTLM_WB_ENABLED)
# TODO missing option (--enable-tls-srp), depends on GNUTLS_SRP/OPENSSL_SRP
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -5059,7 +5059,7 @@ if test "x$CURL_DISABLE_IMAP" != "x1"; then
fi
if test "x$CURL_DISABLE_SMB" != "x1" \
-a "x$CURL_DISABLE_CRYPTO_AUTH" != "x1" \
-a \( "x$OPENSSL_ENABLED" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \
-a \( "x$OPENSSL_ENABLED" = "x1" \
-o "x$GNUTLS_ENABLED" = "x1" -o "x$MBEDTLS_ENABLED" = "x1" \
-o "x$NSS_ENABLED" = "x1" -o "x$SECURETRANSPORT_ENABLED" = "x1" \
-o "x$WOLFSSL_NTLM" = "x1" \); then
Expand Down
8 changes: 2 additions & 6 deletions lib/curl_ntlm_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#include "curl_setup.h"

#if defined(USE_NTLM)
#if defined(HAVE_NTLM_CORE)

/*
* NTLM details:
Expand Down Expand Up @@ -50,8 +50,6 @@
in NTLM type-3 messages.
*/

#if !defined(USE_WINDOWS_SSPI) || defined(USE_WIN32_CRYPTO)

#if defined(USE_OPENSSL) || defined(USE_WOLFSSL)

#ifdef USE_WOLFSSL
Expand Down Expand Up @@ -744,6 +742,4 @@ CURLcode Curl_ntlm_core_mk_lmv2_resp(unsigned char *ntlmv2hash,

#endif /* USE_NTRESPONSES */

#endif /* !USE_WINDOWS_SSPI || USE_WIN32_CRYPTO */

#endif /* USE_NTLM */
#endif /* HAVE_NTLM_CORE */
8 changes: 2 additions & 6 deletions lib/curl_ntlm_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

#include "curl_setup.h"

#if defined(USE_NTLM)
#if defined(HAVE_NTLM_CORE)

/* If NSS is the first available SSL backend (see order in curl_ntlm_core.c)
then it must be initialized to be used by NTLM. */
Expand All @@ -36,8 +36,6 @@
#define NTLM_NEEDS_NSS_INIT
#endif

#if !defined(USE_WINDOWS_SSPI) || defined(USE_WIN32_CRYPTO)

#if defined(USE_OPENSSL) || defined(USE_WOLFSSL)
#ifdef USE_WOLFSSL
# include <wolfssl/options.h>
Expand Down Expand Up @@ -102,8 +100,6 @@ CURLcode Curl_ntlm_core_mk_lmv2_resp(unsigned char *ntlmv2hash,

#endif /* USE_NTRESPONSES */

#endif /* !USE_WINDOWS_SSPI || USE_WIN32_CRYPTO */

#endif /* USE_NTLM */
#endif /* HAVE_NTLM_CORE */

#endif /* HEADER_CURL_NTLM_CORE_H */
9 changes: 6 additions & 3 deletions lib/curl_setup.h
Original file line number Diff line number Diff line change
Expand Up @@ -637,19 +637,22 @@ int netware_init(void);

/* Single point where USE_NTLM definition might be defined */
#if !defined(CURL_DISABLE_NTLM) && !defined(CURL_DISABLE_CRYPTO_AUTH)
#if defined(USE_OPENSSL) || defined(USE_WINDOWS_SSPI) || \
#if defined(USE_OPENSSL) || defined(USE_MBEDTLS) || \
defined(USE_GNUTLS) || defined(USE_NSS) || defined(USE_SECTRANSP) || \
defined(USE_OS400CRYPTO) || defined(USE_WIN32_CRYPTO) || \
defined(USE_MBEDTLS) || \
(defined(USE_WOLFSSL) && defined(HAVE_WOLFSSL_DES_ECB_ENCRYPT))

#define USE_NTLM
#define HAVE_NTLM_CORE

# if defined(USE_MBEDTLS)
/* Get definition of MBEDTLS_MD4_C */
# include <mbedtls/md4.h>
# endif

#endif

#if defined(HAVE_NTLM_CORE) || defined(USE_WINDOWS_SSPI)
#define USE_NTLM
#endif
#endif

Expand Down
8 changes: 2 additions & 6 deletions lib/smb.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,9 @@

#include "curl_setup.h"

#if !defined(CURL_DISABLE_SMB) && defined(USE_NTLM) && \
#if !defined(CURL_DISABLE_SMB) && defined(HAVE_NTLM_CORE) && \
(CURL_SIZEOF_CURL_OFF_T > 4)

#if !defined(USE_WINDOWS_SSPI) || defined(USE_WIN32_CRYPTO)

#define BUILDING_CURL_SMB_C

#ifdef HAVE_PROCESS_H
Expand Down Expand Up @@ -996,6 +994,4 @@ static CURLcode smb_parse_url_path(struct connectdata *conn)
return CURLE_OK;
}

#endif /* !USE_WINDOWS_SSPI || USE_WIN32_CRYPTO */

#endif /* CURL_DISABLE_SMB && USE_NTLM && CURL_SIZEOF_CURL_OFF_T > 4 */
#endif /* CURL_DISABLE_SMB && HAVE_NTLM_CORE && CURL_SIZEOF_CURL_OFF_T > 4 */
8 changes: 2 additions & 6 deletions lib/smb.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,16 +243,12 @@ struct smb_tree_disconnect {

#endif /* BUILDING_CURL_SMB_C */

#if !defined(CURL_DISABLE_SMB) && defined(USE_NTLM) && \
#if !defined(CURL_DISABLE_SMB) && defined(HAVE_NTLM_CORE) && \
(CURL_SIZEOF_CURL_OFF_T > 4)

#if !defined(USE_WINDOWS_SSPI) || defined(USE_WIN32_CRYPTO)

extern const struct Curl_handler Curl_handler_smb;
extern const struct Curl_handler Curl_handler_smbs;

#endif /* !USE_WINDOWS_SSPI || USE_WIN32_CRYPTO */

#endif /* CURL_DISABLE_SMB && USE_NTLM && CURL_SIZEOF_CURL_OFF_T > 4 */
#endif /* CURL_DISABLE_SMB && HAVE_NTLM_CORE && CURL_SIZEOF_CURL_OFF_T > 4 */

#endif /* HEADER_CURL_SMB_H */
5 changes: 2 additions & 3 deletions lib/url.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,8 @@ static const struct Curl_handler * const protocols[] = {
#endif
#endif

#if !defined(CURL_DISABLE_SMB) && defined(USE_NTLM) && \
(CURL_SIZEOF_CURL_OFF_T > 4) && \
(!defined(USE_WINDOWS_SSPI) || defined(USE_WIN32_CRYPTO))
#if !defined(CURL_DISABLE_SMB) && defined(HAVE_NTLM_CORE) && \
(CURL_SIZEOF_CURL_OFF_T > 4)
&Curl_handler_smb,
#ifdef USE_SSL
&Curl_handler_smbs,
Expand Down
5 changes: 2 additions & 3 deletions lib/version.c
Original file line number Diff line number Diff line change
Expand Up @@ -319,9 +319,8 @@ static const char * const protocols[] = {
#ifdef USE_SSH
"sftp",
#endif
#if !defined(CURL_DISABLE_SMB) && defined(USE_NTLM) && \
(CURL_SIZEOF_CURL_OFF_T > 4) && \
(!defined(USE_WINDOWS_SSPI) || defined(USE_WIN32_CRYPTO))
#if !defined(CURL_DISABLE_SMB) && defined(HAVE_NTLM_CORE) && \
(CURL_SIZEOF_CURL_OFF_T > 4)
"smb",
# ifdef USE_SSL
"smbs",
Expand Down