Commit c7fb556f authored by Yang Tse's avatar Yang Tse
Browse files

http NTLM: Further tiding up to libcurl standards

parent 5ed17de3
Loading
Loading
Loading
Loading
+53 −58
Original line number Diff line number Diff line
@@ -33,9 +33,6 @@

#define DEBUG_ME 0

#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
@@ -1127,15 +1124,15 @@ CURLcode Curl_output_ntlm(struct connectdata *conn,
      ntlm->identity.DomainLength = domlen;
      ntlm->identity.Flags = SEC_WINNT_AUTH_IDENTITY_ANSI;
    }
    else {
    else
      ntlm->p_identity = NULL;
    }

    if(s_pSecFn->AcquireCredentialsHandleA(NULL, (char *)"NTLM", SECPKG_CRED_OUTBOUND,
										   NULL, ntlm->p_identity, NULL, NULL,
										   &ntlm->handle, &tsDummy) != SEC_E_OK) {
    status = s_pSecFn->AcquireCredentialsHandleA(NULL, (char *)"NTLM",
                                                 SECPKG_CRED_OUTBOUND, NULL,
                                                 ntlm->p_identity, NULL, NULL,
                                                 &ntlm->handle, &tsDummy);
    if(status != SEC_E_OK)
      return CURLE_OUT_OF_MEMORY;
    }

    desc.ulVersion = SECBUFFER_VERSION;
    desc.cBuffers  = 1;
@@ -1154,9 +1151,9 @@ CURLcode Curl_output_ntlm(struct connectdata *conn,
                                                 &ntlm->c_handle, &desc,
                                                 &attrs, &tsDummy);

    if(status == SEC_I_COMPLETE_AND_CONTINUE || status == SEC_I_CONTINUE_NEEDED) {
    if(status == SEC_I_COMPLETE_AND_CONTINUE ||
       status == SEC_I_CONTINUE_NEEDED)
      s_pSecFn->CompleteAuthToken(&ntlm->c_handle, &desc);
    }
    else if(status != SEC_E_OK) {
      s_pSecFn->FreeCredentialsHandle(&ntlm->handle);
      return CURLE_RECV_ERROR;
@@ -1313,7 +1310,6 @@ CURLcode Curl_output_ntlm(struct connectdata *conn,
                                                  0, &ntlm->c_handle,
                                                  &type_3_desc,
                                                  &attrs, &tsDummy);

    if(status != SEC_E_OK)
      return CURLE_RECV_ERROR;

@@ -1543,8 +1539,8 @@ CURLcode Curl_output_ntlm(struct connectdata *conn,
                    0x0, 0x0,

                    LONGQUARTET(ntlm->flags));
    DEBUGASSERT(size==64);

    DEBUGASSERT(size==64);
    DEBUGASSERT(size == (size_t)lmrespoff);

    /* We append the binary hashes */
@@ -1656,10 +1652,9 @@ void Curl_http_ntlm_cleanup(struct connectdata *conn)
#ifdef USE_WINDOWS_SSPI
  ntlm_sspi_cleanup(&conn->ntlm);
  ntlm_sspi_cleanup(&conn->proxyntlm);
#else
#ifdef WINBIND_NTLM_AUTH_ENABLED
#elif defined(WINBIND_NTLM_AUTH_ENABLED)
  sso_ntlm_close(conn);
#endif
#else
  (void)conn;
#endif
}
+4 −0
Original line number Diff line number Diff line
@@ -44,7 +44,11 @@ CURLcode Curl_output_ntlm(struct connectdata *conn, bool proxy);
CURLcode Curl_output_ntlm_sso(struct connectdata *conn, bool proxy);
#endif

#ifdef USE_NTLM
void Curl_http_ntlm_cleanup(struct connectdata *conn);
#else
#define Curl_http_ntlm_cleanup(x)
#endif

/* Flag bits definitions based on http://davenport.sourceforge.net/ntlm.html */

+0 −2
Original line number Diff line number Diff line
@@ -2617,9 +2617,7 @@ CURLcode Curl_disconnect(struct connectdata *conn, bool dead_connection)
    if(has_host_ntlm || has_proxy_ntlm) {
      data->state.authproblem = FALSE;

#ifdef USE_NTLM
      Curl_http_ntlm_cleanup(conn);
#endif
    }
  }