38581785fa8e532eea1bcc9bc019b22caf4624cd
[reactos.git] / reactos / dll / win32 / secur32 / sspi.c
1 #include <precomp.h>
2
3 #define NDEBUG
4 #include <debug.h>
5
6 SECURITY_STATUS WINAPI ApplyControlTokenW(PCtxtHandle Handle, PSecBufferDesc Buffer);
7 SECURITY_STATUS WINAPI ApplyControlTokenA(PCtxtHandle Handle, PSecBufferDesc Buffer);
8
9 static SecurityFunctionTableA securityFunctionTableA =
10 {
11 SECURITY_SUPPORT_PROVIDER_INTERFACE_VERSION,
12 EnumerateSecurityPackagesA,
13 QueryCredentialsAttributesA,
14 AcquireCredentialsHandleA,
15 FreeCredentialsHandle,
16 NULL, /* Reserved2 */
17 InitializeSecurityContextA,
18 AcceptSecurityContext,
19 CompleteAuthToken,
20 DeleteSecurityContext,
21 ApplyControlTokenA,
22 QueryContextAttributesA,
23 ImpersonateSecurityContext,
24 RevertSecurityContext,
25 MakeSignature,
26 VerifySignature,
27 FreeContextBuffer,
28 QuerySecurityPackageInfoA,
29 EncryptMessage, /* Reserved3 */
30 DecryptMessage, /* Reserved4 */
31 ExportSecurityContext,
32 ImportSecurityContextA,
33 AddCredentialsA,
34 NULL, /* Reserved8 */
35 QuerySecurityContextToken,
36 EncryptMessage,
37 DecryptMessage,
38 NULL
39 };
40
41 static SecurityFunctionTableW securityFunctionTableW =
42 {
43 SECURITY_SUPPORT_PROVIDER_INTERFACE_VERSION,
44 EnumerateSecurityPackagesW,
45 QueryCredentialsAttributesW,
46 AcquireCredentialsHandleW,
47 FreeCredentialsHandle,
48 NULL, /* Reserved2 */
49 InitializeSecurityContextW,
50 AcceptSecurityContext,
51 CompleteAuthToken,
52 DeleteSecurityContext,
53 ApplyControlTokenW,
54 QueryContextAttributesW,
55 ImpersonateSecurityContext,
56 RevertSecurityContext,
57 MakeSignature,
58 VerifySignature,
59 FreeContextBuffer,
60 QuerySecurityPackageInfoW,
61 EncryptMessage, /* Reserved3 */
62 DecryptMessage, /* Reserved4 */
63 ExportSecurityContext,
64 ImportSecurityContextW,
65 AddCredentialsW,
66 NULL, /* Reserved8 */
67 QuerySecurityContextToken,
68 EncryptMessage,
69 DecryptMessage,
70 NULL
71 };
72
73 SECURITY_STATUS
74 WINAPI
75 EnumerateSecurityPackagesW (
76 PULONG pcPackages,
77 PSecPkgInfoW* ppPackageInfo
78 )
79 {
80 SECURITY_STATUS ret = SEC_E_OK;
81
82 *pcPackages = 0;
83
84 /*
85 if (packageTable)
86 {
87
88 }
89 */
90
91 UNIMPLEMENTED;
92 return ret;
93 }
94
95 SECURITY_STATUS
96 WINAPI
97 EnumerateSecurityPackagesA(
98 PULONG pcPackages,
99 PSecPkgInfoA* ppPackageInfo
100 )
101 {
102 SECURITY_STATUS ret;
103 PSecPkgInfoW info;
104
105 ret = EnumerateSecurityPackagesW(pcPackages, &info);
106 if (ret == SEC_E_OK && *pcPackages && info)
107 {
108 /* *ppPackageInfo = thunk_PSecPkgInfoWToA(*pcPackages, info);
109 if (*pcPackages && !*ppPackageInfo)
110 {
111 *pcPackages = 0;
112 ret = SEC_E_INSUFFICIENT_MEMORY;
113 } */
114 FreeContextBuffer(info);
115 }
116
117 UNIMPLEMENTED;
118
119 return ret;
120 }
121
122 SECURITY_STATUS
123 WINAPI
124 FreeContextBuffer (
125 PVOID pvoid
126 )
127 {
128 HeapFree(GetProcessHeap(), 0, pvoid);
129 return SEC_E_OK;
130 }
131
132 SECURITY_STATUS
133 WINAPI
134 FreeCredentialsHandle(PCredHandle Handle)
135 {
136 UNIMPLEMENTED;
137 return ERROR_CALL_NOT_IMPLEMENTED;
138 }
139
140 SECURITY_STATUS
141 WINAPI
142 DeleteSecurityContext(PCtxtHandle Handle)
143 {
144 UNIMPLEMENTED;
145 return ERROR_CALL_NOT_IMPLEMENTED;
146 }
147
148 PSecurityFunctionTableW
149 WINAPI
150 InitSecurityInterfaceW(VOID)
151 {
152 DPRINT("InitSecurityInterfaceW() called\n");
153 return &securityFunctionTableW;
154 }
155
156 SECURITY_STATUS
157 WINAPI
158 EncryptMessage(PCtxtHandle Handle,
159 ULONG Foo,
160 PSecBufferDesc Buffer,
161 ULONG Bar)
162 {
163 UNIMPLEMENTED;
164 return ERROR_CALL_NOT_IMPLEMENTED;
165 }
166
167 SECURITY_STATUS
168 WINAPI
169 DecryptMessage(PCtxtHandle Handle,
170 PSecBufferDesc Buffer,
171 ULONG Foo,
172 PULONG Bar)
173 {
174 UNIMPLEMENTED;
175 return ERROR_CALL_NOT_IMPLEMENTED;
176 }
177
178 SECURITY_STATUS
179 WINAPI
180 ApplyControlTokenW(PCtxtHandle Handle,
181 PSecBufferDesc Buffer)
182 {
183 UNIMPLEMENTED;
184 return ERROR_CALL_NOT_IMPLEMENTED;
185 }
186
187 SECURITY_STATUS
188 WINAPI
189 ApplyControlTokenA(PCtxtHandle Handle,
190 PSecBufferDesc Buffer)
191 {
192 UNIMPLEMENTED;
193 return ERROR_CALL_NOT_IMPLEMENTED;
194 }
195
196 SECURITY_STATUS
197 WINAPI
198 CompleteAuthToken(PCtxtHandle Handle,
199 PSecBufferDesc Buffer)
200 {
201 UNIMPLEMENTED;
202 return ERROR_CALL_NOT_IMPLEMENTED;
203 }
204
205 SECURITY_STATUS
206 WINAPI
207 QueryContextAttributesA(PCtxtHandle Handle,
208 ULONG Foo,
209 PVOID Bar)
210 {
211 UNIMPLEMENTED;
212
213 if (Handle)
214 {
215 Bar = NULL;
216 return ERROR_CALL_NOT_IMPLEMENTED;
217 }
218
219 return SEC_E_INVALID_HANDLE;
220 }
221
222 SECURITY_STATUS
223 WINAPI
224 QueryContextAttributesW(PCtxtHandle Handle,
225 ULONG Foo,
226 PVOID Bar)
227 {
228 UNIMPLEMENTED;
229
230 if (Handle)
231 {
232 Bar = NULL;
233 return ERROR_CALL_NOT_IMPLEMENTED;
234 }
235
236 return SEC_E_INVALID_HANDLE;
237 }
238
239 SECURITY_STATUS
240 WINAPI
241 AcquireCredentialsHandleA (
242 SEC_CHAR* pszPrincipal,
243 SEC_CHAR* pszPackage,
244 ULONG fUsage,
245 PLUID pID,
246 PVOID pAuth,
247 SEC_GET_KEY_FN pGetKeyFn,
248 PVOID pvGetKeyArgument,
249 PCredHandle phCred,
250 PTimeStamp pExpires
251 )
252 {
253 UNIMPLEMENTED;
254
255 if (pszPackage)
256 {
257 phCred = NULL;
258 pExpires = NULL;
259 return ERROR_CALL_NOT_IMPLEMENTED;
260 }
261
262 return SEC_E_SECPKG_NOT_FOUND;
263 }
264
265 SECURITY_STATUS
266 WINAPI
267 AcquireCredentialsHandleW (
268 SEC_WCHAR* pszPrincipal,
269 SEC_WCHAR* pszPackage,
270 ULONG fUsage,
271 PLUID pID,
272 PVOID pAuth,
273 SEC_GET_KEY_FN pGetKeyFn,
274 PVOID pvGetKeyArgument,
275 PCredHandle phCred,
276 PTimeStamp pExpires
277 )
278 {
279 UNIMPLEMENTED;
280
281 if (pszPackage)
282 {
283 phCred = NULL;
284 pExpires = NULL;
285 return ERROR_CALL_NOT_IMPLEMENTED;
286 }
287
288 return SEC_E_SECPKG_NOT_FOUND;
289 }
290
291 SECURITY_STATUS
292 WINAPI
293 InitializeSecurityContextW (
294 PCredHandle phCred,
295 PCtxtHandle phContext,
296 SEC_WCHAR* pszTarget,
297 ULONG fContextReq,
298 ULONG Reserved,
299 ULONG TargetData,
300 PSecBufferDesc pInput,
301 ULONG Reserved2,
302 PCtxtHandle phNewContext,
303 PSecBufferDesc pOut,
304 PULONG pfContextAttributes,
305 PTimeStamp pExpires
306 )
307 {
308 UNIMPLEMENTED;
309 return ERROR_CALL_NOT_IMPLEMENTED;
310 }
311
312 SECURITY_STATUS
313 WINAPI
314 InitializeSecurityContextA (
315 PCredHandle phCred,
316 PCtxtHandle phContext,
317 SEC_CHAR* pszTarget,
318 ULONG fContextReq,
319 ULONG Reserved,
320 ULONG TargetData,
321 PSecBufferDesc pInput,
322 ULONG Reserved2,
323 PCtxtHandle phNewContext,
324 PSecBufferDesc pOut,
325 PULONG pfContextAttributes,
326 PTimeStamp pExpires
327 )
328 {
329 UNIMPLEMENTED;
330 return ERROR_CALL_NOT_IMPLEMENTED;
331 }
332
333
334 SECURITY_STATUS
335 SEC_ENTRY
336 MakeSignature(
337 PCtxtHandle phContext,
338 ULONG fQOP,
339 PSecBufferDesc pMessage,
340 ULONG MessageSeqNo
341 )
342 {
343 UNIMPLEMENTED;
344 return ERROR_CALL_NOT_IMPLEMENTED;
345 }
346
347
348 SECURITY_STATUS
349 SEC_ENTRY
350 VerifySignature(
351 PCtxtHandle phContext,
352 PSecBufferDesc pMessage,
353 ULONG MessageSeqNo,
354 PULONG pfQOP
355 )
356 {
357 UNIMPLEMENTED;
358 return ERROR_CALL_NOT_IMPLEMENTED;
359 }
360
361 SECURITY_STATUS
362 SEC_ENTRY
363 QuerySecurityPackageInfoA(
364 SEC_CHAR* pszPackageName,
365 PSecPkgInfoA* ppPackageInfo
366 )
367 {
368 UNIMPLEMENTED;
369
370 if (pszPackageName)
371 {
372 *ppPackageInfo = NULL;
373 return ERROR_CALL_NOT_IMPLEMENTED;
374 }
375 return SEC_E_SECPKG_NOT_FOUND;
376 }
377
378 SECURITY_STATUS
379 SEC_ENTRY
380 QuerySecurityPackageInfoW(
381 SEC_WCHAR* pszPackageName,
382 PSecPkgInfoW* ppPackageInfo
383 )
384 {
385 UNIMPLEMENTED;
386
387 if (pszPackageName)
388 {
389 *ppPackageInfo = NULL;
390 return ERROR_CALL_NOT_IMPLEMENTED;
391 }
392 return SEC_E_SECPKG_NOT_FOUND;
393 }
394
395 SECURITY_STATUS
396 WINAPI
397 AcceptSecurityContext(
398 PCredHandle phCredential,
399 PCtxtHandle phContext,
400 PSecBufferDesc pInput,
401 ULONG fContextReq,
402 ULONG TargetDataRep,
403 PCtxtHandle phNewContext,
404 PSecBufferDesc pOutput,
405 ULONG *pfContextAttr,
406 PTimeStamp ptsExpiry
407 )
408 {
409 UNIMPLEMENTED;
410 return ERROR_CALL_NOT_IMPLEMENTED;
411 }
412
413 SECURITY_STATUS
414 WINAPI
415 AddCredentialsA(
416 PCredHandle hCredentials,
417 SEC_CHAR *pszPrincipal,
418 SEC_CHAR *pszPackage,
419 ULONG fCredentialUse,
420 LPVOID pAuthData,
421 SEC_GET_KEY_FN pGetKeyFn,
422 LPVOID pvGetKeyArgument,
423 PTimeStamp ptsExpiry
424 )
425 {
426 UNIMPLEMENTED;
427 return ERROR_CALL_NOT_IMPLEMENTED;
428 }
429
430 SECURITY_STATUS
431 WINAPI
432 AddCredentialsW(
433 PCredHandle hCredentials,
434 SEC_WCHAR *pszPrincipal,
435 SEC_WCHAR *pszPackage,
436 ULONG fCredentialUse,
437 LPVOID pAuthData,
438 SEC_GET_KEY_FN pGetKeyFn,
439 LPVOID pvGetKeyArgument,
440 PTimeStamp ptsExpiry
441 )
442 {
443 UNIMPLEMENTED;
444 return ERROR_CALL_NOT_IMPLEMENTED;
445 }
446
447 SECURITY_STATUS
448 WINAPI
449 ExportSecurityContext(
450 PCtxtHandle phContext,
451 ULONG fFlags,
452 PSecBuffer pPackedContext,
453 LPVOID *pToken
454 )
455 {
456 UNIMPLEMENTED;
457 return ERROR_CALL_NOT_IMPLEMENTED;
458 }
459
460 SECURITY_STATUS
461 WINAPI
462 ImpersonateSecurityContext(
463 PCtxtHandle phContext
464 )
465 {
466 UNIMPLEMENTED;
467 return ERROR_CALL_NOT_IMPLEMENTED;
468 }
469
470 SECURITY_STATUS
471 WINAPI
472 ImportSecurityContextA(
473 SEC_CHAR *pszPackage,
474 PSecBuffer pPackedContext,
475 LPVOID Token,
476 PCtxtHandle phContext
477 )
478 {
479 UNIMPLEMENTED;
480 return ERROR_CALL_NOT_IMPLEMENTED;
481 }
482
483 SECURITY_STATUS
484 WINAPI
485 ImportSecurityContextW(
486 SEC_WCHAR *pszPackage,
487 PSecBuffer pPackedContext,
488 LPVOID Token,
489 PCtxtHandle phContext
490 )
491 {
492 UNIMPLEMENTED;
493 return ERROR_CALL_NOT_IMPLEMENTED;
494 }
495
496 SECURITY_STATUS
497 WINAPI
498 QueryCredentialsAttributesA(
499 PCredHandle phCredential,
500 ULONG ulAttribute,
501 LPVOID pBuffer
502 )
503 {
504 UNIMPLEMENTED;
505
506 if (phCredential)
507 {
508 pBuffer = NULL;
509 return ERROR_CALL_NOT_IMPLEMENTED;
510 }
511
512 return SEC_E_INVALID_HANDLE;
513 }
514
515 SECURITY_STATUS
516 WINAPI
517 QueryCredentialsAttributesW(
518 PCredHandle phCredential,
519 ULONG ulAttribute,
520 LPVOID pBuffer
521 )
522 {
523 UNIMPLEMENTED;
524
525 if (phCredential)
526 {
527 pBuffer = NULL;
528 return ERROR_CALL_NOT_IMPLEMENTED;
529 }
530
531 return SEC_E_INVALID_HANDLE;
532 }
533
534 SECURITY_STATUS
535 WINAPI
536 QuerySecurityContextToken(
537 PCtxtHandle phContext,
538 PHANDLE phToken
539 )
540 {
541 UNIMPLEMENTED;
542 return ERROR_CALL_NOT_IMPLEMENTED;
543 }
544
545 SECURITY_STATUS
546 WINAPI
547 RevertSecurityContext(
548 PCtxtHandle phContext
549 )
550 {
551 UNIMPLEMENTED;
552 return ERROR_CALL_NOT_IMPLEMENTED;
553 }
554
555 PSecurityFunctionTableA
556 WINAPI
557 InitSecurityInterfaceA(VOID)
558 {
559 DPRINT("InitSecurityInterfaceA() called\n");
560 return &securityFunctionTableA;
561 }
562
563 BOOLEAN
564 WINAPI
565 TranslateNameA(
566 LPCSTR lpAccountName,
567 EXTENDED_NAME_FORMAT AccountNameFormat,
568 EXTENDED_NAME_FORMAT DesiredNameFormat,
569 LPSTR lpTranslatedName,
570 PULONG nSize
571 )
572 {
573 UNIMPLEMENTED;
574 return FALSE;
575 }
576
577 BOOLEAN
578 WINAPI
579 TranslateNameW(
580 LPCWSTR lpAccountName,
581 EXTENDED_NAME_FORMAT AccountNameFormat,
582 EXTENDED_NAME_FORMAT DesiredNameFormat,
583 LPWSTR lpTranslatedName,
584 PULONG nSize
585 )
586 {
587 UNIMPLEMENTED;
588 return FALSE;
589 }