Debian Codegraph @

winpr/libwinpr/sspi/Negotiate/negotiate.c

raw symbols SCIP
1 /**
2 * WinPR: Windows Portable Runtime
3 * Negotiate Security Package
4 *
5 * Copyright 2011-2014 Marc-Andre Moreau <[email protected]>
6 * Copyright 2017 Dorian Ducournau <[email protected]>
7 *
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 */
20
21 #include <winpr/config.h>cxx . . $ `<file>/build/winpr/include/winpr/config.h`/
22
23 #include <winpr/crt.h>cxx . . $ `<file>/winpr/include/winpr/crt.h`/
24 #include <winpr/wtypes.h>cxx . . $ `<file>/winpr/include/winpr/wtypes.h`/
25 #include <winpr/assert.h>cxx . . $ `<file>/winpr/include/winpr/assert.h`/
26 #include <winpr/sspi.h>cxx . . $ `<file>/winpr/include/winpr/sspi.h`/
27 #include <winpr/tchar.h>cxx . . $ `<file>/winpr/include/winpr/tchar.h`/
28 #include <winpr/registry.h>cxx . . $ `<file>/winpr/include/winpr/registry.h`/
29 #include <winpr/build-config.h>cxx . . $ `<file>/build/winpr/include/winpr/build-config.h`/
30 #include <winpr/asn1.h>cxx . . $ `<file>/winpr/include/winpr/asn1.h`/
31
32 #include "negotiate.h"cxx . . $ `<file>/winpr/libwinpr/sspi/Negotiate/negotiate.h`/
33
34 #include "../NTLM/ntlm.h"cxx . . $ `<file>/winpr/libwinpr/sspi/NTLM/ntlm.h`/
35 #include "../NTLM/ntlm_export.h"cxx . . $ `<file>/winpr/libwinpr/sspi/NTLM/ntlm_export.h`/
36 #include "../Kerberos/kerberos.h"cxx . . $ `<file>/winpr/libwinpr/sspi/Kerberos/kerberos.h`/
37 #include "../sspi.h"cxx . . $ `<file>/winpr/libwinpr/sspi/sspi.h`/
38 #include "../../utils.h"cxx . . $ `<file>/winpr/libwinpr/utils.h`/
39 #include "../../log.h"cxx . . $ `<file>/winpr/libwinpr/log.h`/
40 #define TAGcxx . . $ `winpr/libwinpr/sspi/Negotiate/negotiate.c:40:9`! WINPR_TAGcxx . . $ `winpr/libwinpr/log.h:25:9`!("negotiate")
41
42 #define NEGO_REG_KEYcxx . . $ `winpr/libwinpr/sspi/Negotiate/negotiate.c:42:9`! "Software\\%s\\SSPI\\Negotiate"
43
44 static const char PACKAGE_NAME_DISABLE_ALLcxx . . $ PACKAGE_NAME_DISABLE_ALL.[] = "none";
45 static const char PACKAGE_NAME_NTLMcxx . . $ PACKAGE_NAME_NTLM.[] = "ntlm";
46 static const char PACKAGE_NAME_KERBEROScxx . . $ PACKAGE_NAME_KERBEROS.[] = "kerberos";
47 static const char PACKAGE_NAME_KERBEROS_U2Ucxx . . $ PACKAGE_NAME_KERBEROS_U2U.[] = "u2u";
48
49 typedef structcxx . . $ $anonymous_type_33a869a33ce4afdb_0#
50 {
51 const TCHARcxx . . $ TCHAR#* namecxx . . $ $anonymous_type_33a869a33ce4afdb_0#name.;
52 const SecurityFunctionTableAcxx . . $ SecurityFunctionTableA#* tablecxx . . $ $anonymous_type_33a869a33ce4afdb_0#table.;
53 const SecurityFunctionTableWcxx . . $ SecurityFunctionTableW#* table_wcxx . . $ $anonymous_type_33a869a33ce4afdb_0#table_w.;
54 } SecPkgcxx . . $ SecPkg#;
55
56 struct Mech_stcxx . . $ Mech_st#
57 {
58 const WinPrAsn1_OIDcxx . . $ WinPrAsn1_OID#* oidcxx . . $ Mech_st#oid.;
59 const SecPkgcxx . . $ SecPkg#* pkgcxx . . $ Mech_st#pkg.;
60 const UINTcxx . . $ UINT# flagscxx . . $ Mech_st#flags.;
61 const BOOLcxx . . $ BOOL# preferredcxx . . $ Mech_st#preferred.;
62 };
63
64 typedef structcxx . . $ $anonymous_type_33a869a33ce4afdb_1#
65 {
66 const Mechcxx . . $ Mech#* mechcxx . . $ $anonymous_type_33a869a33ce4afdb_1#mech.;
67 CredHandlecxx . . $ CredHandle# credcxx . . $ $anonymous_type_33a869a33ce4afdb_1#cred.;
68 BOOLcxx . . $ BOOL# validcxx . . $ $anonymous_type_33a869a33ce4afdb_1#valid.;
69 } MechCredcxx . . $ MechCred#;
70
71 const SecPkgInfoAcxx . . $ SecPkgInfoA# NEGOTIATE_SecPkgInfoAcxx . . $ NEGOTIATE_SecPkgInfoA. = {
72 0x00083BB3, /* fCapabilities */
73 1, /* wVersion */
74 0x0009, /* wRPCID */
75 0x00002FE0, /* cbMaxToken */
76 "Negotiate", /* Name */
77 "Microsoft Package Negotiator" /* Comment */
78 };
79
80 static WCHARcxx . . $ WCHAR# NEGOTIATE_SecPkgInfoW_NameBuffercxx . . $ NEGOTIATE_SecPkgInfoW_NameBuffer.[32] = WINPR_C_ARRAY_INITcxx . . $ `winpr/include/winpr/platform.h:87:9`!;
81 static WCHARcxx . . $ WCHAR# NEGOTIATE_SecPkgInfoW_CommentBuffercxx . . $ NEGOTIATE_SecPkgInfoW_CommentBuffer.[32] = WINPR_C_ARRAY_INITcxx . . $ `winpr/include/winpr/platform.h:87:9`!;
82
83 const SecPkgInfoWcxx . . $ SecPkgInfoW# NEGOTIATE_SecPkgInfoWcxx . . $ NEGOTIATE_SecPkgInfoW. = {
84 0x00083BB3, /* fCapabilities */
85 1, /* wVersion */
86 0x0009, /* wRPCID */
87 0x00002FE0, /* cbMaxToken */
88 NEGOTIATE_SecPkgInfoW_NameBuffercxx . . $ NEGOTIATE_SecPkgInfoW_NameBuffer., /* Name */
89 NEGOTIATE_SecPkgInfoW_CommentBuffercxx . . $ NEGOTIATE_SecPkgInfoW_CommentBuffer. /* Comment */
90 };
91
92 static const WinPrAsn1_OIDcxx . . $ WinPrAsn1_OID# spnego_OIDcxx . . $ spnego_OID. = { 6, (BYTEcxx . . $ BYTE#*)"\x2b\x06\x01\x05\x05\x02" };
93 static const WinPrAsn1_OIDcxx . . $ WinPrAsn1_OID# kerberos_u2u_OIDcxx . . $ kerberos_u2u_OID. = { 10,
94 (BYTEcxx . . $ BYTE#*)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x02\x03" };
95 static const WinPrAsn1_OIDcxx . . $ WinPrAsn1_OID# kerberos_OIDcxx . . $ kerberos_OID. = { 9, (BYTEcxx . . $ BYTE#*)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x02" };
96 static const WinPrAsn1_OIDcxx . . $ WinPrAsn1_OID# kerberos_wrong_OIDcxx . . $ kerberos_wrong_OID. = { 9,
97 (BYTEcxx . . $ BYTE#*)"\x2a\x86\x48\x82\xf7\x12\x01\x02\x02" };
98 static const WinPrAsn1_OIDcxx . . $ WinPrAsn1_OID# ntlm_OIDcxx . . $ ntlm_OID. = { 10, (BYTEcxx . . $ BYTE#*)"\x2b\x06\x01\x04\x01\x82\x37\x02\x02\x0a" };
99
100 static const WinPrAsn1_OIDcxx . . $ WinPrAsn1_OID# negoex_OIDcxx . . $ negoex_OID. = { 10, (BYTEcxx . . $ BYTE#*)"\x2b\x06\x01\x04\x01\x82\x37\x02\x02\x1e" };
101
102 #ifdef WITH_KRB5cxx . . $ `<built-in>:425:9`!
103 static const SecPkgcxx . . $ SecPkg# SecPkgTablecxx . . $ SecPkgTable.[] = {
104 { KERBEROS_SSP_NAMEcxx . . $ `winpr/include/winpr/sspi.h:103:9`!, &KERBEROS_SecurityFunctionTableAcxx . . $ KERBEROS_SecurityFunctionTableA., &KERBEROS_SecurityFunctionTableWcxx . . $ KERBEROS_SecurityFunctionTableW. },
105 { KERBEROS_SSP_NAMEcxx . . $ `winpr/include/winpr/sspi.h:103:9`!, &KERBEROS_SecurityFunctionTableAcxx . . $ KERBEROS_SecurityFunctionTableA., &KERBEROS_SecurityFunctionTableWcxx . . $ KERBEROS_SecurityFunctionTableW. },
106 { NTLM_SSP_NAMEcxx . . $ `winpr/include/winpr/sspi.h:102:9`!, &NTLM_SecurityFunctionTableAcxx . . $ NTLM_SecurityFunctionTableA., &NTLM_SecurityFunctionTableWcxx . . $ NTLM_SecurityFunctionTableW. }
107 };
108
109 static const Mechcxx . . $ Mech# MechTablecxx . . $ MechTable.[] = {
110 { &kerberos_u2u_OIDcxx . . $ kerberos_u2u_OID., &SecPkgTablecxx . . $ SecPkgTable.[0], ISC_REQ_INTEGRITYcxx . . $ `winpr/include/winpr/sspi.h:600:9`! | ISC_REQ_USE_SESSION_KEYcxx . . $ `winpr/include/winpr/sspi.h:589:9`!, TRUEcxx . . $ `winpr/include/winpr/wtypes.h:126:9`! },
111 { &kerberos_OIDcxx . . $ kerberos_OID., &SecPkgTablecxx . . $ SecPkgTable.[1], ISC_REQ_INTEGRITYcxx . . $ `winpr/include/winpr/sspi.h:600:9`!, TRUEcxx . . $ `winpr/include/winpr/wtypes.h:126:9`! },
112 { &ntlm_OIDcxx . . $ ntlm_OID., &SecPkgTablecxx . . $ SecPkgTable.[2], 0, FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`! },
113 };
114 #else
115 static const SecPkg SecPkgTable[] = { { NTLM_SSP_NAME, &NTLM_SecurityFunctionTableA,
116 &NTLM_SecurityFunctionTableW } };
117
118 static const Mech MechTable[] = {
119 { &ntlm_OID, &SecPkgTable[0], 0, FALSE },
120 };
121 #endif
122
123 static const size_t MECH_COUNTcxx . . $ MECH_COUNT. = ARRAYSIZEcxx . . $ `winpr/include/winpr/spec.h:962:9`!(MechTable);
124
125 enum NegStatecxx . . $ NegState#
126 {
127 NOSTATEcxx . . $ NOSTATE. = -1,
128 ACCEPT_COMPLETEDcxx . . $ ACCEPT_COMPLETED.,
129 ACCEPT_INCOMPLETEcxx . . $ ACCEPT_INCOMPLETE.,
130 REJECTcxx . . $ REJECT.,
131 REQUEST_MICcxx . . $ REQUEST_MIC.
132 };
133
134 typedef structcxx . . $ $anonymous_type_33a869a33ce4afdb_2#
135 {
136 enum NegStatecxx . . $ NegState# negStatecxx . . $ $anonymous_type_33a869a33ce4afdb_2#negState.;
137 BOOLcxx . . $ BOOL# initcxx . . $ $anonymous_type_33a869a33ce4afdb_2#init.;
138 WinPrAsn1_OIDcxx . . $ WinPrAsn1_OID# supportedMechcxx . . $ $anonymous_type_33a869a33ce4afdb_2#supportedMech.;
139 SecBuffercxx . . $ SecBuffer# mechTypescxx . . $ $anonymous_type_33a869a33ce4afdb_2#mechTypes.;
140 SecBuffercxx . . $ SecBuffer# mechTokencxx . . $ $anonymous_type_33a869a33ce4afdb_2#mechToken.;
141 SecBuffercxx . . $ SecBuffer# miccxx . . $ $anonymous_type_33a869a33ce4afdb_2#mic.;
142 } NegTokencxx . . $ NegToken#;
143
144 static const NegTokencxx . . $ NegToken# empty_neg_tokencxx . . $ empty_neg_token. = { NOSTATEcxx . . $ NOSTATE., FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!,
145 { 0, nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`! }, { 0, 0, nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`! },
146 { 0, 0, nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`! }, { 0, 0, nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`! } };
147
148 static NEGOTIATE_CONTEXTcxx . . $ NEGOTIATE_CONTEXT#* negotiate_ContextNewcxx . . $ negotiate_ContextNew(8bd570cdfc2e9239).(NEGOTIATE_CONTEXTcxx . . $ NEGOTIATE_CONTEXT#* init_context)
149 {
150 NEGOTIATE_CONTEXTcxx . . $ NEGOTIATE_CONTEXT#* context = nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
151
152 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(init_context);
153
154 context = calloccxx . . $ calloc(63a7bf2941bfcd7a).(1, sizeof(NEGOTIATE_CONTEXTcxx . . $ NEGOTIATE_CONTEXT#));
155 if (!context)
156 return nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
157
158 if (init_context->spnegocxx . . $ $anonymous_type_5da0b8083feac31a_1#spnego.)
159 {
160 init_context->mechTypescxx . . $ $anonymous_type_5da0b8083feac31a_1#mechTypes..pvBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#pvBuffer. = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(init_context->mechTypescxx . . $ $anonymous_type_5da0b8083feac31a_1#mechTypes..cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer.);
161 if (!init_context->mechTypescxx . . $ $anonymous_type_5da0b8083feac31a_1#mechTypes..pvBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#pvBuffer.)
162 {
163 freecxx . . $ free(5d22bdacc48458e8).(context);
164 return nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
165 }
166 }
167
168 *context = *init_context;
169
170 return context;
171 }
172
173 static void negotiate_ContextFreecxx . . $ negotiate_ContextFree(98ccfdd22a8b30d5).(NEGOTIATE_CONTEXTcxx . . $ NEGOTIATE_CONTEXT#* context)
174 {
175 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(context);
176
177 if (context->mechTypescxx . . $ $anonymous_type_5da0b8083feac31a_1#mechTypes..pvBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#pvBuffer.)
178 freecxx . . $ free(5d22bdacc48458e8).(context->mechTypescxx . . $ $anonymous_type_5da0b8083feac31a_1#mechTypes..pvBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#pvBuffer.);
179 freecxx . . $ free(5d22bdacc48458e8).(context);
180 }
181
182 static const char* negotiate_mech_namecxx . . $ negotiate_mech_name(2ccc7cd6816ed1f8).(const WinPrAsn1_OIDcxx . . $ WinPrAsn1_OID#* oid)
183 {
184 if (sspi_gss_oid_comparecxx . . $ sspi_gss_oid_compare(8eb53dc27d60d78a).(oid, &spnego_OIDcxx . . $ spnego_OID.))
185 return "SPNEGO (1.3.6.1.5.5.2)";
186 else if (sspi_gss_oid_comparecxx . . $ sspi_gss_oid_compare(8eb53dc27d60d78a).(oid, &kerberos_u2u_OIDcxx . . $ kerberos_u2u_OID.))
187 return "Kerberos user to user (1.2.840.113554.1.2.2.3)";
188 else if (sspi_gss_oid_comparecxx . . $ sspi_gss_oid_compare(8eb53dc27d60d78a).(oid, &kerberos_OIDcxx . . $ kerberos_OID.))
189 return "Kerberos (1.2.840.113554.1.2.2)";
190 else if (sspi_gss_oid_comparecxx . . $ sspi_gss_oid_compare(8eb53dc27d60d78a).(oid, &kerberos_wrong_OIDcxx . . $ kerberos_wrong_OID.))
191 return "Kerberos [wrong OID] (1.2.840.48018.1.2.2)";
192 else if (sspi_gss_oid_comparecxx . . $ sspi_gss_oid_compare(8eb53dc27d60d78a).(oid, &ntlm_OIDcxx . . $ ntlm_OID.))
193 return "NTLM (1.3.6.1.4.1.311.2.2.10)";
194 else if (sspi_gss_oid_comparecxx . . $ sspi_gss_oid_compare(8eb53dc27d60d78a).(oid, &negoex_OIDcxx . . $ negoex_OID.))
195 return "NegoEx (1.3.6.1.4.1.311.2.2.30)";
196 else
197 return "Unknown mechanism";
198 }
199
200 static const Mechcxx . . $ Mech#* negotiate_GetMechByOIDcxx . . $ negotiate_GetMechByOID(b8fc83408cf7dfde).(const WinPrAsn1_OIDcxx . . $ WinPrAsn1_OID#* oid)
201 {
202 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(oid);
203
204 WinPrAsn1_OIDcxx . . $ WinPrAsn1_OID# testOid = *oid;
205
206 if (sspi_gss_oid_comparecxx . . $ sspi_gss_oid_compare(8eb53dc27d60d78a).(&testOid, &kerberos_wrong_OIDcxx . . $ kerberos_wrong_OID.))
207 {
208 testOid.lencxx . . $ $anonymous_type_41db265f08275ce7_2#len. = kerberos_OIDcxx . . $ kerberos_OID..lencxx . . $ $anonymous_type_41db265f08275ce7_2#len.;
209 testOid.datacxx . . $ $anonymous_type_41db265f08275ce7_2#data. = kerberos_OIDcxx . . $ kerberos_OID..datacxx . . $ $anonymous_type_41db265f08275ce7_2#data.;
210 }
211
212 for (size_t i = 0; i < MECH_COUNTcxx . . $ MECH_COUNT.; i++)
213 {
214 if (sspi_gss_oid_comparecxx . . $ sspi_gss_oid_compare(8eb53dc27d60d78a).(&testOid, MechTablecxx . . $ MechTable.[i].oidcxx . . $ Mech_st#oid.))
215 return &MechTablecxx . . $ MechTable.[i];
216 }
217 return nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
218 }
219
220 static PSecHandlecxx . . $ PSecHandle# negotiate_FindCredentialcxx . . $ negotiate_FindCredential(c9942ba04841ed61).(MechCredcxx . . $ MechCred#* creds, const Mechcxx . . $ Mech#* mech)
221 {
222 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(creds);
223
224 if (!mech)
225 return nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
226
227 for (size_t i = 0; i < MECH_COUNTcxx . . $ MECH_COUNT.; i++)
228 {
229 MechCredcxx . . $ MechCred#* cred = &creds[i];
230
231 if (cred->mechcxx . . $ $anonymous_type_33a869a33ce4afdb_1#mech. == mech)
232 {
233 if (cred->validcxx . . $ $anonymous_type_33a869a33ce4afdb_1#valid.)
234 return &cred->credcxx . . $ $anonymous_type_33a869a33ce4afdb_1#cred.;
235 return nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
236 }
237 }
238
239 return nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
240 }
241
242 static BOOLcxx . . $ BOOL# negotiate_get_dwordcxx . . $ negotiate_get_dword(db78f8be06d3b219).(HKEYcxx . . $ HKEY# hKey, const char* subkey, DWORDcxx . . $ DWORD#* pdwValue)
243 {
244 DWORDcxx . . $ DWORD# dwValue = 0;
245 DWORDcxx . . $ DWORD# dwType = 0;
246 DWORDcxx . . $ DWORD# dwSize = sizeof(dwValue);
247 LONGcxx . . $ LONG# rc = RegQueryValueExAcxx . . $ RegQueryValueExA(e9611e8c24dd770c).(hKey, subkey, nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, &dwType, (BYTEcxx . . $ BYTE#*)&dwValue, &dwSize);
248
249 if (rc != ERROR_SUCCESScxx . . $ `winpr/include/winpr/error.h:185:9`!)
250 return FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!;
251 if (dwType != REG_DWORDcxx . . $ REG_DWORD.)
252 return FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!;
253
254 *pdwValue = dwValue;
255 return TRUEcxx . . $ `winpr/include/winpr/wtypes.h:126:9`!;
256 }
257
258 static BOOLcxx . . $ BOOL# negotiate_get_config_from_auth_package_listcxx . . $ negotiate_get_config_from_auth_package_list(7a79db60a0303297).(void* pAuthData, BOOLcxx . . $ BOOL#* kerberos, BOOLcxx . . $ BOOL#* ntlm,
259 BOOLcxx . . $ BOOL#* u2u)
260 {
261 BOOLcxx . . $ BOOL# rc = FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!;
262 char* tok_ctx = nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
263 char* PackageList = nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
264
265 if (!sspi_CopyAuthPackageListAcxx . . $ sspi_CopyAuthPackageListA(e2e729750b712e).((const SEC_WINNT_AUTH_IDENTITY_INFOcxx . . $ SEC_WINNT_AUTH_IDENTITY_INFO#*)pAuthData, &PackageList))
266 return FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!;
267
268 char* tok_ptr = strtok_scxx . . $ strtok_s(a42394c85d6397dd).(PackageList, ",", &tok_ctx);
269
270 while (tok_ptr)
271 {
272 const char* PackageName = tok_ptr;
273 BOOLcxx . . $ BOOL# PackageInclude = TRUEcxx . . $ `winpr/include/winpr/wtypes.h:126:9`!;
274
275 if (PackageName[0] == '!')
276 {
277 PackageName = &PackageName[1];
278 PackageInclude = FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!;
279 }
280
281 if (_stricmpcxx . . $ _stricmp(5ae29d726ae57f88).(PackageName, PACKAGE_NAME_NTLMcxx . . $ PACKAGE_NAME_NTLM.) == 0)
282 {
283 *ntlm = PackageInclude;
284 }
285 else if (_stricmpcxx . . $ _stricmp(5ae29d726ae57f88).(PackageName, PACKAGE_NAME_KERBEROScxx . . $ PACKAGE_NAME_KERBEROS.) == 0)
286 {
287 *kerberos = PackageInclude;
288 }
289 else if (_stricmpcxx . . $ _stricmp(5ae29d726ae57f88).(PackageName, PACKAGE_NAME_KERBEROS_U2Ucxx . . $ PACKAGE_NAME_KERBEROS_U2U.) == 0)
290 {
291 *u2u = PackageInclude;
292 }
293 else if (_stricmpcxx . . $ _stricmp(5ae29d726ae57f88).(PackageName, PACKAGE_NAME_DISABLE_ALLcxx . . $ PACKAGE_NAME_DISABLE_ALL.) == 0)
294 {
295 *kerberos = FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!;
296 *ntlm = FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!;
297 *u2u = FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!;
298
299 if (PackageName != PackageList)
300 {
301 WLog_WARNcxx . . $ `winpr/include/winpr/wlog.h:345:9`!(TAGcxx . . $ `winpr/libwinpr/sspi/Negotiate/negotiate.c:40:9`!, "Special keyword '%s' not first in list, aborting", PackageName);
302 goto fail;
303 }
304 }
305 else
306 {
307 WLog_WARNcxx . . $ `winpr/include/winpr/wlog.h:345:9`!(TAGcxx . . $ `winpr/libwinpr/sspi/Negotiate/negotiate.c:40:9`!, "Unknown authentication package name: %s, ignoring", PackageName);
308 }
309
310 tok_ptr = strtok_scxx . . $ strtok_s(a42394c85d6397dd).(nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, ",", &tok_ctx);
311 }
312
313 rc = TRUEcxx . . $ `winpr/include/winpr/wtypes.h:126:9`!;
314 fail:
315 freecxx . . $ free(5d22bdacc48458e8).(PackageList);
316 return rc;
317 }
318
319 static BOOLcxx . . $ BOOL# negotiate_get_configcxx . . $ negotiate_get_config(7a79db60a0303297).(void* pAuthData, BOOLcxx . . $ BOOL#* kerberos, BOOLcxx . . $ BOOL#* ntlm, BOOLcxx . . $ BOOL#* u2u)
320 {
321 HKEYcxx . . $ HKEY# hKey = nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
322
323 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(kerberos);
324 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(ntlm);
325 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(u2u);
326
327 #if !defined(WITH_KRB5_NO_NTLM_FALLBACK)
328 *ntlm = TRUEcxx . . $ `winpr/include/winpr/wtypes.h:126:9`!;
329 #else
330 *ntlm = FALSE;
331 #endif
332 #if defined(WITH_KRB5cxx . . $ `<built-in>:425:9`!)
333 *kerberos = TRUEcxx . . $ `winpr/include/winpr/wtypes.h:126:9`!;
334 *u2u = TRUEcxx . . $ `winpr/include/winpr/wtypes.h:126:9`!;
335 #else
336 *kerberos = FALSE;
337 *u2u = FALSE;
338 #endif
339
340 if (negotiate_get_config_from_auth_package_listcxx . . $ negotiate_get_config_from_auth_package_list(7a79db60a0303297).(pAuthData, kerberos, ntlm, u2u))
341 {
342 return TRUEcxx . . $ `winpr/include/winpr/wtypes.h:126:9`!; // use explicit authentication package list
343 }
344
345 {
346 char* key = winpr_getApplicatonDetailsRegKeycxx . . $ winpr_getApplicatonDetailsRegKey(a8b8e32347182212).(NEGO_REG_KEYcxx . . $ `winpr/libwinpr/sspi/Negotiate/negotiate.c:42:9`!);
347 if (key)
348 {
349 const LONGcxx . . $ LONG# rc =
350 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);
351 freecxx . . $ free(5d22bdacc48458e8).(key);
352 if (rc == ERROR_SUCCESScxx . . $ `winpr/include/winpr/error.h:185:9`!)
353 {
354 DWORDcxx . . $ DWORD# dwValue = 0;
355
356 if (negotiate_get_dwordcxx . . $ negotiate_get_dword(db78f8be06d3b219).(hKey, PACKAGE_NAME_KERBEROScxx . . $ PACKAGE_NAME_KERBEROS., &dwValue))
357 *kerberos = (dwValue != 0);
358
359 if (negotiate_get_dwordcxx . . $ negotiate_get_dword(db78f8be06d3b219).(hKey, PACKAGE_NAME_KERBEROS_U2Ucxx . . $ PACKAGE_NAME_KERBEROS_U2U., &dwValue))
360 *u2u = (dwValue != 0);
361
362 #if !defined(WITH_KRB5_NO_NTLM_FALLBACK)
363 if (negotiate_get_dwordcxx . . $ negotiate_get_dword(db78f8be06d3b219).(hKey, PACKAGE_NAME_NTLMcxx . . $ PACKAGE_NAME_NTLM., &dwValue))
364 *ntlm = (dwValue != 0);
365 #endif
366
367 RegCloseKeycxx . . $ RegCloseKey(dedf1e9b1c614a07).(hKey);
368 }
369 }
370 }
371
372 return TRUEcxx . . $ `winpr/include/winpr/wtypes.h:126:9`!;
373 }
374
375 static BOOLcxx . . $ BOOL# negotiate_write_neg_tokencxx . . $ negotiate_write_neg_token(f577b0f717e21f66).(PSecBuffercxx . . $ PSecBuffer# output_buffer, NegTokencxx . . $ NegToken#* token)
376 {
377 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(output_buffer);
378 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(token);
379
380 BOOLcxx . . $ BOOL# ret = FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!;
381 WinPrAsn1Encodercxx . . $ WinPrAsn1Encoder#* enc = nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
382 WinPrAsn1_MemoryChunkcxx . . $ WinPrAsn1_MemoryChunk# mechTypes = { token->mechTypescxx . . $ $anonymous_type_33a869a33ce4afdb_2#mechTypes..cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer., token->mechTypescxx . . $ $anonymous_type_33a869a33ce4afdb_2#mechTypes..pvBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#pvBuffer. };
383 WinPrAsn1_OctetStringcxx . . $ WinPrAsn1_OctetString# mechToken = { token->mechTokencxx . . $ $anonymous_type_33a869a33ce4afdb_2#mechToken..cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer., token->mechTokencxx . . $ $anonymous_type_33a869a33ce4afdb_2#mechToken..pvBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#pvBuffer. };
384 WinPrAsn1_OctetStringcxx . . $ WinPrAsn1_OctetString# mechListMic = { token->miccxx . . $ $anonymous_type_33a869a33ce4afdb_2#mic..cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer., token->miccxx . . $ $anonymous_type_33a869a33ce4afdb_2#mic..pvBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#pvBuffer. };
385 wStreamcxx . . $ wStream# s;
386 size_t len = 0;
387
388 enc = WinPrAsn1Encoder_Newcxx . . $ WinPrAsn1Encoder_New(230dd22efc6416a5).(WINPR_ASN1_DERcxx . . $ WINPR_ASN1_DER.);
389 if (!enc)
390 return FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!;
391
392 /* For NegTokenInit wrap in an initialContextToken */
393 if (token->initcxx . . $ $anonymous_type_33a869a33ce4afdb_2#init.)
394 {
395 /* InitialContextToken [APPLICATION 0] IMPLICIT SEQUENCE */
396 if (!WinPrAsn1EncAppContainercxx . . $ WinPrAsn1EncAppContainer(44e8d7d1a70530a5).(enc, 0))
397 goto cleanup;
398
399 /* thisMech MechType OID */
400 if (!WinPrAsn1EncOIDcxx . . $ WinPrAsn1EncOID(55fe8a0323b9182a).(enc, &spnego_OIDcxx . . $ spnego_OID.))
401 goto cleanup;
402 }
403
404 /* innerContextToken [0] NegTokenInit or [1] NegTokenResp */
405 if (!WinPrAsn1EncContextualSeqContainercxx . . $ WinPrAsn1EncContextualSeqContainer(44e8d7d1a70530a5).(enc, token->initcxx . . $ $anonymous_type_33a869a33ce4afdb_2#init. ? 0 : 1))
406 goto cleanup;
407
408 WLog_DBGcxx . . $ `winpr/include/winpr/wlog.h:341:9`!(TAGcxx . . $ `winpr/libwinpr/sspi/Negotiate/negotiate.c:40:9`!, token->init ? "Writing negTokenInit..." : "Writing negTokenResp...");
409
410 /* mechTypes [0] MechTypeList (mechTypes already contains the SEQUENCE tag) */
411 if (token->initcxx . . $ $anonymous_type_33a869a33ce4afdb_2#init.)
412 {
413 if (!WinPrAsn1EncContextualRawContentcxx . . $ WinPrAsn1EncContextualRawContent(f824ba6e8ff7603a).(enc, 0, &mechTypes))
414 goto cleanup;
415 WLog_DBGcxx . . $ `winpr/include/winpr/wlog.h:341:9`!(TAGcxx . . $ `winpr/libwinpr/sspi/Negotiate/negotiate.c:40:9`!, "\tmechTypes [0] (%" PRIu32cxx . . $ `<external>/15933738808807975373/inttypes.h:109:10`! " bytes)", token->mechTypes.cbBuffer);
416 }
417 /* negState [0] ENUMERATED */
418 else if (token->negStatecxx . . $ $anonymous_type_33a869a33ce4afdb_2#negState. != NOSTATEcxx . . $ NOSTATE.)
419 {
420 if (!WinPrAsn1EncContextualEnumeratedcxx . . $ WinPrAsn1EncContextualEnumerated(5c36dbb746f0133b).(enc, 0, token->negStatecxx . . $ $anonymous_type_33a869a33ce4afdb_2#negState.))
421 goto cleanup;
422 WLog_DBGcxx . . $ `winpr/include/winpr/wlog.h:341:9`!(TAGcxx . . $ `winpr/libwinpr/sspi/Negotiate/negotiate.c:40:9`!, "\tnegState [0] (%d)", token->negState);
423 }
424
425 /* supportedMech [1] OID */
426 if (token->supportedMechcxx . . $ $anonymous_type_33a869a33ce4afdb_2#supportedMech..lencxx . . $ $anonymous_type_41db265f08275ce7_2#len.)
427 {
428 if (!WinPrAsn1EncContextualOIDcxx . . $ WinPrAsn1EncContextualOID(f824ba6e8ff7603a).(enc, 1, &token->supportedMechcxx . . $ $anonymous_type_33a869a33ce4afdb_2#supportedMech.))
429 goto cleanup;
430 WLog_DBGcxx . . $ `winpr/include/winpr/wlog.h:341:9`!(TAGcxx . . $ `winpr/libwinpr/sspi/Negotiate/negotiate.c:40:9`!, "\tsupportedMech [1] (%s)", negotiate_mech_name(&token->supportedMech));
431 }
432
433 /* mechToken [2] OCTET STRING */
434 if (token->mechTokencxx . . $ $anonymous_type_33a869a33ce4afdb_2#mechToken..cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer.)
435 {
436 if (WinPrAsn1EncContextualOctetStringcxx . . $ WinPrAsn1EncContextualOctetString(f824ba6e8ff7603a).(enc, 2, &mechToken) == 0)
437 goto cleanup;
438 WLog_DBGcxx . . $ `winpr/include/winpr/wlog.h:341:9`!(TAGcxx . . $ `winpr/libwinpr/sspi/Negotiate/negotiate.c:40:9`!, "\tmechToken [2] (%" PRIu32cxx . . $ `<external>/15933738808807975373/inttypes.h:109:10`! " bytes)", token->mechToken.cbBuffer);
439 }
440
441 /* mechListMIC [3] OCTET STRING */
442 if (token->miccxx . . $ $anonymous_type_33a869a33ce4afdb_2#mic..cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer.)
443 {
444 if (WinPrAsn1EncContextualOctetStringcxx . . $ WinPrAsn1EncContextualOctetString(f824ba6e8ff7603a).(enc, 3, &mechListMic) == 0)
445 goto cleanup;
446 WLog_DBGcxx . . $ `winpr/include/winpr/wlog.h:341:9`!(TAGcxx . . $ `winpr/libwinpr/sspi/Negotiate/negotiate.c:40:9`!, "\tmechListMIC [3] (%" PRIu32cxx . . $ `<external>/15933738808807975373/inttypes.h:109:10`! " bytes)", token->mic.cbBuffer);
447 }
448
449 /* NegTokenInit or NegTokenResp */
450 if (!WinPrAsn1EncEndContainercxx . . $ WinPrAsn1EncEndContainer(9cfb7cc50cd2a2e1).(enc))
451 goto cleanup;
452
453 if (token->initcxx . . $ $anonymous_type_33a869a33ce4afdb_2#init.)
454 {
455 /* initialContextToken */
456 if (!WinPrAsn1EncEndContainercxx . . $ WinPrAsn1EncEndContainer(9cfb7cc50cd2a2e1).(enc))
457 goto cleanup;
458 }
459
460 if (!WinPrAsn1EncStreamSizecxx . . $ WinPrAsn1EncStreamSize(7491d667398adca3).(enc, &len) || len > output_buffer->cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer.)
461 goto cleanup;
462
463 if (len > UINT32_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:124:10`!)
464 goto cleanup;
465
466 Stream_StaticInitcxx . . $ Stream_StaticInit(a93e379cdb0b7c14).(&s, output_buffer->pvBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#pvBuffer., len);
467
468 if (WinPrAsn1EncToStreamcxx . . $ WinPrAsn1EncToStream(eccd197e98b9208).(enc, &s))
469 {
470 output_buffer->cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer. = (UINT32cxx . . $ UINT32#)len;
471 ret = TRUEcxx . . $ `winpr/include/winpr/wtypes.h:126:9`!;
472 }
473
474 cleanup:
475 WinPrAsn1Encoder_Freecxx . . $ WinPrAsn1Encoder_Free(b1493289c6e4e358).(&enc);
476 return ret;
477 }
478
479 static BOOLcxx . . $ BOOL# negotiate_read_neg_tokencxx . . $ negotiate_read_neg_token(f577b0f717e21f66).(PSecBuffercxx . . $ PSecBuffer# input, NegTokencxx . . $ NegToken#* token)
480 {
481 WinPrAsn1Decodercxx . . $ WinPrAsn1Decoder# dec = WinPrAsn1Decoder_initcxx . . $ WinPrAsn1Decoder_init(9f2b2b04a0169e89).();
482 WinPrAsn1Decodercxx . . $ WinPrAsn1Decoder# dec2 = WinPrAsn1Decoder_initcxx . . $ WinPrAsn1Decoder_init(9f2b2b04a0169e89).();
483 WinPrAsn1_OIDcxx . . $ WinPrAsn1_OID# oid = WINPR_C_ARRAY_INITcxx . . $ `winpr/include/winpr/platform.h:87:9`!;
484 WinPrAsn1_tagIdcxx . . $ WinPrAsn1_tagId# contextual = 0;
485 WinPrAsn1_tagcxx . . $ WinPrAsn1_tag# tag = 0;
486 size_t len = 0;
487 WinPrAsn1_OctetStringcxx . . $ WinPrAsn1_OctetString# octet_string = WINPR_C_ARRAY_INITcxx . . $ `winpr/include/winpr/platform.h:87:9`!;
488 BOOLcxx . . $ BOOL# err = 0;
489
490 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(input);
491 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(token);
492
493 WinPrAsn1Decoder_InitMemcxx . . $ WinPrAsn1Decoder_InitMem(87018fb168845641).(&dec, WINPR_ASN1_DERcxx . . $ WINPR_ASN1_DER., input->pvBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#pvBuffer., input->cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer.);
494
495 if (!WinPrAsn1DecPeekTagcxx . . $ WinPrAsn1DecPeekTag(351939a9a2a91f44).(&dec, &tag))
496 return FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!;
497
498 if (tag == 0x60)
499 {
500 /* initialContextToken [APPLICATION 0] */
501 if (!WinPrAsn1DecReadAppcxx . . $ WinPrAsn1DecReadApp(6e392b4d237c4dfd).(&dec, &tag, &dec2) || tag != 0)
502 return FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!;
503 dec = dec2;
504
505 /* thisMech OID */
506 if (!WinPrAsn1DecReadOIDcxx . . $ WinPrAsn1DecReadOID(21289d36764807d6).(&dec, &oid, FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!))
507 return FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!;
508
509 if (!sspi_gss_oid_comparecxx . . $ sspi_gss_oid_compare(8eb53dc27d60d78a).(&spnego_OIDcxx . . $ spnego_OID., &oid))
510 return FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!;
511
512 /* [0] NegTokenInit */
513 if (!WinPrAsn1DecReadContextualSequencecxx . . $ WinPrAsn1DecReadContextualSequence(7422d77ef261274c).(&dec, 0, &err, &dec2))
514 return FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!;
515
516 token->initcxx . . $ $anonymous_type_33a869a33ce4afdb_2#init. = TRUEcxx . . $ `winpr/include/winpr/wtypes.h:126:9`!;
517 }
518 /* [1] NegTokenResp */
519 else if (!WinPrAsn1DecReadContextualSequencecxx . . $ WinPrAsn1DecReadContextualSequence(7422d77ef261274c).(&dec, 1, &err, &dec2))
520 return FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!;
521 dec = dec2;
522
523 WLog_DBGcxx . . $ `winpr/include/winpr/wlog.h:341:9`!(TAGcxx . . $ `winpr/libwinpr/sspi/Negotiate/negotiate.c:40:9`!, token->init ? "Reading negTokenInit..." : "Reading negTokenResp...");
524
525 /* Read NegTokenResp sequence members */
526 do
527 {
528 if (!WinPrAsn1DecReadContextualTagcxx . . $ WinPrAsn1DecReadContextualTag(6e392b4d237c4dfd).(&dec, &contextual, &dec2))
529 return FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!;
530
531 switch (contextual)
532 {
533 case 0:
534 if (token->initcxx . . $ $anonymous_type_33a869a33ce4afdb_2#init.)
535 {
536 /* mechTypes [0] MechTypeList */
537 wStreamcxx . . $ wStream# s = WinPrAsn1DecGetStreamcxx . . $ WinPrAsn1DecGetStream(55d1c207c5d12112).(&dec2);
538 token->mechTypescxx . . $ $anonymous_type_33a869a33ce4afdb_2#mechTypes..BufferTypecxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#BufferType. = SECBUFFER_TOKENcxx . . $ `winpr/include/winpr/sspi.h:998:9`!;
539 const size_t mlen = Stream_Lengthcxx . . $ Stream_Length(ebc7f695a8644dc0).(&s);
540 if (mlen > UINT32_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:124:10`!)
541 return FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!;
542 token->mechTypescxx . . $ $anonymous_type_33a869a33ce4afdb_2#mechTypes..cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer. = (UINT32cxx . . $ UINT32#)mlen;
543 token->mechTypescxx . . $ $anonymous_type_33a869a33ce4afdb_2#mechTypes..pvBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#pvBuffer. = Stream_Buffercxx . . $ Stream_Buffer(38abee8bfc36c01e).(&s);
544 WLog_DBGcxx . . $ `winpr/include/winpr/wlog.h:341:9`!(TAGcxx . . $ `winpr/libwinpr/sspi/Negotiate/negotiate.c:40:9`!, "\tmechTypes [0] (%" PRIu32cxx . . $ `<external>/15933738808807975373/inttypes.h:109:10`! " bytes)", token->mechTypes.cbBuffer);
545 }
546 else
547 {
548 /* negState [0] ENUMERATED */
549 WinPrAsn1_ENUMERATEDcxx . . $ WinPrAsn1_ENUMERATED# rd = 0;
550 if (!WinPrAsn1DecReadEnumeratedcxx . . $ WinPrAsn1DecReadEnumerated(95c5b87d17cd7e74).(&dec2, &rd))
551 return FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!;
552 switch (rd)
553 {
554 case NOSTATEcxx . . $ NOSTATE.:
555 case ACCEPT_COMPLETEDcxx . . $ ACCEPT_COMPLETED.:
556 case ACCEPT_INCOMPLETEcxx . . $ ACCEPT_INCOMPLETE.:
557 case REJECTcxx . . $ REJECT.:
558 case REQUEST_MICcxx . . $ REQUEST_MIC.:
559 break;
560 default:
561 WLog_ERRcxx . . $ `winpr/include/winpr/wlog.h:347:9`!(TAGcxx . . $ `winpr/libwinpr/sspi/Negotiate/negotiate.c:40:9`!, "Invalid negState enumeration value %d", rd);
562 return FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!;
563 }
564
565 token->negStatecxx . . $ $anonymous_type_33a869a33ce4afdb_2#negState. = WINPR_ASSERTING_INT_CASTcxx . . $ `winpr/include/winpr/cast.h:111:9`!(enum NegState, rd);
566 WLog_DBGcxx . . $ `winpr/include/winpr/wlog.h:341:9`!(TAGcxx . . $ `winpr/libwinpr/sspi/Negotiate/negotiate.c:40:9`!, "\tnegState [0] (%d)", rd);
567 }
568 break;
569 case 1:
570 if (token->initcxx . . $ $anonymous_type_33a869a33ce4afdb_2#init.)
571 {
572 /* reqFlags [1] ContextFlags BIT STRING (ignored) */
573 if (!WinPrAsn1DecPeekTagAndLencxx . . $ WinPrAsn1DecPeekTagAndLen(d11a2f594647c0d2).(&dec2, &tag, &len) || (tag != ER_TAG_BIT_STRINGcxx . . $ ER_TAG_BIT_STRING.))
574 return FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!;
575 WLog_DBGcxx . . $ `winpr/include/winpr/wlog.h:341:9`!(TAGcxx . . $ `winpr/libwinpr/sspi/Negotiate/negotiate.c:40:9`!, "\treqFlags [1] (%" PRIuzcxx . . $ `winpr/include/winpr/wtypes.h:485:9`! " bytes)", len);
576 }
577 else
578 {
579 /* supportedMech [1] MechType */
580 if (!WinPrAsn1DecReadOIDcxx . . $ WinPrAsn1DecReadOID(21289d36764807d6).(&dec2, &token->supportedMechcxx . . $ $anonymous_type_33a869a33ce4afdb_2#supportedMech., FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!))
581 return FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!;
582 WLog_DBGcxx . . $ `winpr/include/winpr/wlog.h:341:9`!(TAGcxx . . $ `winpr/libwinpr/sspi/Negotiate/negotiate.c:40:9`!, "\tsupportedMech [1] (%s)",
583 negotiate_mech_name(&token->supportedMech));
584 }
585 break;
586 case 2:
587 /* mechToken [2] OCTET STRING */
588 if (!WinPrAsn1DecReadOctetStringcxx . . $ WinPrAsn1DecReadOctetString(21289d36764807d6).(&dec2, &octet_string, FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!))
589 return FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!;
590 if (octet_string.lencxx . . $ $anonymous_type_41db265f08275ce7_2#len. > UINT32_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:124:10`!)
591 return FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!;
592 token->mechTokencxx . . $ $anonymous_type_33a869a33ce4afdb_2#mechToken..cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer. = (UINT32cxx . . $ UINT32#)octet_string.lencxx . . $ $anonymous_type_41db265f08275ce7_2#len.;
593 token->mechTokencxx . . $ $anonymous_type_33a869a33ce4afdb_2#mechToken..pvBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#pvBuffer. = octet_string.datacxx . . $ $anonymous_type_41db265f08275ce7_2#data.;
594 token->mechTokencxx . . $ $anonymous_type_33a869a33ce4afdb_2#mechToken..BufferTypecxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#BufferType. = SECBUFFER_TOKENcxx . . $ `winpr/include/winpr/sspi.h:998:9`!;
595 WLog_DBGcxx . . $ `winpr/include/winpr/wlog.h:341:9`!(TAGcxx . . $ `winpr/libwinpr/sspi/Negotiate/negotiate.c:40:9`!, "\tmechToken [2] (%" PRIuzcxx . . $ `winpr/include/winpr/wtypes.h:485:9`! " bytes)", octet_string.len);
596 break;
597 case 3:
598 /* mechListMic [3] OCTET STRING */
599 if (!WinPrAsn1DecReadOctetStringcxx . . $ WinPrAsn1DecReadOctetString(21289d36764807d6).(&dec2, &octet_string, FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!))
600 return FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!;
601 if (octet_string.lencxx . . $ $anonymous_type_41db265f08275ce7_2#len. > UINT32_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:124:10`!)
602 return FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!;
603 token->miccxx . . $ $anonymous_type_33a869a33ce4afdb_2#mic..cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer. = (UINT32cxx . . $ UINT32#)octet_string.lencxx . . $ $anonymous_type_41db265f08275ce7_2#len.;
604 token->miccxx . . $ $anonymous_type_33a869a33ce4afdb_2#mic..pvBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#pvBuffer. = octet_string.datacxx . . $ $anonymous_type_41db265f08275ce7_2#data.;
605 token->miccxx . . $ $anonymous_type_33a869a33ce4afdb_2#mic..BufferTypecxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#BufferType. = SECBUFFER_TOKENcxx . . $ `winpr/include/winpr/sspi.h:998:9`!;
606 WLog_DBGcxx . . $ `winpr/include/winpr/wlog.h:341:9`!(TAGcxx . . $ `winpr/libwinpr/sspi/Negotiate/negotiate.c:40:9`!, "\tmechListMIC [3] (%" PRIuzcxx . . $ `winpr/include/winpr/wtypes.h:485:9`! " bytes)", octet_string.len);
607 break;
608 default:
609 WLog_ERRcxx . . $ `winpr/include/winpr/wlog.h:347:9`!(TAGcxx . . $ `winpr/libwinpr/sspi/Negotiate/negotiate.c:40:9`!, "unknown contextual item %d", contextual);
610 return FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!;
611 }
612 } while (WinPrAsn1DecPeekTagcxx . . $ WinPrAsn1DecPeekTag(351939a9a2a91f44).(&dec, &tag));
613
614 return TRUEcxx . . $ `winpr/include/winpr/wtypes.h:126:9`!;
615 }
616
617 static SECURITY_STATUScxx . . $ SECURITY_STATUS# negotiate_mic_exchangecxx . . $ negotiate_mic_exchange(db87e138d711453f).(NEGOTIATE_CONTEXTcxx . . $ NEGOTIATE_CONTEXT#* context, NegTokencxx . . $ NegToken#* input_token,
618 NegTokencxx . . $ NegToken#* output_token, PSecBuffercxx . . $ PSecBuffer# output_buffer)
619 {
620 SecBuffercxx . . $ SecBuffer# mic_buffers[2] = WINPR_C_ARRAY_INITcxx . . $ `winpr/include/winpr/platform.h:87:9`!;
621 SecBufferDesccxx . . $ SecBufferDesc# mic_buffer_desc = { SECBUFFER_VERSIONcxx . . $ `winpr/include/winpr/sspi.h:993:9`!, 2, mic_buffers };
622 SECURITY_STATUScxx . . $ SECURITY_STATUS# status = 0;
623
624 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(context);
625 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(input_token);
626 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(output_token);
627 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(context->mech);
628 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(context->mech->pkg);
629
630 const SecurityFunctionTableAcxx . . $ SecurityFunctionTableA#* table = context->mechcxx . . $ $anonymous_type_5da0b8083feac31a_1#mech.->pkgcxx . . $ Mech_st#pkg.->tablecxx . . $ $anonymous_type_33a869a33ce4afdb_0#table.;
631 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(table);
632
633 mic_buffers[0] = context->mechTypescxx . . $ $anonymous_type_5da0b8083feac31a_1#mechTypes.;
634
635 /* Verify MIC if we received one */
636 if (input_token->miccxx . . $ $anonymous_type_33a869a33ce4afdb_2#mic..cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer. > 0)
637 {
638 mic_buffers[1] = input_token->miccxx . . $ $anonymous_type_33a869a33ce4afdb_2#mic.;
639
640 status = table->VerifySignaturecxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_53#VerifySignature.(&context->sub_contextcxx . . $ $anonymous_type_5da0b8083feac31a_1#sub_context., &mic_buffer_desc, 0, nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!);
641 if (status != SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!)
642 return status;
643
644 output_token->negStatecxx . . $ $anonymous_type_33a869a33ce4afdb_2#negState. = ACCEPT_COMPLETEDcxx . . $ ACCEPT_COMPLETED.;
645 }
646
647 /* If peer expects a MIC then generate it */
648 if (input_token->negStatecxx . . $ $anonymous_type_33a869a33ce4afdb_2#negState. != ACCEPT_COMPLETEDcxx . . $ ACCEPT_COMPLETED.)
649 {
650 /* Store the mic token after the mech token in the output buffer */
651 output_token->miccxx . . $ $anonymous_type_33a869a33ce4afdb_2#mic..BufferTypecxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#BufferType. = SECBUFFER_TOKENcxx . . $ `winpr/include/winpr/sspi.h:998:9`!;
652 if (output_buffer)
653 {
654 output_token->miccxx . . $ $anonymous_type_33a869a33ce4afdb_2#mic..cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer. = output_buffer->cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer. - output_token->mechTokencxx . . $ $anonymous_type_33a869a33ce4afdb_2#mechToken..cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer.;
655 output_token->miccxx . . $ $anonymous_type_33a869a33ce4afdb_2#mic..pvBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#pvBuffer. =
656 (BYTEcxx . . $ BYTE#*)output_buffer->pvBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#pvBuffer. + output_token->mechTokencxx . . $ $anonymous_type_33a869a33ce4afdb_2#mechToken..cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer.;
657 }
658 mic_buffers[1] = output_token->miccxx . . $ $anonymous_type_33a869a33ce4afdb_2#mic.;
659
660 status = table->MakeSignaturecxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_53#MakeSignature.(&context->sub_contextcxx . . $ $anonymous_type_5da0b8083feac31a_1#sub_context., 0, &mic_buffer_desc, 0);
661 if (status != SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!)
662 return status;
663
664 output_token->miccxx . . $ $anonymous_type_33a869a33ce4afdb_2#mic. = mic_buffers[1];
665 }
666
667 /* When using NTLM cipher states need to be reset after mic exchange */
668 const SSPI_PACKAGE_IDcxx . . $ SSPI_PACKAGE_ID# sub_id = sspi_SecureHandleGetPackageIdcxx . . $ sspi_SecureHandleGetPackageId(cd6ee2d8b4ceacc1).(&context->sub_contextcxx . . $ $anonymous_type_5da0b8083feac31a_1#sub_context.);
669 if (!sub_id)
670 return SEC_E_INTERNAL_ERRORcxx . . $ `winpr/include/winpr/sspi.h:138:9`!;
671
672 if (sub_id == SSPI_PACKAGE_NTLMcxx . . $ SSPI_PACKAGE_NTLM.)
673 {
674 if (!ntlm_reset_cipher_statecxx . . $ ntlm_reset_cipher_state(e6bcc0180d974dfe).(&context->sub_contextcxx . . $ $anonymous_type_5da0b8083feac31a_1#sub_context.))
675 return SEC_E_INTERNAL_ERRORcxx . . $ `winpr/include/winpr/sspi.h:138:9`!;
676 }
677
678 return SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!;
679 }
680
681 static SECURITY_STATUScxx . . $ SECURITY_STATUS# SEC_ENTRYcxx . . $ `winpr/include/winpr/sspi.h:44:9`! negotiate_InitializeSecurityContextWcxx . . $ negotiate_InitializeSecurityContextW(422ccc8b6dd4c323).(
682 PCredHandlecxx . . $ PCredHandle# phCredential, PCtxtHandlecxx . . $ PCtxtHandle# phContext, SEC_WCHARcxx . . $ SEC_WCHAR#* pszTargetName, ULONGcxx . . $ ULONG# fContextReq,
683 ULONGcxx . . $ ULONG# Reserved1, ULONGcxx . . $ ULONG# TargetDataRep, PSecBufferDesccxx . . $ PSecBufferDesc# pInput, ULONGcxx . . $ ULONG# Reserved2,
684 PCtxtHandlecxx . . $ PCtxtHandle# phNewContext, PSecBufferDesccxx . . $ PSecBufferDesc# pOutput, PULONGcxx . . $ PULONG# pfContextAttr, PTimeStampcxx . . $ PTimeStamp# ptsExpiry)
685 {
686 NEGOTIATE_CONTEXTcxx . . $ NEGOTIATE_CONTEXT#* context = nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
687 NEGOTIATE_CONTEXTcxx . . $ NEGOTIATE_CONTEXT# init_context = NEGOTIATE_CONTEXT_initcxx . . $ NEGOTIATE_CONTEXT_init(6f869b1bf819f12c).();
688 MechCredcxx . . $ MechCred#* creds = nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
689 PCtxtHandlecxx . . $ PCtxtHandle# sub_context = nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
690 PCredHandlecxx . . $ PCredHandle# sub_cred = nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
691 NegTokencxx . . $ NegToken# input_token = empty_neg_tokencxx . . $ empty_neg_token.;
692 NegTokencxx . . $ NegToken# output_token = empty_neg_tokencxx . . $ empty_neg_token.;
693 PSecBuffercxx . . $ PSecBuffer# input_buffer = nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
694 PSecBuffercxx . . $ PSecBuffer# output_buffer = nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
695 PSecBuffercxx . . $ PSecBuffer# bindings_buffer = nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
696 SecBuffercxx . . $ SecBuffer# mech_input_buffers[2] = WINPR_C_ARRAY_INITcxx . . $ `winpr/include/winpr/platform.h:87:9`!;
697 SecBufferDesccxx . . $ SecBufferDesc# mech_input = { SECBUFFER_VERSIONcxx . . $ `winpr/include/winpr/sspi.h:993:9`!, 2, mech_input_buffers };
698 SecBufferDesccxx . . $ SecBufferDesc# mech_output = { SECBUFFER_VERSIONcxx . . $ `winpr/include/winpr/sspi.h:993:9`!, 1, &output_token.mechTokencxx . . $ $anonymous_type_33a869a33ce4afdb_2#mechToken. };
699 SECURITY_STATUScxx . . $ SECURITY_STATUS# status = SEC_E_INTERNAL_ERRORcxx . . $ `winpr/include/winpr/sspi.h:138:9`!;
700 SECURITY_STATUScxx . . $ SECURITY_STATUS# sub_status = SEC_E_INTERNAL_ERRORcxx . . $ `winpr/include/winpr/sspi.h:138:9`!;
701 WinPrAsn1Encodercxx . . $ WinPrAsn1Encoder#* enc = nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
702 wStreamcxx . . $ wStream# s;
703 const Mechcxx . . $ Mech#* mech = nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
704
705 if (!phCredential || !SecIsValidHandlecxx . . $ `winpr/include/winpr/sspi.h:865:9`!(phCredential))
706 return SEC_E_NO_CREDENTIALScxx . . $ `winpr/include/winpr/sspi.h:148:9`!;
707
708 creds = sspi_SecureHandleGetLowerPointercxx . . $ sspi_SecureHandleGetLowerPointer(850d8027e444f59b).(phCredential);
709
710 /* behave like windows SSPIs that don't want empty context */
711 if (phContext && !phContext->dwLowercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_43#dwLower. && !phContext->dwUppercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_43#dwUpper.)
712 return SEC_E_INVALID_HANDLEcxx . . $ `winpr/include/winpr/sspi.h:135:9`!;
713
714 context = sspi_SecureHandleGetLowerPointercxx . . $ sspi_SecureHandleGetLowerPointer(850d8027e444f59b).(phContext);
715
716 if (pInput)
717 {
718 input_buffer = sspi_FindSecBuffercxx . . $ sspi_FindSecBuffer(d481b8f655c9d7e3).(pInput, SECBUFFER_TOKENcxx . . $ `winpr/include/winpr/sspi.h:998:9`!);
719 bindings_buffer = sspi_FindSecBuffercxx . . $ sspi_FindSecBuffer(d481b8f655c9d7e3).(pInput, SECBUFFER_CHANNEL_BINDINGScxx . . $ `winpr/include/winpr/sspi.h:1010:9`!);
720 }
721 if (pOutput)
722 output_buffer = sspi_FindSecBuffercxx . . $ sspi_FindSecBuffer(d481b8f655c9d7e3).(pOutput, SECBUFFER_TOKENcxx . . $ `winpr/include/winpr/sspi.h:998:9`!);
723
724 if (!context)
725 {
726 enc = WinPrAsn1Encoder_Newcxx . . $ WinPrAsn1Encoder_New(230dd22efc6416a5).(WINPR_ASN1_DERcxx . . $ WINPR_ASN1_DER.);
727 if (!enc)
728 return SEC_E_INSUFFICIENT_MEMORYcxx . . $ `winpr/include/winpr/sspi.h:134:9`!;
729
730 if (!WinPrAsn1EncSeqContainercxx . . $ WinPrAsn1EncSeqContainer(ee6234b60791fdfc).(enc))
731 goto cleanup;
732
733 for (size_t i = 0; i < MECH_COUNTcxx . . $ MECH_COUNT.; i++)
734 {
735 MechCredcxx . . $ MechCred#* cred = &creds[i];
736 const SecPkgcxx . . $ SecPkg#* pkg = MechTablecxx . . $ MechTable.[i].pkgcxx . . $ Mech_st#pkg.;
737 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(pkg);
738 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(pkg->table_w);
739
740 if (!cred->validcxx . . $ $anonymous_type_33a869a33ce4afdb_1#valid.)
741 {
742 WLog_DBGcxx . . $ `winpr/include/winpr/wlog.h:341:9`!(TAGcxx . . $ `winpr/libwinpr/sspi/Negotiate/negotiate.c:40:9`!, "Unavailable mechanism: %s", negotiate_mech_name(cred->mech->oid));
743 continue;
744 }
745
746 /* Send an optimistic token for the first valid mechanism */
747 if (!init_context.mechcxx . . $ $anonymous_type_5da0b8083feac31a_1#mech.)
748 {
749 /* Use the output buffer to store the optimistic token */
750 if (!output_buffer)
751 goto cleanup;
752
753 CopyMemorycxx . . $ `winpr/include/winpr/crt.h:123:9`!(&output_token.mechToken, output_buffer, sizeof(SecBuffer));
754
755 if (bindings_buffer)
756 mech_input_buffers[0] = *bindings_buffer;
757
758 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(pkg->table_w->InitializeSecurityContextW);
759 sub_status = pkg->table_wcxx . . $ $anonymous_type_33a869a33ce4afdb_0#table_w.->InitializeSecurityContextWcxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_54#InitializeSecurityContextW.(
760 &cred->credcxx . . $ $anonymous_type_33a869a33ce4afdb_1#cred., nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, pszTargetName, fContextReq | cred->mechcxx . . $ $anonymous_type_33a869a33ce4afdb_1#mech.->flagscxx . . $ Mech_st#flags., Reserved1,
761 TargetDataRep, &mech_input, Reserved2, &init_context.sub_contextcxx . . $ $anonymous_type_5da0b8083feac31a_1#sub_context., &mech_output,
762 pfContextAttr, ptsExpiry);
763
764 /* If the mechanism failed we can't use it; skip */
765 if (IsSecurityStatusErrorcxx . . $ IsSecurityStatusError(7864480464b09eea).(sub_status))
766 {
767 if (SecIsValidHandlecxx . . $ `winpr/include/winpr/sspi.h:865:9`!(&init_context.sub_context))
768 {
769 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(pkg->table_w->DeleteSecurityContext);
770 pkg->table_wcxx . . $ $anonymous_type_33a869a33ce4afdb_0#table_w.->DeleteSecurityContextcxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_54#DeleteSecurityContext.(&init_context.sub_contextcxx . . $ $anonymous_type_5da0b8083feac31a_1#sub_context.);
771 }
772 cred->validcxx . . $ $anonymous_type_33a869a33ce4afdb_1#valid. = FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!;
773 continue;
774 }
775
776 init_context.mechcxx . . $ $anonymous_type_5da0b8083feac31a_1#mech. = cred->mechcxx . . $ $anonymous_type_33a869a33ce4afdb_1#mech.;
777 }
778
779 if (!WinPrAsn1EncOIDcxx . . $ WinPrAsn1EncOID(55fe8a0323b9182a).(enc, cred->mechcxx . . $ $anonymous_type_33a869a33ce4afdb_1#mech.->oidcxx . . $ Mech_st#oid.))
780 goto cleanup;
781 WLog_DBGcxx . . $ `winpr/include/winpr/wlog.h:341:9`!(TAGcxx . . $ `winpr/libwinpr/sspi/Negotiate/negotiate.c:40:9`!, "Available mechanism: %s", negotiate_mech_name(cred->mech->oid));
782 }
783
784 /* No usable mechanisms were found */
785 if (!init_context.mechcxx . . $ $anonymous_type_5da0b8083feac31a_1#mech.)
786 goto cleanup;
787
788 /* If the only available mech is NTLM use it directly otherwise use spnego */
789 if (init_context.mechcxx . . $ $anonymous_type_5da0b8083feac31a_1#mech.->oidcxx . . $ Mech_st#oid. == &ntlm_OIDcxx . . $ ntlm_OID.)
790 {
791 init_context.spnegocxx . . $ $anonymous_type_5da0b8083feac31a_1#spnego. = FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!;
792 output_buffer->cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer. = output_token.mechTokencxx . . $ $anonymous_type_33a869a33ce4afdb_2#mechToken..cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer.;
793 WLog_DBGcxx . . $ `winpr/include/winpr/wlog.h:341:9`!(TAGcxx . . $ `winpr/libwinpr/sspi/Negotiate/negotiate.c:40:9`!, "Using direct NTLM");
794 }
795 else
796 {
797 init_context.spnegocxx . . $ $anonymous_type_5da0b8083feac31a_1#spnego. = TRUEcxx . . $ `winpr/include/winpr/wtypes.h:126:9`!;
798 init_context.mechTypescxx . . $ $anonymous_type_5da0b8083feac31a_1#mechTypes..BufferTypecxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#BufferType. = SECBUFFER_DATAcxx . . $ `winpr/include/winpr/sspi.h:997:9`!;
799 const size_t cb = WinPrAsn1EncEndContainercxx . . $ WinPrAsn1EncEndContainer(9cfb7cc50cd2a2e1).(enc);
800 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(cb <= UINT32_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:124:10`!);
801 init_context.mechTypescxx . . $ $anonymous_type_5da0b8083feac31a_1#mechTypes..cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer. = (UINT32cxx . . $ UINT32#)cb;
802 }
803
804 /* Allocate memory for the new context */
805 context = negotiate_ContextNewcxx . . $ negotiate_ContextNew(8bd570cdfc2e9239).(&init_context);
806 if (!context)
807 {
808 init_context.mechcxx . . $ $anonymous_type_5da0b8083feac31a_1#mech.->pkgcxx . . $ Mech_st#pkg.->tablecxx . . $ $anonymous_type_33a869a33ce4afdb_0#table.->DeleteSecurityContextcxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_53#DeleteSecurityContext.(&init_context.sub_contextcxx . . $ $anonymous_type_5da0b8083feac31a_1#sub_context.);
809 WinPrAsn1Encoder_Freecxx . . $ WinPrAsn1Encoder_Free(b1493289c6e4e358).(&enc);
810 return SEC_E_INSUFFICIENT_MEMORYcxx . . $ `winpr/include/winpr/sspi.h:134:9`!;
811 }
812
813 sspi_SecureHandleSetPackageIdcxx . . $ sspi_SecureHandleSetPackageId(82c32e2c21b1f4c7).(phNewContext, SSPI_PACKAGE_NEGOTIATEcxx . . $ SSPI_PACKAGE_NEGOTIATE.);
814 sspi_SecureHandleSetLowerPointercxx . . $ sspi_SecureHandleSetLowerPointer(aaeae9b83d9844a8).(phNewContext, context);
815
816 if (!context->spnegocxx . . $ $anonymous_type_5da0b8083feac31a_1#spnego.)
817 {
818 status = sub_status;
819 goto cleanup;
820 }
821
822 /* Write mechTypesList */
823 Stream_StaticInitcxx . . $ Stream_StaticInit(a93e379cdb0b7c14).(&s, context->mechTypescxx . . $ $anonymous_type_5da0b8083feac31a_1#mechTypes..pvBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#pvBuffer., context->mechTypescxx . . $ $anonymous_type_5da0b8083feac31a_1#mechTypes..cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer.);
824 if (!WinPrAsn1EncToStreamcxx . . $ WinPrAsn1EncToStream(eccd197e98b9208).(enc, &s))
825 goto cleanup;
826
827 output_token.mechTypescxx . . $ $anonymous_type_33a869a33ce4afdb_2#mechTypes..cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer. = context->mechTypescxx . . $ $anonymous_type_5da0b8083feac31a_1#mechTypes..cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer.;
828 output_token.mechTypescxx . . $ $anonymous_type_33a869a33ce4afdb_2#mechTypes..pvBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#pvBuffer. = context->mechTypescxx . . $ $anonymous_type_5da0b8083feac31a_1#mechTypes..pvBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#pvBuffer.;
829 output_token.initcxx . . $ $anonymous_type_33a869a33ce4afdb_2#init. = TRUEcxx . . $ `winpr/include/winpr/wtypes.h:126:9`!;
830
831 if (sub_status == SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!)
832 context->statecxx . . $ $anonymous_type_5da0b8083feac31a_1#state. = NEGOTIATE_STATE_FINAL_OPTIMISTICcxx . . $ NEGOTIATE_STATE_FINAL_OPTIMISTIC.;
833 }
834 else
835 {
836 if (!input_buffer)
837 return SEC_E_INVALID_TOKENcxx . . $ `winpr/include/winpr/sspi.h:142:9`!;
838
839 sub_context = &context->sub_contextcxx . . $ $anonymous_type_5da0b8083feac31a_1#sub_context.;
840 sub_cred = negotiate_FindCredentialcxx . . $ negotiate_FindCredential(c9942ba04841ed61).(creds, context->mechcxx . . $ $anonymous_type_5da0b8083feac31a_1#mech.);
841
842 if (!context->spnegocxx . . $ $anonymous_type_5da0b8083feac31a_1#spnego.)
843 {
844 return context->mechcxx . . $ $anonymous_type_5da0b8083feac31a_1#mech.->pkgcxx . . $ Mech_st#pkg.->table_wcxx . . $ $anonymous_type_33a869a33ce4afdb_0#table_w.->InitializeSecurityContextWcxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_54#InitializeSecurityContextW.(
845 sub_cred, sub_context, pszTargetName, fContextReq | context->mechcxx . . $ $anonymous_type_5da0b8083feac31a_1#mech.->flagscxx . . $ Mech_st#flags., Reserved1,
846 TargetDataRep, pInput, Reserved2, sub_context, pOutput, pfContextAttr, ptsExpiry);
847 }
848
849 if (!negotiate_read_neg_tokencxx . . $ negotiate_read_neg_token(f577b0f717e21f66).(input_buffer, &input_token))
850 return SEC_E_INVALID_TOKENcxx . . $ `winpr/include/winpr/sspi.h:142:9`!;
851
852 /* On first response check if the server doesn't like out preferred mech */
853 if (context->statecxx . . $ $anonymous_type_5da0b8083feac31a_1#state. < NEGOTIATE_STATE_NEGORESPcxx . . $ NEGOTIATE_STATE_NEGORESP. && input_token.supportedMechcxx . . $ $anonymous_type_33a869a33ce4afdb_2#supportedMech..lencxx . . $ $anonymous_type_41db265f08275ce7_2#len. &&
854 !sspi_gss_oid_comparecxx . . $ sspi_gss_oid_compare(8eb53dc27d60d78a).(&input_token.supportedMechcxx . . $ $anonymous_type_33a869a33ce4afdb_2#supportedMech., context->mechcxx . . $ $anonymous_type_5da0b8083feac31a_1#mech.->oidcxx . . $ Mech_st#oid.))
855 {
856 mech = negotiate_GetMechByOIDcxx . . $ negotiate_GetMechByOID(b8fc83408cf7dfde).(&input_token.supportedMechcxx . . $ $anonymous_type_33a869a33ce4afdb_2#supportedMech.);
857 if (!mech)
858 return SEC_E_INVALID_TOKENcxx . . $ `winpr/include/winpr/sspi.h:142:9`!;
859
860 /* Make sure the specified mech is supported and get the appropriate credential */
861 sub_cred = negotiate_FindCredentialcxx . . $ negotiate_FindCredential(c9942ba04841ed61).(creds, mech);
862 if (!sub_cred)
863 return SEC_E_INVALID_TOKENcxx . . $ `winpr/include/winpr/sspi.h:142:9`!;
864
865 /* Clean up the optimistic mech */
866 context->mechcxx . . $ $anonymous_type_5da0b8083feac31a_1#mech.->pkgcxx . . $ Mech_st#pkg.->table_wcxx . . $ $anonymous_type_33a869a33ce4afdb_0#table_w.->DeleteSecurityContextcxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_54#DeleteSecurityContext.(&context->sub_contextcxx . . $ $anonymous_type_5da0b8083feac31a_1#sub_context.);
867 sub_context = nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
868
869 context->mechcxx . . $ $anonymous_type_5da0b8083feac31a_1#mech. = mech;
870 context->miccxx . . $ $anonymous_type_5da0b8083feac31a_1#mic. = TRUEcxx . . $ `winpr/include/winpr/wtypes.h:126:9`!;
871 }
872
873 /* Check neg_state (required on first response) */
874 if (context->statecxx . . $ $anonymous_type_5da0b8083feac31a_1#state. < NEGOTIATE_STATE_NEGORESPcxx . . $ NEGOTIATE_STATE_NEGORESP.)
875 {
876 switch (input_token.negStatecxx . . $ $anonymous_type_33a869a33ce4afdb_2#negState.)
877 {
878 case NOSTATEcxx . . $ NOSTATE.:
879 return SEC_E_INVALID_TOKENcxx . . $ `winpr/include/winpr/sspi.h:142:9`!;
880 case REJECTcxx . . $ REJECT.:
881 return SEC_E_LOGON_DENIEDcxx . . $ `winpr/include/winpr/sspi.h:146:9`!;
882 case REQUEST_MICcxx . . $ REQUEST_MIC.:
883 context->miccxx . . $ $anonymous_type_5da0b8083feac31a_1#mic. = TRUEcxx . . $ `winpr/include/winpr/wtypes.h:126:9`!;
884 /* fallthrough */
885 WINPR_FALLTHROUGHcxx . . $ `winpr/include/winpr/platform.h:71:9`!
886 case ACCEPT_INCOMPLETEcxx . . $ ACCEPT_INCOMPLETE.:
887 context->statecxx . . $ $anonymous_type_5da0b8083feac31a_1#state. = NEGOTIATE_STATE_NEGORESPcxx . . $ NEGOTIATE_STATE_NEGORESP.;
888 break;
889 case ACCEPT_COMPLETEDcxx . . $ ACCEPT_COMPLETED.:
890 if (context->statecxx . . $ $anonymous_type_5da0b8083feac31a_1#state. == NEGOTIATE_STATE_INITIALcxx . . $ NEGOTIATE_STATE_INITIAL.)
891 context->statecxx . . $ $anonymous_type_5da0b8083feac31a_1#state. = NEGOTIATE_STATE_NEGORESPcxx . . $ NEGOTIATE_STATE_NEGORESP.;
892 else
893 context->statecxx . . $ $anonymous_type_5da0b8083feac31a_1#state. = NEGOTIATE_STATE_FINALcxx . . $ NEGOTIATE_STATE_FINAL.;
894 break;
895 default:
896 break;
897 }
898
899 WLog_DBGcxx . . $ `winpr/include/winpr/wlog.h:341:9`!(TAGcxx . . $ `winpr/libwinpr/sspi/Negotiate/negotiate.c:40:9`!, "Negotiated mechanism: %s", negotiate_mech_name(context->mech->oid));
900 }
901
902 if (context->statecxx . . $ $anonymous_type_5da0b8083feac31a_1#state. == NEGOTIATE_STATE_NEGORESPcxx . . $ NEGOTIATE_STATE_NEGORESP.)
903 {
904 /* Store the mech token in the output buffer */
905 if (!output_buffer)
906 goto cleanup;
907 CopyMemorycxx . . $ `winpr/include/winpr/crt.h:123:9`!(&output_token.mechToken, output_buffer, sizeof(SecBuffer));
908
909 mech_input_buffers[0] = input_token.mechTokencxx . . $ $anonymous_type_33a869a33ce4afdb_2#mechToken.;
910 if (bindings_buffer)
911 mech_input_buffers[1] = *bindings_buffer;
912
913 status = context->mechcxx . . $ $anonymous_type_5da0b8083feac31a_1#mech.->pkgcxx . . $ Mech_st#pkg.->table_wcxx . . $ $anonymous_type_33a869a33ce4afdb_0#table_w.->InitializeSecurityContextWcxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_54#InitializeSecurityContextW.(
914 sub_cred, sub_context, pszTargetName, fContextReq | context->mechcxx . . $ $anonymous_type_5da0b8083feac31a_1#mech.->flagscxx . . $ Mech_st#flags., Reserved1,
915 TargetDataRep, input_token.mechTokencxx . . $ $anonymous_type_33a869a33ce4afdb_2#mechToken..cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer. ? &mech_input : nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, Reserved2,
916 &context->sub_contextcxx . . $ $anonymous_type_5da0b8083feac31a_1#sub_context., &mech_output, pfContextAttr, ptsExpiry);
917
918 if (IsSecurityStatusErrorcxx . . $ IsSecurityStatusError(7864480464b09eea).(status))
919 return status;
920 }
921
922 if (status == SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!)
923 {
924 if (output_token.mechTokencxx . . $ $anonymous_type_33a869a33ce4afdb_2#mechToken..cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer. > 0)
925 context->statecxx . . $ $anonymous_type_5da0b8083feac31a_1#state. = NEGOTIATE_STATE_MICcxx . . $ NEGOTIATE_STATE_MIC.;
926 else
927 context->statecxx . . $ $anonymous_type_5da0b8083feac31a_1#state. = NEGOTIATE_STATE_FINALcxx . . $ NEGOTIATE_STATE_FINAL.;
928 }
929
930 /* Check if the acceptor sent its final token without a mic */
931 if (context->statecxx . . $ $anonymous_type_5da0b8083feac31a_1#state. == NEGOTIATE_STATE_FINALcxx . . $ NEGOTIATE_STATE_FINAL. && input_token.miccxx . . $ $anonymous_type_33a869a33ce4afdb_2#mic..cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer. == 0)
932 {
933 if (context->miccxx . . $ $anonymous_type_5da0b8083feac31a_1#mic. || input_token.negStatecxx . . $ $anonymous_type_33a869a33ce4afdb_2#negState. != ACCEPT_COMPLETEDcxx . . $ ACCEPT_COMPLETED.)
934 return SEC_E_INVALID_TOKENcxx . . $ `winpr/include/winpr/sspi.h:142:9`!;
935
936 if (output_buffer)
937 output_buffer->cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer. = 0;
938 return SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!;
939 }
940
941 if ((context->statecxx . . $ $anonymous_type_5da0b8083feac31a_1#state. == NEGOTIATE_STATE_MICcxx . . $ NEGOTIATE_STATE_MIC. && context->miccxx . . $ $anonymous_type_5da0b8083feac31a_1#mic.) ||
942 context->statecxx . . $ $anonymous_type_5da0b8083feac31a_1#state. == NEGOTIATE_STATE_FINALcxx . . $ NEGOTIATE_STATE_FINAL.)
943 {
944 status = negotiate_mic_exchangecxx . . $ negotiate_mic_exchange(db87e138d711453f).(context, &input_token, &output_token, output_buffer);
945 if (status != SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!)
946 return status;
947 }
948 }
949
950 if (input_token.negStatecxx . . $ $anonymous_type_33a869a33ce4afdb_2#negState. == ACCEPT_COMPLETEDcxx . . $ ACCEPT_COMPLETED.)
951 {
952 if (output_buffer)
953 output_buffer->cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer. = 0;
954 return SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!;
955 }
956
957 if (output_token.negStatecxx . . $ $anonymous_type_33a869a33ce4afdb_2#negState. == ACCEPT_COMPLETEDcxx . . $ ACCEPT_COMPLETED.)
958 status = SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!;
959 else
960 status = SEC_I_CONTINUE_NEEDEDcxx . . $ `winpr/include/winpr/sspi.h:208:9`!;
961
962 if (!negotiate_write_neg_tokencxx . . $ negotiate_write_neg_token(f577b0f717e21f66).(output_buffer, &output_token))
963 status = SEC_E_INTERNAL_ERRORcxx . . $ `winpr/include/winpr/sspi.h:138:9`!;
964
965 cleanup:
966 WinPrAsn1Encoder_Freecxx . . $ WinPrAsn1Encoder_Free(b1493289c6e4e358).(&enc);
967 return status;
968 }
969
970 static SECURITY_STATUScxx . . $ SECURITY_STATUS# SEC_ENTRYcxx . . $ `winpr/include/winpr/sspi.h:44:9`! negotiate_InitializeSecurityContextAcxx . . $ negotiate_InitializeSecurityContextA(cf9633d63d9b9e60).(
971 PCredHandlecxx . . $ PCredHandle# phCredential, PCtxtHandlecxx . . $ PCtxtHandle# phContext, SEC_CHARcxx . . $ SEC_CHAR#* pszTargetName, ULONGcxx . . $ ULONG# fContextReq,
972 ULONGcxx . . $ ULONG# Reserved1, ULONGcxx . . $ ULONG# TargetDataRep, PSecBufferDesccxx . . $ PSecBufferDesc# pInput, ULONGcxx . . $ ULONG# Reserved2,
973 PCtxtHandlecxx . . $ PCtxtHandle# phNewContext, PSecBufferDesccxx . . $ PSecBufferDesc# pOutput, PULONGcxx . . $ PULONG# pfContextAttr, PTimeStampcxx . . $ PTimeStamp# ptsExpiry)
974 {
975 SECURITY_STATUScxx . . $ SECURITY_STATUS# status = 0;
976 SEC_WCHARcxx . . $ SEC_WCHAR#* pszTargetNameW = nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
977
978 if (pszTargetName)
979 {
980 pszTargetNameW = ConvertUtf8ToWCharAlloccxx . . $ ConvertUtf8ToWCharAlloc(ead477a53cde6f56).(pszTargetName, nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!);
981 if (!pszTargetNameW)
982 return SEC_E_INTERNAL_ERRORcxx . . $ `winpr/include/winpr/sspi.h:138:9`!;
983 }
984
985 status = negotiate_InitializeSecurityContextWcxx . . $ negotiate_InitializeSecurityContextW(422ccc8b6dd4c323).(
986 phCredential, phContext, pszTargetNameW, fContextReq, Reserved1, TargetDataRep, pInput,
987 Reserved2, phNewContext, pOutput, pfContextAttr, ptsExpiry);
988 freecxx . . $ free(5d22bdacc48458e8).(pszTargetNameW);
989 return status;
990 }
991
992 static const Mechcxx . . $ Mech#* guessMechcxx . . $ guessMech(a0abe65bf01644ea).(PSecBuffercxx . . $ PSecBuffer# input_buffer, BOOLcxx . . $ BOOL#* spNego, WinPrAsn1_OIDcxx . . $ WinPrAsn1_OID#* oid)
993 {
994 WinPrAsn1Decodercxx . . $ WinPrAsn1Decoder# decoder = WinPrAsn1Decoder_initcxx . . $ WinPrAsn1Decoder_init(9f2b2b04a0169e89).();
995 WinPrAsn1Decodercxx . . $ WinPrAsn1Decoder# appDecoder = WinPrAsn1Decoder_initcxx . . $ WinPrAsn1Decoder_init(9f2b2b04a0169e89).();
996 WinPrAsn1_tagIdcxx . . $ WinPrAsn1_tagId# tag = 0;
997 const char ssp[] = "NTLMSSP";
998
999 *spNego = FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!;
1000
1001 /* Check for NTLM token */
1002 if (input_buffer->cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer. >= 8 && strncmpcxx . . $ strncmp(fd278af2f295fa2e).(input_buffer->pvBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#pvBuffer., ssp, sizeof(ssp)) == 0)
1003 {
1004 *oid = ntlm_OIDcxx . . $ ntlm_OID.;
1005 return negotiate_GetMechByOIDcxx . . $ negotiate_GetMechByOID(b8fc83408cf7dfde).(&ntlm_OIDcxx . . $ ntlm_OID.);
1006 }
1007
1008 /* Read initialContextToken or raw Kerberos token */
1009 WinPrAsn1Decoder_InitMemcxx . . $ WinPrAsn1Decoder_InitMem(87018fb168845641).(&decoder, WINPR_ASN1_DERcxx . . $ WINPR_ASN1_DER., input_buffer->pvBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#pvBuffer.,
1010 input_buffer->cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer.);
1011
1012 if (!WinPrAsn1DecReadAppcxx . . $ WinPrAsn1DecReadApp(6e392b4d237c4dfd).(&decoder, &tag, &appDecoder) || tag != 0)
1013 return nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
1014
1015 if (!WinPrAsn1DecReadOIDcxx . . $ WinPrAsn1DecReadOID(21289d36764807d6).(&appDecoder, oid, FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!))
1016 return nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
1017
1018 if (sspi_gss_oid_comparecxx . . $ sspi_gss_oid_compare(8eb53dc27d60d78a).(oid, &spnego_OIDcxx . . $ spnego_OID.))
1019 {
1020 *spNego = TRUEcxx . . $ `winpr/include/winpr/wtypes.h:126:9`!;
1021 return nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
1022 }
1023
1024 return negotiate_GetMechByOIDcxx . . $ negotiate_GetMechByOID(b8fc83408cf7dfde).(oid);
1025 }
1026
1027 static SECURITY_STATUScxx . . $ SECURITY_STATUS# SEC_ENTRYcxx . . $ `winpr/include/winpr/sspi.h:44:9`! negotiate_AcceptSecurityContextcxx . . $ negotiate_AcceptSecurityContext(c4f1f6e2f4d578a9).(
1028 PCredHandlecxx . . $ PCredHandle# phCredential, PCtxtHandlecxx . . $ PCtxtHandle# phContext, PSecBufferDesccxx . . $ PSecBufferDesc# pInput, ULONGcxx . . $ ULONG# fContextReq,
1029 ULONGcxx . . $ ULONG# TargetDataRep, PCtxtHandlecxx . . $ PCtxtHandle# phNewContext, PSecBufferDesccxx . . $ PSecBufferDesc# pOutput, PULONGcxx . . $ PULONG# pfContextAttr,
1030 PTimeStampcxx . . $ PTimeStamp# ptsTimeStamp)
1031 {
1032 NEGOTIATE_CONTEXTcxx . . $ NEGOTIATE_CONTEXT#* context = nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
1033 NEGOTIATE_CONTEXTcxx . . $ NEGOTIATE_CONTEXT# init_context = NEGOTIATE_CONTEXT_initcxx . . $ NEGOTIATE_CONTEXT_init(6f869b1bf819f12c).();
1034 MechCredcxx . . $ MechCred#* creds = nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
1035 PCredHandlecxx . . $ PCredHandle# sub_cred = nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
1036 NegTokencxx . . $ NegToken# input_token = empty_neg_tokencxx . . $ empty_neg_token.;
1037 NegTokencxx . . $ NegToken# output_token = empty_neg_tokencxx . . $ empty_neg_token.;
1038 PSecBuffercxx . . $ PSecBuffer# input_buffer = nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
1039 PSecBuffercxx . . $ PSecBuffer# output_buffer = nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
1040 SecBufferDesccxx . . $ SecBufferDesc# mech_input = { SECBUFFER_VERSIONcxx . . $ `winpr/include/winpr/sspi.h:993:9`!, 1, &input_token.mechTokencxx . . $ $anonymous_type_33a869a33ce4afdb_2#mechToken. };
1041 SecBufferDesccxx . . $ SecBufferDesc# mech_output = { SECBUFFER_VERSIONcxx . . $ `winpr/include/winpr/sspi.h:993:9`!, 1, &output_token.mechTokencxx . . $ $anonymous_type_33a869a33ce4afdb_2#mechToken. };
1042 SECURITY_STATUScxx . . $ SECURITY_STATUS# status = SEC_E_INTERNAL_ERRORcxx . . $ `winpr/include/winpr/sspi.h:138:9`!;
1043 WinPrAsn1Decodercxx . . $ WinPrAsn1Decoder# dec = WinPrAsn1Decoder_initcxx . . $ WinPrAsn1Decoder_init(9f2b2b04a0169e89).();
1044 WinPrAsn1Decodercxx . . $ WinPrAsn1Decoder# dec2 = WinPrAsn1Decoder_initcxx . . $ WinPrAsn1Decoder_init(9f2b2b04a0169e89).();
1045 WinPrAsn1_tagIdcxx . . $ WinPrAsn1_tagId# tag = 0;
1046 WinPrAsn1_OIDcxx . . $ WinPrAsn1_OID# oid = WINPR_C_ARRAY_INITcxx . . $ `winpr/include/winpr/platform.h:87:9`!;
1047 const Mechcxx . . $ Mech#* first_mech = nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
1048
1049 if (!phCredential || !SecIsValidHandlecxx . . $ `winpr/include/winpr/sspi.h:865:9`!(phCredential))
1050 return SEC_E_NO_CREDENTIALScxx . . $ `winpr/include/winpr/sspi.h:148:9`!;
1051
1052 creds = sspi_SecureHandleGetLowerPointercxx . . $ sspi_SecureHandleGetLowerPointer(850d8027e444f59b).(phCredential);
1053
1054 if (!pInput)
1055 return SEC_E_INVALID_TOKENcxx . . $ `winpr/include/winpr/sspi.h:142:9`!;
1056
1057 /* behave like windows SSPIs that don't want empty context */
1058 if (phContext && !phContext->dwLowercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_43#dwLower. && !phContext->dwUppercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_43#dwUpper.)
1059 return SEC_E_INVALID_HANDLEcxx . . $ `winpr/include/winpr/sspi.h:135:9`!;
1060
1061 context = sspi_SecureHandleGetLowerPointercxx . . $ sspi_SecureHandleGetLowerPointer(850d8027e444f59b).(phContext);
1062
1063 input_buffer = sspi_FindSecBuffercxx . . $ sspi_FindSecBuffer(d481b8f655c9d7e3).(pInput, SECBUFFER_TOKENcxx . . $ `winpr/include/winpr/sspi.h:998:9`!);
1064 if (pOutput)
1065 output_buffer = sspi_FindSecBuffercxx . . $ sspi_FindSecBuffer(d481b8f655c9d7e3).(pOutput, SECBUFFER_TOKENcxx . . $ `winpr/include/winpr/sspi.h:998:9`!);
1066
1067 if (!context)
1068 {
1069 init_context.mechcxx . . $ $anonymous_type_5da0b8083feac31a_1#mech. = guessMechcxx . . $ guessMech(a0abe65bf01644ea).(input_buffer, &init_context.spnegocxx . . $ $anonymous_type_5da0b8083feac31a_1#spnego., &oid);
1070 if (!init_context.mechcxx . . $ $anonymous_type_5da0b8083feac31a_1#mech. && !init_context.spnegocxx . . $ $anonymous_type_5da0b8083feac31a_1#spnego.)
1071 return SEC_E_INVALID_TOKENcxx . . $ `winpr/include/winpr/sspi.h:142:9`!;
1072
1073 WLog_DBGcxx . . $ `winpr/include/winpr/wlog.h:341:9`!(TAGcxx . . $ `winpr/libwinpr/sspi/Negotiate/negotiate.c:40:9`!, "Mechanism: %s", negotiate_mech_name(&oid));
1074
1075 if (init_context.spnegocxx . . $ $anonymous_type_5da0b8083feac31a_1#spnego.)
1076 {
1077 /* Process spnego token */
1078 if (!negotiate_read_neg_tokencxx . . $ negotiate_read_neg_token(f577b0f717e21f66).(input_buffer, &input_token))
1079 return SEC_E_INVALID_TOKENcxx . . $ `winpr/include/winpr/sspi.h:142:9`!;
1080
1081 /* First token must be negoTokenInit and must contain a mechList */
1082 if (!input_token.initcxx . . $ $anonymous_type_33a869a33ce4afdb_2#init. || input_token.mechTypescxx . . $ $anonymous_type_33a869a33ce4afdb_2#mechTypes..cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer. == 0)
1083 return SEC_E_INVALID_TOKENcxx . . $ `winpr/include/winpr/sspi.h:142:9`!;
1084
1085 init_context.mechTypescxx . . $ $anonymous_type_5da0b8083feac31a_1#mechTypes..BufferTypecxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#BufferType. = SECBUFFER_DATAcxx . . $ `winpr/include/winpr/sspi.h:997:9`!;
1086 init_context.mechTypescxx . . $ $anonymous_type_5da0b8083feac31a_1#mechTypes..cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer. = input_token.mechTypescxx . . $ $anonymous_type_33a869a33ce4afdb_2#mechTypes..cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer.;
1087
1088 /* Prepare to read mechList */
1089 WinPrAsn1Decoder_InitMemcxx . . $ WinPrAsn1Decoder_InitMem(87018fb168845641).(&dec, WINPR_ASN1_DERcxx . . $ WINPR_ASN1_DER., input_token.mechTypescxx . . $ $anonymous_type_33a869a33ce4afdb_2#mechTypes..pvBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#pvBuffer.,
1090 input_token.mechTypescxx . . $ $anonymous_type_33a869a33ce4afdb_2#mechTypes..cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer.);
1091
1092 if (!WinPrAsn1DecReadSequencecxx . . $ WinPrAsn1DecReadSequence(4bc560987bfb974d).(&dec, &dec2))
1093 return SEC_E_INVALID_TOKENcxx . . $ `winpr/include/winpr/sspi.h:142:9`!;
1094 dec = dec2;
1095
1096 /* If an optimistic token was provided pass it into the first mech */
1097 if (input_token.mechTokencxx . . $ $anonymous_type_33a869a33ce4afdb_2#mechToken..cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer.)
1098 {
1099 if (!WinPrAsn1DecReadOIDcxx . . $ WinPrAsn1DecReadOID(21289d36764807d6).(&dec, &oid, FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!))
1100 return SEC_E_INVALID_TOKENcxx . . $ `winpr/include/winpr/sspi.h:142:9`!;
1101
1102 init_context.mechcxx . . $ $anonymous_type_5da0b8083feac31a_1#mech. = negotiate_GetMechByOIDcxx . . $ negotiate_GetMechByOID(b8fc83408cf7dfde).(&oid);
1103
1104 if (init_context.mechcxx . . $ $anonymous_type_5da0b8083feac31a_1#mech.)
1105 {
1106 if (output_buffer)
1107 output_token.mechTokencxx . . $ $anonymous_type_33a869a33ce4afdb_2#mechToken. = *output_buffer;
1108 WLog_DBGcxx . . $ `winpr/include/winpr/wlog.h:341:9`!(TAGcxx . . $ `winpr/libwinpr/sspi/Negotiate/negotiate.c:40:9`!, "Requested mechanism: %s",
1109 negotiate_mech_name(init_context.mech->oid));
1110 }
1111 }
1112 }
1113
1114 if (init_context.mechcxx . . $ $anonymous_type_5da0b8083feac31a_1#mech.)
1115 {
1116 sub_cred = negotiate_FindCredentialcxx . . $ negotiate_FindCredential(c9942ba04841ed61).(creds, init_context.mechcxx . . $ $anonymous_type_5da0b8083feac31a_1#mech.);
1117
1118 if (sub_cred)
1119 {
1120 status = init_context.mechcxx . . $ $anonymous_type_5da0b8083feac31a_1#mech.->pkgcxx . . $ Mech_st#pkg.->tablecxx . . $ $anonymous_type_33a869a33ce4afdb_0#table.->AcceptSecurityContextcxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_53#AcceptSecurityContext.(
1121 sub_cred, nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, init_context.spnegocxx . . $ $anonymous_type_5da0b8083feac31a_1#spnego. ? &mech_input : pInput, fContextReq,
1122 TargetDataRep, &init_context.sub_contextcxx . . $ $anonymous_type_5da0b8083feac31a_1#sub_context.,
1123 init_context.spnegocxx . . $ $anonymous_type_5da0b8083feac31a_1#spnego. ? &mech_output : pOutput, pfContextAttr, ptsTimeStamp);
1124 }
1125 }
1126
1127 if (IsSecurityStatusErrorcxx . . $ IsSecurityStatusError(7864480464b09eea).(status))
1128 {
1129 if (!init_context.spnegocxx . . $ $anonymous_type_5da0b8083feac31a_1#spnego.)
1130 return status;
1131
1132 /* Clean up any partially created sub context before falling back to
1133 * another mechanism (mirrors the mech change handling in
1134 * negotiate_InitializeSecurityContextW) */
1135 if (init_context.mechcxx . . $ $anonymous_type_5da0b8083feac31a_1#mech.)
1136 init_context.mechcxx . . $ $anonymous_type_5da0b8083feac31a_1#mech.->pkgcxx . . $ Mech_st#pkg.->tablecxx . . $ $anonymous_type_33a869a33ce4afdb_0#table.->DeleteSecurityContextcxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_53#DeleteSecurityContext.(&init_context.sub_contextcxx . . $ $anonymous_type_5da0b8083feac31a_1#sub_context.);
1137
1138 init_context.miccxx . . $ $anonymous_type_5da0b8083feac31a_1#mic. = TRUEcxx . . $ `winpr/include/winpr/wtypes.h:126:9`!;
1139 first_mech = init_context.mechcxx . . $ $anonymous_type_5da0b8083feac31a_1#mech.;
1140 init_context.mechcxx . . $ $anonymous_type_5da0b8083feac31a_1#mech. = nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
1141 output_token.mechTokencxx . . $ $anonymous_type_33a869a33ce4afdb_2#mechToken..cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer. = 0;
1142 }
1143
1144 while (!init_context.mechcxx . . $ $anonymous_type_5da0b8083feac31a_1#mech. && WinPrAsn1DecPeekTagcxx . . $ WinPrAsn1DecPeekTag(351939a9a2a91f44).(&dec, &tag))
1145 {
1146 /* Read each mechanism */
1147 if (!WinPrAsn1DecReadOIDcxx . . $ WinPrAsn1DecReadOID(21289d36764807d6).(&dec, &oid, FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!))
1148 return SEC_E_INVALID_TOKENcxx . . $ `winpr/include/winpr/sspi.h:142:9`!;
1149
1150 init_context.mechcxx . . $ $anonymous_type_5da0b8083feac31a_1#mech. = negotiate_GetMechByOIDcxx . . $ negotiate_GetMechByOID(b8fc83408cf7dfde).(&oid);
1151 WLog_DBGcxx . . $ `winpr/include/winpr/wlog.h:341:9`!(TAGcxx . . $ `winpr/libwinpr/sspi/Negotiate/negotiate.c:40:9`!, "Requested mechanism: %s", negotiate_mech_name(&oid));
1152
1153 /* Microsoft may send two versions of the kerberos OID */
1154 if (init_context.mechcxx . . $ $anonymous_type_5da0b8083feac31a_1#mech. == first_mech)
1155 init_context.mechcxx . . $ $anonymous_type_5da0b8083feac31a_1#mech. = nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
1156
1157 if (init_context.mechcxx . . $ $anonymous_type_5da0b8083feac31a_1#mech. && !negotiate_FindCredentialcxx . . $ negotiate_FindCredential(c9942ba04841ed61).(creds, init_context.mechcxx . . $ $anonymous_type_5da0b8083feac31a_1#mech.))
1158 init_context.mechcxx . . $ $anonymous_type_5da0b8083feac31a_1#mech. = nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
1159 }
1160
1161 if (!init_context.mechcxx . . $ $anonymous_type_5da0b8083feac31a_1#mech.)
1162 return SEC_E_INTERNAL_ERRORcxx . . $ `winpr/include/winpr/sspi.h:138:9`!;
1163
1164 context = negotiate_ContextNewcxx . . $ negotiate_ContextNew(8bd570cdfc2e9239).(&init_context);
1165 if (!context)
1166 {
1167 if (!IsSecurityStatusErrorcxx . . $ IsSecurityStatusError(7864480464b09eea).(status))
1168 init_context.mechcxx . . $ $anonymous_type_5da0b8083feac31a_1#mech.->pkgcxx . . $ Mech_st#pkg.->tablecxx . . $ $anonymous_type_33a869a33ce4afdb_0#table.->DeleteSecurityContextcxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_53#DeleteSecurityContext.(&init_context.sub_contextcxx . . $ $anonymous_type_5da0b8083feac31a_1#sub_context.);
1169 return SEC_E_INSUFFICIENT_MEMORYcxx . . $ `winpr/include/winpr/sspi.h:134:9`!;
1170 }
1171
1172 sspi_SecureHandleSetPackageIdcxx . . $ sspi_SecureHandleSetPackageId(82c32e2c21b1f4c7).(phNewContext, SSPI_PACKAGE_NEGOTIATEcxx . . $ SSPI_PACKAGE_NEGOTIATE.);
1173 sspi_SecureHandleSetLowerPointercxx . . $ sspi_SecureHandleSetLowerPointer(aaeae9b83d9844a8).(phNewContext, context);
1174
1175 if (!init_context.spnegocxx . . $ $anonymous_type_5da0b8083feac31a_1#spnego.)
1176 return status;
1177
1178 CopyMemorycxx . . $ `winpr/include/winpr/crt.h:123:9`!(init_context.mechTypes.pvBuffer, input_token.mechTypes.pvBuffer,
1179 input_token.mechTypes.cbBuffer);
1180
1181 if (!context->mechcxx . . $ $anonymous_type_5da0b8083feac31a_1#mech.->preferredcxx . . $ Mech_st#preferred.)
1182 {
1183 output_token.negStatecxx . . $ $anonymous_type_33a869a33ce4afdb_2#negState. = REQUEST_MICcxx . . $ REQUEST_MIC.;
1184 context->miccxx . . $ $anonymous_type_5da0b8083feac31a_1#mic. = TRUEcxx . . $ `winpr/include/winpr/wtypes.h:126:9`!;
1185 }
1186 else
1187 {
1188 output_token.negStatecxx . . $ $anonymous_type_33a869a33ce4afdb_2#negState. = ACCEPT_INCOMPLETEcxx . . $ ACCEPT_INCOMPLETE.;
1189 }
1190
1191 if (status == SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!)
1192 context->statecxx . . $ $anonymous_type_5da0b8083feac31a_1#state. = NEGOTIATE_STATE_FINALcxx . . $ NEGOTIATE_STATE_FINAL.;
1193 else
1194 context->statecxx . . $ $anonymous_type_5da0b8083feac31a_1#state. = NEGOTIATE_STATE_NEGORESPcxx . . $ NEGOTIATE_STATE_NEGORESP.;
1195
1196 output_token.supportedMechcxx . . $ $anonymous_type_33a869a33ce4afdb_2#supportedMech. = oid;
1197 WLog_DBGcxx . . $ `winpr/include/winpr/wlog.h:341:9`!(TAGcxx . . $ `winpr/libwinpr/sspi/Negotiate/negotiate.c:40:9`!, "Accepted mechanism: %s", negotiate_mech_name(&output_token.supportedMech));
1198 }
1199 else
1200 {
1201 sub_cred = negotiate_FindCredentialcxx . . $ negotiate_FindCredential(c9942ba04841ed61).(creds, context->mechcxx . . $ $anonymous_type_5da0b8083feac31a_1#mech.);
1202 if (!sub_cred)
1203 return SEC_E_NO_CREDENTIALScxx . . $ `winpr/include/winpr/sspi.h:148:9`!;
1204
1205 if (!context->spnegocxx . . $ $anonymous_type_5da0b8083feac31a_1#spnego.)
1206 {
1207 return context->mechcxx . . $ $anonymous_type_5da0b8083feac31a_1#mech.->pkgcxx . . $ Mech_st#pkg.->tablecxx . . $ $anonymous_type_33a869a33ce4afdb_0#table.->AcceptSecurityContextcxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_53#AcceptSecurityContext.(
1208 sub_cred, &context->sub_contextcxx . . $ $anonymous_type_5da0b8083feac31a_1#sub_context., pInput, fContextReq, TargetDataRep,
1209 &context->sub_contextcxx . . $ $anonymous_type_5da0b8083feac31a_1#sub_context., pOutput, pfContextAttr, ptsTimeStamp);
1210 }
1211
1212 if (!negotiate_read_neg_tokencxx . . $ negotiate_read_neg_token(f577b0f717e21f66).(input_buffer, &input_token))
1213 return SEC_E_INVALID_TOKENcxx . . $ `winpr/include/winpr/sspi.h:142:9`!;
1214
1215 /* Process the mechanism token */
1216 if (input_token.mechTokencxx . . $ $anonymous_type_33a869a33ce4afdb_2#mechToken..cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer. > 0)
1217 {
1218 if (context->statecxx . . $ $anonymous_type_5da0b8083feac31a_1#state. != NEGOTIATE_STATE_NEGORESPcxx . . $ NEGOTIATE_STATE_NEGORESP.)
1219 return SEC_E_INVALID_TOKENcxx . . $ `winpr/include/winpr/sspi.h:142:9`!;
1220
1221 /* Use the output buffer to store the optimistic token */
1222 if (output_buffer)
1223 CopyMemorycxx . . $ `winpr/include/winpr/crt.h:123:9`!(&output_token.mechToken, output_buffer, sizeof(SecBuffer));
1224
1225 /* If the client's optimistic mechanism was not accepted the sub
1226 * context was never created (or was cleaned up); pass NULL so the
1227 * selected mechanism creates a fresh context instead of rejecting
1228 * the empty handle with SEC_E_INVALID_HANDLE */
1229 PCtxtHandlecxx . . $ PCtxtHandle# sub_context = sspi_SecureHandleGetLowerPointercxx . . $ sspi_SecureHandleGetLowerPointer(850d8027e444f59b).(&context->sub_contextcxx . . $ $anonymous_type_5da0b8083feac31a_1#sub_context.)
1230 ? &context->sub_contextcxx . . $ $anonymous_type_5da0b8083feac31a_1#sub_context.
1231 : nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
1232 status = context->mechcxx . . $ $anonymous_type_5da0b8083feac31a_1#mech.->pkgcxx . . $ Mech_st#pkg.->tablecxx . . $ $anonymous_type_33a869a33ce4afdb_0#table.->AcceptSecurityContextcxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_53#AcceptSecurityContext.(
1233 sub_cred, sub_context, &mech_input, fContextReq | context->mechcxx . . $ $anonymous_type_5da0b8083feac31a_1#mech.->flagscxx . . $ Mech_st#flags.,
1234 TargetDataRep, &context->sub_contextcxx . . $ $anonymous_type_5da0b8083feac31a_1#sub_context., &mech_output, pfContextAttr, ptsTimeStamp);
1235
1236 if (IsSecurityStatusErrorcxx . . $ IsSecurityStatusError(7864480464b09eea).(status))
1237 return status;
1238
1239 if (status == SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!)
1240 context->statecxx . . $ $anonymous_type_5da0b8083feac31a_1#state. = NEGOTIATE_STATE_FINALcxx . . $ NEGOTIATE_STATE_FINAL.;
1241 }
1242 else if (context->statecxx . . $ $anonymous_type_5da0b8083feac31a_1#state. == NEGOTIATE_STATE_NEGORESPcxx . . $ NEGOTIATE_STATE_NEGORESP.)
1243 return SEC_E_INVALID_TOKENcxx . . $ `winpr/include/winpr/sspi.h:142:9`!;
1244 }
1245
1246 if (context->statecxx . . $ $anonymous_type_5da0b8083feac31a_1#state. == NEGOTIATE_STATE_FINALcxx . . $ NEGOTIATE_STATE_FINAL.)
1247 {
1248 /* Check if initiator sent the last mech token without a mic and a mic was required */
1249 if (context->miccxx . . $ $anonymous_type_5da0b8083feac31a_1#mic. && output_token.mechTokencxx . . $ $anonymous_type_33a869a33ce4afdb_2#mechToken..cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer. == 0 && input_token.miccxx . . $ $anonymous_type_33a869a33ce4afdb_2#mic..cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer. == 0)
1250 return SEC_E_INVALID_TOKENcxx . . $ `winpr/include/winpr/sspi.h:142:9`!;
1251
1252 if (context->miccxx . . $ $anonymous_type_5da0b8083feac31a_1#mic. || input_token.miccxx . . $ $anonymous_type_33a869a33ce4afdb_2#mic..cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer. > 0)
1253 {
1254 status = negotiate_mic_exchangecxx . . $ negotiate_mic_exchange(db87e138d711453f).(context, &input_token, &output_token, output_buffer);
1255 if (status != SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!)
1256 return status;
1257 }
1258 else
1259 output_token.negStatecxx . . $ $anonymous_type_33a869a33ce4afdb_2#negState. = ACCEPT_COMPLETEDcxx . . $ ACCEPT_COMPLETED.;
1260 }
1261
1262 if (input_token.negStatecxx . . $ $anonymous_type_33a869a33ce4afdb_2#negState. == ACCEPT_COMPLETEDcxx . . $ ACCEPT_COMPLETED.)
1263 {
1264 if (output_buffer)
1265 output_buffer->cbBuffercxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_44#cbBuffer. = 0;
1266 return SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!;
1267 }
1268
1269 if (output_token.negStatecxx . . $ $anonymous_type_33a869a33ce4afdb_2#negState. == ACCEPT_COMPLETEDcxx . . $ ACCEPT_COMPLETED.)
1270 status = SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!;
1271 else
1272 status = SEC_I_CONTINUE_NEEDEDcxx . . $ `winpr/include/winpr/sspi.h:208:9`!;
1273
1274 if (!negotiate_write_neg_tokencxx . . $ negotiate_write_neg_token(f577b0f717e21f66).(output_buffer, &output_token))
1275 return SEC_E_INTERNAL_ERRORcxx . . $ `winpr/include/winpr/sspi.h:138:9`!;
1276
1277 return status;
1278 }
1279
1280 static SECURITY_STATUScxx . . $ SECURITY_STATUS# SEC_ENTRYcxx . . $ `winpr/include/winpr/sspi.h:44:9`! negotiate_CompleteAuthTokencxx . . $ negotiate_CompleteAuthToken(10bcc9d72790f1ce).(PCtxtHandlecxx . . $ PCtxtHandle# phContext,
1281 PSecBufferDesccxx . . $ PSecBufferDesc# pToken)
1282 {
1283 NEGOTIATE_CONTEXTcxx . . $ NEGOTIATE_CONTEXT#* context = nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
1284 SECURITY_STATUScxx . . $ SECURITY_STATUS# status = SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!;
1285 context = (NEGOTIATE_CONTEXTcxx . . $ NEGOTIATE_CONTEXT#*)sspi_SecureHandleGetLowerPointercxx . . $ sspi_SecureHandleGetLowerPointer(850d8027e444f59b).(phContext);
1286
1287 if (!context)
1288 return SEC_E_INVALID_HANDLEcxx . . $ `winpr/include/winpr/sspi.h:135:9`!;
1289
1290 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(context->mech);
1291 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(context->mech->pkg);
1292 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(context->mech->pkg->table);
1293 if (context->mechcxx . . $ $anonymous_type_5da0b8083feac31a_1#mech.->pkgcxx . . $ Mech_st#pkg.->tablecxx . . $ $anonymous_type_33a869a33ce4afdb_0#table.->CompleteAuthTokencxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_53#CompleteAuthToken.)
1294 status = context->mechcxx . . $ $anonymous_type_5da0b8083feac31a_1#mech.->pkgcxx . . $ Mech_st#pkg.->tablecxx . . $ $anonymous_type_33a869a33ce4afdb_0#table.->CompleteAuthTokencxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_53#CompleteAuthToken.(&context->sub_contextcxx . . $ $anonymous_type_5da0b8083feac31a_1#sub_context., pToken);
1295
1296 return status;
1297 }
1298
1299 static SECURITY_STATUScxx . . $ SECURITY_STATUS# SEC_ENTRYcxx . . $ `winpr/include/winpr/sspi.h:44:9`! negotiate_DeleteSecurityContextcxx . . $ negotiate_DeleteSecurityContext(e6bcc0180d974dfe).(PCtxtHandlecxx . . $ PCtxtHandle# phContext)
1300 {
1301 SECURITY_STATUScxx . . $ SECURITY_STATUS# status = SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!;
1302 NEGOTIATE_CONTEXTcxx . . $ NEGOTIATE_CONTEXT#* context = (NEGOTIATE_CONTEXTcxx . . $ NEGOTIATE_CONTEXT#*)sspi_SecureHandleGetLowerPointercxx . . $ sspi_SecureHandleGetLowerPointer(850d8027e444f59b).(phContext);
1303 sspi_SecureHandleInvalidatecxx . . $ sspi_SecureHandleInvalidate(99ecaff645e5cbc5).(phContext);
1304 const SecPkgcxx . . $ SecPkg#* pkg = nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!;
1305
1306 if (!context)
1307 return SEC_E_INVALID_HANDLEcxx . . $ `winpr/include/winpr/sspi.h:135:9`!;
1308
1309 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(context->mech);
1310 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(context->mech->pkg);
1311 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(context->mech->pkg->table);
1312 pkg = context->mechcxx . . $ $anonymous_type_5da0b8083feac31a_1#mech.->pkgcxx . . $ Mech_st#pkg.;
1313
1314 if (pkg->tablecxx . . $ $anonymous_type_33a869a33ce4afdb_0#table.->DeleteSecurityContextcxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_53#DeleteSecurityContext.)
1315 status = pkg->tablecxx . . $ $anonymous_type_33a869a33ce4afdb_0#table.->DeleteSecurityContextcxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_53#DeleteSecurityContext.(&context->sub_contextcxx . . $ $anonymous_type_5da0b8083feac31a_1#sub_context.);
1316
1317 negotiate_ContextFreecxx . . $ negotiate_ContextFree(98ccfdd22a8b30d5).(context);
1318 return status;
1319 }
1320
1321 static SECURITY_STATUScxx . . $ SECURITY_STATUS# SEC_ENTRYcxx . . $ `winpr/include/winpr/sspi.h:44:9`!
1322 negotiate_ImpersonateSecurityContextcxx . . $ negotiate_ImpersonateSecurityContext(e6bcc0180d974dfe).(WINPR_ATTR_UNUSEDcxx . . $ `winpr/include/winpr/platform.h:713:9`! PCtxtHandlecxx . . $ PCtxtHandle# phContext)
1323 {
1324 return SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!;
1325 }
1326
1327 static SECURITY_STATUScxx . . $ SECURITY_STATUS# SEC_ENTRYcxx . . $ `winpr/include/winpr/sspi.h:44:9`!
1328 negotiate_RevertSecurityContextcxx . . $ negotiate_RevertSecurityContext(e6bcc0180d974dfe).(WINPR_ATTR_UNUSEDcxx . . $ `winpr/include/winpr/platform.h:713:9`! PCtxtHandlecxx . . $ PCtxtHandle# phContext)
1329 {
1330 return SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!;
1331 }
1332
1333 static SECURITY_STATUScxx . . $ SECURITY_STATUS# SEC_ENTRYcxx . . $ `winpr/include/winpr/sspi.h:44:9`! negotiate_QueryContextAttributesWcxx . . $ negotiate_QueryContextAttributesW(998cea891dba569e).(PCtxtHandlecxx . . $ PCtxtHandle# phContext,
1334 ULONGcxx . . $ ULONG# ulAttribute, void* pBuffer)
1335 {
1336 NEGOTIATE_CONTEXTcxx . . $ NEGOTIATE_CONTEXT#* context = (NEGOTIATE_CONTEXTcxx . . $ NEGOTIATE_CONTEXT#*)sspi_SecureHandleGetLowerPointercxx . . $ sspi_SecureHandleGetLowerPointer(850d8027e444f59b).(phContext);
1337
1338 if (!context)
1339 return SEC_E_INVALID_HANDLEcxx . . $ `winpr/include/winpr/sspi.h:135:9`!;
1340
1341 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(context->mech);
1342 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(context->mech->pkg);
1343 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(context->mech->pkg->table_w);
1344 if (context->mechcxx . . $ $anonymous_type_5da0b8083feac31a_1#mech.->pkgcxx . . $ Mech_st#pkg.->table_wcxx . . $ $anonymous_type_33a869a33ce4afdb_0#table_w.->QueryContextAttributesWcxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_54#QueryContextAttributesW.)
1345 return context->mechcxx . . $ $anonymous_type_5da0b8083feac31a_1#mech.->pkgcxx . . $ Mech_st#pkg.->table_wcxx . . $ $anonymous_type_33a869a33ce4afdb_0#table_w.->QueryContextAttributesWcxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_54#QueryContextAttributesW.(&context->sub_contextcxx . . $ $anonymous_type_5da0b8083feac31a_1#sub_context.,
1346 ulAttribute, pBuffer);
1347
1348 return SEC_E_UNSUPPORTED_FUNCTIONcxx . . $ `winpr/include/winpr/sspi.h:136:9`!;
1349 }
1350
1351 static SECURITY_STATUScxx . . $ SECURITY_STATUS# SEC_ENTRYcxx . . $ `winpr/include/winpr/sspi.h:44:9`! negotiate_QueryContextAttributesAcxx . . $ negotiate_QueryContextAttributesA(998cea891dba569e).(PCtxtHandlecxx . . $ PCtxtHandle# phContext,
1352 ULONGcxx . . $ ULONG# ulAttribute, void* pBuffer)
1353 {
1354 NEGOTIATE_CONTEXTcxx . . $ NEGOTIATE_CONTEXT#* context = (NEGOTIATE_CONTEXTcxx . . $ NEGOTIATE_CONTEXT#*)sspi_SecureHandleGetLowerPointercxx . . $ sspi_SecureHandleGetLowerPointer(850d8027e444f59b).(phContext);
1355
1356 if (!context)
1357 return SEC_E_INVALID_HANDLEcxx . . $ `winpr/include/winpr/sspi.h:135:9`!;
1358
1359 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(context->mech);
1360 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(context->mech->pkg);
1361 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(context->mech->pkg->table);
1362 if (context->mechcxx . . $ $anonymous_type_5da0b8083feac31a_1#mech.->pkgcxx . . $ Mech_st#pkg.->tablecxx . . $ $anonymous_type_33a869a33ce4afdb_0#table.->QueryContextAttributesAcxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_53#QueryContextAttributesA.)
1363 return context->mechcxx . . $ $anonymous_type_5da0b8083feac31a_1#mech.->pkgcxx . . $ Mech_st#pkg.->tablecxx . . $ $anonymous_type_33a869a33ce4afdb_0#table.->QueryContextAttributesAcxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_53#QueryContextAttributesA.(&context->sub_contextcxx . . $ $anonymous_type_5da0b8083feac31a_1#sub_context.,
1364 ulAttribute, pBuffer);
1365
1366 return SEC_E_UNSUPPORTED_FUNCTIONcxx . . $ `winpr/include/winpr/sspi.h:136:9`!;
1367 }
1368
1369 static SECURITY_STATUScxx . . $ SECURITY_STATUS# SEC_ENTRYcxx . . $ `winpr/include/winpr/sspi.h:44:9`! negotiate_SetContextAttributesWcxx . . $ negotiate_SetContextAttributesW(b9cda4e27f1b3388).(PCtxtHandlecxx . . $ PCtxtHandle# phContext,
1370 ULONGcxx . . $ ULONG# ulAttribute, void* pBuffer,
1371 ULONGcxx . . $ ULONG# cbBuffer)
1372 {
1373 NEGOTIATE_CONTEXTcxx . . $ NEGOTIATE_CONTEXT#* context = (NEGOTIATE_CONTEXTcxx . . $ NEGOTIATE_CONTEXT#*)sspi_SecureHandleGetLowerPointercxx . . $ sspi_SecureHandleGetLowerPointer(850d8027e444f59b).(phContext);
1374
1375 if (!context)
1376 return SEC_E_INVALID_HANDLEcxx . . $ `winpr/include/winpr/sspi.h:135:9`!;
1377
1378 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(context->mech);
1379 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(context->mech->pkg);
1380 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(context->mech->pkg->table_w);
1381 if (context->mechcxx . . $ $anonymous_type_5da0b8083feac31a_1#mech.->pkgcxx . . $ Mech_st#pkg.->table_wcxx . . $ $anonymous_type_33a869a33ce4afdb_0#table_w.->SetContextAttributesWcxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_54#SetContextAttributesW.)
1382 return context->mechcxx . . $ $anonymous_type_5da0b8083feac31a_1#mech.->pkgcxx . . $ Mech_st#pkg.->table_wcxx . . $ $anonymous_type_33a869a33ce4afdb_0#table_w.->SetContextAttributesWcxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_54#SetContextAttributesW.(&context->sub_contextcxx . . $ $anonymous_type_5da0b8083feac31a_1#sub_context.,
1383 ulAttribute, pBuffer, cbBuffer);
1384
1385 return SEC_E_UNSUPPORTED_FUNCTIONcxx . . $ `winpr/include/winpr/sspi.h:136:9`!;
1386 }
1387
1388 static SECURITY_STATUScxx . . $ SECURITY_STATUS# SEC_ENTRYcxx . . $ `winpr/include/winpr/sspi.h:44:9`! negotiate_SetContextAttributesAcxx . . $ negotiate_SetContextAttributesA(b9cda4e27f1b3388).(PCtxtHandlecxx . . $ PCtxtHandle# phContext,
1389 ULONGcxx . . $ ULONG# ulAttribute, void* pBuffer,
1390 ULONGcxx . . $ ULONG# cbBuffer)
1391 {
1392 NEGOTIATE_CONTEXTcxx . . $ NEGOTIATE_CONTEXT#* context = (NEGOTIATE_CONTEXTcxx . . $ NEGOTIATE_CONTEXT#*)sspi_SecureHandleGetLowerPointercxx . . $ sspi_SecureHandleGetLowerPointer(850d8027e444f59b).(phContext);
1393
1394 if (!context)
1395 return SEC_E_INVALID_HANDLEcxx . . $ `winpr/include/winpr/sspi.h:135:9`!;
1396
1397 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(context->mech);
1398 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(context->mech->pkg);
1399 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(context->mech->pkg->table);
1400 if (context->mechcxx . . $ $anonymous_type_5da0b8083feac31a_1#mech.->pkgcxx . . $ Mech_st#pkg.->tablecxx . . $ $anonymous_type_33a869a33ce4afdb_0#table.->SetContextAttributesAcxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_53#SetContextAttributesA.)
1401 return context->mechcxx . . $ $anonymous_type_5da0b8083feac31a_1#mech.->pkgcxx . . $ Mech_st#pkg.->tablecxx . . $ $anonymous_type_33a869a33ce4afdb_0#table.->SetContextAttributesAcxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_53#SetContextAttributesA.(&context->sub_contextcxx . . $ $anonymous_type_5da0b8083feac31a_1#sub_context., ulAttribute,
1402 pBuffer, cbBuffer);
1403
1404 return SEC_E_UNSUPPORTED_FUNCTIONcxx . . $ `winpr/include/winpr/sspi.h:136:9`!;
1405 }
1406
1407 static SECURITY_STATUScxx . . $ SECURITY_STATUS# SEC_ENTRYcxx . . $ `winpr/include/winpr/sspi.h:44:9`! negotiate_SetCredentialsAttributesWcxx . . $ negotiate_SetCredentialsAttributesW(b9cda4e27f1b3388).(PCredHandlecxx . . $ PCredHandle# phCredential,
1408 ULONGcxx . . $ ULONG# ulAttribute,
1409 void* pBuffer, ULONGcxx . . $ ULONG# cbBuffer)
1410 {
1411 BOOLcxx . . $ BOOL# success = FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!;
1412 MechCredcxx . . $ MechCred#* creds = sspi_SecureHandleGetLowerPointercxx . . $ sspi_SecureHandleGetLowerPointer(850d8027e444f59b).(phCredential);
1413
1414 if (!creds)
1415 return SEC_E_INVALID_HANDLEcxx . . $ `winpr/include/winpr/sspi.h:135:9`!;
1416
1417 for (size_t i = 0; i < MECH_COUNTcxx . . $ MECH_COUNT.; i++)
1418 {
1419 MechCredcxx . . $ MechCred#* cred = &creds[i];
1420
1421 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(cred->mech);
1422 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(cred->mech->pkg);
1423 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(cred->mech->pkg->table);
1424 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(cred->mech->pkg->table_w->SetCredentialsAttributesW);
1425 const SECURITY_STATUScxx . . $ SECURITY_STATUS# secStatus = cred->mechcxx . . $ $anonymous_type_33a869a33ce4afdb_1#mech.->pkgcxx . . $ Mech_st#pkg.->table_wcxx . . $ $anonymous_type_33a869a33ce4afdb_0#table_w.->SetCredentialsAttributesWcxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_54#SetCredentialsAttributesW.(
1426 &cred->credcxx . . $ $anonymous_type_33a869a33ce4afdb_1#cred., ulAttribute, pBuffer, cbBuffer);
1427
1428 if (secStatus == SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!)
1429 success = TRUEcxx . . $ `winpr/include/winpr/wtypes.h:126:9`!;
1430 else
1431 WLog_WARNcxx . . $ `winpr/include/winpr/wlog.h:345:9`!(TAGcxx . . $ `winpr/libwinpr/sspi/Negotiate/negotiate.c:40:9`!, "SetCredentialsAttributesW returned %s",
1432 GetSecurityStatusString(secStatus));
1433 }
1434
1435 // return success if at least one submodule accepts the credential attribute
1436 return (success ? SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`! : SEC_E_UNSUPPORTED_FUNCTIONcxx . . $ `winpr/include/winpr/sspi.h:136:9`!);
1437 }
1438
1439 static SECURITY_STATUScxx . . $ SECURITY_STATUS# SEC_ENTRYcxx . . $ `winpr/include/winpr/sspi.h:44:9`! negotiate_SetCredentialsAttributesAcxx . . $ negotiate_SetCredentialsAttributesA(b9cda4e27f1b3388).(PCredHandlecxx . . $ PCredHandle# phCredential,
1440 ULONGcxx . . $ ULONG# ulAttribute,
1441 void* pBuffer, ULONGcxx . . $ ULONG# cbBuffer)
1442 {
1443 BOOLcxx . . $ BOOL# success = FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!;
1444
1445 MechCredcxx . . $ MechCred#* creds = sspi_SecureHandleGetLowerPointercxx . . $ sspi_SecureHandleGetLowerPointer(850d8027e444f59b).(phCredential);
1446
1447 if (!creds)
1448 return SEC_E_INVALID_HANDLEcxx . . $ `winpr/include/winpr/sspi.h:135:9`!;
1449
1450 for (size_t i = 0; i < MECH_COUNTcxx . . $ MECH_COUNT.; i++)
1451 {
1452 MechCredcxx . . $ MechCred#* cred = &creds[i];
1453
1454 if (!cred->validcxx . . $ $anonymous_type_33a869a33ce4afdb_1#valid.)
1455 continue;
1456
1457 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(cred->mech);
1458 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(cred->mech->pkg);
1459 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(cred->mech->pkg->table);
1460 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(cred->mech->pkg->table->SetCredentialsAttributesA);
1461 const SECURITY_STATUScxx . . $ SECURITY_STATUS# secStatus = cred->mechcxx . . $ $anonymous_type_33a869a33ce4afdb_1#mech.->pkgcxx . . $ Mech_st#pkg.->tablecxx . . $ $anonymous_type_33a869a33ce4afdb_0#table.->SetCredentialsAttributesAcxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_53#SetCredentialsAttributesA.(
1462 &cred->credcxx . . $ $anonymous_type_33a869a33ce4afdb_1#cred., ulAttribute, pBuffer, cbBuffer);
1463
1464 if (secStatus == SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!)
1465 {
1466 success = TRUEcxx . . $ `winpr/include/winpr/wtypes.h:126:9`!;
1467 }
1468 else
1469 WLog_WARNcxx . . $ `winpr/include/winpr/wlog.h:345:9`!(TAGcxx . . $ `winpr/libwinpr/sspi/Negotiate/negotiate.c:40:9`!, "SetCredentialsAttributesA returned %s",
1470 GetSecurityStatusString(secStatus));
1471 }
1472
1473 // return success if at least one submodule accepts the credential attribute
1474 return (success ? SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`! : SEC_E_UNSUPPORTED_FUNCTIONcxx . . $ `winpr/include/winpr/sspi.h:136:9`!);
1475 }
1476
1477 WINPR_ATTR_NODISCARDcxx . . $ `winpr/include/winpr/platform.h:105:9`!
1478 static BOOLcxx . . $ BOOL# checkMechCredValidcxx . . $ checkMechCredValid(8b45f3a9552ac6a0).(void* pAuthData, MechCredcxx . . $ MechCred#* cred)
1479 {
1480 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(cred);
1481 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(cred->mech);
1482 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(cred->mech->pkg);
1483
1484 BOOLcxx . . $ BOOL# kerberos = FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!;
1485 BOOLcxx . . $ BOOL# ntlm = FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!;
1486 BOOLcxx . . $ BOOL# u2u = FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!;
1487 if (!negotiate_get_configcxx . . $ negotiate_get_config(7a79db60a0303297).(pAuthData, &kerberos, &ntlm, &u2u))
1488 {
1489 WLog_DBGcxx . . $ `winpr/include/winpr/wlog.h:341:9`!(TAGcxx . . $ `winpr/libwinpr/sspi/Negotiate/negotiate.c:40:9`!, "Failed to get negotiate configuration");
1490 return FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!;
1491 }
1492
1493 if (!kerberos && sspi_gss_oid_comparecxx . . $ sspi_gss_oid_compare(8eb53dc27d60d78a).(cred->mechcxx . . $ $anonymous_type_33a869a33ce4afdb_1#mech.->oidcxx . . $ Mech_st#oid., &kerberos_OIDcxx . . $ kerberos_OID.))
1494 {
1495 WLog_DBGcxx . . $ `winpr/include/winpr/wlog.h:341:9`!(TAGcxx . . $ `winpr/libwinpr/sspi/Negotiate/negotiate.c:40:9`!, "Kerberos disabled, skipping");
1496 return FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!;
1497 }
1498
1499 if (!u2u && sspi_gss_oid_comparecxx . . $ sspi_gss_oid_compare(8eb53dc27d60d78a).(cred->mechcxx . . $ $anonymous_type_33a869a33ce4afdb_1#mech.->oidcxx . . $ Mech_st#oid., &kerberos_u2u_OIDcxx . . $ kerberos_u2u_OID.))
1500 {
1501 WLog_DBGcxx . . $ `winpr/include/winpr/wlog.h:341:9`!(TAGcxx . . $ `winpr/libwinpr/sspi/Negotiate/negotiate.c:40:9`!, "Kerberos U2U disabled, skipping");
1502 return FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!;
1503 }
1504
1505 if (!ntlm && _tcsncmpcxx . . $ `winpr/include/winpr/tchar.h:61:9`!(cred->mechcxx . . $ $anonymous_type_33a869a33ce4afdb_1#mech.->pkgcxx . . $ Mech_st#pkg.->namecxx . . $ $anonymous_type_33a869a33ce4afdb_0#name., NTLM_SSP_NAMEcxx . . $ `winpr/include/winpr/sspi.h:102:9`!, ARRAYSIZEcxx . . $ `winpr/include/winpr/spec.h:962:9`!(NTLM_SSP_NAMEcxx . . $ `winpr/include/winpr/sspi.h:102:9`!)) == 0)
1506 {
1507 WLog_DBGcxx . . $ `winpr/include/winpr/wlog.h:341:9`!(TAGcxx . . $ `winpr/libwinpr/sspi/Negotiate/negotiate.c:40:9`!, "NTLM disabled, skipping");
1508 return FALSEcxx . . $ `winpr/include/winpr/wtypes.h:122:9`!;
1509 }
1510 return TRUEcxx . . $ `winpr/include/winpr/wtypes.h:126:9`!;
1511 }
1512
1513 static SECURITY_STATUScxx . . $ SECURITY_STATUS# SEC_ENTRYcxx . . $ `winpr/include/winpr/sspi.h:44:9`! negotiate_AcquireCredentialsHandleWcxx . . $ negotiate_AcquireCredentialsHandleW(537031bd00bdbc62).(
1514 SEC_WCHARcxx . . $ SEC_WCHAR#* pszPrincipal, SEC_WCHARcxx . . $ SEC_WCHAR#* pszPackage, ULONGcxx . . $ ULONG# fCredentialUse, void* pvLogonID,
1515 void* pAuthData, SEC_GET_KEY_FNcxx . . $ SEC_GET_KEY_FN# pGetKeyFn, void* pvGetKeyArgument, PCredHandlecxx . . $ PCredHandle# phCredential,
1516 PTimeStampcxx . . $ PTimeStamp# ptsExpiry)
1517 {
1518 MechCredcxx . . $ MechCred#* creds = calloccxx . . $ calloc(63a7bf2941bfcd7a).(MECH_COUNTcxx . . $ MECH_COUNT., sizeof(MechCredcxx . . $ MechCred#));
1519
1520 if (!creds)
1521 return SEC_E_INTERNAL_ERRORcxx . . $ `winpr/include/winpr/sspi.h:138:9`!;
1522
1523 for (size_t i = 0; i < MECH_COUNTcxx . . $ MECH_COUNT.; i++)
1524 {
1525 MechCredcxx . . $ MechCred#* cred = &creds[i];
1526 const SecPkgcxx . . $ SecPkg#* pkg = MechTablecxx . . $ MechTable.[i].pkgcxx . . $ Mech_st#pkg.;
1527 cred->mechcxx . . $ $anonymous_type_33a869a33ce4afdb_1#mech. = &MechTablecxx . . $ MechTable.[i];
1528
1529 if (!checkMechCredValidcxx . . $ checkMechCredValid(8b45f3a9552ac6a0).(pAuthData, cred))
1530 continue;
1531
1532 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(pkg->table_w);
1533 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(pkg->table_w->AcquireCredentialsHandleW);
1534 const SECURITY_STATUScxx . . $ SECURITY_STATUS# rc = pkg->table_wcxx . . $ $anonymous_type_33a869a33ce4afdb_0#table_w.->AcquireCredentialsHandleWcxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_54#AcquireCredentialsHandleW.(
1535 pszPrincipal, pszPackage, fCredentialUse, pvLogonID, pAuthData, pGetKeyFn,
1536 pvGetKeyArgument, &cred->credcxx . . $ $anonymous_type_33a869a33ce4afdb_1#cred., ptsExpiry);
1537 if (rc != SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!)
1538 {
1539 WLog_DBGcxx . . $ `winpr/include/winpr/wlog.h:341:9`!(TAGcxx . . $ `winpr/libwinpr/sspi/Negotiate/negotiate.c:40:9`!, "AcquireCredentialsHandleW returned %s", GetSecurityStatusString(rc));
1540 continue;
1541 }
1542
1543 cred->validcxx . . $ $anonymous_type_33a869a33ce4afdb_1#valid. = TRUEcxx . . $ `winpr/include/winpr/wtypes.h:126:9`!;
1544 }
1545
1546 sspi_SecureHandleSetLowerPointercxx . . $ sspi_SecureHandleSetLowerPointer(aaeae9b83d9844a8).(phCredential, (void*)creds);
1547 sspi_SecureHandleSetPackageIdcxx . . $ sspi_SecureHandleSetPackageId(82c32e2c21b1f4c7).(phCredential, SSPI_PACKAGE_NEGOTIATEcxx . . $ SSPI_PACKAGE_NEGOTIATE.);
1548 return SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!;
1549 }
1550
1551 static SECURITY_STATUScxx . . $ SECURITY_STATUS# SEC_ENTRYcxx . . $ `winpr/include/winpr/sspi.h:44:9`! negotiate_AcquireCredentialsHandleAcxx . . $ negotiate_AcquireCredentialsHandleA(ea7a2ba3fce4e22).(
1552 SEC_CHARcxx . . $ SEC_CHAR#* pszPrincipal, SEC_CHARcxx . . $ SEC_CHAR#* pszPackage, ULONGcxx . . $ ULONG# fCredentialUse, void* pvLogonID,
1553 void* pAuthData, SEC_GET_KEY_FNcxx . . $ SEC_GET_KEY_FN# pGetKeyFn, void* pvGetKeyArgument, PCredHandlecxx . . $ PCredHandle# phCredential,
1554 PTimeStampcxx . . $ PTimeStamp# ptsExpiry)
1555 {
1556 MechCredcxx . . $ MechCred#* creds = calloccxx . . $ calloc(63a7bf2941bfcd7a).(MECH_COUNTcxx . . $ MECH_COUNT., sizeof(MechCredcxx . . $ MechCred#));
1557
1558 if (!creds)
1559 return SEC_E_INTERNAL_ERRORcxx . . $ `winpr/include/winpr/sspi.h:138:9`!;
1560
1561 for (size_t i = 0; i < MECH_COUNTcxx . . $ MECH_COUNT.; i++)
1562 {
1563 const SecPkgcxx . . $ SecPkg#* pkg = MechTablecxx . . $ MechTable.[i].pkgcxx . . $ Mech_st#pkg.;
1564 MechCredcxx . . $ MechCred#* cred = &creds[i];
1565
1566 cred->mechcxx . . $ $anonymous_type_33a869a33ce4afdb_1#mech. = &MechTablecxx . . $ MechTable.[i];
1567
1568 if (!checkMechCredValidcxx . . $ checkMechCredValid(8b45f3a9552ac6a0).(pAuthData, cred))
1569 continue;
1570
1571 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(pkg->table);
1572 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(pkg->table->AcquireCredentialsHandleA);
1573 const SECURITY_STATUScxx . . $ SECURITY_STATUS# rc = pkg->tablecxx . . $ $anonymous_type_33a869a33ce4afdb_0#table.->AcquireCredentialsHandleAcxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_53#AcquireCredentialsHandleA.(
1574 pszPrincipal, pszPackage, fCredentialUse, pvLogonID, pAuthData, pGetKeyFn,
1575 pvGetKeyArgument, &cred->credcxx . . $ $anonymous_type_33a869a33ce4afdb_1#cred., ptsExpiry);
1576 if (rc != SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!)
1577 {
1578 WLog_DBGcxx . . $ `winpr/include/winpr/wlog.h:341:9`!(TAGcxx . . $ `winpr/libwinpr/sspi/Negotiate/negotiate.c:40:9`!, "AcquireCredentialsHandleA returned %s", GetSecurityStatusString(rc));
1579 continue;
1580 }
1581
1582 cred->validcxx . . $ $anonymous_type_33a869a33ce4afdb_1#valid. = TRUEcxx . . $ `winpr/include/winpr/wtypes.h:126:9`!;
1583 }
1584
1585 sspi_SecureHandleSetLowerPointercxx . . $ sspi_SecureHandleSetLowerPointer(aaeae9b83d9844a8).(phCredential, (void*)creds);
1586 sspi_SecureHandleSetPackageIdcxx . . $ sspi_SecureHandleSetPackageId(82c32e2c21b1f4c7).(phCredential, SSPI_PACKAGE_NEGOTIATEcxx . . $ SSPI_PACKAGE_NEGOTIATE.);
1587 return SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!;
1588 }
1589
1590 static SECURITY_STATUScxx . . $ SECURITY_STATUS# SEC_ENTRYcxx . . $ `winpr/include/winpr/sspi.h:44:9`! negotiate_QueryCredentialsAttributesWcxx . . $ negotiate_QueryCredentialsAttributesW(998cea891dba569e).(
1591 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,
1592 WINPR_ATTR_UNUSEDcxx . . $ `winpr/include/winpr/platform.h:713:9`! void* pBuffer)
1593 {
1594 WLog_ERRcxx . . $ `winpr/include/winpr/wlog.h:347:9`!(TAGcxx . . $ `winpr/libwinpr/sspi/Negotiate/negotiate.c:40:9`!, "TODO: Implement");
1595 return SEC_E_UNSUPPORTED_FUNCTIONcxx . . $ `winpr/include/winpr/sspi.h:136:9`!;
1596 }
1597
1598 static SECURITY_STATUScxx . . $ SECURITY_STATUS# SEC_ENTRYcxx . . $ `winpr/include/winpr/sspi.h:44:9`! negotiate_QueryCredentialsAttributesAcxx . . $ negotiate_QueryCredentialsAttributesA(998cea891dba569e).(
1599 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,
1600 WINPR_ATTR_UNUSEDcxx . . $ `winpr/include/winpr/platform.h:713:9`! void* pBuffer)
1601 {
1602 WLog_ERRcxx . . $ `winpr/include/winpr/wlog.h:347:9`!(TAGcxx . . $ `winpr/libwinpr/sspi/Negotiate/negotiate.c:40:9`!, "TODO: Implement");
1603 return SEC_E_UNSUPPORTED_FUNCTIONcxx . . $ `winpr/include/winpr/sspi.h:136:9`!;
1604 }
1605
1606 static SECURITY_STATUScxx . . $ SECURITY_STATUS# SEC_ENTRYcxx . . $ `winpr/include/winpr/sspi.h:44:9`! negotiate_FreeCredentialsHandlecxx . . $ negotiate_FreeCredentialsHandle(e6bcc0180d974dfe).(PCredHandlecxx . . $ PCredHandle# phCredential)
1607 {
1608 MechCredcxx . . $ MechCred#* creds = sspi_SecureHandleGetLowerPointercxx . . $ sspi_SecureHandleGetLowerPointer(850d8027e444f59b).(phCredential);
1609 sspi_SecureHandleInvalidatecxx . . $ sspi_SecureHandleInvalidate(99ecaff645e5cbc5).(phCredential);
1610 if (!creds)
1611 return SEC_E_INVALID_HANDLEcxx . . $ `winpr/include/winpr/sspi.h:135:9`!;
1612
1613 for (size_t i = 0; i < MECH_COUNTcxx . . $ MECH_COUNT.; i++)
1614 {
1615 MechCredcxx . . $ MechCred#* cred = &creds[i];
1616
1617 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(cred->mech);
1618 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(cred->mech->pkg);
1619 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(cred->mech->pkg->table);
1620 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(cred->mech->pkg->table->FreeCredentialsHandle);
1621 const SECURITY_STATUScxx . . $ SECURITY_STATUS# rc = cred->mechcxx . . $ $anonymous_type_33a869a33ce4afdb_1#mech.->pkgcxx . . $ Mech_st#pkg.->tablecxx . . $ $anonymous_type_33a869a33ce4afdb_0#table.->FreeCredentialsHandlecxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_53#FreeCredentialsHandle.(&cred->credcxx . . $ $anonymous_type_33a869a33ce4afdb_1#cred.);
1622 if (rc != SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!)
1623 WLog_DBGcxx . . $ `winpr/include/winpr/wlog.h:341:9`!(TAGcxx . . $ `winpr/libwinpr/sspi/Negotiate/negotiate.c:40:9`!, "FreeCredentialsHandle returned %s", GetSecurityStatusString(rc));
1624 }
1625 freecxx . . $ free(5d22bdacc48458e8).(creds);
1626
1627 return SEC_E_OKcxx . . $ `winpr/include/winpr/sspi.h:133:9`!;
1628 }
1629
1630 static SECURITY_STATUScxx . . $ SECURITY_STATUS# SEC_ENTRYcxx . . $ `winpr/include/winpr/sspi.h:44:9`! negotiate_EncryptMessagecxx . . $ negotiate_EncryptMessage(e5afddb57b5310d6).(PCtxtHandlecxx . . $ PCtxtHandle# phContext, ULONGcxx . . $ ULONG# fQOP,
1631 PSecBufferDesccxx . . $ PSecBufferDesc# pMessage,
1632 ULONGcxx . . $ ULONG# MessageSeqNo)
1633 {
1634 NEGOTIATE_CONTEXTcxx . . $ NEGOTIATE_CONTEXT#* context = (NEGOTIATE_CONTEXTcxx . . $ NEGOTIATE_CONTEXT#*)sspi_SecureHandleGetLowerPointercxx . . $ sspi_SecureHandleGetLowerPointer(850d8027e444f59b).(phContext);
1635
1636 if (!context)
1637 return SEC_E_INVALID_HANDLEcxx . . $ `winpr/include/winpr/sspi.h:135:9`!;
1638
1639 if (context->miccxx . . $ $anonymous_type_5da0b8083feac31a_1#mic.)
1640 MessageSeqNo++;
1641
1642 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(context->mech);
1643 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(context->mech->pkg);
1644 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(context->mech->pkg->table);
1645 if (context->mechcxx . . $ $anonymous_type_5da0b8083feac31a_1#mech.->pkgcxx . . $ Mech_st#pkg.->tablecxx . . $ $anonymous_type_33a869a33ce4afdb_0#table.->EncryptMessagecxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_53#EncryptMessage.)
1646 return context->mechcxx . . $ $anonymous_type_5da0b8083feac31a_1#mech.->pkgcxx . . $ Mech_st#pkg.->tablecxx . . $ $anonymous_type_33a869a33ce4afdb_0#table.->EncryptMessagecxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_53#EncryptMessage.(&context->sub_contextcxx . . $ $anonymous_type_5da0b8083feac31a_1#sub_context., fQOP, pMessage,
1647 MessageSeqNo);
1648
1649 return SEC_E_UNSUPPORTED_FUNCTIONcxx . . $ `winpr/include/winpr/sspi.h:136:9`!;
1650 }
1651
1652 static SECURITY_STATUScxx . . $ SECURITY_STATUS# SEC_ENTRYcxx . . $ `winpr/include/winpr/sspi.h:44:9`! negotiate_DecryptMessagecxx . . $ negotiate_DecryptMessage(413abde90771aeb2).(PCtxtHandlecxx . . $ PCtxtHandle# phContext,
1653 PSecBufferDesccxx . . $ PSecBufferDesc# pMessage,
1654 ULONGcxx . . $ ULONG# MessageSeqNo, ULONGcxx . . $ ULONG#* pfQOP)
1655 {
1656 NEGOTIATE_CONTEXTcxx . . $ NEGOTIATE_CONTEXT#* context = (NEGOTIATE_CONTEXTcxx . . $ NEGOTIATE_CONTEXT#*)sspi_SecureHandleGetLowerPointercxx . . $ sspi_SecureHandleGetLowerPointer(850d8027e444f59b).(phContext);
1657
1658 if (!context)
1659 return SEC_E_INVALID_HANDLEcxx . . $ `winpr/include/winpr/sspi.h:135:9`!;
1660
1661 if (context->miccxx . . $ $anonymous_type_5da0b8083feac31a_1#mic.)
1662 MessageSeqNo++;
1663
1664 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(context->mech);
1665 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(context->mech->pkg);
1666 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(context->mech->pkg->table);
1667 if (context->mechcxx . . $ $anonymous_type_5da0b8083feac31a_1#mech.->pkgcxx . . $ Mech_st#pkg.->tablecxx . . $ $anonymous_type_33a869a33ce4afdb_0#table.->DecryptMessagecxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_53#DecryptMessage.)
1668 return context->mechcxx . . $ $anonymous_type_5da0b8083feac31a_1#mech.->pkgcxx . . $ Mech_st#pkg.->tablecxx . . $ $anonymous_type_33a869a33ce4afdb_0#table.->DecryptMessagecxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_53#DecryptMessage.(&context->sub_contextcxx . . $ $anonymous_type_5da0b8083feac31a_1#sub_context., pMessage,
1669 MessageSeqNo, pfQOP);
1670
1671 return SEC_E_UNSUPPORTED_FUNCTIONcxx . . $ `winpr/include/winpr/sspi.h:136:9`!;
1672 }
1673
1674 static SECURITY_STATUScxx . . $ SECURITY_STATUS# SEC_ENTRYcxx . . $ `winpr/include/winpr/sspi.h:44:9`! negotiate_MakeSignaturecxx . . $ negotiate_MakeSignature(e5afddb57b5310d6).(PCtxtHandlecxx . . $ PCtxtHandle# phContext, ULONGcxx . . $ ULONG# fQOP,
1675 PSecBufferDesccxx . . $ PSecBufferDesc# pMessage,
1676 ULONGcxx . . $ ULONG# MessageSeqNo)
1677 {
1678 NEGOTIATE_CONTEXTcxx . . $ NEGOTIATE_CONTEXT#* context = (NEGOTIATE_CONTEXTcxx . . $ NEGOTIATE_CONTEXT#*)sspi_SecureHandleGetLowerPointercxx . . $ sspi_SecureHandleGetLowerPointer(850d8027e444f59b).(phContext);
1679
1680 if (!context)
1681 return SEC_E_INVALID_HANDLEcxx . . $ `winpr/include/winpr/sspi.h:135:9`!;
1682
1683 if (context->miccxx . . $ $anonymous_type_5da0b8083feac31a_1#mic.)
1684 MessageSeqNo++;
1685
1686 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(context->mech);
1687 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(context->mech->pkg);
1688 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(context->mech->pkg->table);
1689 if (context->mechcxx . . $ $anonymous_type_5da0b8083feac31a_1#mech.->pkgcxx . . $ Mech_st#pkg.->tablecxx . . $ $anonymous_type_33a869a33ce4afdb_0#table.->MakeSignaturecxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_53#MakeSignature.)
1690 return context->mechcxx . . $ $anonymous_type_5da0b8083feac31a_1#mech.->pkgcxx . . $ Mech_st#pkg.->tablecxx . . $ $anonymous_type_33a869a33ce4afdb_0#table.->MakeSignaturecxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_53#MakeSignature.(&context->sub_contextcxx . . $ $anonymous_type_5da0b8083feac31a_1#sub_context., fQOP, pMessage,
1691 MessageSeqNo);
1692
1693 return SEC_E_UNSUPPORTED_FUNCTIONcxx . . $ `winpr/include/winpr/sspi.h:136:9`!;
1694 }
1695
1696 static SECURITY_STATUScxx . . $ SECURITY_STATUS# SEC_ENTRYcxx . . $ `winpr/include/winpr/sspi.h:44:9`! negotiate_VerifySignaturecxx . . $ negotiate_VerifySignature(413abde90771aeb2).(PCtxtHandlecxx . . $ PCtxtHandle# phContext,
1697 PSecBufferDesccxx . . $ PSecBufferDesc# pMessage,
1698 ULONGcxx . . $ ULONG# MessageSeqNo, ULONGcxx . . $ ULONG#* pfQOP)
1699 {
1700 NEGOTIATE_CONTEXTcxx . . $ NEGOTIATE_CONTEXT#* context = (NEGOTIATE_CONTEXTcxx . . $ NEGOTIATE_CONTEXT#*)sspi_SecureHandleGetLowerPointercxx . . $ sspi_SecureHandleGetLowerPointer(850d8027e444f59b).(phContext);
1701
1702 if (!context)
1703 return SEC_E_INVALID_HANDLEcxx . . $ `winpr/include/winpr/sspi.h:135:9`!;
1704
1705 if (context->miccxx . . $ $anonymous_type_5da0b8083feac31a_1#mic.)
1706 MessageSeqNo++;
1707
1708 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(context->mech);
1709 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(context->mech->pkg);
1710 WINPR_ASSERTcxx . . $ `winpr/include/winpr/assert-api.h:76:9`!(context->mech->pkg->table);
1711 if (context->mechcxx . . $ $anonymous_type_5da0b8083feac31a_1#mech.->pkgcxx . . $ Mech_st#pkg.->tablecxx . . $ $anonymous_type_33a869a33ce4afdb_0#table.->VerifySignaturecxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_53#VerifySignature.)
1712 return context->mechcxx . . $ $anonymous_type_5da0b8083feac31a_1#mech.->pkgcxx . . $ Mech_st#pkg.->tablecxx . . $ $anonymous_type_33a869a33ce4afdb_0#table.->VerifySignaturecxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_53#VerifySignature.(&context->sub_contextcxx . . $ $anonymous_type_5da0b8083feac31a_1#sub_context., pMessage,
1713 MessageSeqNo, pfQOP);
1714
1715 return SEC_E_UNSUPPORTED_FUNCTIONcxx . . $ `winpr/include/winpr/sspi.h:136:9`!;
1716 }
1717
1718 const SecurityFunctionTableAcxx . . $ SecurityFunctionTableA# NEGOTIATE_SecurityFunctionTableAcxx . . $ NEGOTIATE_SecurityFunctionTableA. = {
1719 3, /* dwVersion */
1720 nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, /* EnumerateSecurityPackages */
1721 negotiate_QueryCredentialsAttributesAcxx . . $ negotiate_QueryCredentialsAttributesA(998cea891dba569e)., /* QueryCredentialsAttributes */
1722 negotiate_AcquireCredentialsHandleAcxx . . $ negotiate_AcquireCredentialsHandleA(ea7a2ba3fce4e22)., /* AcquireCredentialsHandle */
1723 negotiate_FreeCredentialsHandlecxx . . $ negotiate_FreeCredentialsHandle(e6bcc0180d974dfe)., /* FreeCredentialsHandle */
1724 nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, /* Reserved2 */
1725 negotiate_InitializeSecurityContextAcxx . . $ negotiate_InitializeSecurityContextA(cf9633d63d9b9e60)., /* InitializeSecurityContext */
1726 negotiate_AcceptSecurityContextcxx . . $ negotiate_AcceptSecurityContext(c4f1f6e2f4d578a9)., /* AcceptSecurityContext */
1727 negotiate_CompleteAuthTokencxx . . $ negotiate_CompleteAuthToken(10bcc9d72790f1ce)., /* CompleteAuthToken */
1728 negotiate_DeleteSecurityContextcxx . . $ negotiate_DeleteSecurityContext(e6bcc0180d974dfe)., /* DeleteSecurityContext */
1729 nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, /* ApplyControlToken */
1730 negotiate_QueryContextAttributesAcxx . . $ negotiate_QueryContextAttributesA(998cea891dba569e)., /* QueryContextAttributes */
1731 negotiate_ImpersonateSecurityContextcxx . . $ negotiate_ImpersonateSecurityContext(e6bcc0180d974dfe)., /* ImpersonateSecurityContext */
1732 negotiate_RevertSecurityContextcxx . . $ negotiate_RevertSecurityContext(e6bcc0180d974dfe)., /* RevertSecurityContext */
1733 negotiate_MakeSignaturecxx . . $ negotiate_MakeSignature(e5afddb57b5310d6)., /* MakeSignature */
1734 negotiate_VerifySignaturecxx . . $ negotiate_VerifySignature(413abde90771aeb2)., /* VerifySignature */
1735 nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, /* FreeContextBuffer */
1736 nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, /* QuerySecurityPackageInfo */
1737 nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, /* Reserved3 */
1738 nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, /* Reserved4 */
1739 nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, /* ExportSecurityContext */
1740 nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, /* ImportSecurityContext */
1741 nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, /* AddCredentials */
1742 nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, /* Reserved8 */
1743 nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, /* QuerySecurityContextToken */
1744 negotiate_EncryptMessagecxx . . $ negotiate_EncryptMessage(e5afddb57b5310d6)., /* EncryptMessage */
1745 negotiate_DecryptMessagecxx . . $ negotiate_DecryptMessage(413abde90771aeb2)., /* DecryptMessage */
1746 negotiate_SetContextAttributesAcxx . . $ negotiate_SetContextAttributesA(b9cda4e27f1b3388)., /* SetContextAttributes */
1747 negotiate_SetCredentialsAttributesAcxx . . $ negotiate_SetCredentialsAttributesA(b9cda4e27f1b3388)., /* SetCredentialsAttributes */
1748 };
1749
1750 const SecurityFunctionTableWcxx . . $ SecurityFunctionTableW# NEGOTIATE_SecurityFunctionTableWcxx . . $ NEGOTIATE_SecurityFunctionTableW. = {
1751 3, /* dwVersion */
1752 nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, /* EnumerateSecurityPackages */
1753 negotiate_QueryCredentialsAttributesWcxx . . $ negotiate_QueryCredentialsAttributesW(998cea891dba569e)., /* QueryCredentialsAttributes */
1754 negotiate_AcquireCredentialsHandleWcxx . . $ negotiate_AcquireCredentialsHandleW(537031bd00bdbc62)., /* AcquireCredentialsHandle */
1755 negotiate_FreeCredentialsHandlecxx . . $ negotiate_FreeCredentialsHandle(e6bcc0180d974dfe)., /* FreeCredentialsHandle */
1756 nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, /* Reserved2 */
1757 negotiate_InitializeSecurityContextWcxx . . $ negotiate_InitializeSecurityContextW(422ccc8b6dd4c323)., /* InitializeSecurityContext */
1758 negotiate_AcceptSecurityContextcxx . . $ negotiate_AcceptSecurityContext(c4f1f6e2f4d578a9)., /* AcceptSecurityContext */
1759 negotiate_CompleteAuthTokencxx . . $ negotiate_CompleteAuthToken(10bcc9d72790f1ce)., /* CompleteAuthToken */
1760 negotiate_DeleteSecurityContextcxx . . $ negotiate_DeleteSecurityContext(e6bcc0180d974dfe)., /* DeleteSecurityContext */
1761 nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, /* ApplyControlToken */
1762 negotiate_QueryContextAttributesWcxx . . $ negotiate_QueryContextAttributesW(998cea891dba569e)., /* QueryContextAttributes */
1763 negotiate_ImpersonateSecurityContextcxx . . $ negotiate_ImpersonateSecurityContext(e6bcc0180d974dfe)., /* ImpersonateSecurityContext */
1764 negotiate_RevertSecurityContextcxx . . $ negotiate_RevertSecurityContext(e6bcc0180d974dfe)., /* RevertSecurityContext */
1765 negotiate_MakeSignaturecxx . . $ negotiate_MakeSignature(e5afddb57b5310d6)., /* MakeSignature */
1766 negotiate_VerifySignaturecxx . . $ negotiate_VerifySignature(413abde90771aeb2)., /* VerifySignature */
1767 nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, /* FreeContextBuffer */
1768 nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, /* QuerySecurityPackageInfo */
1769 nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, /* Reserved3 */
1770 nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, /* Reserved4 */
1771 nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, /* ExportSecurityContext */
1772 nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, /* ImportSecurityContext */
1773 nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, /* AddCredentials */
1774 nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, /* Reserved8 */
1775 nullptrcxx . . $ `winpr/include/winpr/platform.h:88:9`!, /* QuerySecurityContextToken */
1776 negotiate_EncryptMessagecxx . . $ negotiate_EncryptMessage(e5afddb57b5310d6)., /* EncryptMessage */
1777 negotiate_DecryptMessagecxx . . $ negotiate_DecryptMessage(413abde90771aeb2)., /* DecryptMessage */
1778 negotiate_SetContextAttributesWcxx . . $ negotiate_SetContextAttributesW(b9cda4e27f1b3388)., /* SetContextAttributes */
1779 negotiate_SetCredentialsAttributesWcxx . . $ negotiate_SetCredentialsAttributesW(b9cda4e27f1b3388)., /* SetCredentialsAttributes */
1780 };
1781
1782 BOOLcxx . . $ BOOL# NEGOTIATE_initcxx . . $ NEGOTIATE_init(b126dc7c1de90089).(void)
1783 {
1784 InitializeConstWCharFromUtf8cxx . . $ InitializeConstWCharFromUtf8(937e1d3c9c433ddd).(NEGOTIATE_SecPkgInfoAcxx . . $ NEGOTIATE_SecPkgInfoA..Namecxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_1#Name., NEGOTIATE_SecPkgInfoW_NameBuffercxx . . $ NEGOTIATE_SecPkgInfoW_NameBuffer.,
1785 ARRAYSIZEcxx . . $ `winpr/include/winpr/spec.h:962:9`!(NEGOTIATE_SecPkgInfoW_NameBuffer));
1786 InitializeConstWCharFromUtf8cxx . . $ InitializeConstWCharFromUtf8(937e1d3c9c433ddd).(NEGOTIATE_SecPkgInfoAcxx . . $ NEGOTIATE_SecPkgInfoA..Commentcxx . . $ $anonymous_type_13c8ac8e1b4cb2c0_1#Comment., NEGOTIATE_SecPkgInfoW_CommentBuffercxx . . $ NEGOTIATE_SecPkgInfoW_CommentBuffer.,
1787 ARRAYSIZEcxx . . $ `winpr/include/winpr/spec.h:962:9`!(NEGOTIATE_SecPkgInfoW_CommentBuffer));
1788
1789 return TRUEcxx . . $ `winpr/include/winpr/wtypes.h:126:9`!;
1790 }