Debian Codegraph @

winpr/libwinpr/sspi/NTLM/ntlm.c

raw symbols SCIP
1 /**
2 * WinPR: Windows Portable Runtime
3 * NTLM Security Package
4 *
5 * Copyright 2011-2014 Marc-Andre Moreau <[email protected]>
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 */
19
20 #include <winpr/config.h>cxx . . $ `<file>/build/winpr/include/winpr/config.h`/
21
22 #include <winpr/crt.h>cxx . . $ `<file>/winpr/include/winpr/crt.h`/
23 #include <winpr/assert.h>cxx . . $ `<file>/winpr/include/winpr/assert.h`/
24 #include <winpr/sspi.h>cxx . . $ `<file>/winpr/include/winpr/sspi.h`/
25 #include <winpr/print.h>cxx . . $ `<file>/winpr/include/winpr/print.h`/
26 #include <winpr/string.h>cxx . . $ `<file>/winpr/include/winpr/string.h`/
27 #include <winpr/tchar.h>cxx . . $ `<file>/winpr/include/winpr/tchar.h`/
28 #include <winpr/sysinfo.h>cxx . . $ `<file>/winpr/include/winpr/sysinfo.h`/
29 #include <winpr/registry.h>cxx . . $ `<file>/winpr/include/winpr/registry.h`/
30 #include <winpr/endian.h>cxx . . $ `<file>/winpr/include/winpr/endian.h`/
31 #include <winpr/build-config.h>cxx . . $ `<file>/build/winpr/include/winpr/build-config.h`/
32
33 #include "ntlm.h"cxx . . $ `<file>/winpr/libwinpr/sspi/NTLM/ntlm.h`/
34 #include "ntlm_export.h"cxx . . $ `<file>/winpr/libwinpr/sspi/NTLM/ntlm_export.h`/
35 #include "../sspi.h"cxx . . $ `<file>/winpr/libwinpr/sspi/sspi.h`/
36
37 #include "ntlm_message.h"cxx . . $ `<file>/winpr/libwinpr/sspi/NTLM/ntlm_message.h`/
38
39 #include "../../utils.h"cxx . . $ `<file>/winpr/libwinpr/utils.h`/
40
41 #include "../../log.h"cxx . . $ `<file>/winpr/libwinpr/log.h`/
42 #define TAGcxx . . $ `winpr/libwinpr/sspi/NTLM/ntlm.c:42:9`! WINPR_TAGcxx . . $ `winpr/libwinpr/log.h:25:9`!("sspi.NTLM")
43
44 #ifndef MIN
45 #define MINcxx . . $ `winpr/libwinpr/sspi/NTLM/ntlm.c:45:9`!(a, b) ((a) < (b)) ? (a) : (b)
46 #endif
47
48 #define WINPR_KEYcxx . . $ `winpr/libwinpr/sspi/NTLM/ntlm.c:48:9`! "Software\\%s\\WinPR\\NTLM"
49
50 #define check_contextcxx . . $ `winpr/libwinpr/sspi/NTLM/ntlm.c:50:9`!(ctx) check_context_((ctx), __FILE__, __func__, __LINE__)
51
52 WINPR_ATTR_NODISCARDcxx . . $ `winpr/include/winpr/platform.h:105:9`!
53 static BOOLcxx . . $ BOOL# check_context_cxx . . $ check_context_(4ebff9b4cead9806).(NTLM_CONTEXTcxx . . $ NTLM_CONTEXT#* context, const char* file, const char* fkt, size_t line)
54 {
55 BOOLcxx . . $ BOOL# rc = TRUEcxx . . $ `winpr/include/winpr/wtypes.h:126:9`!;
56 wLogcxx . . $ wLog#* log = WLog_Getcxx . . $ WLog_Get(1d389f31f69e7580).(TAGcxx . . $ `winpr/libwinpr/sspi/NTLM/ntlm.c:42:9`!);
57 const DWORDcxx . . $ DWORD# log_level = WLOG_ERRORcxx . . $ WLOG_ERROR.;
58
59 if (!context)
60 {
61 if (WLog_IsLevelActivecxx . . $ WLog_IsLevelActive(be4366e4f452978f).(log, log_level))
62 WLog_PrintTextMessagecxx . . $ WLog_PrintTextMessage(bdb23a390b9334b2).(log, log_level, line, file, fkt, "invalid context");
63
64 return FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!;
65 }
66
67 if (!context->RecvRc4Sealcxx . . $ $anonymous_type_544b217a83a6fa2a_13#RecvRc4Seal.)
68 {
69 if (WLog_IsLevelActivecxx . . $ WLog_IsLevelActive(be4366e4f452978f).(log, log_level))
70 WLog_PrintTextMessagecxx . . $ WLog_PrintTextMessage(bdb23a390b9334b2).(log, log_level, line, file, fkt, "invalid context->RecvRc4Seal");
71 rc = FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!;
72 }
73 if (!context->SendRc4Sealcxx . . $ $anonymous_type_544b217a83a6fa2a_13#SendRc4Seal.)
74 {
75 if (WLog_IsLevelActivecxx . . $ WLog_IsLevelActive(be4366e4f452978f).(log, log_level))
76 WLog_PrintTextMessagecxx . . $ WLog_PrintTextMessage(bdb23a390b9334b2).(log, log_level, line, file, fkt, "invalid context->SendRc4Seal");
77 rc = FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!;
78 }
79
80 if (!context->SendSigningKeycxx . . $ $anonymous_type_544b217a83a6fa2a_13#SendSigningKey.)
81 {
82 if (WLog_IsLevelActivecxx . . $ WLog_IsLevelActive(be4366e4f452978f).(log, log_level))
83 WLog_PrintTextMessagecxx . . $ WLog_PrintTextMessage(bdb23a390b9334b2).(log, log_level, line, file, fkt,
84 "invalid context->SendSigningKey");
85 rc = FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!;
86 }
87 if (!context->RecvSigningKeycxx . . $ $anonymous_type_544b217a83a6fa2a_13#RecvSigningKey.)
88 {
89 if (WLog_IsLevelActivecxx . . $ WLog_IsLevelActive(be4366e4f452978f).(log, log_level))
90 WLog_PrintTextMessagecxx . . $ WLog_PrintTextMessage(bdb23a390b9334b2).(log, log_level, line, file, fkt,
91 "invalid context->RecvSigningKey");
92 rc = FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!;
93 }
94 if (!context->SendSealingKeycxx . . $ $anonymous_type_544b217a83a6fa2a_13#SendSealingKey.)
95 {
96 if (WLog_IsLevelActivecxx . . $ WLog_IsLevelActive(be4366e4f452978f).(log, log_level))
97 WLog_PrintTextMessagecxx . . $ WLog_PrintTextMessage(bdb23a390b9334b2).(log, log_level, line, file, fkt,
98 "invalid context->SendSealingKey");
99 rc = FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!;
100 }
101 if (!context->RecvSealingKeycxx . . $ $anonymous_type_544b217a83a6fa2a_13#RecvSealingKey.)
102 {
103 if (WLog_IsLevelActivecxx . . $ WLog_IsLevelActive(be4366e4f452978f).(log, log_level))
104 WLog_PrintTextMessagecxx . . $ WLog_PrintTextMessage(bdb23a390b9334b2).(log, log_level, line, file, fkt,
105 "invalid context->RecvSealingKey");
106 rc = FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!;
107 }
108 return rc;
109 }
110
111 WINPR_ATTR_MALLOCcxx . . $ `winpr/include/winpr/platform.h:629:9`!(free, 1)
112 static char* get_computer_namecxx . . $ get_computer_name(9268f230ec858ba3).(COMPUTER_NAME_FORMATcxx . . $ COMPUTER_NAME_FORMAT# type, size_t* pSize)
113 {
114 DWORDcxx . . $ DWORD# nSize = 0;
115
116 if (pSize)
117 *pSize = 0;
118
119 if (GetComputerNameExAcxx . . $ GetComputerNameExA(776c0fc1add78e59).(type, nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, &nSize))
120 return nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
121
122 if (GetLastErrorcxx . . $ GetLastError(db52760e79bf9054).() != ERROR_MORE_DATAcxx . . $ `winpr/include/winpr/error.h:367:9`!)
123 return nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
124
125 char* computerName = calloccxx . . $ calloc(63a7bf2941bfcd7a).(1, nSize);
126
127 if (!computerName)
128 return nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
129
130 if (!GetComputerNameExAcxx . . $ GetComputerNameExA(776c0fc1add78e59).(type, computerName, &nSize))
131 {
132 freecxx . . $ free(5d22bdacc48458e8).(computerName);
133 return nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
134 }
135
136 if (pSize)
137 *pSize = nSize;
138 return computerName;
139 }
140
141 WINPR_ATTR_NODISCARDcxx . . $ `winpr/include/winpr/platform.h:105:9`!
142 SECURITY_STATUScxx . . $ SECURITY_STATUS# ntlm_SetContextWorkstationXcxx . . $ ntlm_SetContextWorkstationX(53d898e19d77926c).(NTLM_CONTEXTcxx . . $ NTLM_CONTEXT#* context, BOOLcxx . . $ BOOL# unicode, const void* data,
143 size_t length)
144 {
145 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(context);
146 ntlm_free_unicode_stringcxx . . $ ntlm_free_unicode_string(e80ef3157579d559).(&context->Workstationcxx . . $ $anonymous_type_544b217a83a6fa2a_13#Workstation.);
147
148 if (length == 0)
149 return SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!;
150
151 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(data);
152 if (unicode)
153 context->Workstationcxx . . $ $anonymous_type_544b217a83a6fa2a_13#Workstation. = ntlm_from_unicode_string_wcxx . . $ ntlm_from_unicode_string_w(b33fe2b328e22617).(data, length / sizeof(WCHARcxx . . $ WCHAR#));
154 else
155 context->Workstationcxx . . $ $anonymous_type_544b217a83a6fa2a_13#Workstation. = ntlm_from_unicode_string_utf8cxx . . $ ntlm_from_unicode_string_utf8(3cc85ee38b462723).(data, length);
156
157 if (ntlm_is_unicode_string_emptycxx . . $ ntlm_is_unicode_string_empty(8bceef4d9b3378cb).(&context->Workstationcxx . . $ $anonymous_type_544b217a83a6fa2a_13#Workstation.))
158 return SEC_E_INSUFFICIENT_MEMORYcxx . . $ `winpr/include/winpr/sspi.h:134:9`!;
159
160 return SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!;
161 }
162
163 WINPR_ATTR_NODISCARDcxx . . $ `winpr/include/winpr/platform.h:105:9`!
164 static int ntlm_SetContextWorkstationcxx . . $ ntlm_SetContextWorkstation(c121db612af4db9d).(NTLM_CONTEXTcxx . . $ NTLM_CONTEXT#* context, const char* Workstation)
165 {
166 const char* ws = Workstation;
167 CHARcxx . . $ CHAR#* computerName = nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
168
169 if (!Workstation)
170 {
171 computerName = get_computer_namecxx . . $ get_computer_name(9268f230ec858ba3).(ComputerNameNetBIOScxx . . $ ComputerNameNetBIOS., nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!);
172 if (!computerName)
173 return -1;
174 ws = computerName;
175 }
176
177 const size_t len = strlencxx . . $ strlen(751346f8406fd082).(ws);
178 const SECURITY_STATUScxx . . $ SECURITY_STATUS# status = ntlm_SetContextWorkstationXcxx . . $ ntlm_SetContextWorkstationX(53d898e19d77926c).(context, FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!, ws, len);
179 freecxx . . $ free(5d22bdacc48458e8).(computerName);
180
181 return (status == SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!) ? 1 : -1;
182 }
183
184 WINPR_ATTR_NODISCARDcxx . . $ `winpr/include/winpr/platform.h:105:9`!
185 static int ntlm_SetContextServicePrincipalNameWcxx . . $ ntlm_SetContextServicePrincipalNameW(d3fd8b0509953e92).(NTLM_CONTEXTcxx . . $ NTLM_CONTEXT#* context, LPWSTRcxx . . $ LPWSTR# ServicePrincipalName)
186 {
187 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(context);
188
189 ntlm_free_unicode_stringcxx . . $ ntlm_free_unicode_string(e80ef3157579d559).(&context->ServicePrincipalNamecxx . . $ $anonymous_type_544b217a83a6fa2a_13#ServicePrincipalName.);
190 if (!ServicePrincipalName)
191 return 1;
192
193 const size_t len = _wcslencxx . . $ _wcslen(6fce5c29061b60f9).(ServicePrincipalName);
194 context->ServicePrincipalNamecxx . . $ $anonymous_type_544b217a83a6fa2a_13#ServicePrincipalName. = ntlm_from_unicode_string_wcxx . . $ ntlm_from_unicode_string_w(b33fe2b328e22617).(ServicePrincipalName, len);
195 if (ntlm_is_unicode_string_emptycxx . . $ ntlm_is_unicode_string_empty(8bceef4d9b3378cb).(&context->ServicePrincipalNamecxx . . $ $anonymous_type_544b217a83a6fa2a_13#ServicePrincipalName.))
196 return -1;
197
198 return 1;
199 }
200
201 WINPR_ATTR_NODISCARDcxx . . $ `winpr/include/winpr/platform.h:105:9`!
202 static int ntlm_SetContextTargetNamecxx . . $ ntlm_SetContextTargetName(1e39fd0ea8364f9d).(NTLM_CONTEXTcxx . . $ NTLM_CONTEXT#* context, char* TargetName)
203 {
204 char* name = TargetName;
205 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(context);
206
207 if (!name)
208 {
209 size_t nSize = 0;
210 char* computerName = get_computer_namecxx . . $ get_computer_name(9268f230ec858ba3).(ComputerNameNetBIOScxx . . $ ComputerNameNetBIOS., &nSize);
211
212 if (!computerName)
213 return -1;
214
215 if (nSize > MAX_COMPUTERNAME_LENGTHcxx . . $ `winpr/include/winpr/sysinfo.h:323:9`!)
216 computerName[MAX_COMPUTERNAME_LENGTHcxx . . $ `winpr/include/winpr/sysinfo.h:323:9`!] = '\0';
217
218 name = computerName;
219
220 if (!name)
221 return -1;
222
223 CharUpperAcxx . . $ CharUpperA(7a9722d75b371431).(name);
224 }
225
226 size_t len = 0;
227 sspi_SecBufferFreecxx . . $ sspi_SecBufferFree(32b3ea3b65e8fed4).(&context->TargetNamecxx . . $ $anonymous_type_544b217a83a6fa2a_13#TargetName.);
228 context->TargetNamecxx . . $ $anonymous_type_544b217a83a6fa2a_13#TargetName..pvBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#pvBuffer. = ConvertUtf8ToWCharAlloccxx . . $ ConvertUtf8ToWCharAlloc(ead477a53cde6f56).(name, &len);
229
230 if (!context->TargetNamecxx . . $ $anonymous_type_544b217a83a6fa2a_13#TargetName..pvBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#pvBuffer. || (len > UINT16_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:123:10`! / sizeof(WCHARcxx . . $ WCHAR#)))
231 {
232 freecxx . . $ free(5d22bdacc48458e8).(context->TargetNamecxx . . $ $anonymous_type_544b217a83a6fa2a_13#TargetName..pvBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#pvBuffer.);
233 context->TargetNamecxx . . $ $anonymous_type_544b217a83a6fa2a_13#TargetName..pvBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#pvBuffer. = nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
234
235 if (!TargetName)
236 freecxx . . $ free(5d22bdacc48458e8).(name);
237
238 return -1;
239 }
240
241 context->TargetNamecxx . . $ $anonymous_type_544b217a83a6fa2a_13#TargetName..cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer. = (USHORTcxx . . $ USHORT#)(len * sizeof(WCHARcxx . . $ WCHAR#));
242
243 if (!TargetName)
244 freecxx . . $ free(5d22bdacc48458e8).(name);
245
246 return 1;
247 }
248
249 static void ntlm_ContextFreecxx . . $ ntlm_ContextFree(bf41894d596f52ba).(NTLM_CONTEXTcxx . . $ NTLM_CONTEXT#* context)
250 {
251 if (!context)
252 return;
253
254 winpr_RC4_Freecxx . . $ winpr_RC4_Free(d93f1f27970c8599).(context->SendRc4Sealcxx . . $ $anonymous_type_544b217a83a6fa2a_13#SendRc4Seal.);
255 winpr_RC4_Freecxx . . $ winpr_RC4_Free(d93f1f27970c8599).(context->RecvRc4Sealcxx . . $ $anonymous_type_544b217a83a6fa2a_13#RecvRc4Seal.);
256 sspi_SecBufferFreecxx . . $ sspi_SecBufferFree(32b3ea3b65e8fed4).(&context->NegotiateMessagecxx . . $ $anonymous_type_544b217a83a6fa2a_13#NegotiateMessage.);
257 sspi_SecBufferFreecxx . . $ sspi_SecBufferFree(32b3ea3b65e8fed4).(&context->ChallengeMessagecxx . . $ $anonymous_type_544b217a83a6fa2a_13#ChallengeMessage.);
258 sspi_SecBufferFreecxx . . $ sspi_SecBufferFree(32b3ea3b65e8fed4).(&context->AuthenticateMessagecxx . . $ $anonymous_type_544b217a83a6fa2a_13#AuthenticateMessage.);
259 sspi_SecBufferFreecxx . . $ sspi_SecBufferFree(32b3ea3b65e8fed4).(&context->ChallengeTargetInfocxx . . $ $anonymous_type_544b217a83a6fa2a_13#ChallengeTargetInfo.);
260 sspi_SecBufferFreecxx . . $ sspi_SecBufferFree(32b3ea3b65e8fed4).(&context->AuthenticateTargetInfocxx . . $ $anonymous_type_544b217a83a6fa2a_13#AuthenticateTargetInfo.);
261 sspi_SecBufferFreecxx . . $ sspi_SecBufferFree(32b3ea3b65e8fed4).(&context->TargetNamecxx . . $ $anonymous_type_544b217a83a6fa2a_13#TargetName.);
262 sspi_SecBufferFreecxx . . $ sspi_SecBufferFree(32b3ea3b65e8fed4).(&context->NtChallengeResponsecxx . . $ $anonymous_type_544b217a83a6fa2a_13#NtChallengeResponse.);
263 sspi_SecBufferFreecxx . . $ sspi_SecBufferFree(32b3ea3b65e8fed4).(&context->LmChallengeResponsecxx . . $ $anonymous_type_544b217a83a6fa2a_13#LmChallengeResponse.);
264 ntlm_free_unicode_stringcxx . . $ ntlm_free_unicode_string(e80ef3157579d559).(&context->ServicePrincipalNamecxx . . $ $anonymous_type_544b217a83a6fa2a_13#ServicePrincipalName.);
265 ntlm_free_unicode_stringcxx . . $ ntlm_free_unicode_string(e80ef3157579d559).(&context->Workstationcxx . . $ $anonymous_type_544b217a83a6fa2a_13#Workstation.);
266 ntlm_free_unicode_stringcxx . . $ ntlm_free_unicode_string(e80ef3157579d559).(&context->NbComputerNamecxx . . $ $anonymous_type_544b217a83a6fa2a_13#NbComputerName.);
267 ntlm_free_unicode_stringcxx . . $ ntlm_free_unicode_string(e80ef3157579d559).(&context->NbDomainNamecxx . . $ $anonymous_type_544b217a83a6fa2a_13#NbDomainName.);
268 ntlm_free_unicode_stringcxx . . $ ntlm_free_unicode_string(e80ef3157579d559).(&context->DnsComputerNamecxx . . $ $anonymous_type_544b217a83a6fa2a_13#DnsComputerName.);
269 ntlm_free_unicode_stringcxx . . $ ntlm_free_unicode_string(e80ef3157579d559).(&context->DnsDomainNamecxx . . $ $anonymous_type_544b217a83a6fa2a_13#DnsDomainName.);
270
271 ntlm_free_messagescxx . . $ ntlm_free_messages(bf41894d596f52ba).(context);
272
273 /* Zero sensitive key material before freeing the context */
274 memsetcxx . . $ memset(d1de1e4fb215f1c6).(context->NtlmHashcxx . . $ $anonymous_type_544b217a83a6fa2a_13#NtlmHash., 0, sizeof(context->NtlmHashcxx . . $ $anonymous_type_544b217a83a6fa2a_13#NtlmHash.));
275 memsetcxx . . $ memset(d1de1e4fb215f1c6).(context->NtlmV2Hashcxx . . $ $anonymous_type_544b217a83a6fa2a_13#NtlmV2Hash., 0, sizeof(context->NtlmV2Hashcxx . . $ $anonymous_type_544b217a83a6fa2a_13#NtlmV2Hash.));
276 memsetcxx . . $ memset(d1de1e4fb215f1c6).(context->SessionBaseKeycxx . . $ $anonymous_type_544b217a83a6fa2a_13#SessionBaseKey., 0, sizeof(context->SessionBaseKeycxx . . $ $anonymous_type_544b217a83a6fa2a_13#SessionBaseKey.));
277 memsetcxx . . $ memset(d1de1e4fb215f1c6).(context->KeyExchangeKeycxx . . $ $anonymous_type_544b217a83a6fa2a_13#KeyExchangeKey., 0, sizeof(context->KeyExchangeKeycxx . . $ $anonymous_type_544b217a83a6fa2a_13#KeyExchangeKey.));
278 memsetcxx . . $ memset(d1de1e4fb215f1c6).(context->RandomSessionKeycxx . . $ $anonymous_type_544b217a83a6fa2a_13#RandomSessionKey., 0, sizeof(context->RandomSessionKeycxx . . $ $anonymous_type_544b217a83a6fa2a_13#RandomSessionKey.));
279 memsetcxx . . $ memset(d1de1e4fb215f1c6).(context->ExportedSessionKeycxx . . $ $anonymous_type_544b217a83a6fa2a_13#ExportedSessionKey., 0, sizeof(context->ExportedSessionKeycxx . . $ $anonymous_type_544b217a83a6fa2a_13#ExportedSessionKey.));
280 memsetcxx . . $ memset(d1de1e4fb215f1c6).(context->EncryptedRandomSessionKeycxx . . $ $anonymous_type_544b217a83a6fa2a_13#EncryptedRandomSessionKey., 0, sizeof(context->EncryptedRandomSessionKeycxx . . $ $anonymous_type_544b217a83a6fa2a_13#EncryptedRandomSessionKey.));
281 memsetcxx . . $ memset(d1de1e4fb215f1c6).(context->NtProofStringcxx . . $ $anonymous_type_544b217a83a6fa2a_13#NtProofString., 0, sizeof(context->NtProofStringcxx . . $ $anonymous_type_544b217a83a6fa2a_13#NtProofString.));
282 freecxx . . $ free(5d22bdacc48458e8).(context);
283 }
284
285 WINPR_ATTR_NODISCARDcxx . . $ `winpr/include/winpr/platform.h:105:9`!
286 static int ntlm_get_target_computer_namecxx . . $ ntlm_get_target_computer_name(7519c2c4446bdc5c).(PUNICODE_STRINGcxx . . $ PUNICODE_STRING# pName,
287 WINPR_ATTR_UNUSEDcxx . . $ `winpr/include/winpr/platform.h:713:9`! COMPUTER_NAME_FORMATcxx . . $ COMPUTER_NAME_FORMAT# type)
288 {
289 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(pName);
290 ntlm_free_unicode_stringcxx . . $ ntlm_free_unicode_string(e80ef3157579d559).(pName);
291
292 size_t len = 0;
293 char* name = get_computer_namecxx . . $ get_computer_name(9268f230ec858ba3).(ComputerNameNetBIOScxx . . $ ComputerNameNetBIOS., &len);
294 if (!name)
295 return -1;
296
297 CharUpperAcxx . . $ CharUpperA(7a9722d75b371431).(name);
298
299 *pName = ntlm_from_unicode_string_utf8cxx . . $ ntlm_from_unicode_string_utf8(3cc85ee38b462723).(name, len);
300 freecxx . . $ free(5d22bdacc48458e8).(name);
301
302 return !ntlm_is_unicode_string_emptycxx . . $ ntlm_is_unicode_string_empty(8bceef4d9b3378cb).(pName);
303 }
304
305 WINPR_ATTR_NODISCARDcxx . . $ `winpr/include/winpr/platform.h:105:9`!
306 static BOOLcxx . . $ BOOL# ntlm_ContextFillDefaultNamescxx . . $ ntlm_ContextFillDefaultNames(62159e91f0a821e).(NTLM_CONTEXTcxx . . $ NTLM_CONTEXT#* context)
307 {
308 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(context);
309
310 if (ntlm_SetContextWorkstationcxx . . $ ntlm_SetContextWorkstation(c121db612af4db9d).(context, nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!) < 0)
311 return FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!;
312
313 if (ntlm_get_target_computer_namecxx . . $ ntlm_get_target_computer_name(7519c2c4446bdc5c).(&context->NbDomainNamecxx . . $ $anonymous_type_544b217a83a6fa2a_13#NbDomainName., ComputerNameNetBIOScxx . . $ ComputerNameNetBIOS.) < 0)
314 return FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!;
315
316 if (ntlm_get_target_computer_namecxx . . $ ntlm_get_target_computer_name(7519c2c4446bdc5c).(&context->NbComputerNamecxx . . $ $anonymous_type_544b217a83a6fa2a_13#NbComputerName., ComputerNameNetBIOScxx . . $ ComputerNameNetBIOS.) < 0)
317 return FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!;
318
319 if (ntlm_get_target_computer_namecxx . . $ ntlm_get_target_computer_name(7519c2c4446bdc5c).(&context->DnsDomainNamecxx . . $ $anonymous_type_544b217a83a6fa2a_13#DnsDomainName., ComputerNameDnsDomaincxx . . $ ComputerNameDnsDomain.) < 0)
320 return FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!;
321
322 if (ntlm_get_target_computer_namecxx . . $ ntlm_get_target_computer_name(7519c2c4446bdc5c).(&context->DnsComputerNamecxx . . $ $anonymous_type_544b217a83a6fa2a_13#DnsComputerName., ComputerNameDnsHostnamecxx . . $ ComputerNameDnsHostname.) < 0)
323 return FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!;
324 return TRUEcxx . . $ `winpr/include/winpr/wtypes.h:126:9`!;
325 }
326
327 static BOOLcxx . . $ BOOL# ntlm_try_set_from_registrycxx . . $ ntlm_try_set_from_registry(846bf545dea21ed5).(HKEYcxx . . $ HKEY# hKey, const char* key, UNICODE_STRINGcxx . . $ UNICODE_STRING#* ustr)
328 {
329 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(hKey);
330 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(key);
331
332 UNICODE_STRINGcxx . . $ UNICODE_STRING# str = WINPR_C_ARRAY_INITcxx . . $ `winpr/include/winpr/platform.h:87:9`!;
333
334 WCHARcxx . . $ WCHAR# wkey[64] = WINPR_C_ARRAY_INITcxx . . $ `winpr/include/winpr/platform.h:87:9`!;
335 const SSIZE_Tcxx . . $ SSIZE_T# res = ConvertUtf8ToWCharcxx . . $ ConvertUtf8ToWChar(a6cf0e43887e06c3).(key, wkey, ARRAYSIZEcxx . . $ `winpr/include/winpr/spec.h:962:9`!(wkey));
336 if (res < 0)
337 goto fail;
338 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!((size_t)res < ARRAYSIZEcxx . . $ `winpr/include/winpr/spec.h:962:9`!(wkey));
339
340 DWORDcxx . . $ DWORD# dwSize = 0;
341 DWORDcxx . . $ DWORD# dwType = 0;
342 if (RegQueryValueExWcxx . . $ RegQueryValueExW(f01a482383cb3fb7).(hKey, wkey, nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, &dwType, nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, &dwSize) != ERROR_SUCCESScxx . . $ `winpr/include/winpr/error.h:185:9`!)
343 goto fail;
344
345 if ((dwSize > UINT16_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:123:10`!) || ((dwSize % 2) != 0))
346 goto fail;
347
348 str.Buffercxx . . $ $anonymous_type_41beb9bb5fd0dd86_2#Buffer. = calloccxx . . $ calloc(63a7bf2941bfcd7a).(dwSize / sizeof(WCHARcxx . . $ WCHAR#) + 1, sizeof(WCHARcxx . . $ WCHAR#));
349 if (!str.Buffercxx . . $ $anonymous_type_41beb9bb5fd0dd86_2#Buffer.)
350 goto fail;
351 str.Lengthcxx . . $ $anonymous_type_41beb9bb5fd0dd86_2#Length. = WINPR_ASSERTING_INT_CASTcxx . . $ `winpr/include/winpr/cast.h:111:9`!(UINT16, dwSize);
352 str.MaximumLengthcxx . . $ $anonymous_type_41beb9bb5fd0dd86_2#MaximumLength. = WINPR_ASSERTING_INT_CASTcxx . . $ `winpr/include/winpr/cast.h:111:9`!(UINT16, dwSize);
353
354 const LONGcxx . . $ LONG# rc = RegQueryValueExWcxx . . $ RegQueryValueExW(f01a482383cb3fb7).(hKey, wkey, nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, &dwType, (BYTEcxx . . $ BYTE#*)str.Buffercxx . . $ $anonymous_type_41beb9bb5fd0dd86_2#Buffer., &dwSize);
355 if (rc != ERROR_SUCCESScxx . . $ `winpr/include/winpr/error.h:185:9`!)
356 goto fail;
357 ntlm_free_unicode_stringcxx . . $ ntlm_free_unicode_string(e80ef3157579d559).(ustr);
358 *ustr = str;
359 return TRUEcxx . . $ `winpr/include/winpr/wtypes.h:126:9`!;
360
361 fail:
362 ntlm_free_unicode_stringcxx . . $ ntlm_free_unicode_string(e80ef3157579d559).(&str);
363 return FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!;
364 }
365
366 WINPR_ATTR_NODISCARDcxx . . $ `winpr/include/winpr/platform.h:105:9`!
367 static BOOLcxx . . $ BOOL# ntlm_ContextFromConfigcxx . . $ ntlm_ContextFromConfig(62159e91f0a821e).(NTLM_CONTEXTcxx . . $ NTLM_CONTEXT#* context)
368 {
369 {
370 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(context);
371
372 char* key = winpr_getApplicatonDetailsRegKeycxx . . $ winpr_getApplicatonDetailsRegKey(a8b8e32347182212).(WINPR_KEYcxx . . $ `winpr/libwinpr/sspi/NTLM/ntlm.c:48:9`!);
373 if (key)
374 {
375 HKEYcxx . . $ HKEY# hKey = nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
376
377 const LONGcxx . . $ LONG# status =
378 RegOpenKeyExAcxx . . $ RegOpenKeyExA(ec4c8c9cb2baa442).(HKEY_LOCAL_MACHINEcxx . . $ `winpr/include/winpr/registry.h:120:9`!, key, 0, KEY_READcxx . . $ `winpr/include/winpr/registry.h:80:9`! | KEY_WOW64_64KEYcxx . . $ `winpr/include/winpr/registry.h:71:9`!, &hKey);
379 freecxx . . $ free(5d22bdacc48458e8).(key);
380
381 if (status == ERROR_SUCCESScxx . . $ `winpr/include/winpr/error.h:185:9`!)
382 {
383 DWORDcxx . . $ DWORD# dwValue = 0;
384 DWORDcxx . . $ DWORD# dwSize = 0;
385 DWORDcxx . . $ DWORD# dwType = 0;
386
387 if (RegQueryValueExcxx . . $ `winpr/include/winpr/registry.h:422:9`!(hKey, _Tcxx . . $ `winpr/include/winpr/wtypes.h:284:9`!("NTLMv2"), nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, &dwType, (BYTEcxx . . $ BYTE#*)&dwValue,
388 &dwSize) == ERROR_SUCCESScxx . . $ `winpr/include/winpr/error.h:185:9`!)
389 context->NTLMv2cxx . . $ $anonymous_type_544b217a83a6fa2a_13#NTLMv2. = dwValue ? 1 : 0;
390
391 if (RegQueryValueExcxx . . $ `winpr/include/winpr/registry.h:422:9`!(hKey, _Tcxx . . $ `winpr/include/winpr/wtypes.h:284:9`!("UseMIC"), nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, &dwType, (BYTEcxx . . $ BYTE#*)&dwValue,
392 &dwSize) == ERROR_SUCCESScxx . . $ `winpr/include/winpr/error.h:185:9`!)
393 context->UseMICcxx . . $ $anonymous_type_544b217a83a6fa2a_13#UseMIC. = dwValue ? 1 : 0;
394
395 if (RegQueryValueExcxx . . $ `winpr/include/winpr/registry.h:422:9`!(hKey, _Tcxx . . $ `winpr/include/winpr/wtypes.h:284:9`!("SendVersionInfo"), nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, &dwType, (BYTEcxx . . $ BYTE#*)&dwValue,
396 &dwSize) == ERROR_SUCCESScxx . . $ `winpr/include/winpr/error.h:185:9`!)
397 context->SendVersionInfocxx . . $ $anonymous_type_544b217a83a6fa2a_13#SendVersionInfo. = dwValue ? 1 : 0;
398
399 if (RegQueryValueExcxx . . $ `winpr/include/winpr/registry.h:422:9`!(hKey, _Tcxx . . $ `winpr/include/winpr/wtypes.h:284:9`!("SendSingleHostData"), nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, &dwType,
400 (BYTEcxx . . $ BYTE#*)&dwValue, &dwSize) == ERROR_SUCCESScxx . . $ `winpr/include/winpr/error.h:185:9`!)
401 context->SendSingleHostDatacxx . . $ $anonymous_type_544b217a83a6fa2a_13#SendSingleHostData. = dwValue ? 1 : 0;
402
403 if (RegQueryValueExcxx . . $ `winpr/include/winpr/registry.h:422:9`!(hKey, _Tcxx . . $ `winpr/include/winpr/wtypes.h:284:9`!("SendWorkstationName"), nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, &dwType,
404 (BYTEcxx . . $ BYTE#*)&dwValue, &dwSize) == ERROR_SUCCESScxx . . $ `winpr/include/winpr/error.h:185:9`!)
405 context->SendWorkstationNamecxx . . $ $anonymous_type_544b217a83a6fa2a_13#SendWorkstationName. = dwValue ? 1 : 0;
406
407 (void)ntlm_try_set_from_registrycxx . . $ ntlm_try_set_from_registry(846bf545dea21ed5).(hKey, "WorkstationName", &context->Workstationcxx . . $ $anonymous_type_544b217a83a6fa2a_13#Workstation.);
408 (void)ntlm_try_set_from_registrycxx . . $ ntlm_try_set_from_registry(846bf545dea21ed5).(hKey, "NbDomainName", &context->NbDomainNamecxx . . $ $anonymous_type_544b217a83a6fa2a_13#NbDomainName.);
409 (void)ntlm_try_set_from_registrycxx . . $ ntlm_try_set_from_registry(846bf545dea21ed5).(hKey, "NbComputerName", &context->NbComputerNamecxx . . $ $anonymous_type_544b217a83a6fa2a_13#NbComputerName.);
410 (void)ntlm_try_set_from_registrycxx . . $ ntlm_try_set_from_registry(846bf545dea21ed5).(hKey, "DnsDomainName", &context->DnsDomainNamecxx . . $ $anonymous_type_544b217a83a6fa2a_13#DnsDomainName.);
411 (void)ntlm_try_set_from_registrycxx . . $ ntlm_try_set_from_registry(846bf545dea21ed5).(hKey, "DnsComputerName",
412 &context->DnsComputerNamecxx . . $ $anonymous_type_544b217a83a6fa2a_13#DnsComputerName.);
413
414 RegCloseKeycxx . . $ RegCloseKey(dedf1e9b1c614a07).(hKey);
415 }
416 }
417 }
418
419 HKEYcxx . . $ HKEY# hKey = nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
420 const LONGcxx . . $ LONG# status =
421 RegOpenKeyExcxx . . $ `winpr/include/winpr/registry.h:384:9`!(HKEY_LOCAL_MACHINEcxx . . $ `winpr/include/winpr/registry.h:120:9`!, _Tcxx . . $ `winpr/include/winpr/wtypes.h:284:9`!("System\\CurrentControlSet\\Control\\LSA"), 0,
422 KEY_READcxx . . $ `winpr/include/winpr/registry.h:80:9`! | KEY_WOW64_64KEYcxx . . $ `winpr/include/winpr/registry.h:71:9`!, &hKey);
423
424 if (status == ERROR_SUCCESScxx . . $ `winpr/include/winpr/error.h:185:9`!)
425 {
426 DWORDcxx . . $ DWORD# dwType = 0;
427 DWORDcxx . . $ DWORD# dwSize = 0;
428 DWORDcxx . . $ DWORD# dwValue = 0;
429 if (RegQueryValueExcxx . . $ `winpr/include/winpr/registry.h:422:9`!(hKey, _Tcxx . . $ `winpr/include/winpr/wtypes.h:284:9`!("SuppressExtendedProtection"), nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, &dwType,
430 (BYTEcxx . . $ BYTE#*)&dwValue, &dwSize) == ERROR_SUCCESScxx . . $ `winpr/include/winpr/error.h:185:9`!)
431 context->SuppressExtendedProtectioncxx . . $ $anonymous_type_544b217a83a6fa2a_13#SuppressExtendedProtection. = dwValue ? 1 : 0;
432
433 RegCloseKeycxx . . $ RegCloseKey(dedf1e9b1c614a07).(hKey);
434 }
435
436 /*
437 * Extended Protection is enabled by default in Windows 7,
438 * but enabling it in WinPR breaks TS Gateway at this point
439 */
440 context->SuppressExtendedProtectioncxx . . $ $anonymous_type_544b217a83a6fa2a_13#SuppressExtendedProtection. = FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!;
441 return TRUEcxx . . $ `winpr/include/winpr/wtypes.h:126:9`!;
442 }
443
444 WINPR_ATTR_MALLOCcxx . . $ `winpr/include/winpr/platform.h:629:9`!(ntlm_ContextFree, 1)
445 static NTLM_CONTEXTcxx . . $ NTLM_CONTEXT#* ntlm_ContextNewcxx . . $ ntlm_ContextNew(14480e913078f19d).(void)
446 {
447 NTLM_CONTEXTcxx . . $ NTLM_CONTEXT#* context = (NTLM_CONTEXTcxx . . $ NTLM_CONTEXT#*)calloccxx . . $ calloc(63a7bf2941bfcd7a).(1, sizeof(NTLM_CONTEXTcxx . . $ NTLM_CONTEXT#));
448
449 if (!context)
450 return nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
451
452 context->NTLMv2cxx . . $ $anonymous_type_544b217a83a6fa2a_13#NTLMv2. = TRUEcxx . . $ `winpr/include/winpr/wtypes.h:126:9`!;
453 context->UseMICcxx . . $ $anonymous_type_544b217a83a6fa2a_13#UseMIC. = FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!;
454 context->SendVersionInfocxx . . $ $anonymous_type_544b217a83a6fa2a_13#SendVersionInfo. = TRUEcxx . . $ `winpr/include/winpr/wtypes.h:126:9`!;
455 context->SendSingleHostDatacxx . . $ $anonymous_type_544b217a83a6fa2a_13#SendSingleHostData. = FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!;
456 context->SendWorkstationNamecxx . . $ $anonymous_type_544b217a83a6fa2a_13#SendWorkstationName. = TRUEcxx . . $ `winpr/include/winpr/wtypes.h:126:9`!;
457 context->NegotiateKeyExchangecxx . . $ $anonymous_type_544b217a83a6fa2a_13#NegotiateKeyExchange. = TRUEcxx . . $ `winpr/include/winpr/wtypes.h:126:9`!;
458 context->UseSamFileDatabasecxx . . $ $anonymous_type_544b217a83a6fa2a_13#UseSamFileDatabase. = TRUEcxx . . $ `winpr/include/winpr/wtypes.h:126:9`!;
459
460 context->NegotiateFlagscxx . . $ $anonymous_type_544b217a83a6fa2a_13#NegotiateFlags. = 0;
461 context->LmCompatibilityLevelcxx . . $ $anonymous_type_544b217a83a6fa2a_13#LmCompatibilityLevel. = 3;
462 ntlm_change_statecxx . . $ ntlm_change_state(7aab06805bde2dc2).(context, NTLM_STATE_INITIALcxx . . $ NTLM_STATE_INITIAL.);
463 FillMemorycxx . . $ `winpr/include/winpr/crt.h:125:9`!(context->MachineID, sizeof(context->MachineID), 0xAA);
464
465 if (context->NTLMv2cxx . . $ $anonymous_type_544b217a83a6fa2a_13#NTLMv2.)
466 context->UseMICcxx . . $ $anonymous_type_544b217a83a6fa2a_13#UseMIC. = TRUEcxx . . $ `winpr/include/winpr/wtypes.h:126:9`!;
467
468 if (!ntlm_ContextFillDefaultNamescxx . . $ ntlm_ContextFillDefaultNames(62159e91f0a821e).(context))
469 goto fail;
470 if (!ntlm_ContextFromConfigcxx . . $ ntlm_ContextFromConfig(62159e91f0a821e).(context))
471 goto fail;
472
473 return context;
474
475 fail:
476 ntlm_ContextFreecxx . . $ ntlm_ContextFree(bf41894d596f52ba).(context);
477 return nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
478 }
479
480 WINPR_ATTR_NODISCARDcxx . . $ `winpr/include/winpr/platform.h:105:9`!
481 static SECURITY_STATUScxx . . $ SECURITY_STATUS# SEC_ENTRYcxx . . $ `winpr/include/winpr/sspi.h:44:9`! ntlm_AcquireCredentialsHandleWcxx . . $ ntlm_AcquireCredentialsHandleW(537031bd00bdbc62).(
482 WINPR_ATTR_UNUSEDcxx . . $ `winpr/include/winpr/platform.h:713:9`! SEC_WCHARcxx . . $ SEC_WCHAR#* pszPrincipal, WINPR_ATTR_UNUSEDcxx . . $ `winpr/include/winpr/platform.h:713:9`! SEC_WCHARcxx . . $ SEC_WCHAR#* pszPackage,
483 ULONGcxx . . $ ULONG# fCredentialUse, WINPR_ATTR_UNUSEDcxx . . $ `winpr/include/winpr/platform.h:713:9`! void* pvLogonID, void* pAuthData,
484 SEC_GET_KEY_FNcxx . . $ SEC_GET_KEY_FN# pGetKeyFn, void* pvGetKeyArgument, PCredHandlecxx . . $ PCredHandle# phCredential,
485 WINPR_ATTR_UNUSEDcxx . . $ `winpr/include/winpr/platform.h:713:9`! PTimeStampcxx . . $ PTimeStamp# ptsExpiry)
486 {
487 if ((fCredentialUse != SECPKG_CRED_OUTBOUNDcxx . . $ `winpr/include/winpr/sspi.h:260:9`!) && (fCredentialUse != SECPKG_CRED_INBOUNDcxx . . $ `winpr/include/winpr/sspi.h:259:9`!) &&
488 (fCredentialUse != SECPKG_CRED_BOTHcxx . . $ `winpr/include/winpr/sspi.h:261:9`!))
489 {
490 return SEC_E_INVALID_PARAMETERcxx . . $ `winpr/include/winpr/sspi.h:201:9`!;
491 }
492
493 SSPI_CREDENTIALScxx . . $ SSPI_CREDENTIALS#* credentials = sspi_CredentialsNewcxx . . $ sspi_CredentialsNew(9e522d78a489027f).();
494
495 if (!credentials)
496 return SEC_E_INTERNAL_ERRORcxx . . $ `winpr/include/winpr/sspi.h:138:9`!;
497
498 credentials->fCredentialUsecxx . . $ $anonymous_type_5960768699aeeb84_0#fCredentialUse. = fCredentialUse;
499 credentials->pGetKeyFncxx . . $ $anonymous_type_5960768699aeeb84_0#pGetKeyFn. = pGetKeyFn;
500 credentials->pvGetKeyArgumentcxx . . $ $anonymous_type_5960768699aeeb84_0#pvGetKeyArgument. = pvGetKeyArgument;
501
502 #if !defined(WITHOUT_WINPR_3x_DEPRECATED)
503 SEC_WINPR_NTLM_SETTINGScxx . . $ SEC_WINPR_NTLM_SETTINGS#* settingsV1 = nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
504 #endif
505 SEC_WINPR_NTLM_SETTINGS_V2cxx . . $ SEC_WINPR_NTLM_SETTINGS_V2#* settingsV2 = nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
506 if (pAuthData)
507 {
508 UINT32cxx . . $ UINT32# identityFlags = sspi_GetAuthIdentityFlagscxx . . $ sspi_GetAuthIdentityFlags(b11f534102b1ad6).(pAuthData);
509
510 if (sspi_CopyAuthIdentitycxx . . $ sspi_CopyAuthIdentity(a0cfcf6e25210c6a).(&(credentials->identitycxx . . $ $anonymous_type_5960768699aeeb84_0#identity.),
511 (const SEC_WINNT_AUTH_IDENTITY_INFOcxx . . $ SEC_WINNT_AUTH_IDENTITY_INFO#*)pAuthData) < 0)
512 {
513 sspi_CredentialsFreecxx . . $ sspi_CredentialsFree(da18fe57a5c5357d).(credentials);
514 return SEC_E_INVALID_PARAMETERcxx . . $ `winpr/include/winpr/sspi.h:201:9`!;
515 }
516
517 #if !defined(WITHOUT_WINPR_3x_DEPRECATED)
518 if (identityFlags & SEC_WINNT_AUTH_IDENTITY_EXTENDEDcxx . . $ `winpr/include/winpr/sspi.h:695:9`!)
519 settingsV1 = (((SEC_WINNT_AUTH_IDENTITY_WINPRcxx . . $ SEC_WINNT_AUTH_IDENTITY_WINPR#*)pAuthData)->ntlmSettingscxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_48#ntlmSettings.);
520 #endif
521
522 if (identityFlags & SEC_WINNT_AUTH_IDENTITY_EXTENDED_v2cxx . . $ `winpr/include/winpr/sspi.h:698:9`!)
523 {
524 const SEC_WINNT_AUTH_IDENTITY_WINPR_V2cxx . . $ SEC_WINNT_AUTH_IDENTITY_WINPR_V2#* auth =
525 (const SEC_WINNT_AUTH_IDENTITY_WINPR_V2cxx . . $ SEC_WINNT_AUTH_IDENTITY_WINPR_V2#*)pAuthData;
526 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(auth);
527 if (auth->versioncxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_52#version. < SEC_WINNT_AUTH_IDENTITY_WINPR_V2_REVISION_1cxx . . $ SEC_WINNT_AUTH_IDENTITY_WINPR_V2_REVISION_1.)
528 return SEC_E_INVALID_PARAMETERcxx . . $ `winpr/include/winpr/sspi.h:201:9`!;
529 settingsV2 = auth->ntlmSettingsV2cxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_52#ntlmSettingsV2.;
530 }
531 }
532
533 #if !defined(WITHOUT_WINPR_3x_DEPRECATED)
534 if (settingsV1)
535 {
536 if (settingsV1->samFilecxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_46#samFile.)
537 {
538 if (!sspi_CloneSecSettingsStringcxx . . $ sspi_CloneSecSettingsString(cc1a8f44225c7fe0).(&credentials->ntlmSettingsV2cxx . . $ $anonymous_type_5960768699aeeb84_0#ntlmSettingsV2.->samFilecxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_49#samFile.,
539 settingsV1->samFilecxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_46#samFile.))
540 {
541 sspi_CredentialsFreecxx . . $ sspi_CredentialsFree(da18fe57a5c5357d).(credentials);
542 return SEC_E_INSUFFICIENT_MEMORYcxx . . $ `winpr/include/winpr/sspi.h:134:9`!;
543 }
544 }
545 credentials->ntlmSettingsV2cxx . . $ $anonymous_type_5960768699aeeb84_0#ntlmSettingsV2.->hashCallbackcxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_49#hashCallback. = settingsV1->hashCallbackcxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_46#hashCallback.;
546 credentials->ntlmSettingsV2cxx . . $ $anonymous_type_5960768699aeeb84_0#ntlmSettingsV2.->hashCallbackArgcxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_49#hashCallbackArg. = settingsV1->hashCallbackArgcxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_46#hashCallbackArg.;
547 }
548 #endif
549
550 if (settingsV2)
551 {
552 sspi_FreeSecNtlmSettingscxx . . $ sspi_FreeSecNtlmSettings(951db79224ce5e0b).(credentials->ntlmSettingsV2cxx . . $ $anonymous_type_5960768699aeeb84_0#ntlmSettingsV2.);
553 credentials->ntlmSettingsV2cxx . . $ $anonymous_type_5960768699aeeb84_0#ntlmSettingsV2. = sspi_CloneSecNtlmSettingscxx . . $ sspi_CloneSecNtlmSettings(f473b188eaeb76d3).(settingsV2);
554 if (!credentials->ntlmSettingsV2cxx . . $ $anonymous_type_5960768699aeeb84_0#ntlmSettingsV2.)
555 {
556 sspi_CredentialsFreecxx . . $ sspi_CredentialsFree(da18fe57a5c5357d).(credentials);
557 return SEC_E_INVALID_PARAMETERcxx . . $ `winpr/include/winpr/sspi.h:201:9`!;
558 }
559 }
560
561 sspi_SecureHandleSetLowerPointercxx . . $ sspi_SecureHandleSetLowerPointer(aaeae9b83d9844a8).(phCredential, (void*)credentials);
562 sspi_SecureHandleSetPackageIdcxx . . $ sspi_SecureHandleSetPackageId(82c32e2c21b1f4c7).(phCredential, SSPI_PACKAGE_NTLMcxx . . $ SSPI_PACKAGE_NTLM.);
563 return SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!;
564 }
565
566 WINPR_ATTR_NODISCARDcxx . . $ `winpr/include/winpr/platform.h:105:9`!
567 static SECURITY_STATUScxx . . $ SECURITY_STATUS# SEC_ENTRYcxx . . $ `winpr/include/winpr/sspi.h:44:9`! ntlm_AcquireCredentialsHandleAcxx . . $ ntlm_AcquireCredentialsHandleA(ea7a2ba3fce4e22).(
568 SEC_CHARcxx . . $ SEC_CHAR#* pszPrincipal, SEC_CHARcxx . . $ SEC_CHAR#* pszPackage, ULONGcxx . . $ ULONG# fCredentialUse, void* pvLogonID,
569 void* pAuthData, SEC_GET_KEY_FNcxx . . $ SEC_GET_KEY_FN# pGetKeyFn, void* pvGetKeyArgument, PCredHandlecxx . . $ PCredHandle# phCredential,
570 PTimeStampcxx . . $ PTimeStamp# ptsExpiry)
571 {
572 SECURITY_STATUScxx . . $ SECURITY_STATUS# status = SEC_E_INSUFFICIENT_MEMORYcxx . . $ `winpr/include/winpr/sspi.h:134:9`!;
573 SEC_WCHARcxx . . $ SEC_WCHAR#* principal = nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
574 SEC_WCHARcxx . . $ SEC_WCHAR#* package = nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
575
576 if (pszPrincipal)
577 {
578 principal = ConvertUtf8ToWCharAlloccxx . . $ ConvertUtf8ToWCharAlloc(ead477a53cde6f56).(pszPrincipal, nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!);
579 if (!principal)
580 goto fail;
581 }
582 if (pszPackage)
583 {
584 package = ConvertUtf8ToWCharAlloccxx . . $ ConvertUtf8ToWCharAlloc(ead477a53cde6f56).(pszPackage, nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!);
585 if (!package)
586 goto fail;
587 }
588
589 status =
590 ntlm_AcquireCredentialsHandleWcxx . . $ ntlm_AcquireCredentialsHandleW(537031bd00bdbc62).(principal, package, fCredentialUse, pvLogonID, pAuthData,
591 pGetKeyFn, pvGetKeyArgument, phCredential, ptsExpiry);
592
593 fail:
594 freecxx . . $ free(5d22bdacc48458e8).(principal);
595 freecxx . . $ free(5d22bdacc48458e8).(package);
596
597 return status;
598 }
599
600 WINPR_ATTR_NODISCARDcxx . . $ `winpr/include/winpr/platform.h:105:9`!
601 static SECURITY_STATUScxx . . $ SECURITY_STATUS# SEC_ENTRYcxx . . $ `winpr/include/winpr/sspi.h:44:9`! ntlm_FreeCredentialsHandlecxx . . $ ntlm_FreeCredentialsHandle(e6bcc0180d974dfe).(PCredHandlecxx . . $ PCredHandle# phCredential)
602 {
603 if (!phCredential)
604 return SEC_E_INVALID_HANDLEcxx . . $ `winpr/include/winpr/sspi.h:135:9`!;
605
606 SSPI_CREDENTIALScxx . . $ SSPI_CREDENTIALS#* credentials =
607 (SSPI_CREDENTIALScxx . . $ SSPI_CREDENTIALS#*)sspi_SecureHandleGetLowerPointercxx . . $ sspi_SecureHandleGetLowerPointer(850d8027e444f59b).(phCredential);
608 sspi_SecureHandleInvalidatecxx . . $ sspi_SecureHandleInvalidate(99ecaff645e5cbc5).(phCredential);
609 if (!credentials)
610 return SEC_E_INVALID_HANDLEcxx . . $ `winpr/include/winpr/sspi.h:135:9`!;
611
612 sspi_CredentialsFreecxx . . $ sspi_CredentialsFree(da18fe57a5c5357d).(credentials);
613 return SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!;
614 }
615
616 WINPR_ATTR_NODISCARDcxx . . $ `winpr/include/winpr/platform.h:105:9`!
617 static SECURITY_STATUScxx . . $ SECURITY_STATUS# SEC_ENTRYcxx . . $ `winpr/include/winpr/sspi.h:44:9`! ntlm_QueryCredentialsAttributesWcxx . . $ ntlm_QueryCredentialsAttributesW(998cea891dba569e).(
618 WINPR_ATTR_UNUSEDcxx . . $ `winpr/include/winpr/platform.h:713:9`! PCredHandlecxx . . $ PCredHandle# phCredential, WINPR_ATTR_UNUSEDcxx . . $ `winpr/include/winpr/platform.h:713:9`! ULONGcxx . . $ ULONG# ulAttribute,
619 WINPR_ATTR_UNUSEDcxx . . $ `winpr/include/winpr/platform.h:713:9`! void* pBuffer)
620 {
621 if (ulAttribute == SECPKG_CRED_ATTR_NAMEScxx . . $ `winpr/include/winpr/sspi.h:485:9`!)
622 {
623 return SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!;
624 }
625
626 WLog_ERRcxx . . $ `winpr/include/winpr/wlog.h:347:9`!(TAGcxx . . $ `winpr/libwinpr/sspi/NTLM/ntlm.c:42:9`!, "TODO: Implement");
627 return SEC_E_UNSUPPORTED_FUNCTIONcxx . . $ `winpr/include/winpr/sspi.h:136:9`!;
628 }
629
630 WINPR_ATTR_NODISCARDcxx . . $ `winpr/include/winpr/platform.h:105:9`!
631 static SECURITY_STATUScxx . . $ SECURITY_STATUS# SEC_ENTRYcxx . . $ `winpr/include/winpr/sspi.h:44:9`! ntlm_QueryCredentialsAttributesAcxx . . $ ntlm_QueryCredentialsAttributesA(998cea891dba569e).(PCredHandlecxx . . $ PCredHandle# phCredential,
632 ULONGcxx . . $ ULONG# ulAttribute, void* pBuffer)
633 {
634 return ntlm_QueryCredentialsAttributesWcxx . . $ ntlm_QueryCredentialsAttributesW(998cea891dba569e).(phCredential, ulAttribute, pBuffer);
635 }
636
637 WINPR_ATTR_NODISCARDcxx . . $ `winpr/include/winpr/platform.h:105:9`!
638 static SECURITY_STATUScxx . . $ SECURITY_STATUS# ntml_setUnicodeStringAcxx . . $ ntml_setUnicodeStringA(61636e5e24b9fc8a).(UNICODE_STRINGcxx . . $ UNICODE_STRING#* str, const char* val, size_t charlen);
639
640 /**
641 * @see http://msdn.microsoft.com/en-us/library/windows/desktop/aa374707
642 */
643 WINPR_ATTR_NODISCARDcxx . . $ `winpr/include/winpr/platform.h:105:9`!
644 static SECURITY_STATUScxx . . $ SECURITY_STATUS# SEC_ENTRYcxx . . $ `winpr/include/winpr/sspi.h:44:9`! ntlm_AcceptSecurityContextcxx . . $ ntlm_AcceptSecurityContext(c4f1f6e2f4d578a9).(
645 PCredHandlecxx . . $ PCredHandle# phCredential, PCtxtHandlecxx . . $ PCtxtHandle# phContext, PSecBufferDesccxx . . $ PSecBufferDesc# pInput, ULONGcxx . . $ ULONG# fContextReq,
646 WINPR_ATTR_UNUSEDcxx . . $ `winpr/include/winpr/platform.h:713:9`! ULONGcxx . . $ ULONG# TargetDataRep, PCtxtHandlecxx . . $ PCtxtHandle# phNewContext, PSecBufferDesccxx . . $ PSecBufferDesc# pOutput,
647 WINPR_ATTR_UNUSEDcxx . . $ `winpr/include/winpr/platform.h:713:9`! PULONGcxx . . $ PULONG# pfContextAttr, WINPR_ATTR_UNUSEDcxx . . $ `winpr/include/winpr/platform.h:713:9`! PTimeStampcxx . . $ PTimeStamp# ptsTimeStamp)
648 {
649 SECURITY_STATUScxx . . $ SECURITY_STATUS# status = 0;
650 SSPI_CREDENTIALScxx . . $ SSPI_CREDENTIALS#* credentials = nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
651 PSecBuffercxx . . $ PSecBuffer# input_buffer = nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
652 PSecBuffercxx . . $ PSecBuffer# output_buffer = nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
653
654 /* behave like windows SSPIs that don't want empty context */
655 if (phContext && !phContext->dwLowercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_43#dwLower. && !phContext->dwUppercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_43#dwUpper.)
656 return SEC_E_INVALID_HANDLEcxx . . $ `winpr/include/winpr/sspi.h:135:9`!;
657
658 NTLM_CONTEXTcxx . . $ NTLM_CONTEXT#* context = (NTLM_CONTEXTcxx . . $ NTLM_CONTEXT#*)sspi_SecureHandleGetLowerPointercxx . . $ sspi_SecureHandleGetLowerPointer(850d8027e444f59b).(phContext);
659
660 if (!context)
661 {
662 context = ntlm_ContextNewcxx . . $ ntlm_ContextNew(14480e913078f19d).();
663
664 if (!context)
665 return SEC_E_INSUFFICIENT_MEMORYcxx . . $ `winpr/include/winpr/sspi.h:134:9`!;
666
667 context->servercxx . . $ $anonymous_type_544b217a83a6fa2a_13#server. = TRUEcxx . . $ `winpr/include/winpr/wtypes.h:126:9`!;
668
669 if (fContextReq & ASC_REQ_CONFIDENTIALITYcxx . . $ `winpr/include/winpr/sspi.h:641:9`!)
670 context->confidentialitycxx . . $ $anonymous_type_544b217a83a6fa2a_13#confidentiality. = TRUEcxx . . $ `winpr/include/winpr/wtypes.h:126:9`!;
671
672 credentials = (SSPI_CREDENTIALScxx . . $ SSPI_CREDENTIALS#*)sspi_SecureHandleGetLowerPointercxx . . $ sspi_SecureHandleGetLowerPointer(850d8027e444f59b).(phCredential);
673 context->credentialscxx . . $ $anonymous_type_544b217a83a6fa2a_13#credentials. = credentials;
674 context->SamFilecxx . . $ $anonymous_type_544b217a83a6fa2a_13#SamFile. = credentials->ntlmSettingsV2cxx . . $ $anonymous_type_5960768699aeeb84_0#ntlmSettingsV2.->samFilecxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_49#samFile.;
675 context->HashCallbackcxx . . $ $anonymous_type_544b217a83a6fa2a_13#HashCallback. = credentials->ntlmSettingsV2cxx . . $ $anonymous_type_5960768699aeeb84_0#ntlmSettingsV2.->hashCallbackcxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_49#hashCallback.;
676 context->HashCallbackArgcxx . . $ $anonymous_type_544b217a83a6fa2a_13#HashCallbackArg. = credentials->ntlmSettingsV2cxx . . $ $anonymous_type_5960768699aeeb84_0#ntlmSettingsV2.->hashCallbackArgcxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_49#hashCallbackArg.;
677
678 if (credentials->ntlmSettingsV2cxx . . $ $anonymous_type_5960768699aeeb84_0#ntlmSettingsV2.->dnsComputerNamecxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_49#dnsComputerName.)
679 {
680 const SECURITY_STATUScxx . . $ SECURITY_STATUS# rc = ntml_setUnicodeStringAcxx . . $ ntml_setUnicodeStringA(61636e5e24b9fc8a).(
681 &context->DnsComputerNamecxx . . $ $anonymous_type_544b217a83a6fa2a_13#DnsComputerName., credentials->ntlmSettingsV2cxx . . $ $anonymous_type_5960768699aeeb84_0#ntlmSettingsV2.->dnsComputerNamecxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_49#dnsComputerName.,
682 strlencxx . . $ strlen(751346f8406fd082).(credentials->ntlmSettingsV2cxx . . $ $anonymous_type_5960768699aeeb84_0#ntlmSettingsV2.->dnsComputerNamecxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_49#dnsComputerName.));
683 if (SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`! != rc)
684 return rc;
685 }
686
687 if (credentials->ntlmSettingsV2cxx . . $ $anonymous_type_5960768699aeeb84_0#ntlmSettingsV2.->dnsDomainNamecxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_49#dnsDomainName.)
688 {
689 const SECURITY_STATUScxx . . $ SECURITY_STATUS# rc = ntml_setUnicodeStringAcxx . . $ ntml_setUnicodeStringA(61636e5e24b9fc8a).(
690 &context->DnsDomainNamecxx . . $ $anonymous_type_544b217a83a6fa2a_13#DnsDomainName., credentials->ntlmSettingsV2cxx . . $ $anonymous_type_5960768699aeeb84_0#ntlmSettingsV2.->dnsDomainNamecxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_49#dnsDomainName.,
691 strlencxx . . $ strlen(751346f8406fd082).(credentials->ntlmSettingsV2cxx . . $ $anonymous_type_5960768699aeeb84_0#ntlmSettingsV2.->dnsDomainNamecxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_49#dnsDomainName.));
692 if (SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`! != rc)
693 return rc;
694 }
695
696 if (credentials->ntlmSettingsV2cxx . . $ $anonymous_type_5960768699aeeb84_0#ntlmSettingsV2.->netBiosComputerNamecxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_49#netBiosComputerName.)
697 {
698 const SECURITY_STATUScxx . . $ SECURITY_STATUS# rc = ntml_setUnicodeStringAcxx . . $ ntml_setUnicodeStringA(61636e5e24b9fc8a).(
699 &context->NbComputerNamecxx . . $ $anonymous_type_544b217a83a6fa2a_13#NbComputerName., credentials->ntlmSettingsV2cxx . . $ $anonymous_type_5960768699aeeb84_0#ntlmSettingsV2.->netBiosComputerNamecxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_49#netBiosComputerName.,
700 strlencxx . . $ strlen(751346f8406fd082).(credentials->ntlmSettingsV2cxx . . $ $anonymous_type_5960768699aeeb84_0#ntlmSettingsV2.->netBiosComputerNamecxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_49#netBiosComputerName.));
701 if (SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`! != rc)
702 return rc;
703 }
704
705 if (credentials->ntlmSettingsV2cxx . . $ $anonymous_type_5960768699aeeb84_0#ntlmSettingsV2.->netBiosDomainNamecxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_49#netBiosDomainName.)
706 {
707 const SECURITY_STATUScxx . . $ SECURITY_STATUS# rc = ntml_setUnicodeStringAcxx . . $ ntml_setUnicodeStringA(61636e5e24b9fc8a).(
708 &context->NbDomainNamecxx . . $ $anonymous_type_544b217a83a6fa2a_13#NbDomainName., credentials->ntlmSettingsV2cxx . . $ $anonymous_type_5960768699aeeb84_0#ntlmSettingsV2.->netBiosDomainNamecxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_49#netBiosDomainName.,
709 strlencxx . . $ strlen(751346f8406fd082).(credentials->ntlmSettingsV2cxx . . $ $anonymous_type_5960768699aeeb84_0#ntlmSettingsV2.->netBiosDomainNamecxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_49#netBiosDomainName.));
710 if (SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`! != rc)
711 return rc;
712 }
713
714 if (!ntlm_SetContextTargetNamecxx . . $ ntlm_SetContextTargetName(1e39fd0ea8364f9d).(context, credentials->ntlmSettingsV2cxx . . $ $anonymous_type_5960768699aeeb84_0#ntlmSettingsV2.->targetNamecxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_49#targetName.))
715 return SEC_E_INVALID_HANDLEcxx . . $ `winpr/include/winpr/sspi.h:135:9`!;
716 sspi_SecureHandleSetLowerPointercxx . . $ sspi_SecureHandleSetLowerPointer(aaeae9b83d9844a8).(phNewContext, context);
717 sspi_SecureHandleSetPackageIdcxx . . $ sspi_SecureHandleSetPackageId(82c32e2c21b1f4c7).(phNewContext, SSPI_PACKAGE_NTLMcxx . . $ SSPI_PACKAGE_NTLM.);
718 }
719
720 switch (ntlm_get_statecxx . . $ ntlm_get_state(12e3c7312a20c0dc).(context))
721 {
722 case NTLM_STATE_INITIALcxx . . $ NTLM_STATE_INITIAL.:
723 {
724 ntlm_change_statecxx . . $ ntlm_change_state(7aab06805bde2dc2).(context, NTLM_STATE_NEGOTIATEcxx . . $ NTLM_STATE_NEGOTIATE.);
725
726 if (!pInput)
727 return SEC_E_INVALID_TOKENcxx . . $ `winpr/include/winpr/sspi.h:142:9`!;
728
729 if (pInput->cBufferscxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_45#cBuffers. < 1)
730 return SEC_E_INVALID_TOKENcxx . . $ `winpr/include/winpr/sspi.h:142:9`!;
731
732 input_buffer = sspi_FindSecBuffercxx . . $ sspi_FindSecBuffer(d481b8f655c9d7e3).(pInput, SECBUFFER_TOKENcxx . . $ `winpr/include/winpr/sspi.h:998:9`!);
733
734 if (!input_buffer)
735 return SEC_E_INVALID_TOKENcxx . . $ `winpr/include/winpr/sspi.h:142:9`!;
736
737 if (input_buffer->cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer. < 1)
738 return SEC_E_INVALID_TOKENcxx . . $ `winpr/include/winpr/sspi.h:142:9`!;
739
740 status = ntlm_read_NegotiateMessagecxx . . $ ntlm_read_NegotiateMessage(cc5b7ad649ddaba1).(context, input_buffer);
741 if (status != SEC_I_CONTINUE_NEEDEDcxx . . $ `winpr/include/winpr/sspi.h:208:9`!)
742 return status;
743
744 if (ntlm_get_statecxx . . $ ntlm_get_state(12e3c7312a20c0dc).(context) == NTLM_STATE_CHALLENGEcxx . . $ NTLM_STATE_CHALLENGE.)
745 {
746 if (!pOutput)
747 return SEC_E_INVALID_TOKENcxx . . $ `winpr/include/winpr/sspi.h:142:9`!;
748
749 if (pOutput->cBufferscxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_45#cBuffers. < 1)
750 return SEC_E_INVALID_TOKENcxx . . $ `winpr/include/winpr/sspi.h:142:9`!;
751
752 output_buffer = sspi_FindSecBuffercxx . . $ sspi_FindSecBuffer(d481b8f655c9d7e3).(pOutput, SECBUFFER_TOKENcxx . . $ `winpr/include/winpr/sspi.h:998:9`!);
753
754 if (!output_buffer->BufferTypecxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#BufferType.)
755 return SEC_E_INVALID_TOKENcxx . . $ `winpr/include/winpr/sspi.h:142:9`!;
756
757 if (output_buffer->cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer. < 1)
758 return SEC_E_INSUFFICIENT_MEMORYcxx . . $ `winpr/include/winpr/sspi.h:134:9`!;
759
760 return ntlm_write_ChallengeMessagecxx . . $ ntlm_write_ChallengeMessage(cc5b7ad649ddaba1).(context, output_buffer);
761 }
762
763 return SEC_E_OUT_OF_SEQUENCEcxx . . $ `winpr/include/winpr/sspi.h:150:9`!;
764 }
765
766 case NTLM_STATE_AUTHENTICATEcxx . . $ NTLM_STATE_AUTHENTICATE.:
767 {
768 if (!pInput)
769 return SEC_E_INVALID_TOKENcxx . . $ `winpr/include/winpr/sspi.h:142:9`!;
770
771 if (pInput->cBufferscxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_45#cBuffers. < 1)
772 return SEC_E_INVALID_TOKENcxx . . $ `winpr/include/winpr/sspi.h:142:9`!;
773
774 input_buffer = sspi_FindSecBuffercxx . . $ sspi_FindSecBuffer(d481b8f655c9d7e3).(pInput, SECBUFFER_TOKENcxx . . $ `winpr/include/winpr/sspi.h:998:9`!);
775
776 if (!input_buffer)
777 return SEC_E_INVALID_TOKENcxx . . $ `winpr/include/winpr/sspi.h:142:9`!;
778
779 if (input_buffer->cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer. < 1)
780 return SEC_E_INVALID_TOKENcxx . . $ `winpr/include/winpr/sspi.h:142:9`!;
781
782 status = ntlm_read_AuthenticateMessagecxx . . $ ntlm_read_AuthenticateMessage(cc5b7ad649ddaba1).(context, input_buffer);
783
784 if (pOutput)
785 {
786 for (ULONGcxx . . $ ULONG# i = 0; i < pOutput->cBufferscxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_45#cBuffers.; i++)
787 {
788 pOutput->pBufferscxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_45#pBuffers.[i].cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer. = 0;
789 pOutput->pBufferscxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_45#pBuffers.[i].BufferTypecxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#BufferType. = SECBUFFER_TOKENcxx . . $ `winpr/include/winpr/sspi.h:998:9`!;
790 }
791 }
792
793 return status;
794 }
795
796 default:
797 return SEC_E_OUT_OF_SEQUENCEcxx . . $ `winpr/include/winpr/sspi.h:150:9`!;
798 }
799 }
800
801 WINPR_ATTR_NODISCARDcxx . . $ `winpr/include/winpr/platform.h:105:9`!
802 static SECURITY_STATUScxx . . $ SECURITY_STATUS# SEC_ENTRYcxx . . $ `winpr/include/winpr/sspi.h:44:9`!
803 ntlm_ImpersonateSecurityContextcxx . . $ ntlm_ImpersonateSecurityContext(e6bcc0180d974dfe).(WINPR_ATTR_UNUSEDcxx . . $ `winpr/include/winpr/platform.h:713:9`! PCtxtHandlecxx . . $ PCtxtHandle# phContext)
804 {
805 return SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!;
806 }
807
808 WINPR_ATTR_NODISCARDcxx . . $ `winpr/include/winpr/platform.h:105:9`!
809 static SECURITY_STATUScxx . . $ SECURITY_STATUS# SEC_ENTRYcxx . . $ `winpr/include/winpr/sspi.h:44:9`! ntlm_InitializeSecurityContextWcxx . . $ ntlm_InitializeSecurityContextW(422ccc8b6dd4c323).(
810 PCredHandlecxx . . $ PCredHandle# phCredential, PCtxtHandlecxx . . $ PCtxtHandle# phContext, SEC_WCHARcxx . . $ SEC_WCHAR#* pszTargetName, ULONGcxx . . $ ULONG# fContextReq,
811 WINPR_ATTR_UNUSEDcxx . . $ `winpr/include/winpr/platform.h:713:9`! ULONGcxx . . $ ULONG# Reserved1, WINPR_ATTR_UNUSEDcxx . . $ `winpr/include/winpr/platform.h:713:9`! ULONGcxx . . $ ULONG# TargetDataRep, PSecBufferDesccxx . . $ PSecBufferDesc# pInput,
812 WINPR_ATTR_UNUSEDcxx . . $ `winpr/include/winpr/platform.h:713:9`! ULONGcxx . . $ ULONG# Reserved2, PCtxtHandlecxx . . $ PCtxtHandle# phNewContext, PSecBufferDesccxx . . $ PSecBufferDesc# pOutput,
813 WINPR_ATTR_UNUSEDcxx . . $ `winpr/include/winpr/platform.h:713:9`! PULONGcxx . . $ PULONG# pfContextAttr, WINPR_ATTR_UNUSEDcxx . . $ `winpr/include/winpr/platform.h:713:9`! PTimeStampcxx . . $ PTimeStamp# ptsExpiry)
814 {
815 SECURITY_STATUScxx . . $ SECURITY_STATUS# status = 0;
816 SSPI_CREDENTIALScxx . . $ SSPI_CREDENTIALS#* credentials = nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
817 PSecBuffercxx . . $ PSecBuffer# input_buffer = nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
818 PSecBuffercxx . . $ PSecBuffer# output_buffer = nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
819
820 /* behave like windows SSPIs that don't want empty context */
821 if (phContext && !phContext->dwLowercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_43#dwLower. && !phContext->dwUppercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_43#dwUpper.)
822 return SEC_E_INVALID_HANDLEcxx . . $ `winpr/include/winpr/sspi.h:135:9`!;
823
824 NTLM_CONTEXTcxx . . $ NTLM_CONTEXT#* context = (NTLM_CONTEXTcxx . . $ NTLM_CONTEXT#*)sspi_SecureHandleGetLowerPointercxx . . $ sspi_SecureHandleGetLowerPointer(850d8027e444f59b).(phContext);
825
826 if (pInput)
827 {
828 input_buffer = sspi_FindSecBuffercxx . . $ sspi_FindSecBuffer(d481b8f655c9d7e3).(pInput, SECBUFFER_TOKENcxx . . $ `winpr/include/winpr/sspi.h:998:9`!);
829 }
830
831 if (!context)
832 {
833 context = ntlm_ContextNewcxx . . $ ntlm_ContextNew(14480e913078f19d).();
834
835 if (!context)
836 return SEC_E_INSUFFICIENT_MEMORYcxx . . $ `winpr/include/winpr/sspi.h:134:9`!;
837
838 if (fContextReq & ISC_REQ_CONFIDENTIALITYcxx . . $ `winpr/include/winpr/sspi.h:588:9`!)
839 context->confidentialitycxx . . $ $anonymous_type_544b217a83a6fa2a_13#confidentiality. = TRUEcxx . . $ `winpr/include/winpr/wtypes.h:126:9`!;
840
841 credentials = (SSPI_CREDENTIALScxx . . $ SSPI_CREDENTIALS#*)sspi_SecureHandleGetLowerPointercxx . . $ sspi_SecureHandleGetLowerPointer(850d8027e444f59b).(phCredential);
842 context->credentialscxx . . $ $anonymous_type_544b217a83a6fa2a_13#credentials. = credentials;
843
844 if (ntlm_SetContextServicePrincipalNameWcxx . . $ ntlm_SetContextServicePrincipalNameW(d3fd8b0509953e92).(context, pszTargetName) < 0)
845 {
846 ntlm_ContextFreecxx . . $ ntlm_ContextFree(bf41894d596f52ba).(context);
847 return SEC_E_INTERNAL_ERRORcxx . . $ `winpr/include/winpr/sspi.h:138:9`!;
848 }
849
850 sspi_SecureHandleSetLowerPointercxx . . $ sspi_SecureHandleSetLowerPointer(aaeae9b83d9844a8).(phNewContext, context);
851 sspi_SecureHandleSetPackageIdcxx . . $ sspi_SecureHandleSetPackageId(82c32e2c21b1f4c7).(phNewContext, SSPI_PACKAGE_NTLMcxx . . $ SSPI_PACKAGE_NTLM.);
852 }
853
854 if ((!input_buffer) || (ntlm_get_statecxx . . $ ntlm_get_state(12e3c7312a20c0dc).(context) == NTLM_STATE_AUTHENTICATEcxx . . $ NTLM_STATE_AUTHENTICATE.))
855 {
856 if (!pOutput)
857 return SEC_E_INVALID_TOKENcxx . . $ `winpr/include/winpr/sspi.h:142:9`!;
858
859 if (pOutput->cBufferscxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_45#cBuffers. < 1)
860 return SEC_E_INVALID_TOKENcxx . . $ `winpr/include/winpr/sspi.h:142:9`!;
861
862 output_buffer = sspi_FindSecBuffercxx . . $ sspi_FindSecBuffer(d481b8f655c9d7e3).(pOutput, SECBUFFER_TOKENcxx . . $ `winpr/include/winpr/sspi.h:998:9`!);
863
864 if (!output_buffer)
865 return SEC_E_INVALID_TOKENcxx . . $ `winpr/include/winpr/sspi.h:142:9`!;
866
867 if (output_buffer->cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer. < 1)
868 return SEC_E_INVALID_TOKENcxx . . $ `winpr/include/winpr/sspi.h:142:9`!;
869
870 if (ntlm_get_statecxx . . $ ntlm_get_state(12e3c7312a20c0dc).(context) == NTLM_STATE_INITIALcxx . . $ NTLM_STATE_INITIAL.)
871 ntlm_change_statecxx . . $ ntlm_change_state(7aab06805bde2dc2).(context, NTLM_STATE_NEGOTIATEcxx . . $ NTLM_STATE_NEGOTIATE.);
872
873 if (ntlm_get_statecxx . . $ ntlm_get_state(12e3c7312a20c0dc).(context) == NTLM_STATE_NEGOTIATEcxx . . $ NTLM_STATE_NEGOTIATE.)
874 return ntlm_write_NegotiateMessagecxx . . $ ntlm_write_NegotiateMessage(cc5b7ad649ddaba1).(context, output_buffer);
875
876 return SEC_E_OUT_OF_SEQUENCEcxx . . $ `winpr/include/winpr/sspi.h:150:9`!;
877 }
878 else
879 {
880 if (!input_buffer)
881 return SEC_E_INVALID_TOKENcxx . . $ `winpr/include/winpr/sspi.h:142:9`!;
882
883 if (input_buffer->cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer. < 1)
884 return SEC_E_INVALID_TOKENcxx . . $ `winpr/include/winpr/sspi.h:142:9`!;
885
886 PSecBuffercxx . . $ PSecBuffer# channel_bindings = sspi_FindSecBuffercxx . . $ sspi_FindSecBuffer(d481b8f655c9d7e3).(pInput, SECBUFFER_CHANNEL_BINDINGScxx . . $ `winpr/include/winpr/sspi.h:1010:9`!);
887
888 if (channel_bindings)
889 {
890 context->Bindingscxx . . $ $anonymous_type_544b217a83a6fa2a_13#Bindings..BindingsLengthcxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_36#BindingsLength. = channel_bindings->cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer.;
891 context->Bindingscxx . . $ $anonymous_type_544b217a83a6fa2a_13#Bindings..Bindingscxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_36#Bindings. = (SEC_CHANNEL_BINDINGScxx . . $ SEC_CHANNEL_BINDINGS#*)channel_bindings->pvBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#pvBuffer.;
892 }
893
894 if (ntlm_get_statecxx . . $ ntlm_get_state(12e3c7312a20c0dc).(context) == NTLM_STATE_CHALLENGEcxx . . $ NTLM_STATE_CHALLENGE.)
895 {
896 status = ntlm_read_ChallengeMessagecxx . . $ ntlm_read_ChallengeMessage(cc5b7ad649ddaba1).(context, input_buffer);
897
898 if (status != SEC_I_CONTINUE_NEEDEDcxx . . $ `winpr/include/winpr/sspi.h:208:9`!)
899 return status;
900
901 if (!pOutput)
902 return SEC_E_INVALID_TOKENcxx . . $ `winpr/include/winpr/sspi.h:142:9`!;
903
904 if (pOutput->cBufferscxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_45#cBuffers. < 1)
905 return SEC_E_INVALID_TOKENcxx . . $ `winpr/include/winpr/sspi.h:142:9`!;
906
907 output_buffer = sspi_FindSecBuffercxx . . $ sspi_FindSecBuffer(d481b8f655c9d7e3).(pOutput, SECBUFFER_TOKENcxx . . $ `winpr/include/winpr/sspi.h:998:9`!);
908
909 if (!output_buffer)
910 return SEC_E_INVALID_TOKENcxx . . $ `winpr/include/winpr/sspi.h:142:9`!;
911
912 if (output_buffer->cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer. < 1)
913 return SEC_E_INSUFFICIENT_MEMORYcxx . . $ `winpr/include/winpr/sspi.h:134:9`!;
914
915 if (ntlm_get_statecxx . . $ ntlm_get_state(12e3c7312a20c0dc).(context) == NTLM_STATE_AUTHENTICATEcxx . . $ NTLM_STATE_AUTHENTICATE.)
916 return ntlm_write_AuthenticateMessagecxx . . $ ntlm_write_AuthenticateMessage(cc5b7ad649ddaba1).(context, output_buffer);
917 }
918
919 return SEC_E_OUT_OF_SEQUENCEcxx . . $ `winpr/include/winpr/sspi.h:150:9`!;
920 }
921
922 return SEC_E_OUT_OF_SEQUENCEcxx . . $ `winpr/include/winpr/sspi.h:150:9`!;
923 }
924
925 /**
926 * @see http://msdn.microsoft.com/en-us/library/windows/desktop/aa375512%28v=vs.85%29.aspx
927 */
928 WINPR_ATTR_NODISCARDcxx . . $ `winpr/include/winpr/platform.h:105:9`!
929 static SECURITY_STATUScxx . . $ SECURITY_STATUS# SEC_ENTRYcxx . . $ `winpr/include/winpr/sspi.h:44:9`! ntlm_InitializeSecurityContextAcxx . . $ ntlm_InitializeSecurityContextA(cf9633d63d9b9e60).(
930 PCredHandlecxx . . $ PCredHandle# phCredential, PCtxtHandlecxx . . $ PCtxtHandle# phContext, SEC_CHARcxx . . $ SEC_CHAR#* pszTargetName, ULONGcxx . . $ ULONG# fContextReq,
931 ULONGcxx . . $ ULONG# Reserved1, ULONGcxx . . $ ULONG# TargetDataRep, PSecBufferDesccxx . . $ PSecBufferDesc# pInput, ULONGcxx . . $ ULONG# Reserved2,
932 PCtxtHandlecxx . . $ PCtxtHandle# phNewContext, PSecBufferDesccxx . . $ PSecBufferDesc# pOutput, PULONGcxx . . $ PULONG# pfContextAttr, PTimeStampcxx . . $ PTimeStamp# ptsExpiry)
933 {
934 SECURITY_STATUScxx . . $ SECURITY_STATUS# status = 0;
935 SEC_WCHARcxx . . $ SEC_WCHAR#* pszTargetNameW = nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
936
937 if (pszTargetName)
938 {
939 pszTargetNameW = ConvertUtf8ToWCharAlloccxx . . $ ConvertUtf8ToWCharAlloc(ead477a53cde6f56).(pszTargetName, nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!);
940 if (!pszTargetNameW)
941 return SEC_E_INTERNAL_ERRORcxx . . $ `winpr/include/winpr/sspi.h:138:9`!;
942 }
943
944 status = ntlm_InitializeSecurityContextWcxx . . $ ntlm_InitializeSecurityContextW(422ccc8b6dd4c323).(phCredential, phContext, pszTargetNameW, fContextReq,
945 Reserved1, TargetDataRep, pInput, Reserved2,
946 phNewContext, pOutput, pfContextAttr, ptsExpiry);
947 freecxx . . $ free(5d22bdacc48458e8).(pszTargetNameW);
948 return status;
949 }
950
951 /* http://msdn.microsoft.com/en-us/library/windows/desktop/aa375354 */
952 WINPR_ATTR_NODISCARDcxx . . $ `winpr/include/winpr/platform.h:105:9`!
953 static SECURITY_STATUScxx . . $ SECURITY_STATUS# SEC_ENTRYcxx . . $ `winpr/include/winpr/sspi.h:44:9`! ntlm_DeleteSecurityContextcxx . . $ ntlm_DeleteSecurityContext(e6bcc0180d974dfe).(PCtxtHandlecxx . . $ PCtxtHandle# phContext)
954 {
955 NTLM_CONTEXTcxx . . $ NTLM_CONTEXT#* context = (NTLM_CONTEXTcxx . . $ NTLM_CONTEXT#*)sspi_SecureHandleGetLowerPointercxx . . $ sspi_SecureHandleGetLowerPointer(850d8027e444f59b).(phContext);
956 sspi_SecureHandleInvalidatecxx . . $ sspi_SecureHandleInvalidate(99ecaff645e5cbc5).(phContext);
957 ntlm_ContextFreecxx . . $ ntlm_ContextFree(bf41894d596f52ba).(context);
958 return SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!;
959 }
960
961 SECURITY_STATUScxx . . $ SECURITY_STATUS# ntlm_computeProofValuecxx . . $ ntlm_computeProofValue(cc5b7ad649ddaba1).(NTLM_CONTEXTcxx . . $ NTLM_CONTEXT#* ntlm, SecBuffercxx . . $ SecBuffer#* ntproof)
962 {
963 BYTEcxx . . $ BYTE#* blob = nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
964 SecBuffercxx . . $ SecBuffer#* target = nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
965
966 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(ntlm);
967 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(ntproof);
968
969 target = &ntlm->ChallengeTargetInfocxx . . $ $anonymous_type_544b217a83a6fa2a_13#ChallengeTargetInfo.;
970
971 if (!sspi_SecBufferAlloccxx . . $ sspi_SecBufferAlloc(390a1ca73a7a932d).(ntproof, 36 + target->cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer.))
972 return SEC_E_INSUFFICIENT_MEMORYcxx . . $ `winpr/include/winpr/sspi.h:134:9`!;
973
974 blob = (BYTEcxx . . $ BYTE#*)ntproof->pvBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#pvBuffer.;
975 CopyMemorycxx . . $ `winpr/include/winpr/crt.h:123:9`!(blob, ntlm->ServerChallenge, 8); /* Server challenge. */
976 blob[8] = 1; /* Response version. */
977 blob[9] = 1; /* Highest response version understood by the client. */
978 /* Reserved 6B. */
979 CopyMemorycxx . . $ `winpr/include/winpr/crt.h:123:9`!(&blob[16], ntlm->Timestamp, 8); /* Time. */
980 CopyMemorycxx . . $ `winpr/include/winpr/crt.h:123:9`!(&blob[24], ntlm->ClientChallenge, 8); /* Client challenge. */
981 /* Reserved 4B. */
982 /* Server name. */
983 CopyMemorycxx . . $ `winpr/include/winpr/crt.h:123:9`!(&blob[36], target->pvBuffer, target->cbBuffer);
984 return SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!;
985 }
986
987 SECURITY_STATUScxx . . $ SECURITY_STATUS# ntlm_computeMicValuecxx . . $ ntlm_computeMicValue(cc5b7ad649ddaba1).(NTLM_CONTEXTcxx . . $ NTLM_CONTEXT#* ntlm, SecBuffercxx . . $ SecBuffer#* micvalue)
988 {
989 BYTEcxx . . $ BYTE#* blob = nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
990 ULONGcxx . . $ ULONG# msgSize = 0;
991
992 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(ntlm);
993 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(micvalue);
994
995 msgSize = ntlm->NegotiateMessagecxx . . $ $anonymous_type_544b217a83a6fa2a_13#NegotiateMessage..cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer. + ntlm->ChallengeMessagecxx . . $ $anonymous_type_544b217a83a6fa2a_13#ChallengeMessage..cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer. +
996 ntlm->AuthenticateMessagecxx . . $ $anonymous_type_544b217a83a6fa2a_13#AuthenticateMessage..cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer.;
997
998 if (!sspi_SecBufferAlloccxx . . $ sspi_SecBufferAlloc(390a1ca73a7a932d).(micvalue, msgSize))
999 return SEC_E_INSUFFICIENT_MEMORYcxx . . $ `winpr/include/winpr/sspi.h:134:9`!;
1000
1001 blob = (BYTEcxx . . $ BYTE#*)micvalue->pvBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#pvBuffer.;
1002 CopyMemorycxx . . $ `winpr/include/winpr/crt.h:123:9`!(blob, ntlm->NegotiateMessage.pvBuffer, ntlm->NegotiateMessage.cbBuffer);
1003 blob += ntlm->NegotiateMessagecxx . . $ $anonymous_type_544b217a83a6fa2a_13#NegotiateMessage..cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer.;
1004 CopyMemorycxx . . $ `winpr/include/winpr/crt.h:123:9`!(blob, ntlm->ChallengeMessage.pvBuffer, ntlm->ChallengeMessage.cbBuffer);
1005 blob += ntlm->ChallengeMessagecxx . . $ $anonymous_type_544b217a83a6fa2a_13#ChallengeMessage..cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer.;
1006 CopyMemorycxx . . $ `winpr/include/winpr/crt.h:123:9`!(blob, ntlm->AuthenticateMessage.pvBuffer, ntlm->AuthenticateMessage.cbBuffer);
1007 blob += ntlm->MessageIntegrityCheckOffsetcxx . . $ $anonymous_type_544b217a83a6fa2a_13#MessageIntegrityCheckOffset.;
1008 ZeroMemorycxx . . $ `winpr/include/winpr/crt.h:126:9`!(blob, 16);
1009 return SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!;
1010 }
1011
1012 WINPR_ATTR_NODISCARDcxx . . $ `winpr/include/winpr/platform.h:105:9`!
1013 static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! identityToAuthIdentitycxx . . $ identityToAuthIdentity(9cb2c3ac88ea686c).(const SEC_WINNT_AUTH_IDENTITYcxx . . $ `winpr/include/winpr/sspi.h:739:9`!* identity,
1014 SecPkgContext_AuthIdentitycxx . . $ SecPkgContext_AuthIdentity#* pAuthIdentity)
1015 {
1016 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(identity);
1017
1018 if (!pAuthIdentity)
1019 return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!;
1020
1021 const SecPkgContext_AuthIdentitycxx . . $ SecPkgContext_AuthIdentity# empty = WINPR_C_ARRAY_INITcxx . . $ `winpr/include/winpr/platform.h:87:9`!;
1022 *pAuthIdentity = empty;
1023
1024 if ((identity->Flagscxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_37#Flags. & SEC_WINNT_AUTH_IDENTITY_UNICODEcxx . . $ `winpr/include/winpr/sspi.h:687:9`!) != 0)
1025 {
1026 if (identity->UserLengthcxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_37#UserLength. > 0)
1027 {
1028 if (ConvertWCharNToUtf8cxx . . $ ConvertWCharNToUtf8(250a7607ff547331).(identity->Usercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_37#User., identity->UserLengthcxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_37#UserLength., pAuthIdentity->Usercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_56#User.,
1029 ARRAYSIZEcxx . . $ `winpr/include/winpr/spec.h:962:9`!(pAuthIdentity->User)) <= 0)
1030 return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!;
1031 }
1032
1033 if (identity->DomainLengthcxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_37#DomainLength. > 0)
1034 {
1035 if (ConvertWCharNToUtf8cxx . . $ ConvertWCharNToUtf8(250a7607ff547331).(identity->Domaincxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_37#Domain., identity->DomainLengthcxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_37#DomainLength., pAuthIdentity->Domaincxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_56#Domain.,
1036 ARRAYSIZEcxx . . $ `winpr/include/winpr/spec.h:962:9`!(pAuthIdentity->Domain)) <= 0)
1037 return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!;
1038 }
1039 }
1040 else if ((identity->Flagscxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_37#Flags. & SEC_WINNT_AUTH_IDENTITY_ANSIcxx . . $ `winpr/include/winpr/sspi.h:686:9`!) != 0)
1041 {
1042 if (identity->UserLengthcxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_37#UserLength. > 0)
1043 {
1044 const size_t len = MINcxx . . $ `winpr/libwinpr/sspi/NTLM/ntlm.c:45:9`!(ARRAYSIZEcxx . . $ `winpr/include/winpr/spec.h:962:9`!(pAuthIdentity->User) - 1, identity->UserLength);
1045 strncpycxx . . $ strncpy(255158a415b673b0).(pAuthIdentity->Usercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_56#User., (char*)identity->Usercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_37#User., len);
1046 pAuthIdentity->Usercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_56#User.[len] = '\0';
1047 }
1048
1049 if (identity->DomainLengthcxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_37#DomainLength. > 0)
1050 {
1051 const size_t len = MINcxx . . $ `winpr/libwinpr/sspi/NTLM/ntlm.c:45:9`!(ARRAYSIZEcxx . . $ `winpr/include/winpr/spec.h:962:9`!(pAuthIdentity->Domain) - 1, identity->DomainLength);
1052 strncpycxx . . $ strncpy(255158a415b673b0).(pAuthIdentity->Domaincxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_56#Domain., (char*)identity->Domaincxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_37#Domain., len);
1053 pAuthIdentity->Domaincxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_56#Domain.[len] = '\0';
1054 }
1055 }
1056 else
1057 return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!;
1058 return truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
1059 }
1060
1061 WINPR_ATTR_NODISCARDcxx . . $ `winpr/include/winpr/platform.h:105:9`!
1062 static SECURITY_STATUScxx . . $ SECURITY_STATUS# SEC_ENTRYcxx . . $ `winpr/include/winpr/sspi.h:44:9`! ntlm_QueryContextAttributesCommoncxx . . $ ntlm_QueryContextAttributesCommon(998cea891dba569e).(PCtxtHandlecxx . . $ PCtxtHandle# phContext,
1063 ULONGcxx . . $ ULONG# ulAttribute, void* pBuffer)
1064 {
1065 if (!phContext)
1066 return SEC_E_INVALID_HANDLEcxx . . $ `winpr/include/winpr/sspi.h:135:9`!;
1067
1068 if (!pBuffer)
1069 return SEC_E_INSUFFICIENT_MEMORYcxx . . $ `winpr/include/winpr/sspi.h:134:9`!;
1070
1071 NTLM_CONTEXTcxx . . $ NTLM_CONTEXT#* context = (NTLM_CONTEXTcxx . . $ NTLM_CONTEXT#*)sspi_SecureHandleGetLowerPointercxx . . $ sspi_SecureHandleGetLowerPointer(850d8027e444f59b).(phContext);
1072 if (!check_contextcxx . . $ `winpr/libwinpr/sspi/NTLM/ntlm.c:50:9`!(context))
1073 return SEC_E_INVALID_HANDLEcxx . . $ `winpr/include/winpr/sspi.h:135:9`!;
1074
1075 switch (ulAttribute)
1076 {
1077 case SECPKG_ATTR_AUTH_IDENTITYcxx . . $ SECPKG_ATTR_AUTH_IDENTITY.:
1078 {
1079 SecPkgContext_AuthIdentitycxx . . $ SecPkgContext_AuthIdentity#* AuthIdentity = (SecPkgContext_AuthIdentitycxx . . $ SecPkgContext_AuthIdentity#*)pBuffer;
1080 SSPI_CREDENTIALScxx . . $ SSPI_CREDENTIALS#* credentials = context->credentialscxx . . $ $anonymous_type_544b217a83a6fa2a_13#credentials.;
1081 if (!credentials)
1082 return SEC_E_INTERNAL_ERRORcxx . . $ `winpr/include/winpr/sspi.h:138:9`!;
1083 if (!identityToAuthIdentitycxx . . $ identityToAuthIdentity(9cb2c3ac88ea686c).(&credentials->identitycxx . . $ $anonymous_type_5960768699aeeb84_0#identity., AuthIdentity))
1084 return SEC_E_INTERNAL_ERRORcxx . . $ `winpr/include/winpr/sspi.h:138:9`!;
1085 context->UseSamFileDatabasecxx . . $ $anonymous_type_544b217a83a6fa2a_13#UseSamFileDatabase. = FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!;
1086 return SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!;
1087 }
1088 case SECPKG_ATTR_SIZEScxx . . $ `winpr/include/winpr/sspi.h:267:9`!:
1089 {
1090 SecPkgContext_Sizescxx . . $ SecPkgContext_Sizes#* ContextSizes = (SecPkgContext_Sizescxx . . $ SecPkgContext_Sizes#*)pBuffer;
1091 ContextSizes->cbMaxTokencxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_24#cbMaxToken. = 2010;
1092 ContextSizes->cbMaxSignaturecxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_24#cbMaxSignature. = 16; /* the size of expected signature is 16 bytes */
1093 ContextSizes->cbBlockSizecxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_24#cbBlockSize. = 0; /* no padding */
1094 ContextSizes->cbSecurityTrailercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_24#cbSecurityTrailer. = 16; /* no security trailer appended in NTLM
1095 contrary to Kerberos */
1096 return SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!;
1097 }
1098 case SECPKG_ATTR_AUTH_NTLM_NTPROOF_VALUEcxx . . $ SECPKG_ATTR_AUTH_NTLM_NTPROOF_VALUE.:
1099 return ntlm_computeProofValuecxx . . $ ntlm_computeProofValue(cc5b7ad649ddaba1).(context, (SecBuffercxx . . $ SecBuffer#*)pBuffer);
1100
1101 case SECPKG_ATTR_AUTH_NTLM_RANDKEYcxx . . $ SECPKG_ATTR_AUTH_NTLM_RANDKEY.:
1102 {
1103 SecBuffercxx . . $ SecBuffer#* randkey = (SecBuffercxx . . $ SecBuffer#*)pBuffer;
1104
1105 if (!sspi_SecBufferAlloccxx . . $ sspi_SecBufferAlloc(390a1ca73a7a932d).(randkey, 16))
1106 return (SEC_E_INSUFFICIENT_MEMORYcxx . . $ `winpr/include/winpr/sspi.h:134:9`!);
1107
1108 CopyMemorycxx . . $ `winpr/include/winpr/crt.h:123:9`!(randkey->pvBuffer, context->EncryptedRandomSessionKey, 16);
1109 return (SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!);
1110 }
1111
1112 case SECPKG_ATTR_AUTH_NTLM_MICcxx . . $ SECPKG_ATTR_AUTH_NTLM_MIC.:
1113 {
1114 SecBuffercxx . . $ SecBuffer#* mic = (SecBuffercxx . . $ SecBuffer#*)pBuffer;
1115 NTLM_AUTHENTICATE_MESSAGEcxx . . $ NTLM_AUTHENTICATE_MESSAGE#* message = &context->AUTHENTICATE_MESSAGEcxx . . $ $anonymous_type_544b217a83a6fa2a_13#AUTHENTICATE_MESSAGE.;
1116
1117 if (!sspi_SecBufferAlloccxx . . $ sspi_SecBufferAlloc(390a1ca73a7a932d).(mic, 16))
1118 return (SEC_E_INSUFFICIENT_MEMORYcxx . . $ `winpr/include/winpr/sspi.h:134:9`!);
1119
1120 CopyMemorycxx . . $ `winpr/include/winpr/crt.h:123:9`!(mic->pvBuffer, message->MessageIntegrityCheck, 16);
1121 return (SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!);
1122 }
1123
1124 case SECPKG_ATTR_AUTH_NTLM_MIC_VALUEcxx . . $ SECPKG_ATTR_AUTH_NTLM_MIC_VALUE.:
1125 return ntlm_computeMicValuecxx . . $ ntlm_computeMicValue(cc5b7ad649ddaba1).(context, (SecBuffercxx . . $ SecBuffer#*)pBuffer);
1126
1127 default:
1128 WLog_ERRcxx . . $ `winpr/include/winpr/wlog.h:347:9`!(TAGcxx . . $ `winpr/libwinpr/sspi/NTLM/ntlm.c:42:9`!, "TODO: Implement ulAttribute=0x%08" PRIx32cxx . . $ `<external>/15933738808807975373/inttypes.h:125:10`!, ulAttribute);
1129 return SEC_E_UNSUPPORTED_FUNCTIONcxx . . $ `winpr/include/winpr/sspi.h:136:9`!;
1130 }
1131 }
1132
1133 /* http://msdn.microsoft.com/en-us/library/windows/desktop/aa379337/ */
1134 WINPR_ATTR_NODISCARDcxx . . $ `winpr/include/winpr/platform.h:105:9`!
1135 static SECURITY_STATUScxx . . $ SECURITY_STATUS# SEC_ENTRYcxx . . $ `winpr/include/winpr/sspi.h:44:9`! ntlm_QueryContextAttributesWcxx . . $ ntlm_QueryContextAttributesW(998cea891dba569e).(PCtxtHandlecxx . . $ PCtxtHandle# phContext,
1136 ULONGcxx . . $ ULONG# ulAttribute, void* pBuffer)
1137 {
1138 if (!phContext)
1139 return SEC_E_INVALID_HANDLEcxx . . $ `winpr/include/winpr/sspi.h:135:9`!;
1140
1141 if (!pBuffer)
1142 return SEC_E_INSUFFICIENT_MEMORYcxx . . $ `winpr/include/winpr/sspi.h:134:9`!;
1143
1144 NTLM_CONTEXTcxx . . $ NTLM_CONTEXT#* context = (NTLM_CONTEXTcxx . . $ NTLM_CONTEXT#*)sspi_SecureHandleGetLowerPointercxx . . $ sspi_SecureHandleGetLowerPointer(850d8027e444f59b).(phContext);
1145 if (!check_contextcxx . . $ `winpr/libwinpr/sspi/NTLM/ntlm.c:50:9`!(context))
1146 return SEC_E_INVALID_HANDLEcxx . . $ `winpr/include/winpr/sspi.h:135:9`!;
1147
1148 switch (ulAttribute)
1149 {
1150 case SECPKG_ATTR_AUTH_NTLM_HOSTNAMEcxx . . $ SECPKG_ATTR_AUTH_NTLM_HOSTNAME.:
1151 {
1152 memcpycxx . . $ memcpy(cc817cb175f282d).(pBuffer, context->Workstationcxx . . $ $anonymous_type_544b217a83a6fa2a_13#Workstation..Buffercxx . . $ $anonymous_type_41beb9bb5fd0dd86_2#Buffer., context->Workstationcxx . . $ $anonymous_type_544b217a83a6fa2a_13#Workstation..Lengthcxx . . $ $anonymous_type_41beb9bb5fd0dd86_2#Length.);
1153 return SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!;
1154 }
1155 case SECPKG_ATTR_AUTH_NTLM_NB_DOMAIN_NAMEcxx . . $ SECPKG_ATTR_AUTH_NTLM_NB_DOMAIN_NAME.:
1156 {
1157 memcpycxx . . $ memcpy(cc817cb175f282d).(pBuffer, context->NbDomainNamecxx . . $ $anonymous_type_544b217a83a6fa2a_13#NbDomainName..Buffercxx . . $ $anonymous_type_41beb9bb5fd0dd86_2#Buffer., context->NbDomainNamecxx . . $ $anonymous_type_544b217a83a6fa2a_13#NbDomainName..Lengthcxx . . $ $anonymous_type_41beb9bb5fd0dd86_2#Length.);
1158 return SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!;
1159 }
1160 case SECPKG_ATTR_AUTH_NTLM_NB_COMPUTER_NAMEcxx . . $ SECPKG_ATTR_AUTH_NTLM_NB_COMPUTER_NAME.:
1161 {
1162 memcpycxx . . $ memcpy(cc817cb175f282d).(pBuffer, context->NbComputerNamecxx . . $ $anonymous_type_544b217a83a6fa2a_13#NbComputerName..Buffercxx . . $ $anonymous_type_41beb9bb5fd0dd86_2#Buffer., context->NbComputerNamecxx . . $ $anonymous_type_544b217a83a6fa2a_13#NbComputerName..Lengthcxx . . $ $anonymous_type_41beb9bb5fd0dd86_2#Length.);
1163 return SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!;
1164 }
1165 case SECPKG_ATTR_AUTH_NTLM_DNS_DOMAIN_NAMEcxx . . $ SECPKG_ATTR_AUTH_NTLM_DNS_DOMAIN_NAME.:
1166 {
1167 memcpycxx . . $ memcpy(cc817cb175f282d).(pBuffer, context->DnsDomainNamecxx . . $ $anonymous_type_544b217a83a6fa2a_13#DnsDomainName..Buffercxx . . $ $anonymous_type_41beb9bb5fd0dd86_2#Buffer., context->DnsDomainNamecxx . . $ $anonymous_type_544b217a83a6fa2a_13#DnsDomainName..Lengthcxx . . $ $anonymous_type_41beb9bb5fd0dd86_2#Length.);
1168 return SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!;
1169 }
1170 case SECPKG_ATTR_AUTH_NTLM_DNS_COMPUTER_NAMEcxx . . $ SECPKG_ATTR_AUTH_NTLM_DNS_COMPUTER_NAME.:
1171 {
1172 memcpycxx . . $ memcpy(cc817cb175f282d).(pBuffer, context->DnsComputerNamecxx . . $ $anonymous_type_544b217a83a6fa2a_13#DnsComputerName..Buffercxx . . $ $anonymous_type_41beb9bb5fd0dd86_2#Buffer., context->DnsComputerNamecxx . . $ $anonymous_type_544b217a83a6fa2a_13#DnsComputerName..Lengthcxx . . $ $anonymous_type_41beb9bb5fd0dd86_2#Length.);
1173 return SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!;
1174 }
1175
1176 case SECPKG_ATTR_PACKAGE_INFOcxx . . $ `winpr/include/winpr/sspi.h:277:9`!:
1177 {
1178 SecPkgContext_PackageInfoWcxx . . $ SecPkgContext_PackageInfoW#* PackageInfo = (SecPkgContext_PackageInfoWcxx . . $ SecPkgContext_PackageInfoW#*)pBuffer;
1179 size_t size = sizeof(SecPkgInfoWcxx . . $ SecPkgInfoW#);
1180 SecPkgInfoWcxx . . $ SecPkgInfoW#* pPackageInfo =
1181 (SecPkgInfoWcxx . . $ SecPkgInfoW#*)sspi_ContextBufferAlloccxx . . $ sspi_ContextBufferAlloc(2683421e6da7745b).(QuerySecurityPackageInfoIndexcxx . . $ QuerySecurityPackageInfoIndex., size);
1182
1183 if (!pPackageInfo)
1184 return SEC_E_INSUFFICIENT_MEMORYcxx . . $ `winpr/include/winpr/sspi.h:134:9`!;
1185
1186 pPackageInfo->fCapabilitiescxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_2#fCapabilities. = NTLM_SecPkgInfoWcxx . . $ NTLM_SecPkgInfoW..fCapabilitiescxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_2#fCapabilities.;
1187 pPackageInfo->wVersioncxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_2#wVersion. = NTLM_SecPkgInfoWcxx . . $ NTLM_SecPkgInfoW..wVersioncxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_2#wVersion.;
1188 pPackageInfo->wRPCIDcxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_2#wRPCID. = NTLM_SecPkgInfoWcxx . . $ NTLM_SecPkgInfoW..wRPCIDcxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_2#wRPCID.;
1189 pPackageInfo->cbMaxTokencxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_2#cbMaxToken. = NTLM_SecPkgInfoWcxx . . $ NTLM_SecPkgInfoW..cbMaxTokencxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_2#cbMaxToken.;
1190 pPackageInfo->Namecxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_2#Name. = _wcsdupcxx . . $ _wcsdup(9e424e4e1cead538).(NTLM_SecPkgInfoWcxx . . $ NTLM_SecPkgInfoW..Namecxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_2#Name.);
1191 pPackageInfo->Commentcxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_2#Comment. = _wcsdupcxx . . $ _wcsdup(9e424e4e1cead538).(NTLM_SecPkgInfoWcxx . . $ NTLM_SecPkgInfoW..Commentcxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_2#Comment.);
1192
1193 if (!pPackageInfo->Namecxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_2#Name. || !pPackageInfo->Commentcxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_2#Comment.)
1194 {
1195 sspi_ContextBufferFreecxx . . $ sspi_ContextBufferFree(5d22bdacc48458e8).(pPackageInfo);
1196 return SEC_E_INSUFFICIENT_MEMORYcxx . . $ `winpr/include/winpr/sspi.h:134:9`!;
1197 }
1198 PackageInfo->PackageInfocxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_20#PackageInfo. = pPackageInfo;
1199 return SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!;
1200 }
1201 default:
1202 return ntlm_QueryContextAttributesCommoncxx . . $ ntlm_QueryContextAttributesCommon(998cea891dba569e).(phContext, ulAttribute, pBuffer);
1203 }
1204 }
1205
1206 WINPR_ATTR_NODISCARDcxx . . $ `winpr/include/winpr/platform.h:105:9`!
1207 static SECURITY_STATUScxx . . $ SECURITY_STATUS# utf8lencxx . . $ utf8len(6bdbe5387991b24b).(const UNICODE_STRINGcxx . . $ UNICODE_STRING#* str, void* pBuffer)
1208 {
1209 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(str);
1210 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(pBuffer);
1211 ULONGcxx . . $ ULONG#* val = (ULONGcxx . . $ ULONG#*)pBuffer;
1212 const size_t wlen = str->Lengthcxx . . $ $anonymous_type_41beb9bb5fd0dd86_2#Length. / sizeof(WCHARcxx . . $ WCHAR#);
1213 const SSIZE_Tcxx . . $ SSIZE_T# rc = ConvertWCharNToUtf8cxx . . $ ConvertWCharNToUtf8(250a7607ff547331).(str->Buffercxx . . $ $anonymous_type_41beb9bb5fd0dd86_2#Buffer., wlen, nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, 0);
1214 if (rc < 0)
1215 return SEC_E_INVALID_PARAMETERcxx . . $ `winpr/include/winpr/sspi.h:201:9`!;
1216 *val = WINPR_ASSERTING_INT_CASTcxx . . $ `winpr/include/winpr/cast.h:111:9`!(ULONG, rc);
1217 return SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!;
1218 }
1219
1220 WINPR_ATTR_NODISCARDcxx . . $ `winpr/include/winpr/platform.h:105:9`!
1221 static SECURITY_STATUScxx . . $ SECURITY_STATUS# utf8strcxx . . $ utf8str(6bdbe5387991b24b).(const UNICODE_STRINGcxx . . $ UNICODE_STRING#* str, void* pBuffer)
1222 {
1223 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(str);
1224 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(pBuffer);
1225 ULONGcxx . . $ ULONG# len = 0;
1226
1227 const SECURITY_STATUScxx . . $ SECURITY_STATUS# status = utf8lencxx . . $ utf8len(6bdbe5387991b24b).(str, &len);
1228 if (status != SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!)
1229 return status;
1230 if (len == 0)
1231 return SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!;
1232
1233 const size_t wlen = str->Lengthcxx . . $ $anonymous_type_41beb9bb5fd0dd86_2#Length. / sizeof(WCHARcxx . . $ WCHAR#);
1234 const SSIZE_Tcxx . . $ SSIZE_T# rc = ConvertWCharNToUtf8cxx . . $ ConvertWCharNToUtf8(250a7607ff547331).(str->Buffercxx . . $ $anonymous_type_41beb9bb5fd0dd86_2#Buffer., wlen, pBuffer, (size_t)len);
1235 return rc < 0 ? SEC_E_INVALID_PARAMETERcxx . . $ `winpr/include/winpr/sspi.h:201:9`! : SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!;
1236 }
1237
1238 WINPR_ATTR_NODISCARDcxx . . $ `winpr/include/winpr/platform.h:105:9`!
1239 static SECURITY_STATUScxx . . $ SECURITY_STATUS# SEC_ENTRYcxx . . $ `winpr/include/winpr/sspi.h:44:9`! ntlm_QueryContextAttributesAcxx . . $ ntlm_QueryContextAttributesA(998cea891dba569e).(PCtxtHandlecxx . . $ PCtxtHandle# phContext,
1240 ULONGcxx . . $ ULONG# ulAttribute, void* pBuffer)
1241 {
1242 if (!phContext)
1243 return SEC_E_INVALID_HANDLEcxx . . $ `winpr/include/winpr/sspi.h:135:9`!;
1244
1245 if (!pBuffer)
1246 return SEC_E_INSUFFICIENT_MEMORYcxx . . $ `winpr/include/winpr/sspi.h:134:9`!;
1247
1248 NTLM_CONTEXTcxx . . $ NTLM_CONTEXT#* context = (NTLM_CONTEXTcxx . . $ NTLM_CONTEXT#*)sspi_SecureHandleGetLowerPointercxx . . $ sspi_SecureHandleGetLowerPointer(850d8027e444f59b).(phContext);
1249
1250 switch (ulAttribute)
1251 {
1252 case SECPKG_ATTR_AUTH_NTLM_HOSTNAME_LENcxx . . $ SECPKG_ATTR_AUTH_NTLM_HOSTNAME_LEN.:
1253 return utf8lencxx . . $ utf8len(6bdbe5387991b24b).(&context->Workstationcxx . . $ $anonymous_type_544b217a83a6fa2a_13#Workstation., pBuffer);
1254 case SECPKG_ATTR_AUTH_NTLM_NB_DOMAIN_NAME_LENcxx . . $ SECPKG_ATTR_AUTH_NTLM_NB_DOMAIN_NAME_LEN.:
1255 return utf8lencxx . . $ utf8len(6bdbe5387991b24b).(&context->NbDomainNamecxx . . $ $anonymous_type_544b217a83a6fa2a_13#NbDomainName., pBuffer);
1256 case SECPKG_ATTR_AUTH_NTLM_NB_COMPUTER_NAME_LENcxx . . $ SECPKG_ATTR_AUTH_NTLM_NB_COMPUTER_NAME_LEN.:
1257 return utf8lencxx . . $ utf8len(6bdbe5387991b24b).(&context->NbComputerNamecxx . . $ $anonymous_type_544b217a83a6fa2a_13#NbComputerName., pBuffer);
1258 case SECPKG_ATTR_AUTH_NTLM_DNS_DOMAIN_NAME_LENcxx . . $ SECPKG_ATTR_AUTH_NTLM_DNS_DOMAIN_NAME_LEN.:
1259 return utf8lencxx . . $ utf8len(6bdbe5387991b24b).(&context->DnsDomainNamecxx . . $ $anonymous_type_544b217a83a6fa2a_13#DnsDomainName., pBuffer);
1260 case SECPKG_ATTR_AUTH_NTLM_DNS_COMPUTER_NAME_LENcxx . . $ SECPKG_ATTR_AUTH_NTLM_DNS_COMPUTER_NAME_LEN.:
1261 return utf8lencxx . . $ utf8len(6bdbe5387991b24b).(&context->DnsComputerNamecxx . . $ $anonymous_type_544b217a83a6fa2a_13#DnsComputerName., pBuffer);
1262 case SECPKG_ATTR_AUTH_NTLM_HOSTNAMEcxx . . $ SECPKG_ATTR_AUTH_NTLM_HOSTNAME.:
1263 return utf8strcxx . . $ utf8str(6bdbe5387991b24b).(&context->Workstationcxx . . $ $anonymous_type_544b217a83a6fa2a_13#Workstation., pBuffer);
1264 case SECPKG_ATTR_AUTH_NTLM_NB_DOMAIN_NAMEcxx . . $ SECPKG_ATTR_AUTH_NTLM_NB_DOMAIN_NAME.:
1265 return utf8strcxx . . $ utf8str(6bdbe5387991b24b).(&context->NbDomainNamecxx . . $ $anonymous_type_544b217a83a6fa2a_13#NbDomainName., pBuffer);
1266 case SECPKG_ATTR_AUTH_NTLM_NB_COMPUTER_NAMEcxx . . $ SECPKG_ATTR_AUTH_NTLM_NB_COMPUTER_NAME.:
1267 return utf8strcxx . . $ utf8str(6bdbe5387991b24b).(&context->NbComputerNamecxx . . $ $anonymous_type_544b217a83a6fa2a_13#NbComputerName., pBuffer);
1268 case SECPKG_ATTR_AUTH_NTLM_DNS_DOMAIN_NAMEcxx . . $ SECPKG_ATTR_AUTH_NTLM_DNS_DOMAIN_NAME.:
1269 return utf8strcxx . . $ utf8str(6bdbe5387991b24b).(&context->DnsDomainNamecxx . . $ $anonymous_type_544b217a83a6fa2a_13#DnsDomainName., pBuffer);
1270 case SECPKG_ATTR_AUTH_NTLM_DNS_COMPUTER_NAMEcxx . . $ SECPKG_ATTR_AUTH_NTLM_DNS_COMPUTER_NAME.:
1271 return utf8strcxx . . $ utf8str(6bdbe5387991b24b).(&context->DnsComputerNamecxx . . $ $anonymous_type_544b217a83a6fa2a_13#DnsComputerName., pBuffer);
1272 case SECPKG_ATTR_PACKAGE_INFOcxx . . $ `winpr/include/winpr/sspi.h:277:9`!:
1273 {
1274 SecPkgContext_PackageInfoAcxx . . $ SecPkgContext_PackageInfoA#* PackageInfo = (SecPkgContext_PackageInfoAcxx . . $ SecPkgContext_PackageInfoA#*)pBuffer;
1275 size_t size = sizeof(SecPkgInfoAcxx . . $ SecPkgInfoA#);
1276 SecPkgInfoAcxx . . $ SecPkgInfoA#* pPackageInfo =
1277 (SecPkgInfoAcxx . . $ SecPkgInfoA#*)sspi_ContextBufferAlloccxx . . $ sspi_ContextBufferAlloc(2683421e6da7745b).(QuerySecurityPackageInfoIndexcxx . . $ QuerySecurityPackageInfoIndex., size);
1278
1279 if (!pPackageInfo)
1280 return SEC_E_INSUFFICIENT_MEMORYcxx . . $ `winpr/include/winpr/sspi.h:134:9`!;
1281
1282 pPackageInfo->fCapabilitiescxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_1#fCapabilities. = NTLM_SecPkgInfoAcxx . . $ NTLM_SecPkgInfoA..fCapabilitiescxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_1#fCapabilities.;
1283 pPackageInfo->wVersioncxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_1#wVersion. = NTLM_SecPkgInfoAcxx . . $ NTLM_SecPkgInfoA..wVersioncxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_1#wVersion.;
1284 pPackageInfo->wRPCIDcxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_1#wRPCID. = NTLM_SecPkgInfoAcxx . . $ NTLM_SecPkgInfoA..wRPCIDcxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_1#wRPCID.;
1285 pPackageInfo->cbMaxTokencxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_1#cbMaxToken. = NTLM_SecPkgInfoAcxx . . $ NTLM_SecPkgInfoA..cbMaxTokencxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_1#cbMaxToken.;
1286 pPackageInfo->Namecxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_1#Name. = _strdupcxx . . $ _strdup(a8b8e32347182212).(NTLM_SecPkgInfoAcxx . . $ NTLM_SecPkgInfoA..Namecxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_1#Name.);
1287 pPackageInfo->Commentcxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_1#Comment. = _strdupcxx . . $ _strdup(a8b8e32347182212).(NTLM_SecPkgInfoAcxx . . $ NTLM_SecPkgInfoA..Commentcxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_1#Comment.);
1288
1289 if (!pPackageInfo->Namecxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_1#Name. || !pPackageInfo->Commentcxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_1#Comment.)
1290 {
1291 sspi_ContextBufferFreecxx . . $ sspi_ContextBufferFree(5d22bdacc48458e8).(pPackageInfo);
1292 return SEC_E_INSUFFICIENT_MEMORYcxx . . $ `winpr/include/winpr/sspi.h:134:9`!;
1293 }
1294 PackageInfo->PackageInfocxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_19#PackageInfo. = pPackageInfo;
1295 return SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!;
1296 }
1297
1298 default:
1299 return ntlm_QueryContextAttributesCommoncxx . . $ ntlm_QueryContextAttributesCommon(998cea891dba569e).(phContext, ulAttribute, pBuffer);
1300 }
1301 }
1302
1303 WINPR_ATTR_NODISCARDcxx . . $ `winpr/include/winpr/platform.h:105:9`!
1304 static SECURITY_STATUScxx . . $ SECURITY_STATUS# SEC_ENTRYcxx . . $ `winpr/include/winpr/sspi.h:44:9`! ntlm_SetContextAttributesCommoncxx . . $ ntlm_SetContextAttributesCommon(b9cda4e27f1b3388).(PCtxtHandlecxx . . $ PCtxtHandle# phContext,
1305 ULONGcxx . . $ ULONG# ulAttribute, void* pBuffer,
1306 ULONGcxx . . $ ULONG# cbBuffer)
1307 {
1308 if (!phContext)
1309 return SEC_E_INVALID_HANDLEcxx . . $ `winpr/include/winpr/sspi.h:135:9`!;
1310
1311 if (!pBuffer)
1312 return SEC_E_INVALID_PARAMETERcxx . . $ `winpr/include/winpr/sspi.h:201:9`!;
1313
1314 NTLM_CONTEXTcxx . . $ NTLM_CONTEXT#* context = (NTLM_CONTEXTcxx . . $ NTLM_CONTEXT#*)sspi_SecureHandleGetLowerPointercxx . . $ sspi_SecureHandleGetLowerPointer(850d8027e444f59b).(phContext);
1315 if (!context)
1316 return SEC_E_INVALID_HANDLEcxx . . $ `winpr/include/winpr/sspi.h:135:9`!;
1317
1318 switch (ulAttribute)
1319 {
1320 case SECPKG_ATTR_AUTH_NTLM_HASHcxx . . $ SECPKG_ATTR_AUTH_NTLM_HASH.:
1321 {
1322 SecPkgContext_AuthNtlmHashcxx . . $ SecPkgContext_AuthNtlmHash#* AuthNtlmHash = (SecPkgContext_AuthNtlmHashcxx . . $ SecPkgContext_AuthNtlmHash#*)pBuffer;
1323
1324 if (cbBuffer < sizeof(SecPkgContext_AuthNtlmHashcxx . . $ SecPkgContext_AuthNtlmHash#))
1325 return SEC_E_INVALID_PARAMETERcxx . . $ `winpr/include/winpr/sspi.h:201:9`!;
1326
1327 if (AuthNtlmHash->Versioncxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_58#Version. == 1)
1328 CopyMemorycxx . . $ `winpr/include/winpr/crt.h:123:9`!(context->NtlmHash, AuthNtlmHash->NtlmHash, 16);
1329 else if (AuthNtlmHash->Versioncxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_58#Version. == 2)
1330 CopyMemorycxx . . $ `winpr/include/winpr/crt.h:123:9`!(context->NtlmV2Hash, AuthNtlmHash->NtlmHash, 16);
1331
1332 return SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!;
1333 }
1334
1335 case SECPKG_ATTR_AUTH_NTLM_MESSAGEcxx . . $ SECPKG_ATTR_AUTH_NTLM_MESSAGE.:
1336 {
1337 SecPkgContext_AuthNtlmMessagecxx . . $ SecPkgContext_AuthNtlmMessage#* AuthNtlmMessage =
1338 (SecPkgContext_AuthNtlmMessagecxx . . $ SecPkgContext_AuthNtlmMessage#*)pBuffer;
1339
1340 if (cbBuffer < sizeof(SecPkgContext_AuthNtlmMessagecxx . . $ SecPkgContext_AuthNtlmMessage#))
1341 return SEC_E_INVALID_PARAMETERcxx . . $ `winpr/include/winpr/sspi.h:201:9`!;
1342
1343 if (AuthNtlmMessage->typecxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_62#type. == 1)
1344 {
1345 if (!ntlm_SecBufferRealloccxx . . $ ntlm_SecBufferRealloc(c43574e4947ec252).(&context->NegotiateMessagecxx . . $ $anonymous_type_544b217a83a6fa2a_13#NegotiateMessage., AuthNtlmMessage->lengthcxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_62#length.))
1346 return SEC_E_INSUFFICIENT_MEMORYcxx . . $ `winpr/include/winpr/sspi.h:134:9`!;
1347
1348 CopyMemorycxx . . $ `winpr/include/winpr/crt.h:123:9`!(context->NegotiateMessage.pvBuffer, AuthNtlmMessage->buffer,
1349 AuthNtlmMessage->length);
1350 }
1351 else if (AuthNtlmMessage->typecxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_62#type. == 2)
1352 {
1353 if (!ntlm_SecBufferRealloccxx . . $ ntlm_SecBufferRealloc(c43574e4947ec252).(&context->ChallengeMessagecxx . . $ $anonymous_type_544b217a83a6fa2a_13#ChallengeMessage., AuthNtlmMessage->lengthcxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_62#length.))
1354 return SEC_E_INSUFFICIENT_MEMORYcxx . . $ `winpr/include/winpr/sspi.h:134:9`!;
1355
1356 CopyMemorycxx . . $ `winpr/include/winpr/crt.h:123:9`!(context->ChallengeMessage.pvBuffer, AuthNtlmMessage->buffer,
1357 AuthNtlmMessage->length);
1358 }
1359 else if (AuthNtlmMessage->typecxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_62#type. == 3)
1360 {
1361 if (!ntlm_SecBufferRealloccxx . . $ ntlm_SecBufferRealloc(c43574e4947ec252).(&context->AuthenticateMessagecxx . . $ $anonymous_type_544b217a83a6fa2a_13#AuthenticateMessage., AuthNtlmMessage->lengthcxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_62#length.))
1362 return SEC_E_INSUFFICIENT_MEMORYcxx . . $ `winpr/include/winpr/sspi.h:134:9`!;
1363
1364 CopyMemorycxx . . $ `winpr/include/winpr/crt.h:123:9`!(context->AuthenticateMessage.pvBuffer, AuthNtlmMessage->buffer,
1365 AuthNtlmMessage->length);
1366 }
1367
1368 return SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!;
1369 }
1370
1371 case SECPKG_ATTR_AUTH_NTLM_TIMESTAMPcxx . . $ SECPKG_ATTR_AUTH_NTLM_TIMESTAMP.:
1372 {
1373 SecPkgContext_AuthNtlmTimestampcxx . . $ SecPkgContext_AuthNtlmTimestamp#* AuthNtlmTimestamp =
1374 (SecPkgContext_AuthNtlmTimestampcxx . . $ SecPkgContext_AuthNtlmTimestamp#*)pBuffer;
1375
1376 if (cbBuffer < sizeof(SecPkgContext_AuthNtlmTimestampcxx . . $ SecPkgContext_AuthNtlmTimestamp#))
1377 return SEC_E_INVALID_PARAMETERcxx . . $ `winpr/include/winpr/sspi.h:201:9`!;
1378
1379 if (AuthNtlmTimestamp->ChallengeOrResponsecxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_59#ChallengeOrResponse.)
1380 CopyMemorycxx . . $ `winpr/include/winpr/crt.h:123:9`!(context->ChallengeTimestamp, AuthNtlmTimestamp->Timestamp, 8);
1381 else
1382 CopyMemorycxx . . $ `winpr/include/winpr/crt.h:123:9`!(context->Timestamp, AuthNtlmTimestamp->Timestamp, 8);
1383
1384 return SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!;
1385 }
1386
1387 case SECPKG_ATTR_AUTH_NTLM_CLIENT_CHALLENGEcxx . . $ SECPKG_ATTR_AUTH_NTLM_CLIENT_CHALLENGE.:
1388 {
1389 SecPkgContext_AuthNtlmClientChallengecxx . . $ SecPkgContext_AuthNtlmClientChallenge#* AuthNtlmClientChallenge =
1390 (SecPkgContext_AuthNtlmClientChallengecxx . . $ SecPkgContext_AuthNtlmClientChallenge#*)pBuffer;
1391
1392 if (cbBuffer < sizeof(SecPkgContext_AuthNtlmClientChallengecxx . . $ SecPkgContext_AuthNtlmClientChallenge#))
1393 return SEC_E_INVALID_PARAMETERcxx . . $ `winpr/include/winpr/sspi.h:201:9`!;
1394
1395 CopyMemorycxx . . $ `winpr/include/winpr/crt.h:123:9`!(context->ClientChallenge, AuthNtlmClientChallenge->ClientChallenge, 8);
1396 return SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!;
1397 }
1398
1399 case SECPKG_ATTR_AUTH_NTLM_SERVER_CHALLENGEcxx . . $ SECPKG_ATTR_AUTH_NTLM_SERVER_CHALLENGE.:
1400 {
1401 SecPkgContext_AuthNtlmServerChallengecxx . . $ SecPkgContext_AuthNtlmServerChallenge#* AuthNtlmServerChallenge =
1402 (SecPkgContext_AuthNtlmServerChallengecxx . . $ SecPkgContext_AuthNtlmServerChallenge#*)pBuffer;
1403
1404 if (cbBuffer < sizeof(SecPkgContext_AuthNtlmServerChallengecxx . . $ SecPkgContext_AuthNtlmServerChallenge#))
1405 return SEC_E_INVALID_PARAMETERcxx . . $ `winpr/include/winpr/sspi.h:201:9`!;
1406
1407 CopyMemorycxx . . $ `winpr/include/winpr/crt.h:123:9`!(context->ServerChallenge, AuthNtlmServerChallenge->ServerChallenge, 8);
1408 return SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!;
1409 }
1410
1411 default:
1412 WLog_ERRcxx . . $ `winpr/include/winpr/wlog.h:347:9`!(TAGcxx . . $ `winpr/libwinpr/sspi/NTLM/ntlm.c:42:9`!, "TODO: Implement ulAttribute=%08" PRIx32cxx . . $ `<external>/15933738808807975373/inttypes.h:125:10`!, ulAttribute);
1413 return SEC_E_UNSUPPORTED_FUNCTIONcxx . . $ `winpr/include/winpr/sspi.h:136:9`!;
1414 }
1415 }
1416
1417 WINPR_ATTR_NODISCARDcxx . . $ `winpr/include/winpr/platform.h:105:9`!
1418 static SECURITY_STATUScxx . . $ SECURITY_STATUS# ntml_setUnicodeStringWcxx . . $ ntml_setUnicodeStringW(dfa7c31fda8e3b89).(UNICODE_STRINGcxx . . $ UNICODE_STRING#* str, const WCHARcxx . . $ WCHAR#* val, size_t bytelen)
1419 {
1420 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(str);
1421 ntlm_free_unicode_stringcxx . . $ ntlm_free_unicode_string(e80ef3157579d559).(str);
1422 *str = ntlm_from_unicode_string_wcxx . . $ ntlm_from_unicode_string_w(b33fe2b328e22617).(val, bytelen / sizeof(WCHARcxx . . $ WCHAR#));
1423 if (ntlm_is_unicode_string_emptycxx . . $ ntlm_is_unicode_string_empty(8bceef4d9b3378cb).(str))
1424 return SEC_E_INVALID_PARAMETERcxx . . $ `winpr/include/winpr/sspi.h:201:9`!;
1425 return SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!;
1426 }
1427
1428 WINPR_ATTR_NODISCARDcxx . . $ `winpr/include/winpr/platform.h:105:9`!
1429 static SECURITY_STATUScxx . . $ SECURITY_STATUS# utf16lencxx . . $ utf16len(6bdbe5387991b24b).(const UNICODE_STRINGcxx . . $ UNICODE_STRING#* str, void* pBuffer)
1430 {
1431 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(str);
1432 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(pBuffer);
1433 ULONGcxx . . $ ULONG#* val = (ULONGcxx . . $ ULONG#*)pBuffer;
1434 *val = str->Lengthcxx . . $ $anonymous_type_41beb9bb5fd0dd86_2#Length.;
1435 return SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!;
1436 }
1437
1438 WINPR_ATTR_NODISCARDcxx . . $ `winpr/include/winpr/platform.h:105:9`!
1439 static SECURITY_STATUScxx . . $ SECURITY_STATUS# SEC_ENTRYcxx . . $ `winpr/include/winpr/sspi.h:44:9`! ntlm_SetContextAttributesWcxx . . $ ntlm_SetContextAttributesW(b9cda4e27f1b3388).(PCtxtHandlecxx . . $ PCtxtHandle# phContext,
1440 ULONGcxx . . $ ULONG# ulAttribute, void* pBuffer,
1441 ULONGcxx . . $ ULONG# cbBuffer)
1442 {
1443 if (!phContext)
1444 return SEC_E_INVALID_HANDLEcxx . . $ `winpr/include/winpr/sspi.h:135:9`!;
1445
1446 if (!pBuffer)
1447 return SEC_E_INVALID_PARAMETERcxx . . $ `winpr/include/winpr/sspi.h:201:9`!;
1448
1449 NTLM_CONTEXTcxx . . $ NTLM_CONTEXT#* context = (NTLM_CONTEXTcxx . . $ NTLM_CONTEXT#*)sspi_SecureHandleGetLowerPointercxx . . $ sspi_SecureHandleGetLowerPointer(850d8027e444f59b).(phContext);
1450 if (!context)
1451 return SEC_E_INVALID_HANDLEcxx . . $ `winpr/include/winpr/sspi.h:135:9`!;
1452
1453 switch (ulAttribute)
1454 {
1455 case SECPKG_ATTR_AUTH_NTLM_HOSTNAME_LENcxx . . $ SECPKG_ATTR_AUTH_NTLM_HOSTNAME_LEN.:
1456 return utf16lencxx . . $ utf16len(6bdbe5387991b24b).(&context->Workstationcxx . . $ $anonymous_type_544b217a83a6fa2a_13#Workstation., pBuffer);
1457 case SECPKG_ATTR_AUTH_NTLM_NB_DOMAIN_NAME_LENcxx . . $ SECPKG_ATTR_AUTH_NTLM_NB_DOMAIN_NAME_LEN.:
1458 return utf16lencxx . . $ utf16len(6bdbe5387991b24b).(&context->NbDomainNamecxx . . $ $anonymous_type_544b217a83a6fa2a_13#NbDomainName., pBuffer);
1459 case SECPKG_ATTR_AUTH_NTLM_NB_COMPUTER_NAME_LENcxx . . $ SECPKG_ATTR_AUTH_NTLM_NB_COMPUTER_NAME_LEN.:
1460 return utf16lencxx . . $ utf16len(6bdbe5387991b24b).(&context->NbComputerNamecxx . . $ $anonymous_type_544b217a83a6fa2a_13#NbComputerName., pBuffer);
1461 case SECPKG_ATTR_AUTH_NTLM_DNS_DOMAIN_NAME_LENcxx . . $ SECPKG_ATTR_AUTH_NTLM_DNS_DOMAIN_NAME_LEN.:
1462 return utf16lencxx . . $ utf16len(6bdbe5387991b24b).(&context->DnsDomainNamecxx . . $ $anonymous_type_544b217a83a6fa2a_13#DnsDomainName., pBuffer);
1463 case SECPKG_ATTR_AUTH_NTLM_DNS_COMPUTER_NAME_LENcxx . . $ SECPKG_ATTR_AUTH_NTLM_DNS_COMPUTER_NAME_LEN.:
1464 return utf16lencxx . . $ utf16len(6bdbe5387991b24b).(&context->DnsComputerNamecxx . . $ $anonymous_type_544b217a83a6fa2a_13#DnsComputerName., pBuffer);
1465 case SECPKG_ATTR_AUTH_NTLM_HOSTNAMEcxx . . $ SECPKG_ATTR_AUTH_NTLM_HOSTNAME.:
1466 return ntml_setUnicodeStringWcxx . . $ ntml_setUnicodeStringW(dfa7c31fda8e3b89).(&context->Workstationcxx . . $ $anonymous_type_544b217a83a6fa2a_13#Workstation., pBuffer, cbBuffer);
1467 case SECPKG_ATTR_AUTH_NTLM_NB_DOMAIN_NAMEcxx . . $ SECPKG_ATTR_AUTH_NTLM_NB_DOMAIN_NAME.:
1468 return ntml_setUnicodeStringWcxx . . $ ntml_setUnicodeStringW(dfa7c31fda8e3b89).(&context->NbDomainNamecxx . . $ $anonymous_type_544b217a83a6fa2a_13#NbDomainName., pBuffer, cbBuffer);
1469 case SECPKG_ATTR_AUTH_NTLM_NB_COMPUTER_NAMEcxx . . $ SECPKG_ATTR_AUTH_NTLM_NB_COMPUTER_NAME.:
1470 return ntml_setUnicodeStringWcxx . . $ ntml_setUnicodeStringW(dfa7c31fda8e3b89).(&context->NbComputerNamecxx . . $ $anonymous_type_544b217a83a6fa2a_13#NbComputerName., pBuffer, cbBuffer);
1471 case SECPKG_ATTR_AUTH_NTLM_DNS_DOMAIN_NAMEcxx . . $ SECPKG_ATTR_AUTH_NTLM_DNS_DOMAIN_NAME.:
1472 return ntml_setUnicodeStringWcxx . . $ ntml_setUnicodeStringW(dfa7c31fda8e3b89).(&context->DnsDomainNamecxx . . $ $anonymous_type_544b217a83a6fa2a_13#DnsDomainName., pBuffer, cbBuffer);
1473 case SECPKG_ATTR_AUTH_NTLM_DNS_COMPUTER_NAMEcxx . . $ SECPKG_ATTR_AUTH_NTLM_DNS_COMPUTER_NAME.:
1474 return ntml_setUnicodeStringWcxx . . $ ntml_setUnicodeStringW(dfa7c31fda8e3b89).(&context->DnsComputerNamecxx . . $ $anonymous_type_544b217a83a6fa2a_13#DnsComputerName., pBuffer, cbBuffer);
1475
1476 default:
1477 return ntlm_SetContextAttributesCommoncxx . . $ ntlm_SetContextAttributesCommon(b9cda4e27f1b3388).(phContext, ulAttribute, pBuffer, cbBuffer);
1478 }
1479 }
1480
1481 SECURITY_STATUScxx . . $ SECURITY_STATUS# ntml_setUnicodeStringAcxx . . $ ntml_setUnicodeStringA(61636e5e24b9fc8a).(UNICODE_STRINGcxx . . $ UNICODE_STRING#* str, const char* val, size_t charlen)
1482 {
1483 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(str);
1484 ntlm_free_unicode_stringcxx . . $ ntlm_free_unicode_string(e80ef3157579d559).(str);
1485 *str = ntlm_from_unicode_string_utf8cxx . . $ ntlm_from_unicode_string_utf8(3cc85ee38b462723).(val, charlen);
1486 if (ntlm_is_unicode_string_emptycxx . . $ ntlm_is_unicode_string_empty(8bceef4d9b3378cb).(str))
1487 return SEC_E_INVALID_PARAMETERcxx . . $ `winpr/include/winpr/sspi.h:201:9`!;
1488 return SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!;
1489 }
1490
1491 WINPR_ATTR_NODISCARDcxx . . $ `winpr/include/winpr/platform.h:105:9`!
1492 static SECURITY_STATUScxx . . $ SECURITY_STATUS# SEC_ENTRYcxx . . $ `winpr/include/winpr/sspi.h:44:9`! ntlm_SetContextAttributesAcxx . . $ ntlm_SetContextAttributesA(b9cda4e27f1b3388).(PCtxtHandlecxx . . $ PCtxtHandle# phContext,
1493 ULONGcxx . . $ ULONG# ulAttribute, void* pBuffer,
1494 ULONGcxx . . $ ULONG# cbBuffer)
1495 {
1496 if (!phContext)
1497 return SEC_E_INVALID_HANDLEcxx . . $ `winpr/include/winpr/sspi.h:135:9`!;
1498
1499 if (!pBuffer)
1500 return SEC_E_INVALID_PARAMETERcxx . . $ `winpr/include/winpr/sspi.h:201:9`!;
1501
1502 NTLM_CONTEXTcxx . . $ NTLM_CONTEXT#* context = (NTLM_CONTEXTcxx . . $ NTLM_CONTEXT#*)sspi_SecureHandleGetLowerPointercxx . . $ sspi_SecureHandleGetLowerPointer(850d8027e444f59b).(phContext);
1503 if (!context)
1504 return SEC_E_INVALID_HANDLEcxx . . $ `winpr/include/winpr/sspi.h:135:9`!;
1505
1506 switch (ulAttribute)
1507 {
1508 case SECPKG_ATTR_AUTH_NTLM_HOSTNAMEcxx . . $ SECPKG_ATTR_AUTH_NTLM_HOSTNAME.:
1509 return ntml_setUnicodeStringAcxx . . $ ntml_setUnicodeStringA(61636e5e24b9fc8a).(&context->Workstationcxx . . $ $anonymous_type_544b217a83a6fa2a_13#Workstation., pBuffer, cbBuffer);
1510 case SECPKG_ATTR_AUTH_NTLM_NB_DOMAIN_NAMEcxx . . $ SECPKG_ATTR_AUTH_NTLM_NB_DOMAIN_NAME.:
1511 return ntml_setUnicodeStringAcxx . . $ ntml_setUnicodeStringA(61636e5e24b9fc8a).(&context->NbDomainNamecxx . . $ $anonymous_type_544b217a83a6fa2a_13#NbDomainName., pBuffer, cbBuffer);
1512 case SECPKG_ATTR_AUTH_NTLM_NB_COMPUTER_NAMEcxx . . $ SECPKG_ATTR_AUTH_NTLM_NB_COMPUTER_NAME.:
1513 return ntml_setUnicodeStringAcxx . . $ ntml_setUnicodeStringA(61636e5e24b9fc8a).(&context->NbComputerNamecxx . . $ $anonymous_type_544b217a83a6fa2a_13#NbComputerName., pBuffer, cbBuffer);
1514 case SECPKG_ATTR_AUTH_NTLM_DNS_DOMAIN_NAMEcxx . . $ SECPKG_ATTR_AUTH_NTLM_DNS_DOMAIN_NAME.:
1515 return ntml_setUnicodeStringAcxx . . $ ntml_setUnicodeStringA(61636e5e24b9fc8a).(&context->DnsDomainNamecxx . . $ $anonymous_type_544b217a83a6fa2a_13#DnsDomainName., pBuffer, cbBuffer);
1516 case SECPKG_ATTR_AUTH_NTLM_DNS_COMPUTER_NAMEcxx . . $ SECPKG_ATTR_AUTH_NTLM_DNS_COMPUTER_NAME.:
1517 return ntml_setUnicodeStringAcxx . . $ ntml_setUnicodeStringA(61636e5e24b9fc8a).(&context->DnsComputerNamecxx . . $ $anonymous_type_544b217a83a6fa2a_13#DnsComputerName., pBuffer, cbBuffer);
1518 default:
1519 return ntlm_SetContextAttributesCommoncxx . . $ ntlm_SetContextAttributesCommon(b9cda4e27f1b3388).(phContext, ulAttribute, pBuffer, cbBuffer);
1520 }
1521 }
1522
1523 WINPR_ATTR_NODISCARDcxx . . $ `winpr/include/winpr/platform.h:105:9`!
1524 static SECURITY_STATUScxx . . $ SECURITY_STATUS# SEC_ENTRYcxx . . $ `winpr/include/winpr/sspi.h:44:9`! ntlm_SetCredentialsAttributesWcxx . . $ ntlm_SetCredentialsAttributesW(b9cda4e27f1b3388).(
1525 WINPR_ATTR_UNUSEDcxx . . $ `winpr/include/winpr/platform.h:713:9`! PCredHandlecxx . . $ PCredHandle# phCredential, WINPR_ATTR_UNUSEDcxx . . $ `winpr/include/winpr/platform.h:713:9`! ULONGcxx . . $ ULONG# ulAttribute,
1526 WINPR_ATTR_UNUSEDcxx . . $ `winpr/include/winpr/platform.h:713:9`! void* pBuffer, WINPR_ATTR_UNUSEDcxx . . $ `winpr/include/winpr/platform.h:713:9`! ULONGcxx . . $ ULONG# cbBuffer)
1527 {
1528 return SEC_E_UNSUPPORTED_FUNCTIONcxx . . $ `winpr/include/winpr/sspi.h:136:9`!;
1529 }
1530
1531 WINPR_ATTR_NODISCARDcxx . . $ `winpr/include/winpr/platform.h:105:9`!
1532 static SECURITY_STATUScxx . . $ SECURITY_STATUS# SEC_ENTRYcxx . . $ `winpr/include/winpr/sspi.h:44:9`! ntlm_SetCredentialsAttributesAcxx . . $ ntlm_SetCredentialsAttributesA(b9cda4e27f1b3388).(
1533 WINPR_ATTR_UNUSEDcxx . . $ `winpr/include/winpr/platform.h:713:9`! PCredHandlecxx . . $ PCredHandle# phCredential, WINPR_ATTR_UNUSEDcxx . . $ `winpr/include/winpr/platform.h:713:9`! ULONGcxx . . $ ULONG# ulAttribute,
1534 WINPR_ATTR_UNUSEDcxx . . $ `winpr/include/winpr/platform.h:713:9`! void* pBuffer, WINPR_ATTR_UNUSEDcxx . . $ `winpr/include/winpr/platform.h:713:9`! ULONGcxx . . $ ULONG# cbBuffer)
1535 {
1536 return SEC_E_UNSUPPORTED_FUNCTIONcxx . . $ `winpr/include/winpr/sspi.h:136:9`!;
1537 }
1538
1539 WINPR_ATTR_NODISCARDcxx . . $ `winpr/include/winpr/platform.h:105:9`!
1540 static SECURITY_STATUScxx . . $ SECURITY_STATUS# SEC_ENTRYcxx . . $ `winpr/include/winpr/sspi.h:44:9`! ntlm_RevertSecurityContextcxx . . $ ntlm_RevertSecurityContext(e6bcc0180d974dfe).(WINPR_ATTR_UNUSEDcxx . . $ `winpr/include/winpr/platform.h:713:9`! PCtxtHandlecxx . . $ PCtxtHandle# phContext)
1541 {
1542 return SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!;
1543 }
1544
1545 WINPR_ATTR_NODISCARDcxx . . $ `winpr/include/winpr/platform.h:105:9`!
1546 static SECURITY_STATUScxx . . $ SECURITY_STATUS# SEC_ENTRYcxx . . $ `winpr/include/winpr/sspi.h:44:9`! ntlm_EncryptMessagecxx . . $ ntlm_EncryptMessage(e5afddb57b5310d6).(PCtxtHandlecxx . . $ PCtxtHandle# phContext,
1547 WINPR_ATTR_UNUSEDcxx . . $ `winpr/include/winpr/platform.h:713:9`! ULONGcxx . . $ ULONG# fQOP,
1548 PSecBufferDesccxx . . $ PSecBufferDesc# pMessage, ULONGcxx . . $ ULONG# MessageSeqNo)
1549 {
1550 const UINT32cxx . . $ UINT32# SeqNo = MessageSeqNo;
1551 UINT32cxx . . $ UINT32# value = 0;
1552 BYTEcxx . . $ BYTE# digest[WINPR_MD5_DIGEST_LENGTHcxx . . $ `winpr/include/winpr/custom-crypto.h:34:9`!] = WINPR_C_ARRAY_INITcxx . . $ `winpr/include/winpr/platform.h:87:9`!;
1553 BYTEcxx . . $ BYTE# checksum[8] = WINPR_C_ARRAY_INITcxx . . $ `winpr/include/winpr/platform.h:87:9`!;
1554 ULONGcxx . . $ ULONG# version = 1;
1555 PSecBuffercxx . . $ PSecBuffer# data_buffer = nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
1556 PSecBuffercxx . . $ PSecBuffer# signature_buffer = nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
1557 NTLM_CONTEXTcxx . . $ NTLM_CONTEXT#* context = (NTLM_CONTEXTcxx . . $ NTLM_CONTEXT#*)sspi_SecureHandleGetLowerPointercxx . . $ sspi_SecureHandleGetLowerPointer(850d8027e444f59b).(phContext);
1558 if (!check_contextcxx . . $ `winpr/libwinpr/sspi/NTLM/ntlm.c:50:9`!(context))
1559 return SEC_E_INVALID_HANDLEcxx . . $ `winpr/include/winpr/sspi.h:135:9`!;
1560
1561 for (ULONGcxx . . $ ULONG# index = 0; index < pMessage->cBufferscxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_45#cBuffers.; index++)
1562 {
1563 SecBuffercxx . . $ SecBuffer#* cur = &pMessage->pBufferscxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_45#pBuffers.[index];
1564
1565 if (cur->BufferTypecxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#BufferType. & SECBUFFER_DATAcxx . . $ `winpr/include/winpr/sspi.h:997:9`!)
1566 data_buffer = cur;
1567 else if (cur->BufferTypecxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#BufferType. & SECBUFFER_TOKENcxx . . $ `winpr/include/winpr/sspi.h:998:9`!)
1568 signature_buffer = cur;
1569 }
1570
1571 if (!data_buffer)
1572 return SEC_E_INVALID_TOKENcxx . . $ `winpr/include/winpr/sspi.h:142:9`!;
1573
1574 if (!signature_buffer)
1575 return SEC_E_INVALID_TOKENcxx . . $ `winpr/include/winpr/sspi.h:142:9`!;
1576
1577 if (signature_buffer->cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer. < 16)
1578 return SEC_E_INSUFFICIENT_MEMORYcxx . . $ `winpr/include/winpr/sspi.h:134:9`!;
1579
1580 /* Copy original data buffer */
1581 ULONGcxx . . $ ULONG# length = data_buffer->cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer.;
1582 void* data = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(length);
1583
1584 if (!data)
1585 return SEC_E_INSUFFICIENT_MEMORYcxx . . $ `winpr/include/winpr/sspi.h:134:9`!;
1586
1587 CopyMemorycxx . . $ `winpr/include/winpr/crt.h:123:9`!(data, data_buffer->pvBuffer, length);
1588 /* Compute the HMAC-MD5 hash of ConcatenationOf(seq_num,data) using the client signing key */
1589 WINPR_HMAC_CTXcxx . . $ WINPR_HMAC_CTX#* hmac = winpr_HMAC_Newcxx . . $ winpr_HMAC_New(eda14d31e92aac8e).();
1590
1591 BOOLcxx . . $ BOOL# success = FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!;
1592 {
1593 if (!hmac)
1594 goto hmac_fail;
1595 if (!winpr_HMAC_Initcxx . . $ winpr_HMAC_Init(92c13b0dd6fbb09a).(hmac, WINPR_MD_MD5cxx . . $ WINPR_MD_MD5., context->SendSigningKeycxx . . $ $anonymous_type_544b217a83a6fa2a_13#SendSigningKey., WINPR_MD5_DIGEST_LENGTHcxx . . $ `winpr/include/winpr/custom-crypto.h:34:9`!))
1596 goto hmac_fail;
1597
1598 winpr_Data_Write_UINT32cxx . . $ winpr_Data_Write_UINT32(67abb4dd43ac34c5).(&value, SeqNo);
1599
1600 if (!winpr_HMAC_Updatecxx . . $ winpr_HMAC_Update(269662ae430c6e94).(hmac, (void*)&value, 4))
1601 goto hmac_fail;
1602 if (!winpr_HMAC_Updatecxx . . $ winpr_HMAC_Update(269662ae430c6e94).(hmac, data, length))
1603 goto hmac_fail;
1604 if (!winpr_HMAC_Finalcxx . . $ winpr_HMAC_Final(78a9addfb34fddf4).(hmac, digest, WINPR_MD5_DIGEST_LENGTHcxx . . $ `winpr/include/winpr/custom-crypto.h:34:9`!))
1605 goto hmac_fail;
1606 }
1607
1608 success = TRUEcxx . . $ `winpr/include/winpr/wtypes.h:126:9`!;
1609
1610 hmac_fail:
1611 winpr_HMAC_Freecxx . . $ winpr_HMAC_Free(f305f1c2ab229823).(hmac);
1612 if (!success)
1613 {
1614 freecxx . . $ free(5d22bdacc48458e8).(data);
1615 return SEC_E_INSUFFICIENT_MEMORYcxx . . $ `winpr/include/winpr/sspi.h:134:9`!;
1616 }
1617
1618 /* Encrypt message using with RC4, result overwrites original buffer */
1619 if ((data_buffer->BufferTypecxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#BufferType. & SECBUFFER_READONLYcxx . . $ `winpr/include/winpr/sspi.h:1017:9`!) == 0)
1620 {
1621 if (context->confidentialitycxx . . $ $anonymous_type_544b217a83a6fa2a_13#confidentiality.)
1622 {
1623 if (!winpr_RC4_Updatecxx . . $ winpr_RC4_Update(ed5b6f42ccfe68a5).(context->SendRc4Sealcxx . . $ $anonymous_type_544b217a83a6fa2a_13#SendRc4Seal., length, (BYTEcxx . . $ BYTE#*)data,
1624 (BYTEcxx . . $ BYTE#*)data_buffer->pvBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#pvBuffer.))
1625 {
1626 freecxx . . $ free(5d22bdacc48458e8).(data);
1627 return SEC_E_INSUFFICIENT_MEMORYcxx . . $ `winpr/include/winpr/sspi.h:134:9`!;
1628 }
1629 }
1630 else
1631 CopyMemorycxx . . $ `winpr/include/winpr/crt.h:123:9`!(data_buffer->pvBuffer, data, length);
1632 }
1633
1634 #ifdef WITH_DEBUG_NTLM
1635 WLog_DBG(TAG, "Data Buffer (length = %" PRIu32 ")", length);
1636 winpr_HexDump(TAG, WLOG_DEBUG, data, length);
1637 WLog_DBG(TAG, "Encrypted Data Buffer (length = %" PRIu32 ")", data_buffer->cbBuffer);
1638 winpr_HexDump(TAG, WLOG_DEBUG, data_buffer->pvBuffer, data_buffer->cbBuffer);
1639 #endif
1640 freecxx . . $ free(5d22bdacc48458e8).(data);
1641 /* RC4-encrypt first 8 bytes of digest */
1642 if (!winpr_RC4_Updatecxx . . $ winpr_RC4_Update(ed5b6f42ccfe68a5).(context->SendRc4Sealcxx . . $ $anonymous_type_544b217a83a6fa2a_13#SendRc4Seal., 8, digest, checksum))
1643 return SEC_E_INSUFFICIENT_MEMORYcxx . . $ `winpr/include/winpr/sspi.h:134:9`!;
1644 if ((signature_buffer->BufferTypecxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#BufferType. & SECBUFFER_READONLYcxx . . $ `winpr/include/winpr/sspi.h:1017:9`!) == 0)
1645 {
1646 BYTEcxx . . $ BYTE#* signature = signature_buffer->pvBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#pvBuffer.;
1647 /* Concatenate version, ciphertext and sequence number to build signature */
1648 winpr_Data_Write_UINT32cxx . . $ winpr_Data_Write_UINT32(67abb4dd43ac34c5).(signature, version);
1649 CopyMemorycxx . . $ `winpr/include/winpr/crt.h:123:9`!(&signature[4], (void*)checksum, 8);
1650 winpr_Data_Write_UINT32cxx . . $ winpr_Data_Write_UINT32(67abb4dd43ac34c5).(&signature[12], SeqNo);
1651 }
1652 context->SendSeqNumcxx . . $ $anonymous_type_544b217a83a6fa2a_13#SendSeqNum.++;
1653 #ifdef WITH_DEBUG_NTLM
1654 WLog_DBG(TAG, "Signature (length = %" PRIu32 ")", signature_buffer->cbBuffer);
1655 winpr_HexDump(TAG, WLOG_DEBUG, signature_buffer->pvBuffer, signature_buffer->cbBuffer);
1656 #endif
1657 return SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!;
1658 }
1659
1660 static SECURITY_STATUScxx . . $ SECURITY_STATUS# SEC_ENTRYcxx . . $ `winpr/include/winpr/sspi.h:44:9`! ntlm_DecryptMessagecxx . . $ ntlm_DecryptMessage(413abde90771aeb2).(PCtxtHandlecxx . . $ PCtxtHandle# phContext, PSecBufferDesccxx . . $ PSecBufferDesc# pMessage,
1661 ULONGcxx . . $ ULONG# MessageSeqNo,
1662 WINPR_ATTR_UNUSEDcxx . . $ `winpr/include/winpr/platform.h:713:9`! PULONGcxx . . $ PULONG# pfQOP)
1663 {
1664 const UINT32cxx . . $ UINT32# SeqNo = (UINT32cxx . . $ UINT32#)MessageSeqNo;
1665 UINT32cxx . . $ UINT32# value = 0;
1666 BYTEcxx . . $ BYTE# digest[WINPR_MD5_DIGEST_LENGTHcxx . . $ `winpr/include/winpr/custom-crypto.h:34:9`!] = WINPR_C_ARRAY_INITcxx . . $ `winpr/include/winpr/platform.h:87:9`!;
1667 BYTEcxx . . $ BYTE# checksum[8] = WINPR_C_ARRAY_INITcxx . . $ `winpr/include/winpr/platform.h:87:9`!;
1668 UINT32cxx . . $ UINT32# version = 1;
1669 BYTEcxx . . $ BYTE# expected_signature[WINPR_MD5_DIGEST_LENGTHcxx . . $ `winpr/include/winpr/custom-crypto.h:34:9`!] = WINPR_C_ARRAY_INITcxx . . $ `winpr/include/winpr/platform.h:87:9`!;
1670 PSecBuffercxx . . $ PSecBuffer# data_buffer = nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
1671 PSecBuffercxx . . $ PSecBuffer# signature_buffer = nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
1672 NTLM_CONTEXTcxx . . $ NTLM_CONTEXT#* context = (NTLM_CONTEXTcxx . . $ NTLM_CONTEXT#*)sspi_SecureHandleGetLowerPointercxx . . $ sspi_SecureHandleGetLowerPointer(850d8027e444f59b).(phContext);
1673 if (!check_contextcxx . . $ `winpr/libwinpr/sspi/NTLM/ntlm.c:50:9`!(context))
1674 return SEC_E_INVALID_HANDLEcxx . . $ `winpr/include/winpr/sspi.h:135:9`!;
1675
1676 for (ULONGcxx . . $ ULONG# index = 0; index < pMessage->cBufferscxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_45#cBuffers.; index++)
1677 {
1678 if (pMessage->pBufferscxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_45#pBuffers.[index].BufferTypecxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#BufferType. == SECBUFFER_DATAcxx . . $ `winpr/include/winpr/sspi.h:997:9`!)
1679 data_buffer = &pMessage->pBufferscxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_45#pBuffers.[index];
1680 else if (pMessage->pBufferscxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_45#pBuffers.[index].BufferTypecxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#BufferType. == SECBUFFER_TOKENcxx . . $ `winpr/include/winpr/sspi.h:998:9`!)
1681 signature_buffer = &pMessage->pBufferscxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_45#pBuffers.[index];
1682 }
1683
1684 if (!data_buffer)
1685 return SEC_E_INVALID_TOKENcxx . . $ `winpr/include/winpr/sspi.h:142:9`!;
1686
1687 if (!signature_buffer)
1688 return SEC_E_INVALID_TOKENcxx . . $ `winpr/include/winpr/sspi.h:142:9`!;
1689
1690 if (signature_buffer->cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer. < 16)
1691 return SEC_E_INVALID_TOKENcxx . . $ `winpr/include/winpr/sspi.h:142:9`!;
1692
1693 /* Copy original data buffer */
1694 const ULONGcxx . . $ ULONG# length = data_buffer->cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer.;
1695 void* data = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(length);
1696
1697 if (!data)
1698 return SEC_E_INSUFFICIENT_MEMORYcxx . . $ `winpr/include/winpr/sspi.h:134:9`!;
1699
1700 CopyMemorycxx . . $ `winpr/include/winpr/crt.h:123:9`!(data, data_buffer->pvBuffer, length);
1701
1702 /* Decrypt message using with RC4, result overwrites original buffer */
1703
1704 if (context->confidentialitycxx . . $ $anonymous_type_544b217a83a6fa2a_13#confidentiality.)
1705 {
1706 if (!winpr_RC4_Updatecxx . . $ winpr_RC4_Update(ed5b6f42ccfe68a5).(context->RecvRc4Sealcxx . . $ $anonymous_type_544b217a83a6fa2a_13#RecvRc4Seal., length, (BYTEcxx . . $ BYTE#*)data,
1707 (BYTEcxx . . $ BYTE#*)data_buffer->pvBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#pvBuffer.))
1708 {
1709 freecxx . . $ free(5d22bdacc48458e8).(data);
1710 return SEC_E_INSUFFICIENT_MEMORYcxx . . $ `winpr/include/winpr/sspi.h:134:9`!;
1711 }
1712 }
1713 else
1714 CopyMemorycxx . . $ `winpr/include/winpr/crt.h:123:9`!(data_buffer->pvBuffer, data, length);
1715
1716 /* Compute the HMAC-MD5 hash of ConcatenationOf(seq_num,data) using the client signing key */
1717 WINPR_HMAC_CTXcxx . . $ WINPR_HMAC_CTX#* hmac = winpr_HMAC_Newcxx . . $ winpr_HMAC_New(eda14d31e92aac8e).();
1718
1719 BOOLcxx . . $ BOOL# success = FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!;
1720 {
1721 if (!hmac)
1722 goto hmac_fail;
1723
1724 if (!winpr_HMAC_Initcxx . . $ winpr_HMAC_Init(92c13b0dd6fbb09a).(hmac, WINPR_MD_MD5cxx . . $ WINPR_MD_MD5., context->RecvSigningKeycxx . . $ $anonymous_type_544b217a83a6fa2a_13#RecvSigningKey., WINPR_MD5_DIGEST_LENGTHcxx . . $ `winpr/include/winpr/custom-crypto.h:34:9`!))
1725 goto hmac_fail;
1726
1727 winpr_Data_Write_UINT32cxx . . $ winpr_Data_Write_UINT32(67abb4dd43ac34c5).(&value, SeqNo);
1728
1729 if (!winpr_HMAC_Updatecxx . . $ winpr_HMAC_Update(269662ae430c6e94).(hmac, (void*)&value, 4))
1730 goto hmac_fail;
1731 if (!winpr_HMAC_Updatecxx . . $ winpr_HMAC_Update(269662ae430c6e94).(hmac, data_buffer->pvBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#pvBuffer., data_buffer->cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer.))
1732 goto hmac_fail;
1733 if (!winpr_HMAC_Finalcxx . . $ winpr_HMAC_Final(78a9addfb34fddf4).(hmac, digest, WINPR_MD5_DIGEST_LENGTHcxx . . $ `winpr/include/winpr/custom-crypto.h:34:9`!))
1734 goto hmac_fail;
1735
1736 success = TRUEcxx . . $ `winpr/include/winpr/wtypes.h:126:9`!;
1737 }
1738 hmac_fail:
1739 winpr_HMAC_Freecxx . . $ winpr_HMAC_Free(f305f1c2ab229823).(hmac);
1740 if (!success)
1741 {
1742 freecxx . . $ free(5d22bdacc48458e8).(data);
1743 return SEC_E_INSUFFICIENT_MEMORYcxx . . $ `winpr/include/winpr/sspi.h:134:9`!;
1744 }
1745
1746 #ifdef WITH_DEBUG_NTLM
1747 WLog_DBG(TAG, "Encrypted Data Buffer (length = %" PRIu32 ")", length);
1748 winpr_HexDump(TAG, WLOG_DEBUG, data, length);
1749 WLog_DBG(TAG, "Data Buffer (length = %" PRIu32 ")", data_buffer->cbBuffer);
1750 winpr_HexDump(TAG, WLOG_DEBUG, data_buffer->pvBuffer, data_buffer->cbBuffer);
1751 #endif
1752 freecxx . . $ free(5d22bdacc48458e8).(data);
1753 /* RC4-encrypt first 8 bytes of digest */
1754 if (!winpr_RC4_Updatecxx . . $ winpr_RC4_Update(ed5b6f42ccfe68a5).(context->RecvRc4Sealcxx . . $ $anonymous_type_544b217a83a6fa2a_13#RecvRc4Seal., 8, digest, checksum))
1755 return SEC_E_MESSAGE_ALTEREDcxx . . $ `winpr/include/winpr/sspi.h:149:9`!;
1756
1757 /* Concatenate version, ciphertext and sequence number to build signature */
1758 winpr_Data_Write_UINT32cxx . . $ winpr_Data_Write_UINT32(67abb4dd43ac34c5).(expected_signature, version);
1759 CopyMemorycxx . . $ `winpr/include/winpr/crt.h:123:9`!(&expected_signature[4], (void*)checksum, 8);
1760 winpr_Data_Write_UINT32cxx . . $ winpr_Data_Write_UINT32(67abb4dd43ac34c5).(&expected_signature[12], SeqNo);
1761 context->RecvSeqNumcxx . . $ $anonymous_type_544b217a83a6fa2a_13#RecvSeqNum.++;
1762
1763 if (memcmpcxx . . $ memcmp(36f949851efa3055).(signature_buffer->pvBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#pvBuffer., expected_signature, 16) != 0)
1764 {
1765 /* signature verification failed! */
1766 WLog_ERRcxx . . $ `winpr/include/winpr/wlog.h:347:9`!(TAGcxx . . $ `winpr/libwinpr/sspi/NTLM/ntlm.c:42:9`!, "signature verification failed, something nasty is going on!");
1767 #ifdef WITH_DEBUG_NTLM
1768 WLog_ERR(TAG, "Expected Signature:");
1769 winpr_HexDump(TAG, WLOG_ERROR, expected_signature, 16);
1770 WLog_ERR(TAG, "Actual Signature:");
1771 winpr_HexDump(TAG, WLOG_ERROR, (BYTE*)signature_buffer->pvBuffer, 16);
1772 #endif
1773 return SEC_E_MESSAGE_ALTEREDcxx . . $ `winpr/include/winpr/sspi.h:149:9`!;
1774 }
1775
1776 return SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!;
1777 }
1778
1779 static SECURITY_STATUScxx . . $ SECURITY_STATUS# SEC_ENTRYcxx . . $ `winpr/include/winpr/sspi.h:44:9`! ntlm_MakeSignaturecxx . . $ ntlm_MakeSignature(e5afddb57b5310d6).(PCtxtHandlecxx . . $ PCtxtHandle# phContext,
1780 WINPR_ATTR_UNUSEDcxx . . $ `winpr/include/winpr/platform.h:713:9`! ULONGcxx . . $ ULONG# fQOP,
1781 PSecBufferDesccxx . . $ PSecBufferDesc# pMessage, ULONGcxx . . $ ULONG# MessageSeqNo)
1782 {
1783 SECURITY_STATUScxx . . $ SECURITY_STATUS# status = SEC_E_INTERNAL_ERRORcxx . . $ `winpr/include/winpr/sspi.h:138:9`!;
1784 PSecBuffercxx . . $ PSecBuffer# data_buffer = nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
1785 PSecBuffercxx . . $ PSecBuffer# sig_buffer = nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
1786 UINT32cxx . . $ UINT32# seq_no = 0;
1787 BYTEcxx . . $ BYTE# digest[WINPR_MD5_DIGEST_LENGTHcxx . . $ `winpr/include/winpr/custom-crypto.h:34:9`!] = WINPR_C_ARRAY_INITcxx . . $ `winpr/include/winpr/platform.h:87:9`!;
1788 BYTEcxx . . $ BYTE# checksum[8] = WINPR_C_ARRAY_INITcxx . . $ `winpr/include/winpr/platform.h:87:9`!;
1789
1790 NTLM_CONTEXTcxx . . $ NTLM_CONTEXT#* context = sspi_SecureHandleGetLowerPointercxx . . $ sspi_SecureHandleGetLowerPointer(850d8027e444f59b).(phContext);
1791 if (!check_contextcxx . . $ `winpr/libwinpr/sspi/NTLM/ntlm.c:50:9`!(context))
1792 return SEC_E_INVALID_HANDLEcxx . . $ `winpr/include/winpr/sspi.h:135:9`!;
1793
1794 for (ULONGcxx . . $ ULONG# i = 0; i < pMessage->cBufferscxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_45#cBuffers.; i++)
1795 {
1796 if (pMessage->pBufferscxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_45#pBuffers.[i].BufferTypecxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#BufferType. == SECBUFFER_DATAcxx . . $ `winpr/include/winpr/sspi.h:997:9`!)
1797 data_buffer = &pMessage->pBufferscxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_45#pBuffers.[i];
1798 else if (pMessage->pBufferscxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_45#pBuffers.[i].BufferTypecxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#BufferType. == SECBUFFER_TOKENcxx . . $ `winpr/include/winpr/sspi.h:998:9`!)
1799 sig_buffer = &pMessage->pBufferscxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_45#pBuffers.[i];
1800 }
1801
1802 if (!data_buffer || !sig_buffer)
1803 return SEC_E_INVALID_TOKENcxx . . $ `winpr/include/winpr/sspi.h:142:9`!;
1804
1805 if (sig_buffer->cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer. < 16)
1806 return SEC_E_INSUFFICIENT_MEMORYcxx . . $ `winpr/include/winpr/sspi.h:134:9`!;
1807
1808 WINPR_HMAC_CTXcxx . . $ WINPR_HMAC_CTX#* hmac = winpr_HMAC_Newcxx . . $ winpr_HMAC_New(eda14d31e92aac8e).();
1809
1810 if (!winpr_HMAC_Initcxx . . $ winpr_HMAC_Init(92c13b0dd6fbb09a).(hmac, WINPR_MD_MD5cxx . . $ WINPR_MD_MD5., context->SendSigningKeycxx . . $ $anonymous_type_544b217a83a6fa2a_13#SendSigningKey., WINPR_MD5_DIGEST_LENGTHcxx . . $ `winpr/include/winpr/custom-crypto.h:34:9`!))
1811 goto fail;
1812
1813 winpr_Data_Write_UINT32cxx . . $ winpr_Data_Write_UINT32(67abb4dd43ac34c5).(&seq_no, MessageSeqNo);
1814 if (!winpr_HMAC_Updatecxx . . $ winpr_HMAC_Update(269662ae430c6e94).(hmac, (BYTEcxx . . $ BYTE#*)&seq_no, 4))
1815 goto fail;
1816 if (!winpr_HMAC_Updatecxx . . $ winpr_HMAC_Update(269662ae430c6e94).(hmac, data_buffer->pvBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#pvBuffer., data_buffer->cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer.))
1817 goto fail;
1818 if (!winpr_HMAC_Finalcxx . . $ winpr_HMAC_Final(78a9addfb34fddf4).(hmac, digest, WINPR_MD5_DIGEST_LENGTHcxx . . $ `winpr/include/winpr/custom-crypto.h:34:9`!))
1819 goto fail;
1820
1821 if (!winpr_RC4_Updatecxx . . $ winpr_RC4_Update(ed5b6f42ccfe68a5).(context->SendRc4Sealcxx . . $ $anonymous_type_544b217a83a6fa2a_13#SendRc4Seal., 8, digest, checksum))
1822 goto fail;
1823
1824 BYTEcxx . . $ BYTE#* signature = sig_buffer->pvBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#pvBuffer.;
1825 winpr_Data_Write_UINT32cxx . . $ winpr_Data_Write_UINT32(67abb4dd43ac34c5).(signature, 1L);
1826 CopyMemorycxx . . $ `winpr/include/winpr/crt.h:123:9`!(&signature[4], checksum, 8);
1827 winpr_Data_Write_UINT32cxx . . $ winpr_Data_Write_UINT32(67abb4dd43ac34c5).(&signature[12], seq_no);
1828 sig_buffer->cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer. = 16;
1829
1830 status = SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!;
1831
1832 fail:
1833 winpr_HMAC_Freecxx . . $ winpr_HMAC_Free(f305f1c2ab229823).(hmac);
1834 return status;
1835 }
1836
1837 WINPR_ATTR_NODISCARDcxx . . $ `winpr/include/winpr/platform.h:105:9`!
1838 static SECURITY_STATUScxx . . $ SECURITY_STATUS# SEC_ENTRYcxx . . $ `winpr/include/winpr/sspi.h:44:9`! ntlm_VerifySignaturecxx . . $ ntlm_VerifySignature(413abde90771aeb2).(PCtxtHandlecxx . . $ PCtxtHandle# phContext,
1839 PSecBufferDesccxx . . $ PSecBufferDesc# pMessage, ULONGcxx . . $ ULONG# MessageSeqNo,
1840 WINPR_ATTR_UNUSEDcxx . . $ `winpr/include/winpr/platform.h:713:9`! PULONGcxx . . $ PULONG# pfQOP)
1841 {
1842 SECURITY_STATUScxx . . $ SECURITY_STATUS# status = SEC_E_INTERNAL_ERRORcxx . . $ `winpr/include/winpr/sspi.h:138:9`!;
1843 PSecBuffercxx . . $ PSecBuffer# data_buffer = nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
1844 PSecBuffercxx . . $ PSecBuffer# sig_buffer = nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
1845 UINT32cxx . . $ UINT32# seq_no = 0;
1846 BYTEcxx . . $ BYTE# digest[WINPR_MD5_DIGEST_LENGTHcxx . . $ `winpr/include/winpr/custom-crypto.h:34:9`!] = WINPR_C_ARRAY_INITcxx . . $ `winpr/include/winpr/platform.h:87:9`!;
1847 BYTEcxx . . $ BYTE# checksum[8] = WINPR_C_ARRAY_INITcxx . . $ `winpr/include/winpr/platform.h:87:9`!;
1848 BYTEcxx . . $ BYTE# signature[16] = WINPR_C_ARRAY_INITcxx . . $ `winpr/include/winpr/platform.h:87:9`!;
1849
1850 NTLM_CONTEXTcxx . . $ NTLM_CONTEXT#* context = sspi_SecureHandleGetLowerPointercxx . . $ sspi_SecureHandleGetLowerPointer(850d8027e444f59b).(phContext);
1851 if (!check_contextcxx . . $ `winpr/libwinpr/sspi/NTLM/ntlm.c:50:9`!(context))
1852 return SEC_E_INVALID_HANDLEcxx . . $ `winpr/include/winpr/sspi.h:135:9`!;
1853
1854 for (ULONGcxx . . $ ULONG# i = 0; i < pMessage->cBufferscxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_45#cBuffers.; i++)
1855 {
1856 if (pMessage->pBufferscxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_45#pBuffers.[i].BufferTypecxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#BufferType. == SECBUFFER_DATAcxx . . $ `winpr/include/winpr/sspi.h:997:9`!)
1857 data_buffer = &pMessage->pBufferscxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_45#pBuffers.[i];
1858 else if (pMessage->pBufferscxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_45#pBuffers.[i].BufferTypecxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#BufferType. == SECBUFFER_TOKENcxx . . $ `winpr/include/winpr/sspi.h:998:9`!)
1859 sig_buffer = &pMessage->pBufferscxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_45#pBuffers.[i];
1860 }
1861
1862 if (!data_buffer || !sig_buffer || (sig_buffer->cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer. < 16))
1863 return SEC_E_INVALID_TOKENcxx . . $ `winpr/include/winpr/sspi.h:142:9`!;
1864
1865 WINPR_HMAC_CTXcxx . . $ WINPR_HMAC_CTX#* hmac = winpr_HMAC_Newcxx . . $ winpr_HMAC_New(eda14d31e92aac8e).();
1866
1867 if (!winpr_HMAC_Initcxx . . $ winpr_HMAC_Init(92c13b0dd6fbb09a).(hmac, WINPR_MD_MD5cxx . . $ WINPR_MD_MD5., context->RecvSigningKeycxx . . $ $anonymous_type_544b217a83a6fa2a_13#RecvSigningKey., WINPR_MD5_DIGEST_LENGTHcxx . . $ `winpr/include/winpr/custom-crypto.h:34:9`!))
1868 goto fail;
1869
1870 winpr_Data_Write_UINT32cxx . . $ winpr_Data_Write_UINT32(67abb4dd43ac34c5).(&seq_no, MessageSeqNo);
1871 if (!winpr_HMAC_Updatecxx . . $ winpr_HMAC_Update(269662ae430c6e94).(hmac, (BYTEcxx . . $ BYTE#*)&seq_no, 4))
1872 goto fail;
1873 if (!winpr_HMAC_Updatecxx . . $ winpr_HMAC_Update(269662ae430c6e94).(hmac, data_buffer->pvBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#pvBuffer., data_buffer->cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer.))
1874 goto fail;
1875 if (!winpr_HMAC_Finalcxx . . $ winpr_HMAC_Final(78a9addfb34fddf4).(hmac, digest, WINPR_MD5_DIGEST_LENGTHcxx . . $ `winpr/include/winpr/custom-crypto.h:34:9`!))
1876 goto fail;
1877
1878 if (!winpr_RC4_Updatecxx . . $ winpr_RC4_Update(ed5b6f42ccfe68a5).(context->RecvRc4Sealcxx . . $ $anonymous_type_544b217a83a6fa2a_13#RecvRc4Seal., 8, digest, checksum))
1879 goto fail;
1880
1881 winpr_Data_Write_UINT32cxx . . $ winpr_Data_Write_UINT32(67abb4dd43ac34c5).(signature, 1L);
1882 CopyMemorycxx . . $ `winpr/include/winpr/crt.h:123:9`!(&signature[4], checksum, 8);
1883 winpr_Data_Write_UINT32cxx . . $ winpr_Data_Write_UINT32(67abb4dd43ac34c5).(&signature[12], seq_no);
1884
1885 status = SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!;
1886 if (memcmpcxx . . $ memcmp(36f949851efa3055).(sig_buffer->pvBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#pvBuffer., signature, 16) != 0)
1887 status = SEC_E_MESSAGE_ALTEREDcxx . . $ `winpr/include/winpr/sspi.h:149:9`!;
1888
1889 fail:
1890 winpr_HMAC_Freecxx . . $ winpr_HMAC_Free(f305f1c2ab229823).(hmac);
1891 return status;
1892 }
1893
1894 const SecurityFunctionTableAcxx . . $ SecurityFunctionTableA# NTLM_SecurityFunctionTableAcxx . . $ NTLM_SecurityFunctionTableA. = {
1895 3, /* dwVersion */
1896 nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, /* EnumerateSecurityPackages */
1897 ntlm_QueryCredentialsAttributesAcxx . . $ ntlm_QueryCredentialsAttributesA(998cea891dba569e)., /* QueryCredentialsAttributes */
1898 ntlm_AcquireCredentialsHandleAcxx . . $ ntlm_AcquireCredentialsHandleA(ea7a2ba3fce4e22)., /* AcquireCredentialsHandle */
1899 ntlm_FreeCredentialsHandlecxx . . $ ntlm_FreeCredentialsHandle(e6bcc0180d974dfe)., /* FreeCredentialsHandle */
1900 nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, /* Reserved2 */
1901 ntlm_InitializeSecurityContextAcxx . . $ ntlm_InitializeSecurityContextA(cf9633d63d9b9e60)., /* InitializeSecurityContext */
1902 ntlm_AcceptSecurityContextcxx . . $ ntlm_AcceptSecurityContext(c4f1f6e2f4d578a9)., /* AcceptSecurityContext */
1903 nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, /* CompleteAuthToken */
1904 ntlm_DeleteSecurityContextcxx . . $ ntlm_DeleteSecurityContext(e6bcc0180d974dfe)., /* DeleteSecurityContext */
1905 nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, /* ApplyControlToken */
1906 ntlm_QueryContextAttributesAcxx . . $ ntlm_QueryContextAttributesA(998cea891dba569e)., /* QueryContextAttributes */
1907 ntlm_ImpersonateSecurityContextcxx . . $ ntlm_ImpersonateSecurityContext(e6bcc0180d974dfe)., /* ImpersonateSecurityContext */
1908 ntlm_RevertSecurityContextcxx . . $ ntlm_RevertSecurityContext(e6bcc0180d974dfe)., /* RevertSecurityContext */
1909 ntlm_MakeSignaturecxx . . $ ntlm_MakeSignature(e5afddb57b5310d6)., /* MakeSignature */
1910 ntlm_VerifySignaturecxx . . $ ntlm_VerifySignature(413abde90771aeb2)., /* VerifySignature */
1911 nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, /* FreeContextBuffer */
1912 nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, /* QuerySecurityPackageInfo */
1913 nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, /* Reserved3 */
1914 nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, /* Reserved4 */
1915 nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, /* ExportSecurityContext */
1916 nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, /* ImportSecurityContext */
1917 nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, /* AddCredentials */
1918 nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, /* Reserved8 */
1919 nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, /* QuerySecurityContextToken */
1920 ntlm_EncryptMessagecxx . . $ ntlm_EncryptMessage(e5afddb57b5310d6)., /* EncryptMessage */
1921 ntlm_DecryptMessagecxx . . $ ntlm_DecryptMessage(413abde90771aeb2)., /* DecryptMessage */
1922 ntlm_SetContextAttributesAcxx . . $ ntlm_SetContextAttributesA(b9cda4e27f1b3388)., /* SetContextAttributes */
1923 ntlm_SetCredentialsAttributesAcxx . . $ ntlm_SetCredentialsAttributesA(b9cda4e27f1b3388)., /* SetCredentialsAttributes */
1924 };
1925
1926 const SecurityFunctionTableWcxx . . $ SecurityFunctionTableW# NTLM_SecurityFunctionTableWcxx . . $ NTLM_SecurityFunctionTableW. = {
1927 3, /* dwVersion */
1928 nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, /* EnumerateSecurityPackages */
1929 ntlm_QueryCredentialsAttributesWcxx . . $ ntlm_QueryCredentialsAttributesW(998cea891dba569e)., /* QueryCredentialsAttributes */
1930 ntlm_AcquireCredentialsHandleWcxx . . $ ntlm_AcquireCredentialsHandleW(537031bd00bdbc62)., /* AcquireCredentialsHandle */
1931 ntlm_FreeCredentialsHandlecxx . . $ ntlm_FreeCredentialsHandle(e6bcc0180d974dfe)., /* FreeCredentialsHandle */
1932 nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, /* Reserved2 */
1933 ntlm_InitializeSecurityContextWcxx . . $ ntlm_InitializeSecurityContextW(422ccc8b6dd4c323)., /* InitializeSecurityContext */
1934 ntlm_AcceptSecurityContextcxx . . $ ntlm_AcceptSecurityContext(c4f1f6e2f4d578a9)., /* AcceptSecurityContext */
1935 nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, /* CompleteAuthToken */
1936 ntlm_DeleteSecurityContextcxx . . $ ntlm_DeleteSecurityContext(e6bcc0180d974dfe)., /* DeleteSecurityContext */
1937 nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, /* ApplyControlToken */
1938 ntlm_QueryContextAttributesWcxx . . $ ntlm_QueryContextAttributesW(998cea891dba569e)., /* QueryContextAttributes */
1939 ntlm_ImpersonateSecurityContextcxx . . $ ntlm_ImpersonateSecurityContext(e6bcc0180d974dfe)., /* ImpersonateSecurityContext */
1940 ntlm_RevertSecurityContextcxx . . $ ntlm_RevertSecurityContext(e6bcc0180d974dfe)., /* RevertSecurityContext */
1941 ntlm_MakeSignaturecxx . . $ ntlm_MakeSignature(e5afddb57b5310d6)., /* MakeSignature */
1942 ntlm_VerifySignaturecxx . . $ ntlm_VerifySignature(413abde90771aeb2)., /* VerifySignature */
1943 nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, /* FreeContextBuffer */
1944 nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, /* QuerySecurityPackageInfo */
1945 nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, /* Reserved3 */
1946 nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, /* Reserved4 */
1947 nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, /* ExportSecurityContext */
1948 nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, /* ImportSecurityContext */
1949 nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, /* AddCredentials */
1950 nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, /* Reserved8 */
1951 nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, /* QuerySecurityContextToken */
1952 ntlm_EncryptMessagecxx . . $ ntlm_EncryptMessage(e5afddb57b5310d6)., /* EncryptMessage */
1953 ntlm_DecryptMessagecxx . . $ ntlm_DecryptMessage(413abde90771aeb2)., /* DecryptMessage */
1954 ntlm_SetContextAttributesWcxx . . $ ntlm_SetContextAttributesW(b9cda4e27f1b3388)., /* SetContextAttributes */
1955 ntlm_SetCredentialsAttributesWcxx . . $ ntlm_SetCredentialsAttributesW(b9cda4e27f1b3388)., /* SetCredentialsAttributes */
1956 };
1957
1958 const SecPkgInfoAcxx . . $ SecPkgInfoA# NTLM_SecPkgInfoAcxx . . $ NTLM_SecPkgInfoA. = {
1959 0x00082B37, /* fCapabilities */
1960 1, /* wVersion */
1961 0x000A, /* wRPCID */
1962 0x00000B48, /* cbMaxToken */
1963 "NTLM", /* Name */
1964 "NTLM Security Package" /* Comment */
1965 };
1966
1967 static WCHARcxx . . $ WCHAR# NTLM_SecPkgInfoW_NameBuffercxx . . $ NTLM_SecPkgInfoW_NameBuffer.[32] = WINPR_C_ARRAY_INITcxx . . $ `winpr/include/winpr/platform.h:87:9`!;
1968 static WCHARcxx . . $ WCHAR# NTLM_SecPkgInfoW_CommentBuffercxx . . $ NTLM_SecPkgInfoW_CommentBuffer.[32] = WINPR_C_ARRAY_INITcxx . . $ `winpr/include/winpr/platform.h:87:9`!;
1969
1970 const SecPkgInfoWcxx . . $ SecPkgInfoW# NTLM_SecPkgInfoWcxx . . $ NTLM_SecPkgInfoW. = {
1971 0x00082B37, /* fCapabilities */
1972 1, /* wVersion */
1973 0x000A, /* wRPCID */
1974 0x00000B48, /* cbMaxToken */
1975 NTLM_SecPkgInfoW_NameBuffercxx . . $ NTLM_SecPkgInfoW_NameBuffer., /* Name */
1976 NTLM_SecPkgInfoW_CommentBuffercxx . . $ NTLM_SecPkgInfoW_CommentBuffer. /* Comment */
1977 };
1978
1979 char* ntlm_negotiate_flags_stringcxx . . $ ntlm_negotiate_flags_string(21b3a5ae7cdf2c9f).(char* buffer, size_t size, UINT32cxx . . $ UINT32# flags)
1980 {
1981 if (!buffer || (size == 0))
1982 return buffer;
1983
1984 (void)_snprintfcxx . . $ `winpr/include/winpr/string.h:252:9`!(buffer, size, "[0x%08" PRIx32cxx . . $ `<external>/15933738808807975373/inttypes.h:125:10`! "] ", flags);
1985
1986 for (int x = 0; x < 31; x++)
1987 {
1988 const UINT32cxx . . $ UINT32# mask = 1u << x;
1989 size_t len = strnlencxx . . $ strnlen(ac5a385650b4bde5).(buffer, size);
1990 if (flags & mask)
1991 {
1992 const char* str = ntlm_get_negotiate_stringcxx . . $ ntlm_get_negotiate_string(81a3ae90da26a711).(mask);
1993 const size_t flen = strlencxx . . $ strlen(751346f8406fd082).(str);
1994
1995 if ((len > 0) && (buffer[len - 1] != ' '))
1996 {
1997 if (size - len < 1)
1998 break;
1999 winpr_str_appendcxx . . $ winpr_str_append(eb862ebbb58ce5da).("|", buffer, size, nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!);
2000 len++;
2001 }
2002
2003 if (size - len < flen)
2004 break;
2005 winpr_str_appendcxx . . $ winpr_str_append(eb862ebbb58ce5da).(str, buffer, size, nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!);
2006 }
2007 }
2008
2009 return buffer;
2010 }
2011
2012 const char* ntlm_message_type_stringcxx . . $ ntlm_message_type_string(81a3ae90da26a711).(UINT32cxx . . $ UINT32# messageType)
2013 {
2014 switch (messageType)
2015 {
2016 case MESSAGE_TYPE_NEGOTIATEcxx . . $ `winpr/libwinpr/sspi/NTLM/ntlm.h:32:9`!:
2017 return "MESSAGE_TYPE_NEGOTIATE";
2018 case MESSAGE_TYPE_CHALLENGEcxx . . $ `winpr/libwinpr/sspi/NTLM/ntlm.h:33:9`!:
2019 return "MESSAGE_TYPE_CHALLENGE";
2020 case MESSAGE_TYPE_AUTHENTICATEcxx . . $ `winpr/libwinpr/sspi/NTLM/ntlm.h:34:9`!:
2021 return "MESSAGE_TYPE_AUTHENTICATE";
2022 default:
2023 return "MESSAGE_TYPE_UNKNOWN";
2024 }
2025 }
2026
2027 const char* ntlm_state_stringcxx . . $ ntlm_state_string(5b64de9b5f2c4c7f).(NTLM_STATEcxx . . $ NTLM_STATE# state)
2028 {
2029 switch (state)
2030 {
2031 case NTLM_STATE_INITIALcxx . . $ NTLM_STATE_INITIAL.:
2032 return "NTLM_STATE_INITIAL";
2033 case NTLM_STATE_NEGOTIATEcxx . . $ NTLM_STATE_NEGOTIATE.:
2034 return "NTLM_STATE_NEGOTIATE";
2035 case NTLM_STATE_CHALLENGEcxx . . $ NTLM_STATE_CHALLENGE.:
2036 return "NTLM_STATE_CHALLENGE";
2037 case NTLM_STATE_AUTHENTICATEcxx . . $ NTLM_STATE_AUTHENTICATE.:
2038 return "NTLM_STATE_AUTHENTICATE";
2039 case NTLM_STATE_FINALcxx . . $ NTLM_STATE_FINAL.:
2040 return "NTLM_STATE_FINAL";
2041 default:
2042 return "NTLM_STATE_UNKNOWN";
2043 }
2044 }
2045 void ntlm_change_statecxx . . $ ntlm_change_state(7aab06805bde2dc2).(NTLM_CONTEXTcxx . . $ NTLM_CONTEXT#* ntlm, NTLM_STATEcxx . . $ NTLM_STATE# state)
2046 {
2047 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(ntlm);
2048 WLog_DBGcxx . . $ `winpr/include/winpr/wlog.h:341:9`!(TAGcxx . . $ `winpr/libwinpr/sspi/NTLM/ntlm.c:42:9`!, "change state from %s to %s", ntlm_state_string(ntlm->state),
2049 ntlm_state_string(state));
2050 ntlm->statecxx . . $ $anonymous_type_544b217a83a6fa2a_13#state. = state;
2051 }
2052
2053 NTLM_STATEcxx . . $ NTLM_STATE# ntlm_get_statecxx . . $ ntlm_get_state(12e3c7312a20c0dc).(NTLM_CONTEXTcxx . . $ NTLM_CONTEXT#* ntlm)
2054 {
2055 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(ntlm);
2056 return ntlm->statecxx . . $ $anonymous_type_544b217a83a6fa2a_13#state.;
2057 }
2058
2059 BOOLcxx . . $ BOOL# ntlm_reset_cipher_statecxx . . $ ntlm_reset_cipher_state(e6bcc0180d974dfe).(PSecHandlecxx . . $ PSecHandle# phContext)
2060 {
2061 NTLM_CONTEXTcxx . . $ NTLM_CONTEXT#* context = sspi_SecureHandleGetLowerPointercxx . . $ sspi_SecureHandleGetLowerPointer(850d8027e444f59b).(phContext);
2062
2063 if (context)
2064 {
2065 if (!check_contextcxx . . $ `winpr/libwinpr/sspi/NTLM/ntlm.c:50:9`!(context))
2066 return FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!;
2067
2068 winpr_RC4_Freecxx . . $ winpr_RC4_Free(d93f1f27970c8599).(context->SendRc4Sealcxx . . $ $anonymous_type_544b217a83a6fa2a_13#SendRc4Seal.);
2069 winpr_RC4_Freecxx . . $ winpr_RC4_Free(d93f1f27970c8599).(context->RecvRc4Sealcxx . . $ $anonymous_type_544b217a83a6fa2a_13#RecvRc4Seal.);
2070 context->SendRc4Sealcxx . . $ $anonymous_type_544b217a83a6fa2a_13#SendRc4Seal. = winpr_RC4_Newcxx . . $ winpr_RC4_New(13d3dba6f4565a89).(context->RecvSealingKeycxx . . $ $anonymous_type_544b217a83a6fa2a_13#RecvSealingKey., 16);
2071 context->RecvRc4Sealcxx . . $ $anonymous_type_544b217a83a6fa2a_13#RecvRc4Seal. = winpr_RC4_Newcxx . . $ winpr_RC4_New(13d3dba6f4565a89).(context->SendSealingKeycxx . . $ $anonymous_type_544b217a83a6fa2a_13#SendSealingKey., 16);
2072
2073 if (!context->SendRc4Sealcxx . . $ $anonymous_type_544b217a83a6fa2a_13#SendRc4Seal.)
2074 {
2075 WLog_ERRcxx . . $ `winpr/include/winpr/wlog.h:347:9`!(TAGcxx . . $ `winpr/libwinpr/sspi/NTLM/ntlm.c:42:9`!, "Failed to allocate context->SendRc4Seal");
2076 return FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!;
2077 }
2078 if (!context->RecvRc4Sealcxx . . $ $anonymous_type_544b217a83a6fa2a_13#RecvRc4Seal.)
2079 {
2080 WLog_ERRcxx . . $ `winpr/include/winpr/wlog.h:347:9`!(TAGcxx . . $ `winpr/libwinpr/sspi/NTLM/ntlm.c:42:9`!, "Failed to allocate context->RecvRc4Seal");
2081 return FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!;
2082 }
2083 }
2084
2085 return TRUEcxx . . $ `winpr/include/winpr/wtypes.h:126:9`!;
2086 }
2087
2088 BOOLcxx . . $ BOOL# NTLM_initcxx . . $ NTLM_init(b126dc7c1de90089).(void)
2089 {
2090 InitializeConstWCharFromUtf8cxx . . $ InitializeConstWCharFromUtf8(937e1d3c9c433ddd).(NTLM_SecPkgInfoAcxx . . $ NTLM_SecPkgInfoA..Namecxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_1#Name., NTLM_SecPkgInfoW_NameBuffercxx . . $ NTLM_SecPkgInfoW_NameBuffer.,
2091 ARRAYSIZEcxx . . $ `winpr/include/winpr/spec.h:962:9`!(NTLM_SecPkgInfoW_NameBuffer));
2092 InitializeConstWCharFromUtf8cxx . . $ InitializeConstWCharFromUtf8(937e1d3c9c433ddd).(NTLM_SecPkgInfoAcxx . . $ NTLM_SecPkgInfoA..Commentcxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_1#Comment., NTLM_SecPkgInfoW_CommentBuffercxx . . $ NTLM_SecPkgInfoW_CommentBuffer.,
2093 ARRAYSIZEcxx . . $ `winpr/include/winpr/spec.h:962:9`!(NTLM_SecPkgInfoW_CommentBuffer));
2094
2095 return TRUEcxx . . $ `winpr/include/winpr/wtypes.h:126:9`!;
2096 }
2097
2098 BOOLcxx . . $ BOOL# ntlm_SecBufferRealloccxx . . $ ntlm_SecBufferRealloc(c43574e4947ec252).(SecBuffercxx . . $ SecBuffer#* buffer, ULONGcxx . . $ ULONG# len)
2099 {
2100 sspi_SecBufferFreecxx . . $ sspi_SecBufferFree(32b3ea3b65e8fed4).(buffer);
2101 return sspi_SecBufferAlloccxx . . $ sspi_SecBufferAlloc(390a1ca73a7a932d).(buffer, len) != nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
2102 }