diff options
author | Steve Holme <steve_holme@hotmail.com> | 2019-05-15 16:10:56 +0100 |
---|---|---|
committer | Steve Holme <steve_holme@hotmail.com> | 2019-05-16 00:03:30 +0100 |
commit | fe20826b580aa221f8f796cba236d08dc0fd80fd (patch) | |
tree | 6ed2951863f6f44b8b99f91dfa2bc7098304f90d /lib/curl_ntlm_wb.c | |
parent | ab4616f8cb4b2a736170ad70c03b6ab7347e63fe (diff) | |
download | curl-fe20826b580aa221f8f796cba236d08dc0fd80fd.tar.gz |
http_ntlm_wb: Move the type-2 message processing into a dedicated function
This brings the code inline with the other HTTP authentication mechanisms.
Closes #3890
Diffstat (limited to 'lib/curl_ntlm_wb.c')
-rw-r--r-- | lib/curl_ntlm_wb.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/curl_ntlm_wb.c b/lib/curl_ntlm_wb.c index 865f1396b..2400ff091 100644 --- a/lib/curl_ntlm_wb.c +++ b/lib/curl_ntlm_wb.c @@ -53,6 +53,8 @@ #include "url.h" #include "strerror.h" #include "strdup.h" +#include "strcase.h" + /* The last 3 #include files should be in this order */ #include "curl_printf.h" #include "curl_memory.h" @@ -333,6 +335,30 @@ done: return CURLE_REMOTE_ACCESS_DENIED; } +CURLcode Curl_input_ntlm_wb(struct connectdata *conn, + bool proxy, + const char *header) +{ + (void) proxy; + + if(!checkprefix("NTLM", header)) + return CURLE_BAD_CONTENT_ENCODING; + + header += strlen("NTLM"); + while(*header && ISSPACE(*header)) + header++; + + if(*header) { + conn->challenge_header = strdup(header); + if(!conn->challenge_header) + return CURLE_OUT_OF_MEMORY; + } + else + return CURLE_BAD_CONTENT_ENCODING; + + return CURLE_OK; +} + /* * This is for creating ntlm header output by delegating challenge/response * to Samba's winbind daemon helper ntlm_auth. |