sasl: Added initial stub functions for SSPI DIGEST-MD support
authorSteve Holme <steve_holme@hotmail.com>
Wed, 2 Apr 2014 20:21:12 +0000 (21:21 +0100)
committerSteve Holme <steve_holme@hotmail.com>
Sat, 5 Apr 2014 22:16:51 +0000 (23:16 +0100)
lib/Makefile.inc
lib/curl_sasl.c
lib/curl_sasl.h
lib/sasl_sspi.c [new file with mode: 0644]
packages/Symbian/group/libcurl.mmp

index d7828c3..79674de 100644 (file)
@@ -44,7 +44,7 @@ CSOURCES = file.c timeval.c base64.c hostip.c progress.c formdata.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 bundles.c conncache.c pipeline.c dotdot.c x509asn1.c     \
-  http2.c $(VSOURCES)
+  http2.c sasl_sspi.c $(VSOURCES)
 
 HHEADERS = 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                \
index 8d16585..842bb72 100644 (file)
@@ -263,6 +263,7 @@ CURLcode Curl_sasl_create_cram_md5_message(struct SessionHandle *data,
   return result;
 }
 
+#ifndef USE_WINDOWS_SSPI
 /*
  * sasl_decode_digest_md5_message()
  *
@@ -480,7 +481,9 @@ CURLcode Curl_sasl_create_digest_md5_message(struct SessionHandle *data,
 
   return result;
 }
-#endif
+#endif  /* USE_WINDOWS_SSPI */
+
+#endif  /* CURL_DISABLE_CRYPTO_AUTH */
 
 #ifdef USE_NTLM
 /*
index 25ebfe8..6d15c70 100644 (file)
@@ -76,6 +76,14 @@ CURLcode Curl_sasl_create_cram_md5_message(struct SessionHandle *data,
                                            const char *user,
                                            const char *passwdp,
                                            char **outptr, size_t *outlen);
+#endif
+
+#if !defined(CURL_DISABLE_CRYPTO_AUTH) || defined(USE_WINDOWS_SSPI)
+/* This is used to decode a base64 encoded DIGEST-MD5 challange message */
+CURLcode Curl_sasl_decode_digest_md5_message(const char *chlg64,
+                                             char *nonce, size_t nlen,
+                                             char *realm, size_t rlen,
+                                             char *alg, size_t alen);
 
 /* This is used to generate a base64 encoded DIGEST-MD5 response message */
 CURLcode Curl_sasl_create_digest_md5_message(struct SessionHandle *data,
diff --git a/lib/sasl_sspi.c b/lib/sasl_sspi.c
new file mode 100644 (file)
index 0000000..675118e
--- /dev/null
@@ -0,0 +1,71 @@
+/***************************************************************************
+ *                                  _   _ ____  _
+ *  Project                     ___| | | |  _ \| |
+ *                             / __| | | | |_) | |
+ *                            | (__| |_| |  _ <| |___
+ *                             \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 2014, 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
+ * are also available at http://curl.haxx.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ * RFC2831 DIGEST-MD5 authentication
+ * RFC4422 Simple Authentication and Security Layer (SASL)
+ *
+ ***************************************************************************/
+
+#include "curl_setup.h"
+
+#if defined(USE_WINDOWS_SSPI)
+
+#include <curl/curl.h>
+
+/* The last #include file should be: */
+#include "memdebug.h"
+
+/*
+ * Curl_sasl_create_digest_md5_message()
+ *
+ * This is used to generate an already encoded DIGEST-MD5 response message
+ * ready for sending to the recipient.
+ *
+ * Parameters:
+ *
+ * data    [in]     - The session handle.
+ * chlg64  [in]     - Pointer to the base64 encoded challenge message.
+ * userp   [in]     - The user name.
+ * passdwp [in]     - The user's password.
+ * service [in]     - The service type such as www, smtp, pop or imap.
+ * outptr  [in/out] - The address where a pointer to newly allocated memory
+ *                    holding the result will be stored upon completion.
+ * outlen  [out]    - The length of the output message.
+ *
+ * Returns CURLE_OK on success.
+ */
+CURLcode Curl_sasl_create_digest_md5_message(struct SessionHandle *data,
+                                             const char *chlg64,
+                                             const char *userp,
+                                             const char *passwdp,
+                                             const char *service,
+                                             char **outptr, size_t *outlen)
+{
+  (void)data;
+  (void)chlg64;
+  (void)userp;
+  (void)passwdp;
+  (void)outptr;
+  (void)outlen;
+
+  return CURLE_NOT_BUILT_IN;
+}
+
+#endif /* USE_WINDOWS_SSPI */
index c61f1d5..064b5d4 100644 (file)
@@ -39,7 +39,7 @@ SOURCE \
   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/curl_schannel.c curl_multibyte.c                    \
-  vtls/curl_darwinssl.c bundles.c conncache.c
+  vtls/curl_darwinssl.c bundles.c conncache.c sasl_sspi
 
 USERINCLUDE   ../../../lib ../../../include/curl
 #ifdef ENABLE_SSL