mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
vauth: Moved the NTLM authentication code to the new vauth directory
This commit is contained in:
parent
e1dca8a117
commit
6012fa5aee
@ -22,9 +22,9 @@
|
||||
|
||||
LIB_VAUTH_CFILES = vauth/vauth.c vauth/cleartext.c vauth/cram.c \
|
||||
vauth/digest.c vauth/digest_sspi.c vauth/krb5_gssapi.c \
|
||||
vauth/krb5_sspi.c
|
||||
vauth/krb5_sspi.c vauth/ntlm.c vauth/ntlm_sspi.c
|
||||
|
||||
LIB_VAUTH_HFILES = vauth/vauth.h vauth/digest.h
|
||||
LIB_VAUTH_HFILES = vauth/vauth.h vauth/digest.h vauth/ntlm.h
|
||||
|
||||
LIB_VTLS_CFILES = vtls/openssl.c vtls/gtls.c vtls/vtls.c vtls/nss.c \
|
||||
vtls/polarssl.c vtls/polarssl_threadlock.c vtls/axtls.c \
|
||||
@ -51,9 +51,8 @@ LIB_CFILES = file.c timeval.c base64.c hostip.c progress.c formdata.c \
|
||||
openldap.c curl_gethostname.c gopher.c idn_win32.c \
|
||||
http_negotiate_sspi.c http_proxy.c non-ascii.c asyn-ares.c \
|
||||
asyn-thread.c curl_gssapi.c curl_ntlm.c curl_ntlm_wb.c \
|
||||
curl_ntlm_core.c curl_ntlm_msgs.c curl_sasl.c curl_multibyte.c \
|
||||
hostcheck.c conncache.c pipeline.c dotdot.c x509asn1.c \
|
||||
http2.c curl_sasl_sspi.c smb.c curl_endian.c curl_des.c
|
||||
curl_ntlm_core.c curl_sasl.c curl_multibyte.c hostcheck.c conncache.c \
|
||||
pipeline.c dotdot.c x509asn1.c http2.c smb.c curl_endian.c curl_des.c
|
||||
|
||||
LIB_HFILES = arpa_telnet.h netrc.h file.h timeval.h hostip.h progress.h \
|
||||
formdata.h cookie.h http.h sendf.h ftp.h url.h dict.h if2ip.h \
|
||||
@ -69,9 +68,9 @@ LIB_HFILES = arpa_telnet.h netrc.h file.h timeval.h hostip.h progress.h \
|
||||
rtsp.h curl_threads.h warnless.h curl_hmac.h curl_rtmp.h \
|
||||
curl_gethostname.h gopher.h http_proxy.h non-ascii.h asyn.h \
|
||||
curl_ntlm.h curl_gssapi.h curl_ntlm_wb.h curl_ntlm_core.h \
|
||||
curl_ntlm_msgs.h curl_sasl.h curl_multibyte.h hostcheck.h \
|
||||
conncache.h curl_setup_once.h multihandle.h setup-vms.h pipeline.h \
|
||||
dotdot.h x509asn1.h http2.h sigpipe.h smb.h curl_endian.h curl_des.h \
|
||||
curl_sasl.h curl_multibyte.h hostcheck.h conncache.h \
|
||||
curl_setup_once.h multihandle.h setup-vms.h pipeline.h dotdot.h \
|
||||
x509asn1.h http2.h sigpipe.h smb.h curl_endian.h curl_des.h \
|
||||
curl_printf.h
|
||||
|
||||
LIB_RCFILES = libcurl.rc
|
||||
|
@ -542,11 +542,9 @@ X_OBJS= \
|
||||
$(DIROBJ)\curl_multibyte.obj \
|
||||
$(DIROBJ)\curl_ntlm.obj \
|
||||
$(DIROBJ)\curl_ntlm_core.obj \
|
||||
$(DIROBJ)\curl_ntlm_msgs.obj \
|
||||
$(DIROBJ)\curl_ntlm_wb.obj \
|
||||
$(DIROBJ)\curl_rtmp.obj \
|
||||
$(DIROBJ)\curl_sasl.obj \
|
||||
$(DIROBJ)\curl_sasl_sspi.obj \
|
||||
$(DIROBJ)\curl_sspi.obj \
|
||||
$(DIROBJ)\curl_threads.obj \
|
||||
$(DIROBJ)\cyassl.obj \
|
||||
@ -626,6 +624,8 @@ X_OBJS= \
|
||||
$(DIROBJ)\digest_sspi.obj \
|
||||
$(DIROBJ)\krb5_gssapi.obj \
|
||||
$(DIROBJ)\krb5_sspi.obj \
|
||||
$(DIROBJ)\ntlm.obj \
|
||||
$(DIROBJ)\ntlm_sspi.obj \
|
||||
$(DIROBJ)\vtls.obj \
|
||||
$(DIROBJ)\openssl.obj \
|
||||
$(DIROBJ)\strdup.obj \
|
||||
|
@ -37,9 +37,8 @@
|
||||
#include "sendf.h"
|
||||
#include "rawstr.h"
|
||||
#include "curl_ntlm.h"
|
||||
#include "curl_ntlm_msgs.h"
|
||||
#include "curl_ntlm_wb.h"
|
||||
#include "curl_sasl.h"
|
||||
#include "vauth/vauth.h"
|
||||
#include "url.h"
|
||||
#include "curl_printf.h"
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
@ -47,7 +47,7 @@
|
||||
#include "urldata.h"
|
||||
#include "sendf.h"
|
||||
#include "select.h"
|
||||
#include "curl_ntlm_msgs.h"
|
||||
#include "vauth/ntlm.h"
|
||||
#include "curl_ntlm_wb.h"
|
||||
#include "url.h"
|
||||
#include "strerror.h"
|
||||
|
@ -70,27 +70,6 @@ const struct {
|
||||
{ ZERO_NULL, 0, 0 }
|
||||
};
|
||||
|
||||
#if defined(USE_NTLM) && !defined(USE_WINDOWS_SSPI)
|
||||
/*
|
||||
* Curl_sasl_ntlm_cleanup()
|
||||
*
|
||||
* This is used to clean up the NTLM specific data.
|
||||
*
|
||||
* Parameters:
|
||||
*
|
||||
* ntlm [in/out] - The NTLM data struct being cleaned up.
|
||||
*
|
||||
*/
|
||||
void Curl_sasl_ntlm_cleanup(struct ntlmdata *ntlm)
|
||||
{
|
||||
/* Free the target info */
|
||||
Curl_safefree(ntlm->target_info);
|
||||
|
||||
/* Reset any variables */
|
||||
ntlm->target_info_len = 0;
|
||||
}
|
||||
#endif /* USE_NTLM && !USE_WINDOWS_SSPI*/
|
||||
|
||||
/*
|
||||
* sasl_create_oauth_bearer_message()
|
||||
*
|
||||
|
@ -27,10 +27,6 @@
|
||||
struct SessionHandle;
|
||||
struct connectdata;
|
||||
|
||||
#if defined(USE_NTLM)
|
||||
struct ntlmdata;
|
||||
#endif
|
||||
|
||||
/* Authentication mechanism flags */
|
||||
#define SASL_MECH_LOGIN (1 << 0)
|
||||
#define SASL_MECH_PLAIN (1 << 1)
|
||||
@ -118,31 +114,6 @@ struct SASL {
|
||||
(wordlen == (sizeof(mech) - 1) / sizeof(char) && \
|
||||
!memcmp(line, mech, wordlen))
|
||||
|
||||
#ifdef USE_NTLM
|
||||
/* This is used to generate a base64 encoded NTLM type-1 message */
|
||||
CURLcode Curl_sasl_create_ntlm_type1_message(const char *userp,
|
||||
const char *passwdp,
|
||||
struct ntlmdata *ntlm,
|
||||
char **outptr,
|
||||
size_t *outlen);
|
||||
|
||||
/* This is used to decode a base64 encoded NTLM type-2 message */
|
||||
CURLcode Curl_sasl_decode_ntlm_type2_message(struct SessionHandle *data,
|
||||
const char *type2msg,
|
||||
struct ntlmdata *ntlm);
|
||||
|
||||
/* This is used to generate a base64 encoded NTLM type-3 message */
|
||||
CURLcode Curl_sasl_create_ntlm_type3_message(struct SessionHandle *data,
|
||||
const char *userp,
|
||||
const char *passwdp,
|
||||
struct ntlmdata *ntlm,
|
||||
char **outptr, size_t *outlen);
|
||||
|
||||
/* This is used to clean up the ntlm specific data */
|
||||
void Curl_sasl_ntlm_cleanup(struct ntlmdata *ntlm);
|
||||
|
||||
#endif /* USE_NTLM */
|
||||
|
||||
/* This is used to cleanup any libraries or curl modules used by the sasl
|
||||
functions */
|
||||
void Curl_sasl_cleanup(struct connectdata *conn, unsigned int authused);
|
||||
|
@ -49,8 +49,8 @@
|
||||
#endif
|
||||
|
||||
#define BUILDING_CURL_NTLM_MSGS_C
|
||||
#include "curl_ntlm_msgs.h"
|
||||
#include "curl_sasl.h"
|
||||
#include "vauth/vauth.h"
|
||||
#include "vauth/ntlm.h"
|
||||
#include "curl_endian.h"
|
||||
#include "curl_printf.h"
|
||||
|
||||
@ -138,7 +138,9 @@ static void ntlm_print_flags(FILE *handle, unsigned long flags)
|
||||
static void ntlm_print_hex(FILE *handle, const char *buf, size_t len)
|
||||
{
|
||||
const char *p = buf;
|
||||
|
||||
(void) handle;
|
||||
|
||||
fprintf(stderr, "0x");
|
||||
while(len-- > 0)
|
||||
fprintf(stderr, "%02.2x", (unsigned int)*p++);
|
||||
@ -818,4 +820,23 @@ CURLcode Curl_sasl_create_ntlm_type3_message(struct SessionHandle *data,
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Curl_sasl_ntlm_cleanup()
|
||||
*
|
||||
* This is used to clean up the NTLM specific data.
|
||||
*
|
||||
* Parameters:
|
||||
*
|
||||
* ntlm [in/out] - The NTLM data struct being cleaned up.
|
||||
*
|
||||
*/
|
||||
void Curl_sasl_ntlm_cleanup(struct ntlmdata *ntlm)
|
||||
{
|
||||
/* Free the target info */
|
||||
Curl_safefree(ntlm->target_info);
|
||||
|
||||
/* Reset any variables */
|
||||
ntlm->target_info_len = 0;
|
||||
}
|
||||
|
||||
#endif /* USE_NTLM && !USE_WINDOWS_SSPI */
|
@ -1,5 +1,5 @@
|
||||
#ifndef HEADER_CURL_NTLM_MSGS_H
|
||||
#define HEADER_CURL_NTLM_MSGS_H
|
||||
#ifndef HEADER_CURL_NTLM_H
|
||||
#define HEADER_CURL_NTLM_H
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
@ -7,7 +7,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
@ -140,4 +140,4 @@
|
||||
|
||||
#endif /* USE_NTLM */
|
||||
|
||||
#endif /* HEADER_CURL_NTLM_MSGS_H */
|
||||
#endif /* HEADER_CURL_NTLM_H */
|
@ -5,8 +5,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 2014 - 2016 Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 2014 - 2016, Steve Holme, <steve_holme@hotmail.com>.
|
||||
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
@ -19,35 +18,25 @@
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* RFC2617 Basic and Digest Access Authentication
|
||||
* RFC2831 DIGEST-MD5 authentication
|
||||
* RFC4422 Simple Authentication and Security Layer (SASL)
|
||||
* RFC4752 The Kerberos V5 ("GSSAPI") SASL Mechanism
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
#include "curl_setup.h"
|
||||
|
||||
#if defined(USE_WINDOWS_SSPI)
|
||||
#if defined(USE_WINDOWS_SSPI) && defined(USE_NTLM)
|
||||
|
||||
#include <curl/curl.h>
|
||||
|
||||
#include "curl_sasl.h"
|
||||
#include "vauth/vauth.h"
|
||||
#include "urldata.h"
|
||||
#include "curl_base64.h"
|
||||
#include "warnless.h"
|
||||
#include "curl_multibyte.h"
|
||||
#include "sendf.h"
|
||||
#include "strdup.h"
|
||||
#include "curl_printf.h"
|
||||
#include "rawstr.h"
|
||||
|
||||
/* The last #include files should be: */
|
||||
#include "curl_memory.h"
|
||||
#include "memdebug.h"
|
||||
|
||||
#if defined USE_NTLM
|
||||
/*
|
||||
* Curl_sasl_create_ntlm_type1_message()
|
||||
*
|
||||
@ -320,6 +309,5 @@ void Curl_sasl_ntlm_cleanup(struct ntlmdata *ntlm)
|
||||
/* Reset any variables */
|
||||
ntlm->token_max = 0;
|
||||
}
|
||||
#endif /* USE_NTLM */
|
||||
|
||||
#endif /* USE_WINDOWS_SSPI */
|
||||
#endif /* USE_WINDOWS_SSPI && USE_NTLM */
|
@ -30,6 +30,10 @@ struct SessionHandle;
|
||||
struct digestdata;
|
||||
#endif
|
||||
|
||||
#if defined(USE_NTLM)
|
||||
struct ntlmdata;
|
||||
#endif
|
||||
|
||||
#if defined(USE_KERBEROS5)
|
||||
struct kerberos5data;
|
||||
#endif
|
||||
@ -98,6 +102,30 @@ CURLcode Curl_sasl_create_digest_http_message(struct SessionHandle *data,
|
||||
void Curl_sasl_digest_cleanup(struct digestdata *digest);
|
||||
#endif /* !CURL_DISABLE_CRYPTO_AUTH */
|
||||
|
||||
#if defined(USE_NTLM)
|
||||
/* This is used to generate a base64 encoded NTLM type-1 message */
|
||||
CURLcode Curl_sasl_create_ntlm_type1_message(const char *userp,
|
||||
const char *passwdp,
|
||||
struct ntlmdata *ntlm,
|
||||
char **outptr,
|
||||
size_t *outlen);
|
||||
|
||||
/* This is used to decode a base64 encoded NTLM type-2 message */
|
||||
CURLcode Curl_sasl_decode_ntlm_type2_message(struct SessionHandle *data,
|
||||
const char *type2msg,
|
||||
struct ntlmdata *ntlm);
|
||||
|
||||
/* This is used to generate a base64 encoded NTLM type-3 message */
|
||||
CURLcode Curl_sasl_create_ntlm_type3_message(struct SessionHandle *data,
|
||||
const char *userp,
|
||||
const char *passwdp,
|
||||
struct ntlmdata *ntlm,
|
||||
char **outptr, size_t *outlen);
|
||||
|
||||
/* This is used to clean up the NTLM specific data */
|
||||
void Curl_sasl_ntlm_cleanup(struct ntlmdata *ntlm);
|
||||
#endif /* USE_NTLM */
|
||||
|
||||
#if defined(USE_KERBEROS5)
|
||||
/* This is used to generate a base64 encoded GSSAPI (Kerberos V5) user token
|
||||
message */
|
||||
|
@ -37,11 +37,12 @@ SOURCE \
|
||||
vtls/polarssl.c curl_rtmp.c openldap.c curl_gethostname.c gopher.c \
|
||||
vtls/axtls.c idn_win32.c http_negotiate_sspi.c vtls/cyassl.c \
|
||||
http_proxy.c non-ascii.c asyn-ares.c asyn-thread.c curl_gssapi.c \
|
||||
curl_ntlm.c curl_ntlm_wb.c curl_ntlm_core.c curl_ntlm_msgs.c \
|
||||
curl_sasl.c vtls/schannel.c curl_multibyte.c vtls/darwinssl.c \
|
||||
conncache.c curl_sasl_sspi.c smb.c curl_endian.c curl_des.c \
|
||||
curl_ntlm.c curl_ntlm_wb.c curl_ntlm_core.c curl_sasl.c \
|
||||
vtls/schannel.c curl_multibyte.c vtls/darwinssl.c conncache.c \
|
||||
curl_sasl_sspi.c smb.c curl_endian.c curl_des.c \
|
||||
vauth/vauth.c vauth/cleartext.c vauth/cram.c vauth/digest.c \
|
||||
vauth/digest_sspi.c vauth/krb5_gssapi.c vauth/krb5_sspi.c
|
||||
vauth/digest_sspi.c vauth/krb5_gssapi.c vauth/krb5_sspi.c \
|
||||
vauth/ntlm.c vauth/ntlm_sspi.c
|
||||
|
||||
USERINCLUDE ../../../lib ../../../include/curl
|
||||
#ifdef ENABLE_SSL
|
||||
|
Loading…
Reference in New Issue
Block a user