diff options
author | George Hazan <george.hazan@gmail.com> | 2012-07-02 22:30:27 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-07-02 22:30:27 +0000 |
commit | 980bcaff693a86971750d6e9ffc8ba1e561b8b3a (patch) | |
tree | d8a422e9ccd2357d6e28368447bee8cfcd26123a /src/modules/netlib/netlibhttp.cpp | |
parent | 990f961261d92fccadb16b495171bb619c0183f0 (diff) |
the core without manual critical sections' control
git-svn-id: http://svn.miranda-ng.org/main/trunk@730 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/netlib/netlibhttp.cpp')
-rw-r--r-- | src/modules/netlib/netlibhttp.cpp | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/src/modules/netlib/netlibhttp.cpp b/src/modules/netlib/netlibhttp.cpp index 520f371917..7296b339bd 100644 --- a/src/modules/netlib/netlibhttp.cpp +++ b/src/modules/netlib/netlibhttp.cpp @@ -264,19 +264,16 @@ struct HttpSecurityContext char* szAuthHdr = NULL;
bool justCreated = false;
- if (m_hNtlmSecurity)
- {
+ if (m_hNtlmSecurity) {
bool newAuth = !m_szProvider || !szProvider || _stricmp(m_szProvider, szProvider);
newAuth = newAuth || (m_szHost != szHost && ( !m_szHost || !szHost || _stricmp(m_szHost, szHost)));
if (newAuth)
Destroy();
}
- if (m_hNtlmSecurity == NULL)
- {
+ if (m_hNtlmSecurity == NULL) {
char szSpnStr[256] = "";
- if (szHost && _stricmp(szProvider, "Basic"))
- {
+ if (szHost && _stricmp(szProvider, "Basic")) {
unsigned long ip = inet_addr(szHost);
PHOSTENT host = (ip == INADDR_NONE) ? gethostbyname(szHost) : gethostbyaddr((char*)&ip, 4, AF_INET);
mir_snprintf(szSpnStr, SIZEOF(szSpnStr), "HTTP/%s", host && host->h_name ? host->h_name : szHost);
@@ -284,31 +281,26 @@ struct HttpSecurityContext NetlibLogf(nlc->nlu, "Host SPN: %s", szSpnStr);
}
m_hNtlmSecurity = NetlibInitSecurityProvider(szProvider, szSpnStr[0] ? szSpnStr : NULL);
- if (m_hNtlmSecurity)
- {
+ if (m_hNtlmSecurity) {
m_szProvider = mir_strdup(szProvider);
m_szHost = mir_strdup(szHost);
justCreated = true;
}
}
- if (m_hNtlmSecurity)
- {
+ if (m_hNtlmSecurity) {
TCHAR *szLogin = NULL, *szPassw = NULL;
- if (nlc->nlu->settings.useProxyAuth)
- {
- EnterCriticalSection(&csNetlibUser);
+ if (nlc->nlu->settings.useProxyAuth) {
+ mir_cslock lck(csNetlibUser);
szLogin = mir_a2t(nlc->nlu->settings.szProxyAuthUser);
szPassw = mir_a2t(nlc->nlu->settings.szProxyAuthPassword);
- LeaveCriticalSection(&csNetlibUser);
}
szAuthHdr = NtlmCreateResponseFromChallenge(m_hNtlmSecurity,
szChallenge, szLogin, szPassw, true, complete);
- if ( !szAuthHdr)
- {
+ if ( !szAuthHdr) {
NetlibLogf(NULL, "Security login %s failed, user: " TCHAR_STR_PARAM " pssw: " TCHAR_STR_PARAM,
szProvider, szLogin ? szLogin : _T("(no user)"), szPassw ? _T("(exist)") : _T("(no psw)"));
}
@@ -318,8 +310,7 @@ struct HttpSecurityContext mir_free(szLogin);
mir_free(szPassw);
}
- else
- complete = 1;
+ else complete = 1;
return szAuthHdr;
}
|