diff options
author | Steve Holme <steve_holme@hotmail.com> | 2014-04-02 21:21:12 +0100 |
---|---|---|
committer | Steve Holme <steve_holme@hotmail.com> | 2014-04-05 23:16:51 +0100 |
commit | 2c49e960922129ba971bb4ee4a1767adf54ffae1 (patch) | |
tree | 4864dfde16f8dba19b0ee3778d2362c98d69ecee | |
parent | 3a92de56362dcf39895e3781429fcc4c6877105b (diff) |
sasl: Added initial stub functions for SSPI DIGEST-MD support
-rw-r--r-- | lib/Makefile.inc | 2 | ||||
-rw-r--r-- | lib/curl_sasl.c | 5 | ||||
-rw-r--r-- | lib/curl_sasl.h | 8 | ||||
-rw-r--r-- | lib/sasl_sspi.c | 71 | ||||
-rw-r--r-- | packages/Symbian/group/libcurl.mmp | 2 |
5 files changed, 85 insertions, 3 deletions
diff --git a/lib/Makefile.inc b/lib/Makefile.inc index d7828c333..79674dec6 100644 --- a/lib/Makefile.inc +++ b/lib/Makefile.inc @@ -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 \ diff --git a/lib/curl_sasl.c b/lib/curl_sasl.c index 8d1658586..842bb727f 100644 --- a/lib/curl_sasl.c +++ b/lib/curl_sasl.c @@ -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 /* diff --git a/lib/curl_sasl.h b/lib/curl_sasl.h index 25ebfe8f2..6d15c708c 100644 --- a/lib/curl_sasl.h +++ b/lib/curl_sasl.h @@ -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 index 000000000..675118ede --- /dev/null +++ b/lib/sasl_sspi.c @@ -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 */ diff --git a/packages/Symbian/group/libcurl.mmp b/packages/Symbian/group/libcurl.mmp index c61f1d5ab..064b5d4c8 100644 --- a/packages/Symbian/group/libcurl.mmp +++ b/packages/Symbian/group/libcurl.mmp @@ -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 |