diff options
author | George Hazan <ghazan@miranda.im> | 2020-07-12 15:25:35 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2020-07-12 15:25:35 +0300 |
commit | fb46006c0aa2f5829fa80cf1cfbaa57900ff202b (patch) | |
tree | dd4ed88de3a8676c4be1e7fb88ad1ac2ef0b2f41 /protocols/JabberG/src | |
parent | 1a0788c26404b5f42b6be2919bff5be261b2f3e7 (diff) |
more correct implementation of TNtlmAuth
Diffstat (limited to 'protocols/JabberG/src')
-rw-r--r-- | protocols/JabberG/src/jabber_secur.cpp | 17 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_secur.h | 1 |
2 files changed, 10 insertions, 8 deletions
diff --git a/protocols/JabberG/src/jabber_secur.cpp b/protocols/JabberG/src/jabber_secur.cpp index c92cc4dc64..a4f21a7d77 100644 --- a/protocols/JabberG/src/jabber_secur.cpp +++ b/protocols/JabberG/src/jabber_secur.cpp @@ -51,6 +51,14 @@ TNtlmAuth::TNtlmAuth(ThreadData *info, const char *mechanism) : if ((hProvider = Netlib_InitSecurityProvider(szProvider, szSpn)) == nullptr)
return;
+ // This generates login method advertisement packet
+ if (info->conn.password[0] != 0)
+ szInitRequest = Netlib_NtlmCreateResponse(hProvider, "", Utf2T(info->conn.username), Utf2T(info->conn.password), complete);
+ else
+ szInitRequest = Netlib_NtlmCreateResponse(hProvider, "", nullptr, nullptr, complete);
+ if (szInitRequest == nullptr)
+ return;
+
bIsValid = true;
}
@@ -98,14 +106,7 @@ bool TNtlmAuth::getSpn(wchar_t* szSpn, size_t dwSpnLen) char* TNtlmAuth::getInitialRequest()
{
- if (!hProvider)
- return nullptr;
-
- // This generates login method advertisement packet
- if (info->conn.password[0] != 0)
- return Netlib_NtlmCreateResponse(hProvider, "", Utf2T(info->conn.username), Utf2T(info->conn.password), complete);
-
- return Netlib_NtlmCreateResponse(hProvider, "", nullptr, nullptr, complete);
+ return szInitRequest.detach();
}
char* TNtlmAuth::getChallenge(const char *challenge)
diff --git a/protocols/JabberG/src/jabber_secur.h b/protocols/JabberG/src/jabber_secur.h index 14ad699b70..26286b491b 100644 --- a/protocols/JabberG/src/jabber_secur.h +++ b/protocols/JabberG/src/jabber_secur.h @@ -110,6 +110,7 @@ class TNtlmAuth : public TJabberAuth typedef TJabberAuth CSuper;
HANDLE hProvider;
+ ptrA szInitRequest;
public:
TNtlmAuth(ThreadData*, const char* mechanism);
|