b5bf8aee5a103d56117e54e18febea375872a32e
[reactos.git] / reactos / dll / win32 / msv1_0 / msv1_0.c
1 /*
2 * PROJECT: Authentication Package DLL
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: dll/win32/msv1_0/msv1_0.c
5 * PURPOSE: Main file
6 * COPYRIGHT: Copyright 2013 Eric Kohl
7 */
8
9 /* INCLUDES ****************************************************************/
10
11 #include "msv1_0.h"
12
13 WINE_DEFAULT_DEBUG_CHANNEL(msv1_0);
14
15
16 /* GLOBALS *****************************************************************/
17
18 LSA_DISPATCH_TABLE DispatchTable;
19
20
21 /* FUNCTIONS ***************************************************************/
22
23 static
24 NTSTATUS
25 GetDomainSid(PRPC_SID *Sid)
26 {
27 LSAPR_HANDLE PolicyHandle = NULL;
28 PLSAPR_POLICY_INFORMATION PolicyInfo = NULL;
29 ULONG Length = 0;
30 NTSTATUS Status;
31
32 Status = LsaIOpenPolicyTrusted(&PolicyHandle);
33 if (!NT_SUCCESS(Status))
34 {
35 TRACE("LsaIOpenPolicyTrusted() failed (Status 0x%08lx)\n", Status);
36 return Status;
37 }
38
39 Status = LsarQueryInformationPolicy(PolicyHandle,
40 PolicyAccountDomainInformation,
41 &PolicyInfo);
42 if (!NT_SUCCESS(Status))
43 {
44 TRACE("LsarQueryInformationPolicy() failed (Status 0x%08lx)\n", Status);
45 goto done;
46 }
47
48 Length = RtlLengthSid(PolicyInfo->PolicyAccountDomainInfo.Sid);
49
50 *Sid = RtlAllocateHeap(RtlGetProcessHeap(), 0, Length);
51 if (*Sid == NULL)
52 {
53 ERR("Failed to allocate SID\n");
54 Status = STATUS_INSUFFICIENT_RESOURCES;
55 goto done;
56 }
57
58 memcpy(*Sid, PolicyInfo->PolicyAccountDomainInfo.Sid, Length);
59
60 done:
61 if (PolicyInfo != NULL)
62 LsaIFree_LSAPR_POLICY_INFORMATION(PolicyAccountDomainInformation,
63 PolicyInfo);
64
65 if (PolicyHandle != NULL)
66 LsarClose(&PolicyHandle);
67
68 return Status;
69 }
70
71
72 static
73 NTSTATUS
74 BuildInteractiveProfileBuffer(IN PLSA_CLIENT_REQUEST ClientRequest,
75 IN PSAMPR_USER_INFO_BUFFER UserInfo,
76 IN PUNICODE_STRING LogonServer,
77 OUT PMSV1_0_INTERACTIVE_PROFILE *ProfileBuffer,
78 OUT PULONG ProfileBufferLength)
79 {
80 PMSV1_0_INTERACTIVE_PROFILE LocalBuffer = NULL;
81 PVOID ClientBaseAddress = NULL;
82 LPWSTR Ptr;
83 ULONG BufferLength;
84 NTSTATUS Status = STATUS_SUCCESS;
85
86 *ProfileBuffer = NULL;
87 *ProfileBufferLength = 0;
88
89 BufferLength = sizeof(MSV1_0_INTERACTIVE_PROFILE) +
90 UserInfo->All.FullName.Length + sizeof(WCHAR) +
91 UserInfo->All.HomeDirectory.Length + sizeof(WCHAR) +
92 UserInfo->All.HomeDirectoryDrive.Length + sizeof(WCHAR) +
93 UserInfo->All.ScriptPath.Length + sizeof(WCHAR) +
94 UserInfo->All.ProfilePath.Length + sizeof(WCHAR) +
95 LogonServer->Length + sizeof(WCHAR);
96
97 LocalBuffer = DispatchTable.AllocateLsaHeap(BufferLength);
98 if (LocalBuffer == NULL)
99 {
100 TRACE("Failed to allocate the local buffer!\n");
101 Status = STATUS_INSUFFICIENT_RESOURCES;
102 goto done;
103 }
104
105 Status = DispatchTable.AllocateClientBuffer(ClientRequest,
106 BufferLength,
107 &ClientBaseAddress);
108 if (!NT_SUCCESS(Status))
109 {
110 TRACE("DispatchTable.AllocateClientBuffer failed (Status 0x%08lx)\n", Status);
111 goto done;
112 }
113
114 TRACE("ClientBaseAddress: %p\n", ClientBaseAddress);
115
116 Ptr = (LPWSTR)((ULONG_PTR)LocalBuffer + sizeof(MSV1_0_INTERACTIVE_PROFILE));
117
118 LocalBuffer->MessageType = MsV1_0InteractiveProfile;
119 LocalBuffer->LogonCount = UserInfo->All.LogonCount;
120 LocalBuffer->BadPasswordCount = UserInfo->All.BadPasswordCount;
121
122 LocalBuffer->LogonTime.LowPart = UserInfo->All.LastLogon.LowPart;
123 LocalBuffer->LogonTime.HighPart = UserInfo->All.LastLogon.HighPart;
124
125 // LocalBuffer->LogoffTime.LowPart =
126 // LocalBuffer->LogoffTime.HighPart =
127
128 // LocalBuffer->KickOffTime.LowPart =
129 // LocalBuffer->KickOffTime.HighPart =
130
131 LocalBuffer->PasswordLastSet.LowPart = UserInfo->All.PasswordLastSet.LowPart;
132 LocalBuffer->PasswordLastSet.HighPart = UserInfo->All.PasswordLastSet.HighPart;
133
134 LocalBuffer->PasswordCanChange.LowPart = UserInfo->All.PasswordCanChange.LowPart;
135 LocalBuffer->PasswordCanChange.HighPart = UserInfo->All.PasswordCanChange.HighPart;
136
137 LocalBuffer->PasswordMustChange.LowPart = UserInfo->All.PasswordMustChange.LowPart;
138 LocalBuffer->PasswordMustChange.HighPart = UserInfo->All.PasswordMustChange.HighPart;
139
140 LocalBuffer->LogonScript.Length = UserInfo->All.ScriptPath.Length;
141 LocalBuffer->LogonScript.MaximumLength = UserInfo->All.ScriptPath.Length + sizeof(WCHAR);
142 LocalBuffer->LogonScript.Buffer = (LPWSTR)((ULONG_PTR)ClientBaseAddress + (ULONG_PTR)Ptr - (ULONG_PTR)LocalBuffer);
143 memcpy(Ptr,
144 UserInfo->All.ScriptPath.Buffer,
145 UserInfo->All.ScriptPath.Length);
146
147 Ptr = (LPWSTR)((ULONG_PTR)Ptr + LocalBuffer->LogonScript.MaximumLength);
148
149 LocalBuffer->HomeDirectory.Length = UserInfo->All.HomeDirectory.Length;
150 LocalBuffer->HomeDirectory.MaximumLength = UserInfo->All.HomeDirectory.Length + sizeof(WCHAR);
151 LocalBuffer->HomeDirectory.Buffer = (LPWSTR)((ULONG_PTR)ClientBaseAddress + (ULONG_PTR)Ptr - (ULONG_PTR)LocalBuffer);
152 memcpy(Ptr,
153 UserInfo->All.HomeDirectory.Buffer,
154 UserInfo->All.HomeDirectory.Length);
155
156 Ptr = (LPWSTR)((ULONG_PTR)Ptr + LocalBuffer->HomeDirectory.MaximumLength);
157
158 LocalBuffer->FullName.Length = UserInfo->All.FullName.Length;
159 LocalBuffer->FullName.MaximumLength = UserInfo->All.FullName.Length + sizeof(WCHAR);
160 LocalBuffer->FullName.Buffer = (LPWSTR)((ULONG_PTR)ClientBaseAddress + (ULONG_PTR)Ptr - (ULONG_PTR)LocalBuffer);
161 memcpy(Ptr,
162 UserInfo->All.FullName.Buffer,
163 UserInfo->All.FullName.Length);
164 TRACE("FullName.Buffer: %p\n", LocalBuffer->FullName.Buffer);
165
166 Ptr = (LPWSTR)((ULONG_PTR)Ptr + LocalBuffer->FullName.MaximumLength);
167
168 LocalBuffer->ProfilePath.Length = UserInfo->All.ProfilePath.Length;
169 LocalBuffer->ProfilePath.MaximumLength = UserInfo->All.ProfilePath.Length + sizeof(WCHAR);
170 LocalBuffer->ProfilePath.Buffer = (LPWSTR)((ULONG_PTR)ClientBaseAddress + (ULONG_PTR)Ptr - (ULONG_PTR)LocalBuffer);
171 memcpy(Ptr,
172 UserInfo->All.ProfilePath.Buffer,
173 UserInfo->All.ProfilePath.Length);
174
175 Ptr = (LPWSTR)((ULONG_PTR)Ptr + LocalBuffer->ProfilePath.MaximumLength);
176
177 LocalBuffer->HomeDirectoryDrive.Length = UserInfo->All.HomeDirectoryDrive.Length;
178 LocalBuffer->HomeDirectoryDrive.MaximumLength = UserInfo->All.HomeDirectoryDrive.Length + sizeof(WCHAR);
179 LocalBuffer->HomeDirectoryDrive.Buffer = (LPWSTR)((ULONG_PTR)ClientBaseAddress + (ULONG_PTR)Ptr - (ULONG_PTR)LocalBuffer);
180 memcpy(Ptr,
181 UserInfo->All.HomeDirectoryDrive.Buffer,
182 UserInfo->All.HomeDirectoryDrive.Length);
183
184 Ptr = (LPWSTR)((ULONG_PTR)Ptr + LocalBuffer->HomeDirectoryDrive.MaximumLength);
185
186 LocalBuffer->LogonServer.Length = LogonServer->Length;
187 LocalBuffer->LogonServer.MaximumLength = LogonServer->Length + sizeof(WCHAR);
188 LocalBuffer->LogonServer.Buffer = (LPWSTR)((ULONG_PTR)ClientBaseAddress + (ULONG_PTR)Ptr - (ULONG_PTR)LocalBuffer);;
189 memcpy(Ptr,
190 LogonServer->Buffer,
191 LogonServer->Length);
192
193 LocalBuffer->UserFlags = 0;
194
195 Status = DispatchTable.CopyToClientBuffer(ClientRequest,
196 BufferLength,
197 ClientBaseAddress,
198 LocalBuffer);
199 if (!NT_SUCCESS(Status))
200 {
201 TRACE("DispatchTable.CopyToClientBuffer failed (Status 0x%08lx)\n", Status);
202 goto done;
203 }
204
205 *ProfileBuffer = (PMSV1_0_INTERACTIVE_PROFILE)ClientBaseAddress;
206 *ProfileBufferLength = BufferLength;
207
208 done:
209 if (LocalBuffer != NULL)
210 DispatchTable.FreeLsaHeap(LocalBuffer);
211
212 if (!NT_SUCCESS(Status))
213 {
214 if (ClientBaseAddress != NULL)
215 DispatchTable.FreeClientBuffer(ClientRequest,
216 ClientBaseAddress);
217 }
218
219 return Status;
220 }
221
222
223 static
224 PSID
225 AppendRidToSid(PSID SrcSid,
226 ULONG Rid)
227 {
228 PSID DstSid = NULL;
229 UCHAR RidCount;
230
231 RidCount = *RtlSubAuthorityCountSid(SrcSid);
232 if (RidCount >= 8)
233 return NULL;
234
235 DstSid = DispatchTable.AllocateLsaHeap(RtlLengthRequiredSid(RidCount + 1));
236 if (DstSid == NULL)
237 return NULL;
238
239 RtlCopyMemory(DstSid,
240 SrcSid,
241 RtlLengthRequiredSid(RidCount));
242
243 *RtlSubAuthorityCountSid(DstSid) = RidCount + 1;
244 *RtlSubAuthoritySid(DstSid, RidCount) = Rid;
245
246 return DstSid;
247 }
248
249 static
250 NTSTATUS
251 BuildTokenUser(OUT PTOKEN_USER User,
252 IN PSID AccountDomainSid,
253 IN ULONG RelativeId)
254 {
255 User->User.Sid = AppendRidToSid(AccountDomainSid,
256 RelativeId);
257 if (User->User.Sid == NULL)
258 {
259 ERR("Could not create the user SID\n");
260 return STATUS_UNSUCCESSFUL;
261 }
262
263 User->User.Attributes = 0;
264
265 return STATUS_SUCCESS;
266 }
267
268
269 static
270 NTSTATUS
271 BuildTokenGroups(IN PSID AccountDomainSid,
272 IN PLUID LogonId,
273 OUT PTOKEN_GROUPS *Groups,
274 OUT PSID *PrimaryGroupSid,
275 OUT PSID *OwnerSid)
276 {
277 SID_IDENTIFIER_AUTHORITY WorldAuthority = {SECURITY_WORLD_SID_AUTHORITY};
278 SID_IDENTIFIER_AUTHORITY LocalAuthority = {SECURITY_LOCAL_SID_AUTHORITY};
279 SID_IDENTIFIER_AUTHORITY SystemAuthority = {SECURITY_NT_AUTHORITY};
280 PTOKEN_GROUPS TokenGroups;
281 #define MAX_GROUPS 8
282 DWORD GroupCount = 0;
283 PSID Sid;
284 NTSTATUS Status = STATUS_SUCCESS;
285
286 TokenGroups = DispatchTable.AllocateLsaHeap(sizeof(TOKEN_GROUPS) +
287 MAX_GROUPS * sizeof(SID_AND_ATTRIBUTES));
288 if (TokenGroups == NULL)
289 {
290 return STATUS_INSUFFICIENT_RESOURCES;
291 }
292
293 Sid = AppendRidToSid(AccountDomainSid, DOMAIN_GROUP_RID_USERS);
294 if (Sid == NULL)
295 {
296
297 }
298
299 /* Member of the domain */
300 TokenGroups->Groups[GroupCount].Sid = Sid;
301 TokenGroups->Groups[GroupCount].Attributes =
302 SE_GROUP_ENABLED | SE_GROUP_ENABLED_BY_DEFAULT | SE_GROUP_MANDATORY;
303 *PrimaryGroupSid = Sid;
304 GroupCount++;
305
306 /* Member of 'Everyone' */
307 RtlAllocateAndInitializeSid(&WorldAuthority,
308 1,
309 SECURITY_WORLD_RID,
310 SECURITY_NULL_RID,
311 SECURITY_NULL_RID,
312 SECURITY_NULL_RID,
313 SECURITY_NULL_RID,
314 SECURITY_NULL_RID,
315 SECURITY_NULL_RID,
316 SECURITY_NULL_RID,
317 &Sid);
318 TokenGroups->Groups[GroupCount].Sid = Sid;
319 TokenGroups->Groups[GroupCount].Attributes =
320 SE_GROUP_ENABLED | SE_GROUP_ENABLED_BY_DEFAULT | SE_GROUP_MANDATORY;
321 GroupCount++;
322
323 #if 1
324 /* Member of 'Administrators' */
325 RtlAllocateAndInitializeSid(&SystemAuthority,
326 2,
327 SECURITY_BUILTIN_DOMAIN_RID,
328 DOMAIN_ALIAS_RID_ADMINS,
329 SECURITY_NULL_RID,
330 SECURITY_NULL_RID,
331 SECURITY_NULL_RID,
332 SECURITY_NULL_RID,
333 SECURITY_NULL_RID,
334 SECURITY_NULL_RID,
335 &Sid);
336 TokenGroups->Groups[GroupCount].Sid = Sid;
337 TokenGroups->Groups[GroupCount].Attributes =
338 SE_GROUP_ENABLED | SE_GROUP_ENABLED_BY_DEFAULT | SE_GROUP_MANDATORY;
339 GroupCount++;
340 #else
341 TRACE("Not adding user to Administrators group\n");
342 #endif
343
344 /* Member of 'Users' */
345 RtlAllocateAndInitializeSid(&SystemAuthority,
346 2,
347 SECURITY_BUILTIN_DOMAIN_RID,
348 DOMAIN_ALIAS_RID_USERS,
349 SECURITY_NULL_RID,
350 SECURITY_NULL_RID,
351 SECURITY_NULL_RID,
352 SECURITY_NULL_RID,
353 SECURITY_NULL_RID,
354 SECURITY_NULL_RID,
355 &Sid);
356 TokenGroups->Groups[GroupCount].Sid = Sid;
357 TokenGroups->Groups[GroupCount].Attributes =
358 SE_GROUP_ENABLED | SE_GROUP_ENABLED_BY_DEFAULT | SE_GROUP_MANDATORY;
359 GroupCount++;
360
361 /* Logon SID */
362 RtlAllocateAndInitializeSid(&SystemAuthority,
363 SECURITY_LOGON_IDS_RID_COUNT,
364 SECURITY_LOGON_IDS_RID,
365 LogonId->HighPart,
366 LogonId->LowPart,
367 SECURITY_NULL_RID,
368 SECURITY_NULL_RID,
369 SECURITY_NULL_RID,
370 SECURITY_NULL_RID,
371 SECURITY_NULL_RID,
372 &Sid);
373 TokenGroups->Groups[GroupCount].Sid = Sid;
374 TokenGroups->Groups[GroupCount].Attributes =
375 SE_GROUP_ENABLED | SE_GROUP_ENABLED_BY_DEFAULT | SE_GROUP_MANDATORY | SE_GROUP_LOGON_ID;
376 GroupCount++;
377 *OwnerSid = Sid;
378
379 /* Member of 'Local users */
380 RtlAllocateAndInitializeSid(&LocalAuthority,
381 1,
382 SECURITY_LOCAL_RID,
383 SECURITY_NULL_RID,
384 SECURITY_NULL_RID,
385 SECURITY_NULL_RID,
386 SECURITY_NULL_RID,
387 SECURITY_NULL_RID,
388 SECURITY_NULL_RID,
389 SECURITY_NULL_RID,
390 &Sid);
391 TokenGroups->Groups[GroupCount].Sid = Sid;
392 TokenGroups->Groups[GroupCount].Attributes =
393 SE_GROUP_ENABLED | SE_GROUP_ENABLED_BY_DEFAULT | SE_GROUP_MANDATORY;
394 GroupCount++;
395
396 /* Member of 'Interactive users' */
397 RtlAllocateAndInitializeSid(&SystemAuthority,
398 1,
399 SECURITY_INTERACTIVE_RID,
400 SECURITY_NULL_RID,
401 SECURITY_NULL_RID,
402 SECURITY_NULL_RID,
403 SECURITY_NULL_RID,
404 SECURITY_NULL_RID,
405 SECURITY_NULL_RID,
406 SECURITY_NULL_RID,
407 &Sid);
408 TokenGroups->Groups[GroupCount].Sid = Sid;
409 TokenGroups->Groups[GroupCount].Attributes =
410 SE_GROUP_ENABLED | SE_GROUP_ENABLED_BY_DEFAULT | SE_GROUP_MANDATORY;
411 GroupCount++;
412
413 /* Member of 'Authenticated users' */
414 RtlAllocateAndInitializeSid(&SystemAuthority,
415 1,
416 SECURITY_AUTHENTICATED_USER_RID,
417 SECURITY_NULL_RID,
418 SECURITY_NULL_RID,
419 SECURITY_NULL_RID,
420 SECURITY_NULL_RID,
421 SECURITY_NULL_RID,
422 SECURITY_NULL_RID,
423 SECURITY_NULL_RID,
424 &Sid);
425 TokenGroups->Groups[GroupCount].Sid = Sid;
426 TokenGroups->Groups[GroupCount].Attributes =
427 SE_GROUP_ENABLED | SE_GROUP_ENABLED_BY_DEFAULT | SE_GROUP_MANDATORY;
428 GroupCount++;
429
430 TokenGroups->GroupCount = GroupCount;
431 ASSERT(TokenGroups->GroupCount <= MAX_GROUPS);
432
433 *Groups = TokenGroups;
434
435 return Status;
436 }
437
438
439 static
440 NTSTATUS
441 BuildTokenPrimaryGroup(PTOKEN_PRIMARY_GROUP PrimaryGroup,
442 PSID PrimaryGroupSid)
443 {
444 ULONG RidCount;
445 ULONG Size;
446
447 RidCount = *RtlSubAuthorityCountSid(PrimaryGroupSid);
448 Size = RtlLengthRequiredSid(RidCount);
449
450 PrimaryGroup->PrimaryGroup = DispatchTable.AllocateLsaHeap(Size);
451 if (PrimaryGroup->PrimaryGroup == NULL)
452 {
453 return STATUS_INSUFFICIENT_RESOURCES;
454 }
455
456 RtlCopyMemory(PrimaryGroup->PrimaryGroup,
457 PrimaryGroupSid,
458 Size);
459
460 return STATUS_SUCCESS;
461 }
462
463 static
464 NTSTATUS
465 BuildTokenPrivileges(PTOKEN_PRIVILEGES *TokenPrivileges)
466 {
467 /* FIXME shouldn't use hard-coded list of privileges */
468 static struct
469 {
470 LPCWSTR PrivName;
471 DWORD Attributes;
472 }
473 DefaultPrivs[] =
474 {
475 { L"SeMachineAccountPrivilege", 0 },
476 { L"SeSecurityPrivilege", 0 },
477 { L"SeTakeOwnershipPrivilege", 0 },
478 { L"SeLoadDriverPrivilege", 0 },
479 { L"SeSystemProfilePrivilege", 0 },
480 { L"SeSystemtimePrivilege", 0 },
481 { L"SeProfileSingleProcessPrivilege", 0 },
482 { L"SeIncreaseBasePriorityPrivilege", 0 },
483 { L"SeCreatePagefilePrivilege", 0 },
484 { L"SeBackupPrivilege", 0 },
485 { L"SeRestorePrivilege", 0 },
486 { L"SeShutdownPrivilege", 0 },
487 { L"SeDebugPrivilege", 0 },
488 { L"SeSystemEnvironmentPrivilege", 0 },
489 { L"SeChangeNotifyPrivilege", SE_PRIVILEGE_ENABLED | SE_PRIVILEGE_ENABLED_BY_DEFAULT },
490 { L"SeRemoteShutdownPrivilege", 0 },
491 { L"SeUndockPrivilege", 0 },
492 { L"SeEnableDelegationPrivilege", 0 },
493 { L"SeImpersonatePrivilege", SE_PRIVILEGE_ENABLED | SE_PRIVILEGE_ENABLED_BY_DEFAULT },
494 { L"SeCreateGlobalPrivilege", SE_PRIVILEGE_ENABLED | SE_PRIVILEGE_ENABLED_BY_DEFAULT }
495 };
496 PTOKEN_PRIVILEGES Privileges = NULL;
497 ULONG i;
498 RPC_UNICODE_STRING PrivilegeName;
499 LSAPR_HANDLE PolicyHandle = NULL;
500 NTSTATUS Status = STATUS_SUCCESS;
501
502 Status = LsaIOpenPolicyTrusted(&PolicyHandle);
503 if (!NT_SUCCESS(Status))
504 {
505 goto done;
506 }
507
508 /* Allocate and initialize token privileges */
509 Privileges = DispatchTable.AllocateLsaHeap(sizeof(TOKEN_PRIVILEGES) +
510 sizeof(DefaultPrivs) / sizeof(DefaultPrivs[0]) *
511 sizeof(LUID_AND_ATTRIBUTES));
512 if (Privileges == NULL)
513 {
514 Status = STATUS_INSUFFICIENT_RESOURCES;
515 goto done;
516 }
517
518 Privileges->PrivilegeCount = 0;
519 for (i = 0; i < sizeof(DefaultPrivs) / sizeof(DefaultPrivs[0]); i++)
520 {
521 PrivilegeName.Length = wcslen(DefaultPrivs[i].PrivName) * sizeof(WCHAR);
522 PrivilegeName.MaximumLength = PrivilegeName.Length + sizeof(WCHAR);
523 PrivilegeName.Buffer = (LPWSTR)DefaultPrivs[i].PrivName;
524
525 Status = LsarLookupPrivilegeValue(PolicyHandle,
526 &PrivilegeName,
527 &Privileges->Privileges[Privileges->PrivilegeCount].Luid);
528 if (!NT_SUCCESS(Status))
529 {
530 WARN("Can't set privilege %S\n", DefaultPrivs[i].PrivName);
531 }
532 else
533 {
534 Privileges->Privileges[Privileges->PrivilegeCount].Attributes = DefaultPrivs[i].Attributes;
535 Privileges->PrivilegeCount++;
536 }
537 }
538
539 *TokenPrivileges = Privileges;
540
541 done:
542 if (PolicyHandle != NULL)
543 LsarClose(PolicyHandle);
544
545 return Status;
546 }
547
548
549 static
550 NTSTATUS
551 BuildTokenOwner(PTOKEN_OWNER Owner,
552 PSID OwnerSid)
553 {
554 ULONG RidCount;
555 ULONG Size;
556
557 RidCount = *RtlSubAuthorityCountSid(OwnerSid);
558 Size = RtlLengthRequiredSid(RidCount);
559
560 Owner->Owner = DispatchTable.AllocateLsaHeap(Size);
561 if (Owner->Owner == NULL)
562 {
563 return STATUS_INSUFFICIENT_RESOURCES;
564 }
565
566 RtlCopyMemory(Owner->Owner,
567 OwnerSid,
568 Size);
569
570 return STATUS_SUCCESS;
571 }
572
573
574 static
575 NTSTATUS
576 BuildTokenDefaultDacl(PTOKEN_DEFAULT_DACL DefaultDacl,
577 PSID OwnerSid)
578 {
579 SID_IDENTIFIER_AUTHORITY SystemAuthority = {SECURITY_NT_AUTHORITY};
580 PSID LocalSystemSid = NULL;
581 PACL Dacl = NULL;
582 NTSTATUS Status = STATUS_SUCCESS;
583
584 RtlAllocateAndInitializeSid(&SystemAuthority,
585 1,
586 SECURITY_LOCAL_SYSTEM_RID,
587 SECURITY_NULL_RID,
588 SECURITY_NULL_RID,
589 SECURITY_NULL_RID,
590 SECURITY_NULL_RID,
591 SECURITY_NULL_RID,
592 SECURITY_NULL_RID,
593 SECURITY_NULL_RID,
594 &LocalSystemSid);
595
596 Dacl = DispatchTable.AllocateLsaHeap(1024);
597 if (Dacl == NULL)
598 {
599 Status = STATUS_INSUFFICIENT_RESOURCES;
600 goto done;
601 }
602
603 Status = RtlCreateAcl(Dacl, 1024, ACL_REVISION);
604 if (!NT_SUCCESS(Status))
605 goto done;
606
607 RtlAddAccessAllowedAce(Dacl,
608 ACL_REVISION,
609 GENERIC_ALL,
610 OwnerSid);
611
612 /* SID: S-1-5-18 */
613 RtlAddAccessAllowedAce(Dacl,
614 ACL_REVISION,
615 GENERIC_ALL,
616 LocalSystemSid);
617
618 DefaultDacl->DefaultDacl = Dacl;
619
620 done:
621 if (!NT_SUCCESS(Status))
622 {
623 if (Dacl != NULL)
624 DispatchTable.FreeLsaHeap(Dacl);
625 }
626
627 if (LocalSystemSid != NULL)
628 RtlFreeSid(LocalSystemSid);
629
630 return Status;
631 }
632
633
634 static
635 NTSTATUS
636 BuildTokenInformationBuffer(PLSA_TOKEN_INFORMATION_V1 *TokenInformation,
637 PRPC_SID AccountDomainSid,
638 ULONG RelativeId,
639 PLUID LogonId)
640 {
641 PLSA_TOKEN_INFORMATION_V1 Buffer = NULL;
642 PSID OwnerSid = NULL;
643 PSID PrimaryGroupSid = NULL;
644 ULONG i;
645 NTSTATUS Status = STATUS_SUCCESS;
646
647 Buffer = DispatchTable.AllocateLsaHeap(sizeof(LSA_TOKEN_INFORMATION_V1));
648 if (Buffer == NULL)
649 {
650 TRACE("Failed to allocate the local buffer!\n");
651 Status = STATUS_INSUFFICIENT_RESOURCES;
652 goto done;
653 }
654
655 /* FIXME: */
656 Buffer->ExpirationTime.QuadPart = -1;
657
658 Status = BuildTokenUser(&Buffer->User,
659 (PSID)AccountDomainSid,
660 RelativeId);
661 if (!NT_SUCCESS(Status))
662 goto done;
663
664 Status = BuildTokenGroups((PSID)AccountDomainSid,
665 LogonId,
666 &Buffer->Groups,
667 &PrimaryGroupSid,
668 &OwnerSid);
669 if (!NT_SUCCESS(Status))
670 goto done;
671
672 Status = BuildTokenPrimaryGroup(&Buffer->PrimaryGroup,
673 PrimaryGroupSid);
674 if (!NT_SUCCESS(Status))
675 goto done;
676
677 Status = BuildTokenPrivileges(&Buffer->Privileges);
678 if (!NT_SUCCESS(Status))
679 goto done;
680
681 Status = BuildTokenOwner(&Buffer->Owner,
682 OwnerSid);
683 if (!NT_SUCCESS(Status))
684 goto done;
685
686 Status = BuildTokenDefaultDacl(&Buffer->DefaultDacl,
687 OwnerSid);
688 if (!NT_SUCCESS(Status))
689 goto done;
690
691 *TokenInformation = Buffer;
692
693 done:
694 if (!NT_SUCCESS(Status))
695 {
696 if (Buffer != NULL)
697 {
698 if (Buffer->User.User.Sid != NULL)
699 DispatchTable.FreeLsaHeap(Buffer->User.User.Sid);
700
701 if (Buffer->Groups != NULL)
702 {
703 for (i = 0; i < Buffer->Groups->GroupCount; i++)
704 {
705 if (Buffer->Groups->Groups[i].Sid != NULL)
706 DispatchTable.FreeLsaHeap(Buffer->Groups->Groups[i].Sid);
707 }
708
709 DispatchTable.FreeLsaHeap(Buffer->Groups);
710 }
711
712 if (Buffer->PrimaryGroup.PrimaryGroup != NULL)
713 DispatchTable.FreeLsaHeap(Buffer->PrimaryGroup.PrimaryGroup);
714
715 if (Buffer->Privileges != NULL)
716 DispatchTable.FreeLsaHeap(Buffer->Privileges);
717
718 if (Buffer->Owner.Owner != NULL)
719 DispatchTable.FreeLsaHeap(Buffer->Owner.Owner);
720
721 if (Buffer->DefaultDacl.DefaultDacl != NULL)
722 DispatchTable.FreeLsaHeap(Buffer->DefaultDacl.DefaultDacl);
723
724 DispatchTable.FreeLsaHeap(Buffer);
725 }
726 }
727
728 return Status;
729 }
730
731
732 static
733 NTSTATUS
734 ChangePassword(IN PLSA_CLIENT_REQUEST ClientRequest,
735 IN PVOID ProtocolSubmitBuffer,
736 IN PVOID ClientBufferBase,
737 IN ULONG SubmitBufferLength,
738 OUT PVOID *ProtocolReturnBuffer,
739 OUT PULONG ReturnBufferLength,
740 OUT PNTSTATUS ProtocolStatus)
741 {
742 PMSV1_0_CHANGEPASSWORD_REQUEST RequestBuffer;
743 ULONG_PTR PtrOffset;
744
745 TRACE("()\n");
746
747 RequestBuffer = (PMSV1_0_CHANGEPASSWORD_REQUEST)ProtocolSubmitBuffer;
748
749 /* Fix-up pointers in the request buffer info */
750 PtrOffset = (ULONG_PTR)ProtocolSubmitBuffer - (ULONG_PTR)ClientBufferBase;
751
752 RequestBuffer->DomainName.Buffer = (PWSTR)((ULONG_PTR)RequestBuffer->DomainName.Buffer + PtrOffset);
753 RequestBuffer->AccountName.Buffer = (PWSTR)((ULONG_PTR)RequestBuffer->AccountName.Buffer + PtrOffset);
754 RequestBuffer->OldPassword.Buffer = (PWSTR)((ULONG_PTR)RequestBuffer->OldPassword.Buffer + PtrOffset);
755 RequestBuffer->NewPassword.Buffer = (PWSTR)((ULONG_PTR)RequestBuffer->NewPassword.Buffer + PtrOffset);
756
757 TRACE("Domain: %S\n", RequestBuffer->DomainName.Buffer);
758 TRACE("Account: %S\n", RequestBuffer->AccountName.Buffer);
759 TRACE("Old Password: %S\n", RequestBuffer->OldPassword.Buffer);
760 TRACE("New Password: %S\n", RequestBuffer->NewPassword.Buffer);
761
762
763 return STATUS_SUCCESS;
764 }
765
766
767 /*
768 * @unimplemented
769 */
770 NTSTATUS
771 NTAPI
772 LsaApCallPackage(IN PLSA_CLIENT_REQUEST ClientRequest,
773 IN PVOID ProtocolSubmitBuffer,
774 IN PVOID ClientBufferBase,
775 IN ULONG SubmitBufferLength,
776 OUT PVOID *ProtocolReturnBuffer,
777 OUT PULONG ReturnBufferLength,
778 OUT PNTSTATUS ProtocolStatus)
779 {
780 ULONG MessageType;
781 NTSTATUS Status;
782
783 TRACE("()\n");
784
785 if (SubmitBufferLength < sizeof(MSV1_0_PROTOCOL_MESSAGE_TYPE))
786 return STATUS_INVALID_PARAMETER;
787
788 MessageType = (ULONG)*((PMSV1_0_PROTOCOL_MESSAGE_TYPE)ProtocolSubmitBuffer);
789
790 *ProtocolReturnBuffer = NULL;
791 *ReturnBufferLength = 0;
792
793 switch (MessageType)
794 {
795 case MsV1_0Lm20ChallengeRequest:
796 case MsV1_0Lm20GetChallengeResponse:
797 case MsV1_0EnumerateUsers:
798 case MsV1_0GetUserInfo:
799 case MsV1_0ReLogonUsers:
800 Status = STATUS_NOT_IMPLEMENTED;
801 break;
802
803 case MsV1_0ChangePassword:
804 Status = ChangePassword(ClientRequest,
805 ProtocolSubmitBuffer,
806 ClientBufferBase,
807 SubmitBufferLength,
808 ProtocolReturnBuffer,
809 ReturnBufferLength,
810 ProtocolStatus);
811 break;
812
813 case MsV1_0ChangeCachedPassword:
814 case MsV1_0GenericPassthrough:
815 case MsV1_0CacheLogon:
816 case MsV1_0SubAuth:
817 case MsV1_0DeriveCredential:
818 case MsV1_0CacheLookup:
819 Status = STATUS_NOT_IMPLEMENTED;
820 break;
821
822 default:
823 return STATUS_INVALID_PARAMETER;
824 }
825
826 return Status;
827 }
828
829
830 /*
831 * @unimplemented
832 */
833 NTSTATUS
834 NTAPI
835 LsaApCallPackagePassthrough(IN PLSA_CLIENT_REQUEST ClientRequest,
836 IN PVOID ProtocolSubmitBuffer,
837 IN PVOID ClientBufferBase,
838 IN ULONG SubmitBufferLength,
839 OUT PVOID *ProtocolReturnBuffer,
840 OUT PULONG ReturnBufferLength,
841 OUT PNTSTATUS ProtocolStatus)
842 {
843 TRACE("()\n");
844 return STATUS_NOT_IMPLEMENTED;
845 }
846
847
848 /*
849 * @unimplemented
850 */
851 NTSTATUS
852 NTAPI
853 LsaApCallPackageUntrusted(IN PLSA_CLIENT_REQUEST ClientRequest,
854 IN PVOID ProtocolSubmitBuffer,
855 IN PVOID ClientBufferBase,
856 IN ULONG SubmitBufferLength,
857 OUT PVOID *ProtocolReturnBuffer,
858 OUT PULONG ReturnBufferLength,
859 OUT PNTSTATUS ProtocolStatus)
860 {
861 TRACE("()\n");
862 return STATUS_NOT_IMPLEMENTED;
863 }
864
865
866 /*
867 * @unimplemented
868 */
869 NTSTATUS
870 NTAPI
871 LsaApInitializePackage(IN ULONG AuthenticationPackageId,
872 IN PLSA_DISPATCH_TABLE LsaDispatchTable,
873 IN PLSA_STRING Database OPTIONAL,
874 IN PLSA_STRING Confidentiality OPTIONAL,
875 OUT PLSA_STRING *AuthenticationPackageName)
876 {
877 PANSI_STRING NameString;
878 PCHAR NameBuffer;
879
880 TRACE("(%lu %p %p %p %p)\n",
881 AuthenticationPackageId, LsaDispatchTable, Database,
882 Confidentiality, AuthenticationPackageName);
883
884 /* Get the dispatch table entries */
885 DispatchTable.CreateLogonSession = LsaDispatchTable->CreateLogonSession;
886 DispatchTable.DeleteLogonSession = LsaDispatchTable->DeleteLogonSession;
887 DispatchTable.AddCredential = LsaDispatchTable->AddCredential;
888 DispatchTable.GetCredentials = LsaDispatchTable->GetCredentials;
889 DispatchTable.DeleteCredential = LsaDispatchTable->DeleteCredential;
890 DispatchTable.AllocateLsaHeap = LsaDispatchTable->AllocateLsaHeap;
891 DispatchTable.FreeLsaHeap = LsaDispatchTable->FreeLsaHeap;
892 DispatchTable.AllocateClientBuffer = LsaDispatchTable->AllocateClientBuffer;
893 DispatchTable.FreeClientBuffer = LsaDispatchTable->FreeClientBuffer;
894 DispatchTable.CopyToClientBuffer = LsaDispatchTable->CopyToClientBuffer;
895 DispatchTable.CopyFromClientBuffer = LsaDispatchTable->CopyFromClientBuffer;
896
897 /* Return the package name */
898 NameString = DispatchTable.AllocateLsaHeap(sizeof(LSA_STRING));
899 if (NameString == NULL)
900 return STATUS_INSUFFICIENT_RESOURCES;
901
902 NameBuffer = DispatchTable.AllocateLsaHeap(sizeof(MSV1_0_PACKAGE_NAME));
903 if (NameBuffer == NULL)
904 {
905 DispatchTable.FreeLsaHeap(NameString);
906 return STATUS_INSUFFICIENT_RESOURCES;
907 }
908
909 strcpy(NameBuffer, MSV1_0_PACKAGE_NAME);
910
911 RtlInitAnsiString(NameString, NameBuffer);
912
913 *AuthenticationPackageName = (PLSA_STRING)NameString;
914
915 return STATUS_SUCCESS;
916 }
917
918
919 /*
920 * @unimplemented
921 */
922 VOID
923 NTAPI
924 LsaApLogonTerminated(IN PLUID LogonId)
925 {
926 TRACE("()\n");
927 }
928
929
930 /*
931 * @unimplemented
932 */
933 NTSTATUS
934 NTAPI
935 LsaApLogonUser(IN PLSA_CLIENT_REQUEST ClientRequest,
936 IN SECURITY_LOGON_TYPE LogonType,
937 IN PVOID AuthenticationInformation,
938 IN PVOID ClientAuthenticationBase,
939 IN ULONG AuthenticationInformationLength,
940 OUT PVOID *ProfileBuffer,
941 OUT PULONG ProfileBufferLength,
942 OUT PLUID LogonId,
943 OUT PNTSTATUS SubStatus,
944 OUT PLSA_TOKEN_INFORMATION_TYPE TokenInformationType,
945 OUT PVOID *TokenInformation,
946 OUT PLSA_UNICODE_STRING *AccountName,
947 OUT PLSA_UNICODE_STRING *AuthenticatingAuthority)
948 {
949 PMSV1_0_INTERACTIVE_LOGON LogonInfo;
950
951 SAMPR_HANDLE ServerHandle = NULL;
952 SAMPR_HANDLE DomainHandle = NULL;
953 SAMPR_HANDLE UserHandle = NULL;
954 PRPC_SID AccountDomainSid = NULL;
955 RPC_UNICODE_STRING Names[1];
956 SAMPR_ULONG_ARRAY RelativeIds = {0, NULL};
957 SAMPR_ULONG_ARRAY Use = {0, NULL};
958 PSAMPR_USER_INFO_BUFFER UserInfo = NULL;
959 UNICODE_STRING LogonServer;
960 BOOLEAN SessionCreated = FALSE;
961 NTSTATUS Status;
962
963 TRACE("()\n");
964
965 TRACE("LogonType: %lu\n", LogonType);
966 TRACE("AuthenticationInformation: %p\n", AuthenticationInformation);
967 TRACE("AuthenticationInformationLength: %lu\n", AuthenticationInformationLength);
968
969 *ProfileBuffer = NULL;
970 *ProfileBufferLength = 0;
971 *SubStatus = STATUS_SUCCESS;
972
973 if (LogonType == Interactive ||
974 LogonType == Batch ||
975 LogonType == Service)
976 {
977 ULONG_PTR PtrOffset;
978
979 LogonInfo = (PMSV1_0_INTERACTIVE_LOGON)AuthenticationInformation;
980
981 /* Fix-up pointers in the authentication info */
982 PtrOffset = (ULONG_PTR)AuthenticationInformation - (ULONG_PTR)ClientAuthenticationBase;
983
984 LogonInfo->LogonDomainName.Buffer = FIXUP_POINTER(LogonInfo->LogonDomainName.Buffer, PtrOffset);
985 LogonInfo->UserName.Buffer = FIXUP_POINTER(LogonInfo->UserName.Buffer, PtrOffset);
986 LogonInfo->Password.Buffer = FIXUP_POINTER(LogonInfo->Password.Buffer, PtrOffset);
987
988 TRACE("Domain: %S\n", LogonInfo->LogonDomainName.Buffer);
989 TRACE("User: %S\n", LogonInfo->UserName.Buffer);
990 TRACE("Password: %S\n", LogonInfo->Password.Buffer);
991
992 RtlInitUnicodeString(&LogonServer, L"Testserver");
993 }
994 else
995 {
996 FIXME("LogonType %lu is not supported yet!\n", LogonType);
997 return STATUS_NOT_IMPLEMENTED;
998 }
999
1000 Status = GetDomainSid(&AccountDomainSid);
1001 if (!NT_SUCCESS(Status))
1002 {
1003 TRACE("GetDomainSid() failed (Status 0x%08lx)\n", Status);
1004 return Status;
1005 }
1006
1007 /* Connect to the SAM server */
1008 Status = SamIConnect(NULL,
1009 &ServerHandle,
1010 SAM_SERVER_CONNECT | SAM_SERVER_LOOKUP_DOMAIN,
1011 TRUE);
1012 if (!NT_SUCCESS(Status))
1013 {
1014 TRACE("SamIConnect() failed (Status 0x%08lx)\n", Status);
1015 goto done;
1016 }
1017
1018 /* Open the account domain */
1019 Status = SamrOpenDomain(ServerHandle,
1020 DOMAIN_LOOKUP,
1021 AccountDomainSid,
1022 &DomainHandle);
1023 if (!NT_SUCCESS(Status))
1024 {
1025 TRACE("SamrOpenDomain failed (Status %08lx)\n", Status);
1026 goto done;
1027 }
1028
1029 Names[0].Length = LogonInfo->UserName.Length;
1030 Names[0].MaximumLength = LogonInfo->UserName.MaximumLength;
1031 Names[0].Buffer = LogonInfo->UserName.Buffer;
1032
1033 /* Try to get the RID for the user name */
1034 Status = SamrLookupNamesInDomain(DomainHandle,
1035 1,
1036 Names,
1037 &RelativeIds,
1038 &Use);
1039 if (!NT_SUCCESS(Status))
1040 {
1041 TRACE("SamrLookupNamesInDomain failed (Status %08lx)\n", Status);
1042 Status = STATUS_NO_SUCH_USER;
1043 goto done;
1044 }
1045
1046 /* Fail, if it is not a user account */
1047 if (Use.Element[0] != SidTypeUser)
1048 {
1049 TRACE("Account is not a user account!\n");
1050 Status = STATUS_NO_SUCH_USER;
1051 goto done;
1052 }
1053
1054 /* Open the user object */
1055 Status = SamrOpenUser(DomainHandle,
1056 USER_READ_GENERAL | USER_READ_LOGON |
1057 USER_READ_ACCOUNT | USER_READ_PREFERENCES, /* FIXME */
1058 RelativeIds.Element[0],
1059 &UserHandle);
1060 if (!NT_SUCCESS(Status))
1061 {
1062 TRACE("SamrOpenUser failed (Status %08lx)\n", Status);
1063 goto done;
1064 }
1065
1066 Status = SamrQueryInformationUser(UserHandle,
1067 UserAllInformation,
1068 &UserInfo);
1069 if (!NT_SUCCESS(Status))
1070 {
1071 TRACE("SamrQueryInformationUser failed (Status %08lx)\n", Status);
1072 goto done;
1073 }
1074
1075
1076 TRACE("UserName: %S\n", UserInfo->All.UserName.Buffer);
1077
1078 /* FIXME: Check restrictions */
1079
1080 /* FIXME: Check the password */
1081 if ((UserInfo->All.UserAccountControl & USER_PASSWORD_NOT_REQUIRED) == 0)
1082 {
1083 FIXME("Must check the password!\n");
1084
1085 }
1086
1087 /* Return logon information */
1088
1089 /* Create and return a new logon id */
1090 Status = NtAllocateLocallyUniqueId(LogonId);
1091 if (!NT_SUCCESS(Status))
1092 {
1093 TRACE("NtAllocateLocallyUniqueId failed (Status %08lx)\n", Status);
1094 goto done;
1095 }
1096
1097 /* Create the logon session */
1098 Status = DispatchTable.CreateLogonSession(LogonId);
1099 if (!NT_SUCCESS(Status))
1100 {
1101 TRACE("CreateLogonSession failed (Status %08lx)\n", Status);
1102 goto done;
1103 }
1104
1105 SessionCreated = TRUE;
1106
1107 /* Build and fill the interactve profile buffer */
1108 Status = BuildInteractiveProfileBuffer(ClientRequest,
1109 UserInfo,
1110 &LogonServer,
1111 (PMSV1_0_INTERACTIVE_PROFILE*)ProfileBuffer,
1112 ProfileBufferLength);
1113 if (!NT_SUCCESS(Status))
1114 {
1115 TRACE("BuildInteractiveProfileBuffer failed (Status %08lx)\n", Status);
1116 goto done;
1117 }
1118
1119 /* Return the token information type */
1120 *TokenInformationType = LsaTokenInformationV1;
1121
1122 /* Build and fill the token information buffer */
1123 Status = BuildTokenInformationBuffer((PLSA_TOKEN_INFORMATION_V1*)TokenInformation,
1124 AccountDomainSid,
1125 RelativeIds.Element[0],
1126 LogonId);
1127 if (!NT_SUCCESS(Status))
1128 {
1129 TRACE("BuildTokenInformationBuffer failed (Status %08lx)\n", Status);
1130 goto done;
1131 }
1132
1133 *SubStatus = STATUS_SUCCESS;
1134
1135 done:
1136 /* Return the account name */
1137 *AccountName = DispatchTable.AllocateLsaHeap(sizeof(UNICODE_STRING));
1138 if (*AccountName != NULL)
1139 {
1140 (*AccountName)->Buffer = DispatchTable.AllocateLsaHeap(LogonInfo->UserName.Length +
1141 sizeof(UNICODE_NULL));
1142 if ((*AccountName)->Buffer != NULL)
1143 {
1144 (*AccountName)->MaximumLength = LogonInfo->UserName.Length +
1145 sizeof(UNICODE_NULL);
1146 RtlCopyUnicodeString(*AccountName, &LogonInfo->UserName);
1147 }
1148 }
1149
1150 if (!NT_SUCCESS(Status))
1151 {
1152 if (SessionCreated == TRUE)
1153 DispatchTable.DeleteLogonSession(LogonId);
1154
1155 if (*ProfileBuffer != NULL)
1156 {
1157 DispatchTable.FreeClientBuffer(ClientRequest,
1158 *ProfileBuffer);
1159 *ProfileBuffer = NULL;
1160 }
1161 }
1162
1163 if (UserHandle != NULL)
1164 SamrCloseHandle(&UserHandle);
1165
1166 SamIFree_SAMPR_USER_INFO_BUFFER(UserInfo,
1167 UserAllInformation);
1168 SamIFree_SAMPR_ULONG_ARRAY(&RelativeIds);
1169 SamIFree_SAMPR_ULONG_ARRAY(&Use);
1170
1171 if (DomainHandle != NULL)
1172 SamrCloseHandle(&DomainHandle);
1173
1174 if (ServerHandle != NULL)
1175 SamrCloseHandle(&ServerHandle);
1176
1177 if (AccountDomainSid != NULL)
1178 RtlFreeHeap(RtlGetProcessHeap(), 0, AccountDomainSid);
1179
1180 TRACE("LsaApLogonUser done (Status %08lx)\n", Status);
1181
1182 return Status;
1183 }
1184
1185
1186 /*
1187 * @unimplemented
1188 */
1189 #if 0
1190 NTSTATUS
1191 NTAPI
1192 LsaApLogonUserEx(IN PLSA_CLIENT_REQUEST ClientRequest,
1193 IN SECURITY_LOGON_TYPE LogonType,
1194 IN PVOID AuthenticationInformation,
1195 IN PVOID ClientAuthenticationBase,
1196 IN ULONG AuthenticationInformationLength,
1197 OUT PVOID *ProfileBuffer,
1198 OUT PULONG ProfileBufferLength,
1199 OUT PLUID LogonId,
1200 OUT PNTSTATUS SubStatus,
1201 OUT PLSA_TOKEN_INFORMATION_TYPE TokenInformationType,
1202 OUT PVOID *TokenInformation,
1203 OUT PUNICODE_STRING *AccountName,
1204 OUT PUNICODE_STRING *AuthenticatingAuthority,
1205 OUT PUNICODE_STRING *MachineName)
1206 {
1207 TRACE("()\n");
1208
1209 TRACE("LogonType: %lu\n", LogonType);
1210 TRACE("AuthenticationInformation: %p\n", AuthenticationInformation);
1211 TRACE("AuthenticationInformationLength: %lu\n", AuthenticationInformationLength);
1212
1213 return STATUS_NOT_IMPLEMENTED;
1214 }
1215
1216
1217 /*
1218 * @unimplemented
1219 */
1220 NTSTATUS
1221 NTAPI
1222 LsaApLogonUserEx2(IN PLSA_CLIENT_REQUEST ClientRequest,
1223 IN SECURITY_LOGON_TYPE LogonType,
1224 IN PVOID ProtocolSubmitBuffer,
1225 IN PVOID ClientBufferBase,
1226 IN ULONG SubmitBufferSize,
1227 OUT PVOID *ProfileBuffer,
1228 OUT PULONG ProfileBufferSize,
1229 OUT PLUID LogonId,
1230 OUT PNTSTATUS SubStatus,
1231 OUT PLSA_TOKEN_INFORMATION_TYPE TokenInformationType,
1232 OUT PVOID *TokenInformation,
1233 OUT PUNICODE_STRING *AccountName,
1234 OUT PUNICODE_STRING *AuthenticatingAuthority,
1235 OUT PUNICODE_STRING *MachineName,
1236 OUT PSECPKG_PRIMARY_CRED PrimaryCredentials,
1237 OUT PSECPKG_SUPPLEMENTAL_CRED_ARRAY *SupplementalCredentials)
1238 {
1239 TRACE("()\n");
1240
1241 TRACE("LogonType: %lu\n", LogonType);
1242 TRACE("ProtocolSubmitBuffer: %p\n", ProtocolSubmitBuffer);
1243 TRACE("SubmitBufferSize: %lu\n", SubmitBufferSize);
1244
1245
1246 return STATUS_NOT_IMPLEMENTED;
1247 }
1248 #endif
1249
1250 /* EOF */