NTLM restart authentication (trivial change)

* src/http-ntlm.c (ntlm_input): Continue on NTLMSTATE_LAST,
  error on NTLMSTATE_TYPE3

The code comes from the cURL project. Thanks to Daniel Stenberg
for donating the code.

https://lists.gnu.org/archive/html/bug-wget/2018-12/msg00030.html
This commit is contained in:
André Wolski 2016-08-16 14:44:34 +02:00 committed by Tim Rühsen
parent fc65b4521a
commit 5dceb6626b

View File

@ -135,13 +135,24 @@ ntlm_input (struct ntlmdata *ntlm, const char *header)
}
else
{
if (ntlm->state >= NTLMSTATE_TYPE1)
if (ntlm->state == NTLMSTATE_LAST)
{
DEBUGP (("NTLM auth restarted.\n"));
/* no return, continue */
}
else if (ntlm->state == NTLMSTATE_TYPE3)
{
DEBUGP (("NTLM handshake rejected.\n"));
ntlm->state = NTLMSTATE_NONE;
return false;
}
else if (ntlm->state >= NTLMSTATE_TYPE1)
{
DEBUGP (("Unexpected empty NTLM message.\n"));
return false; /* this is an error */
}
DEBUGP (("Empty NTLM message, starting transaction.\n"));
DEBUGP (("Empty NTLM message, (re)starting transaction.\n"));
ntlm->state = NTLMSTATE_TYPE1; /* we should sent away a type-1 */
}