aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/curl_ntlm.c7
-rw-r--r--lib/curl_ntlm_msgs.c14
-rw-r--r--lib/curl_ntlm_msgs.h6
3 files changed, 17 insertions, 10 deletions
diff --git a/lib/curl_ntlm.c b/lib/curl_ntlm.c
index 0e492d707..c7d67a0de 100644
--- a/lib/curl_ntlm.c
+++ b/lib/curl_ntlm.c
@@ -114,6 +114,7 @@ CURLcode Curl_output_ntlm(struct connectdata *conn,
bool proxy)
{
char *base64 = NULL;
+ size_t len = 0;
CURLcode error;
/* point to the address of the pointer that holds the string to send to the
@@ -172,7 +173,9 @@ CURLcode Curl_output_ntlm(struct connectdata *conn,
case NTLMSTATE_TYPE1:
default: /* for the weird cases we (re)start here */
/* Create a type-1 message */
- error = Curl_ntlm_create_type1_message(userp, passwdp, ntlm, &base64);
+ error = Curl_ntlm_create_type1_message(userp, passwdp, ntlm, &base64,
+ &len);
+
if(error)
return error;
@@ -189,7 +192,7 @@ CURLcode Curl_output_ntlm(struct connectdata *conn,
case NTLMSTATE_TYPE2:
/* We already received the type-2 message, create a type-3 message */
error = Curl_ntlm_create_type3_message(conn->data, userp, passwdp,
- ntlm, &base64);
+ ntlm, &base64, &len);
if(error)
return error;
diff --git a/lib/curl_ntlm_msgs.c b/lib/curl_ntlm_msgs.c
index c67fdb2cf..23dbb7e18 100644
--- a/lib/curl_ntlm_msgs.c
+++ b/lib/curl_ntlm_msgs.c
@@ -354,13 +354,15 @@ static void unicodecpy(unsigned char *dest,
* ntlm [in/out] - The ntlm data struct being used and modified.
* outptr [in/out] - The adress 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_ntlm_create_type1_message(const char *userp,
const char *passwdp,
struct ntlmdata *ntlm,
- char **outptr)
+ char **outptr,
+ size_t *outlen)
{
/* NTLM type-1 message structure:
@@ -377,7 +379,6 @@ CURLcode Curl_ntlm_create_type1_message(const char *userp,
*/
unsigned char ntlmbuf[NTLM_BUFSIZE];
- size_t base64_sz = 0;
size_t size;
#ifdef USE_WINDOWS_SSPI
@@ -556,7 +557,7 @@ CURLcode Curl_ntlm_create_type1_message(const char *userp,
});
/* Return with binary blob encoded into base64 */
- return Curl_base64_encode(NULL, (char *)ntlmbuf, size, outptr, &base64_sz);
+ return Curl_base64_encode(NULL, (char *)ntlmbuf, size, outptr, outlen);
}
/*
@@ -574,6 +575,7 @@ CURLcode Curl_ntlm_create_type1_message(const char *userp,
* ntlm [in/out] - The ntlm data struct being used and modified.
* outptr [in/out] - The adress 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.
*/
@@ -581,7 +583,8 @@ CURLcode Curl_ntlm_create_type3_message(struct SessionHandle *data,
const char *userp,
const char *passwdp,
struct ntlmdata *ntlm,
- char **outptr)
+ char **outptr,
+ size_t *outlen)
{
/* NTLM type-3 message structure:
@@ -602,7 +605,6 @@ CURLcode Curl_ntlm_create_type3_message(struct SessionHandle *data,
*/
unsigned char ntlmbuf[NTLM_BUFSIZE];
- size_t base64_sz = 0;
size_t size;
#ifdef USE_WINDOWS_SSPI
@@ -950,7 +952,7 @@ CURLcode Curl_ntlm_create_type3_message(struct SessionHandle *data,
#endif
/* Return with binary blob encoded into base64 */
- return Curl_base64_encode(NULL, (char *)ntlmbuf, size, outptr, &base64_sz);
+ return Curl_base64_encode(NULL, (char *)ntlmbuf, size, outptr, outlen);
}
#endif /* USE_NTLM */
diff --git a/lib/curl_ntlm_msgs.h b/lib/curl_ntlm_msgs.h
index 1d4549558..6b6ea2a71 100644
--- a/lib/curl_ntlm_msgs.h
+++ b/lib/curl_ntlm_msgs.h
@@ -30,14 +30,16 @@
CURLcode Curl_ntlm_create_type1_message(const char *userp,
const char *passwdp,
struct ntlmdata *ntlm,
- char **outptr);
+ char **outptr,
+ size_t *outlen);
/* This is to generate a base64 encoded NTLM type-3 message */
CURLcode Curl_ntlm_create_type3_message(struct SessionHandle *data,
const char *userp,
const char *passwdp,
struct ntlmdata *ntlm,
- char **outptr);
+ char **outptr,
+ size_t *outlen);
/* This is to decode a NTLM type-2 message */
CURLcode Curl_ntlm_decode_type2_message(struct SessionHandle *data,