From a3d8488e85d66ef48f80cfe122dcb48d63eb5aa8 Mon Sep 17 00:00:00 2001 From: Stefan Becker Date: Thu, 5 Dec 2013 22:34:46 +0200 Subject: [PATCH] Fix #225: HTTP re-authentication with NTLM fails The built-in NTLM implementation didn't support re-authentication. With HTTP 1.1 keep-alive support of the new HTTP stack this has become necessary now. (cherry picked from commit 3f3dcfc3caecacec333e73efb9c850df4fec7c70) --- src/core/sip-sec-ntlm.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/core/sip-sec-ntlm.c b/src/core/sip-sec-ntlm.c index af03e00e..31ae4f06 100644 --- a/src/core/sip-sec-ntlm.c +++ b/src/core/sip-sec-ntlm.c @@ -1752,6 +1752,17 @@ sip_sec_init_sec_context__ntlm(SipSecContext context, SIPE_DEBUG_INFO_NOFORMAT("sip_sec_init_sec_context__ntlm: in use"); + /* + * If authentication was already completed, then this mean a new + * authentication handshake has started on the existing connection. + * We must throw away the old context, because we need a new one. + */ + if (context->flags & SIP_SEC_FLAG_COMMON_READY) { + SIPE_DEBUG_INFO_NOFORMAT("sip_sec_init_sec_context__ntlm: dropping old context"); + context->flags &= ~SIP_SEC_FLAG_COMMON_READY; + context->flags |= SIP_SEC_FLAG_NTLM_INITIAL; + } + if (context->flags & SIP_SEC_FLAG_NTLM_INITIAL) { context->flags &= ~SIP_SEC_FLAG_NTLM_INITIAL; -- 2.11.4.GIT