]> granicus.if.org Git - curl/commitdiff
vauth: Moved the NTLM authentication code to the new vauth directory
authorSteve Holme <steve_holme@hotmail.com>
Sat, 12 Sep 2015 13:50:02 +0000 (14:50 +0100)
committerSteve Holme <steve_holme@hotmail.com>
Fri, 25 Mar 2016 15:11:09 +0000 (15:11 +0000)
lib/Makefile.inc
lib/Makefile.vc6
lib/curl_ntlm.c
lib/curl_ntlm_wb.c
lib/curl_sasl.c
lib/curl_sasl.h
lib/vauth/ntlm.c [moved from lib/curl_ntlm_msgs.c with 98% similarity]
lib/vauth/ntlm.h [moved from lib/curl_ntlm_msgs.h with 97% similarity]
lib/vauth/ntlm_sspi.c [moved from lib/curl_sasl_sspi.c with 95% similarity]
lib/vauth/vauth.h
packages/Symbian/group/libcurl.mmp

index 856d914fa6a9842993f8410224fe3d215b2a2961..92cc40f015c55b7d8e08cc2d93f6a2417a72e191 100644 (file)
@@ -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
index 75f1087100964bc6930dc718b578a29875404eba..57e03929f3dba1319bb1ba843a2c50bbac7d7182 100644 (file)
@@ -542,11 +542,9 @@ X_OBJS= \
        $(DIROBJ)\curl_multibyte.obj \\r
        $(DIROBJ)\curl_ntlm.obj \\r
        $(DIROBJ)\curl_ntlm_core.obj \\r
-       $(DIROBJ)\curl_ntlm_msgs.obj \\r
        $(DIROBJ)\curl_ntlm_wb.obj \\r
        $(DIROBJ)\curl_rtmp.obj \\r
        $(DIROBJ)\curl_sasl.obj \\r
-       $(DIROBJ)\curl_sasl_sspi.obj \\r
        $(DIROBJ)\curl_sspi.obj \\r
        $(DIROBJ)\curl_threads.obj \\r
        $(DIROBJ)\cyassl.obj \\r
@@ -626,6 +624,8 @@ X_OBJS= \
        $(DIROBJ)\digest_sspi.obj \\r
        $(DIROBJ)\krb5_gssapi.obj \\r
        $(DIROBJ)\krb5_sspi.obj \\r
+       $(DIROBJ)\ntlm.obj \\r
+       $(DIROBJ)\ntlm_sspi.obj \\r
        $(DIROBJ)\vtls.obj \\r
        $(DIROBJ)\openssl.obj \\r
        $(DIROBJ)\strdup.obj \\r
index d4842e468a389d3c232ae358bc473a8ed725140d..f3fac5babfe8b2e10e885bae333f2c4f8a422f37 100644 (file)
@@ -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"
 
index 06f66702d494b2911dcaf8e7fb006a4f9d2efe04..71bc08700e90fdb58b40afe0bee9b006e85de787 100644 (file)
@@ -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"
index c57bc37a79dd319321aa3233edbfe3d0e5de6042..aabf3ecf5427b51a8543c781a5a338e8c8f55a59 100644 (file)
@@ -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()
  *
index 7fd658846610ad3c266004b89c0281c46c28a213..6535fedbc551115c01f073c34e7d76bdd2a9aeeb 100644 (file)
 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);
similarity index 98%
rename from lib/curl_ntlm_msgs.c
rename to lib/vauth/ntlm.c
index fc95472076a51b621d9e7d82060beec2a2c7f63b..aef29bdfbd0997be551efb53c9abcfe20189a1ce 100644 (file)
@@ -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;
+
+  (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 */
similarity index 97%
rename from lib/curl_ntlm_msgs.h
rename to lib/vauth/ntlm.h
index b9026f87c06f3840da456c1ae58ba6570b40691f..9a393f014eca3be80708b3165ef4b402fb5b2158 100644 (file)
@@ -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
 
 #endif /* USE_NTLM */
 
-#endif /* HEADER_CURL_NTLM_MSGS_H */
+#endif /* HEADER_CURL_NTLM_H */
similarity index 95%
rename from lib/curl_sasl_sspi.c
rename to lib/vauth/ntlm_sspi.c
index d3dde2cfe0577b2074cda360d5bdfa64fdcab9f7..3f48d50800bb25bd323e8c270d7bf90f6715bfac 100644 (file)
@@ -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
  * 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 */
index f38583a175fa4302238a39e24852bd44f7858f73..c26b9e31dca6b4da59f091280327c4d4ebdb20a7 100644 (file)
@@ -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 */
index 9cc57e05c65f07d39c4ee4a2b9a71af7a73d715c..ab628bc5337262293180ab494c281abe0aaffa72 100644 (file)
@@ -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