ReactOS  0.4.13-dev-73-gcfe54aa
policy.c
Go to the documentation of this file.
1 /*
2  * PROJECT: Local Security Authority Server DLL
3  * LICENSE: GPL - See COPYING in the top level directory
4  * FILE: dll/win32/lsasrv/policy.c
5  * PURPOSE: Policy object routines
6  * COPYRIGHT: Copyright 2011 Eric Kohl
7  */
8 
9 #include "lsasrv.h"
10 
11 /* FUNCTIONS ***************************************************************/
12 
14 WINAPI
16 {
17  PLSA_DB_OBJECT PolicyObject;
19 
20  TRACE("(%p)\n", PolicyHandle);
21 
23  NULL,
24  L"Policy",
27  TRUE,
28  &PolicyObject);
29 
30  if (NT_SUCCESS(Status))
31  *PolicyHandle = (LSAPR_HANDLE)PolicyObject;
32 
33  return Status;
34 }
35 
36 
39  PLSAPR_POLICY_INFORMATION *PolicyInformation)
40 {
41  PPOLICY_AUDIT_LOG_INFO AuditLogInfo = NULL;
42  ULONG AttributeSize;
44 
45  *PolicyInformation = NULL;
46 
47  AttributeSize = sizeof(POLICY_AUDIT_LOG_INFO);
48  AuditLogInfo = MIDL_user_allocate(AttributeSize);
49  if (AuditLogInfo == NULL)
51 
52  Status = LsapGetObjectAttribute(PolicyObject,
53  L"PolAdtLg",
54  AuditLogInfo,
55  &AttributeSize);
56  if (!NT_SUCCESS(Status))
57  {
58  MIDL_user_free(AuditLogInfo);
59  }
60  else
61  {
62  *PolicyInformation = (PLSAPR_POLICY_INFORMATION)AuditLogInfo;
63  }
64 
65  return Status;
66 }
67 
68 
71  PLSAPR_POLICY_INFORMATION *PolicyInformation)
72 {
75  ULONG AttributeSize;
77 
78  *PolicyInformation = NULL;
79 
80  AttributeSize = 0;
81  Status = LsapGetObjectAttribute(PolicyObject,
82  L"PolAdtEv",
83  NULL,
84  &AttributeSize);
85  if (!NT_SUCCESS(Status))
86  return Status;
87 
88  TRACE("Attribute size: %lu\n", AttributeSize);
89  if (AttributeSize > 0)
90  {
91  AuditData = MIDL_user_allocate(AttributeSize);
92  if (AuditData == NULL)
94 
95  Status = LsapGetObjectAttribute(PolicyObject,
96  L"PolAdtEv",
97  AuditData,
98  &AttributeSize);
99  if (!NT_SUCCESS(Status))
100  goto done;
101  }
102 
104  if (p == NULL)
105  {
107  goto done;
108  }
109 
110  if (AuditData == NULL)
111  {
112  p->AuditingMode = FALSE;
113  p->MaximumAuditEventCount = 0;
114  p->EventAuditingOptions = NULL;
115  }
116  else
117  {
118  p->AuditingMode = AuditData->AuditingMode;
119  p->MaximumAuditEventCount = AuditData->MaximumAuditEventCount;
120 
121  p->EventAuditingOptions = MIDL_user_allocate(AuditData->MaximumAuditEventCount * sizeof(DWORD));
122  if (p->EventAuditingOptions == NULL)
123  {
125  goto done;
126  }
127 
128  memcpy(p->EventAuditingOptions,
129  &(AuditData->AuditEvents[0]),
130  AuditData->MaximumAuditEventCount * sizeof(DWORD));
131  }
132 
133  *PolicyInformation = (PLSAPR_POLICY_INFORMATION)p;
134 
135 done:
136  TRACE("Status: 0x%lx\n", Status);
137 
138  if (!NT_SUCCESS(Status))
139  {
140  if (p != NULL)
141  {
142  if (p->EventAuditingOptions != NULL)
143  MIDL_user_free(p->EventAuditingOptions);
144 
145  MIDL_user_free(p);
146  }
147  }
148 
149  if (AuditData != NULL)
150  MIDL_user_free(AuditData);
151 
152  return Status;
153 }
154 
155 
156 NTSTATUS
158  PLSAPR_POLICY_INFORMATION *PolicyInformation)
159 {
161  PUNICODE_STRING DomainName;
162  ULONG AttributeSize;
164 
165  *PolicyInformation = NULL;
166 
168  if (p == NULL)
170 
171  /* Domain Name */
172  AttributeSize = 0;
173  Status = LsapGetObjectAttribute(PolicyObject,
174  L"PolPrDmN",
175  NULL,
176  &AttributeSize);
177  if (!NT_SUCCESS(Status))
178  {
179  goto Done;
180  }
181 
182  if (AttributeSize > 0)
183  {
184  DomainName = MIDL_user_allocate(AttributeSize);
185  if (DomainName == NULL)
186  {
188  goto Done;
189  }
190 
191  Status = LsapGetObjectAttribute(PolicyObject,
192  L"PolPrDmN",
193  DomainName,
194  &AttributeSize);
195  if (Status == STATUS_SUCCESS)
196  {
197  DomainName->Buffer = (LPWSTR)((ULONG_PTR)DomainName + (ULONG_PTR)DomainName->Buffer);
198 
199  TRACE("PrimaryDomainName: %wZ\n", DomainName);
200 
201  p->Name.Buffer = MIDL_user_allocate(DomainName->MaximumLength);
202  if (p->Name.Buffer == NULL)
203  {
204  MIDL_user_free(DomainName);
206  goto Done;
207  }
208 
209  p->Name.Length = DomainName->Length;
210  p->Name.MaximumLength = DomainName->MaximumLength;
211  memcpy(p->Name.Buffer,
212  DomainName->Buffer,
213  DomainName->MaximumLength);
214  }
215 
216  MIDL_user_free(DomainName);
217  }
218 
219  /* Domain SID */
220  AttributeSize = 0;
221  Status = LsapGetObjectAttribute(PolicyObject,
222  L"PolPrDmS",
223  NULL,
224  &AttributeSize);
225  if (!NT_SUCCESS(Status))
226  {
227  goto Done;
228  }
229 
230  if (AttributeSize > 0)
231  {
232  p->Sid = MIDL_user_allocate(AttributeSize);
233  if (p->Sid == NULL)
234  {
236  goto Done;
237  }
238 
239  Status = LsapGetObjectAttribute(PolicyObject,
240  L"PolPrDmS",
241  p->Sid,
242  &AttributeSize);
243  }
244 
245  *PolicyInformation = (PLSAPR_POLICY_INFORMATION)p;
246 
247 Done:
248  if (!NT_SUCCESS(Status))
249  {
250  if (p != NULL)
251  {
252  if (p->Name.Buffer)
253  MIDL_user_free(p->Name.Buffer);
254 
255  if (p->Sid)
256  MIDL_user_free(p->Sid);
257 
258  MIDL_user_free(p);
259  }
260  }
261 
262  return Status;
263 }
264 
265 
266 NTSTATUS
268  PLSAPR_POLICY_INFORMATION *PolicyInformation)
269 {
270  PLSAPR_POLICY_PD_ACCOUNT_INFO PdAccountInfo = NULL;
271 
272  *PolicyInformation = NULL;
273 
274  PdAccountInfo = MIDL_user_allocate(sizeof(LSAPR_POLICY_PD_ACCOUNT_INFO));
275  if (PdAccountInfo == NULL)
277 
278  PdAccountInfo->Name.Length = 0;
279  PdAccountInfo->Name.MaximumLength = 0;
280  PdAccountInfo->Name.Buffer = NULL;
281 
282  *PolicyInformation = (PLSAPR_POLICY_INFORMATION)PdAccountInfo;
283 
284  return STATUS_SUCCESS;
285 }
286 
287 
288 NTSTATUS
290  PLSAPR_POLICY_INFORMATION *PolicyInformation)
291 {
293  PUNICODE_STRING DomainName;
294  ULONG AttributeSize = 0;
296 
297  *PolicyInformation = NULL;
298 
300  if (p == NULL)
302 
303  /* Domain Name */
304  Status = LsapGetObjectAttribute(PolicyObject,
305  L"PolAcDmN",
306  NULL,
307  &AttributeSize);
308  if (!NT_SUCCESS(Status))
309  {
310  goto Done;
311  }
312 
313  if (AttributeSize > 0)
314  {
315  DomainName = MIDL_user_allocate(AttributeSize);
316  if (DomainName == NULL)
317  {
319  goto Done;
320  }
321 
322  Status = LsapGetObjectAttribute(PolicyObject,
323  L"PolAcDmN",
324  DomainName,
325  &AttributeSize);
326  if (Status == STATUS_SUCCESS)
327  {
328  DomainName->Buffer = (LPWSTR)((ULONG_PTR)DomainName + (ULONG_PTR)DomainName->Buffer);
329 
330  TRACE("AccountDomainName: %wZ\n", DomainName);
331 
332  p->DomainName.Buffer = MIDL_user_allocate(DomainName->MaximumLength);
333  if (p->DomainName.Buffer == NULL)
334  {
335  MIDL_user_free(DomainName);
337  goto Done;
338  }
339 
340  p->DomainName.Length = DomainName->Length;
341  p->DomainName.MaximumLength = DomainName->MaximumLength;
342  memcpy(p->DomainName.Buffer,
343  DomainName->Buffer,
344  DomainName->MaximumLength);
345  }
346 
347  MIDL_user_free(DomainName);
348  }
349 
350  /* Domain SID */
351  AttributeSize = 0;
352  Status = LsapGetObjectAttribute(PolicyObject,
353  L"PolAcDmS",
354  NULL,
355  &AttributeSize);
356  if (!NT_SUCCESS(Status))
357  {
358  goto Done;
359  }
360 
361  if (AttributeSize > 0)
362  {
363  p->Sid = MIDL_user_allocate(AttributeSize);
364  if (p->Sid == NULL)
365  {
367  goto Done;
368  }
369 
370  Status = LsapGetObjectAttribute(PolicyObject,
371  L"PolAcDmS",
372  p->Sid,
373  &AttributeSize);
374  }
375 
376  *PolicyInformation = (PLSAPR_POLICY_INFORMATION)p;
377 
378 Done:
379  if (!NT_SUCCESS(Status))
380  {
381  if (p)
382  {
383  if (p->DomainName.Buffer)
384  MIDL_user_free(p->DomainName.Buffer);
385 
386  if (p->Sid)
387  MIDL_user_free(p->Sid);
388 
389  MIDL_user_free(p);
390  }
391  }
392 
393  return Status;
394 }
395 
396 
397 NTSTATUS
399  PLSAPR_POLICY_INFORMATION *PolicyInformation)
400 {
401  PPOLICY_LSA_SERVER_ROLE_INFO ServerRoleInfo = NULL;
402  ULONG AttributeSize;
404 
405  *PolicyInformation = NULL;
406 
407  AttributeSize = sizeof(POLICY_LSA_SERVER_ROLE_INFO);
408  ServerRoleInfo = MIDL_user_allocate(AttributeSize);
409  if (ServerRoleInfo == NULL)
411 
412  Status = LsapGetObjectAttribute(PolicyObject,
413  L"PolSrvRo",
414  ServerRoleInfo,
415  &AttributeSize);
417  {
418  ServerRoleInfo->LsaServerRole = PolicyServerRolePrimary;
420  }
421 
422  if (!NT_SUCCESS(Status))
423  {
424  MIDL_user_free(ServerRoleInfo);
425  }
426  else
427  {
428  *PolicyInformation = (PLSAPR_POLICY_INFORMATION)ServerRoleInfo;
429  }
430 
431  return Status;
432 }
433 
434 
435 NTSTATUS
437  PLSAPR_POLICY_INFORMATION *PolicyInformation)
438 {
439  FIXME("\n");
440  *PolicyInformation = NULL;
441  return STATUS_NOT_IMPLEMENTED;
442 }
443 
444 
445 NTSTATUS
447  PLSAPR_POLICY_INFORMATION *PolicyInformation)
448 {
449  PPOLICY_DEFAULT_QUOTA_INFO QuotaInfo = NULL;
450  ULONG AttributeSize;
452 
453  *PolicyInformation = NULL;
454 
455  AttributeSize = sizeof(POLICY_DEFAULT_QUOTA_INFO);
456  QuotaInfo = MIDL_user_allocate(AttributeSize);
457  if (QuotaInfo == NULL)
459 
460  Status = LsapGetObjectAttribute(PolicyObject,
461  L"DefQuota",
462  QuotaInfo,
463  &AttributeSize);
464  if (!NT_SUCCESS(Status))
465  {
466  MIDL_user_free(QuotaInfo);
467  }
468  else
469  {
470  *PolicyInformation = (PLSAPR_POLICY_INFORMATION)QuotaInfo;
471  }
472 
473  return Status;
474 }
475 
476 
477 NTSTATUS
479  PLSAPR_POLICY_INFORMATION *PolicyInformation)
480 {
482  ULONG AttributeSize;
484 
485  *PolicyInformation = NULL;
486 
487  AttributeSize = sizeof(POLICY_MODIFICATION_INFO);
488  Info = MIDL_user_allocate(AttributeSize);
489  if (Info == NULL)
491 
492  Status = LsapGetObjectAttribute(PolicyObject,
493  L"PolMod",
494  Info,
495  &AttributeSize);
496  if (!NT_SUCCESS(Status))
497  {
499  }
500  else
501  {
502  *PolicyInformation = (PLSAPR_POLICY_INFORMATION)Info;
503  }
504 
505  return Status;
506 }
507 
508 
509 NTSTATUS
511  PLSAPR_POLICY_INFORMATION *PolicyInformation)
512 {
513  PPOLICY_AUDIT_FULL_QUERY_INFO AuditFullInfo = NULL;
514  ULONG AttributeSize;
516 
517  *PolicyInformation = NULL;
518 
519  AttributeSize = sizeof(POLICY_AUDIT_FULL_QUERY_INFO);
520  AuditFullInfo = MIDL_user_allocate(AttributeSize);
521  if (AuditFullInfo == NULL)
523 
524  Status = LsapGetObjectAttribute(PolicyObject,
525  L"PolAdtFl",
526  AuditFullInfo,
527  &AttributeSize);
528  if (!NT_SUCCESS(Status))
529  {
530  MIDL_user_free(AuditFullInfo);
531  }
532  else
533  {
534  *PolicyInformation = (PLSAPR_POLICY_INFORMATION)AuditFullInfo;
535  }
536 
537  return Status;
538 }
539 
540 
541 NTSTATUS
543  PLSAPR_POLICY_INFORMATION *PolicyInformation)
544 {
546  PUNICODE_STRING DomainName;
547  ULONG AttributeSize;
549 
550  *PolicyInformation = NULL;
551 
553  if (p == NULL)
555 
556  /* Primary Domain Name */
557  AttributeSize = 0;
558  Status = LsapGetObjectAttribute(PolicyObject,
559  L"PolPrDmN",
560  NULL,
561  &AttributeSize);
562  if (!NT_SUCCESS(Status))
563  {
564  goto done;
565  }
566 
567  if (AttributeSize > 0)
568  {
569  DomainName = MIDL_user_allocate(AttributeSize);
570  if (DomainName == NULL)
571  {
573  goto done;
574  }
575 
576  Status = LsapGetObjectAttribute(PolicyObject,
577  L"PolPrDmN",
578  DomainName,
579  &AttributeSize);
580  if (Status == STATUS_SUCCESS)
581  {
582  DomainName->Buffer = (LPWSTR)((ULONG_PTR)DomainName + (ULONG_PTR)DomainName->Buffer);
583 
584  TRACE("PrimaryDomainName: %wZ\n", DomainName);
585 
586  p->Name.Buffer = MIDL_user_allocate(DomainName->MaximumLength);
587  if (p->Name.Buffer == NULL)
588  {
589  MIDL_user_free(DomainName);
591  goto done;
592  }
593 
594  p->Name.Length = DomainName->Length;
595  p->Name.MaximumLength = DomainName->MaximumLength;
596  memcpy(p->Name.Buffer,
597  DomainName->Buffer,
598  DomainName->MaximumLength);
599  }
600 
601  MIDL_user_free(DomainName);
602  }
603 
604  /* Primary Domain SID */
605  AttributeSize = 0;
606  Status = LsapGetObjectAttribute(PolicyObject,
607  L"PolPrDmS",
608  NULL,
609  &AttributeSize);
610  if (!NT_SUCCESS(Status))
611  {
612  goto done;
613  }
614 
615  if (AttributeSize > 0)
616  {
617  p->Sid = MIDL_user_allocate(AttributeSize);
618  if (p->Sid == NULL)
619  {
621  goto done;
622  }
623 
624  Status = LsapGetObjectAttribute(PolicyObject,
625  L"PolPrDmS",
626  p->Sid,
627  &AttributeSize);
628  }
629 
630  /* DNS Domain Name */
631  AttributeSize = 0;
632  Status = LsapGetObjectAttribute(PolicyObject,
633  L"PolDnDDN",
634  NULL,
635  &AttributeSize);
636  if (!NT_SUCCESS(Status))
637  goto done;
638 
639  if (AttributeSize > 0)
640  {
641  DomainName = MIDL_user_allocate(AttributeSize);
642  if (DomainName == NULL)
643  {
645  goto done;
646  }
647 
648  Status = LsapGetObjectAttribute(PolicyObject,
649  L"PolDnDDN",
650  DomainName,
651  &AttributeSize);
652  if (Status == STATUS_SUCCESS)
653  {
654  DomainName->Buffer = (LPWSTR)((ULONG_PTR)DomainName + (ULONG_PTR)DomainName->Buffer);
655 
656  TRACE("DNS Domain Name: %wZ\n", DomainName);
657 
658  p->DnsDomainName.Buffer = MIDL_user_allocate(DomainName->MaximumLength);
659  if (p->DnsDomainName.Buffer == NULL)
660  {
661  MIDL_user_free(DomainName);
663  goto done;
664  }
665 
666  p->DnsDomainName.Length = DomainName->Length;
667  p->DnsDomainName.MaximumLength = DomainName->MaximumLength;
668  memcpy(p->DnsDomainName.Buffer,
669  DomainName->Buffer,
670  DomainName->MaximumLength);
671  }
672 
673  MIDL_user_free(DomainName);
674  }
675 
676  /* DNS Forest Name */
677  AttributeSize = 0;
678  Status = LsapGetObjectAttribute(PolicyObject,
679  L"PolDnTrN",
680  NULL,
681  &AttributeSize);
682  if (!NT_SUCCESS(Status))
683  goto done;
684 
685  if (AttributeSize > 0)
686  {
687  DomainName = MIDL_user_allocate(AttributeSize);
688  if (DomainName == NULL)
689  {
691  goto done;
692  }
693 
694  Status = LsapGetObjectAttribute(PolicyObject,
695  L"PolDnTrN",
696  DomainName,
697  &AttributeSize);
698  if (Status == STATUS_SUCCESS)
699  {
700  DomainName->Buffer = (LPWSTR)((ULONG_PTR)DomainName + (ULONG_PTR)DomainName->Buffer);
701 
702  TRACE("DNS Forest Name: %wZ\n", DomainName);
703 
704  p->DnsForestName.Buffer = MIDL_user_allocate(DomainName->MaximumLength);
705  if (p->DnsForestName.Buffer == NULL)
706  {
707  MIDL_user_free(DomainName);
709  goto done;
710  }
711 
712  p->DnsForestName.Length = DomainName->Length;
713  p->DnsForestName.MaximumLength = DomainName->MaximumLength;
714  memcpy(p->DnsForestName.Buffer,
715  DomainName->Buffer,
716  DomainName->MaximumLength);
717  }
718 
719  MIDL_user_free(DomainName);
720  }
721 
722  /* DNS Domain GUID */
723  AttributeSize = sizeof(GUID);
724  Status = LsapGetObjectAttribute(PolicyObject,
725  L"PolDnDmG",
726  &(p->DomainGuid),
727  &AttributeSize);
728  if (!NT_SUCCESS(Status))
729  goto done;
730 
731  *PolicyInformation = (PLSAPR_POLICY_INFORMATION)p;
732 
733 done:
734  if (!NT_SUCCESS(Status))
735  {
736  if (p)
737  {
738  if (p->Name.Buffer)
739  MIDL_user_free(p->Name.Buffer);
740 
741  if (p->DnsDomainName.Buffer)
742  MIDL_user_free(p->DnsDomainName.Buffer);
743 
744  if (p->DnsForestName.Buffer)
745  MIDL_user_free(p->DnsForestName.Buffer);
746 
747  if (p->Sid)
748  MIDL_user_free(p->Sid);
749 
750  MIDL_user_free(p);
751  }
752  }
753 
754  return Status;
755 }
756 
757 
758 NTSTATUS
760  PLSAPR_POLICY_INFORMATION *PolicyInformation)
761 {
762  FIXME("\n");
763  *PolicyInformation = NULL;
764  return STATUS_NOT_IMPLEMENTED;
765 }
766 
767 
768 NTSTATUS
770  PLSAPR_POLICY_INFORMATION *PolicyInformation)
771 {
772  FIXME("\n");
773  *PolicyInformation = NULL;
774  return STATUS_NOT_IMPLEMENTED;
775 }
776 
777 
778 NTSTATUS
781 {
782  TRACE("(%p %p)\n", PolicyObject, Info);
783 
784  return LsapSetObjectAttribute(PolicyObject,
785  L"PolAdtLg",
786  Info,
787  sizeof(POLICY_AUDIT_LOG_INFO));
788 }
789 
790 
791 NTSTATUS
794 {
796  ULONG AttributeSize;
798 
799  TRACE("(%p %p)\n", PolicyObject, Info);
800 
801  AttributeSize = sizeof(LSAP_POLICY_AUDIT_EVENTS_DATA) +
802  Info->MaximumAuditEventCount * sizeof(DWORD);
803 
804  AuditData = RtlAllocateHeap(RtlGetProcessHeap(),
806  AttributeSize);
807  if (AuditData == NULL)
809 
810  AuditData->AuditingMode = Info->AuditingMode;
811  AuditData->MaximumAuditEventCount = Info->MaximumAuditEventCount;
812 
813  memcpy(&(AuditData->AuditEvents[0]),
814  Info->EventAuditingOptions,
815  Info->MaximumAuditEventCount * sizeof(DWORD));
816 
817  Status = LsapSetObjectAttribute(PolicyObject,
818  L"PolAdtEv",
819  AuditData,
820  AttributeSize);
821 
822  RtlFreeHeap(RtlGetProcessHeap(), 0, AuditData);
823 
824  return Status;
825 }
826 
827 
828 NTSTATUS
831 {
833  ULONG Length = 0;
835  LPWSTR Ptr;
836 
837  TRACE("(%p %p)\n", PolicyObject, Info);
838 
839  Length = sizeof(UNICODE_STRING) + Info->Name.MaximumLength;
840  Buffer = RtlAllocateHeap(RtlGetProcessHeap(),
841  0,
842  Length);
843  if (Buffer == NULL)
845 
846  Buffer->Length = Info->Name.Length;
847  Buffer->MaximumLength = Info->Name.MaximumLength;
848  Buffer->Buffer = (LPWSTR)sizeof(UNICODE_STRING);
849  Ptr = (LPWSTR)((ULONG_PTR)Buffer + sizeof(UNICODE_STRING));
850  memcpy(Ptr, Info->Name.Buffer, Info->Name.MaximumLength);
851 
852  Status = LsapSetObjectAttribute(PolicyObject,
853  L"PolPrDmN",
854  Buffer,
855  Length);
856 
857  RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer);
858 
859  if (!NT_SUCCESS(Status))
860  return Status;
861 
862  Length = 0;
863  if (Info->Sid != NULL)
864  Length = RtlLengthSid(Info->Sid);
865 
866  Status = LsapSetObjectAttribute(PolicyObject,
867  L"PolPrDmS",
868  (LPBYTE)Info->Sid,
869  Length);
870 
871  return Status;
872 }
873 
874 
875 NTSTATUS
878 {
880  ULONG Length = 0;
882  LPWSTR Ptr;
883 
884  TRACE("(%p %p)\n", PolicyObject, Info);
885 
886  Length = sizeof(UNICODE_STRING) + Info->DomainName.MaximumLength;
887  Buffer = RtlAllocateHeap(RtlGetProcessHeap(),
888  0,
889  Length);
890  if (Buffer == NULL)
892 
893  Buffer->Length = Info->DomainName.Length;
894  Buffer->MaximumLength = Info->DomainName.MaximumLength;
895  Buffer->Buffer = (LPWSTR)sizeof(UNICODE_STRING);
896  Ptr = (LPWSTR)((ULONG_PTR)Buffer + sizeof(UNICODE_STRING));
897  memcpy(Ptr, Info->DomainName.Buffer, Info->DomainName.MaximumLength);
898 
899  Status = LsapSetObjectAttribute(PolicyObject,
900  L"PolAcDmN",
901  Buffer,
902  Length);
903 
904  RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer);
905 
906  if (!NT_SUCCESS(Status))
907  return Status;
908 
909  Length = 0;
910  if (Info->Sid != NULL)
911  Length = RtlLengthSid(Info->Sid);
912 
913  Status = LsapSetObjectAttribute(PolicyObject,
914  L"PolAcDmS",
915  (LPBYTE)Info->Sid,
916  Length);
917 
918  return Status;
919 }
920 
921 
922 NTSTATUS
925 {
926  TRACE("(%p %p)\n", PolicyObject, Info);
927 
928  return LsapSetObjectAttribute(PolicyObject,
929  L"PolSrvRo",
930  Info,
932 }
933 
934 
935 NTSTATUS
938 {
939  FIXME("\n");
940  return STATUS_NOT_IMPLEMENTED;
941 }
942 
943 
944 NTSTATUS
947 {
948  TRACE("(%p %p)\n", PolicyObject, Info);
949 
950  return LsapSetObjectAttribute(PolicyObject,
951  L"DefQuota",
952  Info,
953  sizeof(POLICY_DEFAULT_QUOTA_INFO));
954 }
955 
956 
957 NTSTATUS
960 {
961  TRACE("(%p %p)\n", PolicyObject, Info);
962 
963  return LsapSetObjectAttribute(PolicyObject,
964  L"PolMod",
965  Info,
966  sizeof(POLICY_MODIFICATION_INFO));
967 }
968 
969 
970 NTSTATUS
973 {
974  PPOLICY_AUDIT_FULL_QUERY_INFO AuditFullInfo = NULL;
975  ULONG AttributeSize;
977 
978  TRACE("(%p %p)\n", PolicyObject, Info);
979 
980  AttributeSize = sizeof(POLICY_AUDIT_FULL_QUERY_INFO);
981  AuditFullInfo = MIDL_user_allocate(AttributeSize);
982  if (AuditFullInfo == NULL)
984 
985  Status = LsapGetObjectAttribute(PolicyObject,
986  L"PolAdtFl",
987  AuditFullInfo,
988  &AttributeSize);
989  if (!NT_SUCCESS(Status))
990  goto done;
991 
992  AuditFullInfo->ShutDownOnFull = Info->ShutDownOnFull;
993 
994  Status = LsapSetObjectAttribute(PolicyObject,
995  L"PolAdtFl",
996  AuditFullInfo,
997  AttributeSize);
998 
999 done:
1000  if (AuditFullInfo != NULL)
1001  MIDL_user_free(AuditFullInfo);
1002 
1003  return Status;
1004 }
1005 
1006 
1007 NTSTATUS
1010 {
1011  FIXME("\n");
1012  return STATUS_NOT_IMPLEMENTED;
1013 }
1014 
1015 
1016 NTSTATUS
1019 {
1020  FIXME("\n");
1021  return STATUS_NOT_IMPLEMENTED;
1022 }
1023 
1024 
1025 NTSTATUS
1028 {
1029  FIXME("\n");
1030  return STATUS_NOT_IMPLEMENTED;
1031 }
1032 
1033 /* EOF */
NTSTATUS LsapOpenDbObject(IN PLSA_DB_OBJECT ParentObject, IN LPWSTR ContainerName, IN LPWSTR ObjectName, IN LSA_DB_OBJECT_TYPE ObjectType, IN ACCESS_MASK DesiredAccess, IN BOOLEAN Trusted, OUT PLSA_DB_OBJECT *DbObject)
Definition: database.c:710
#define TRUE
Definition: types.h:120
NTSTATUS LsapSetObjectAttribute(PLSA_DB_OBJECT DbObject, LPWSTR AttributeName, LPVOID AttributeData, ULONG AttributeSize)
Definition: database.c:959
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
NTSTATUS LsarSetReplicaSource(PLSA_DB_OBJECT PolicyObject, PPOLICY_LSA_REPLICA_SRCE_INFO Info)
Definition: policy.c:936
NTSTATUS LsarQueryAccountDomain(PLSA_DB_OBJECT PolicyObject, PLSAPR_POLICY_INFORMATION *PolicyInformation)
Definition: policy.c:289
NTSTATUS LsarQueryDnsDomainInt(PLSA_DB_OBJECT PolicyObject, PLSAPR_POLICY_INFORMATION *PolicyInformation)
Definition: policy.c:759
struct _POLICY_AUDIT_LOG_INFO POLICY_AUDIT_LOG_INFO
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
USHORT MaximumLength
Definition: env_spec_w32.h:370
struct _POLICY_AUDIT_FULL_QUERY_INFO POLICY_AUDIT_FULL_QUERY_INFO
NTSTATUS LsarQueryPrimaryDomain(PLSA_DB_OBJECT PolicyObject, PLSAPR_POLICY_INFORMATION *PolicyInformation)
Definition: policy.c:157
struct _LSAP_POLICY_AUDIT_EVENTS_DATA LSAP_POLICY_AUDIT_EVENTS_DATA
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
NTSTATUS LsarQueryReplicaSource(PLSA_DB_OBJECT PolicyObject, PLSAPR_POLICY_INFORMATION *PolicyInformation)
Definition: policy.c:436
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:603
NTSTATUS LsarQueryAuditEvents(PLSA_DB_OBJECT PolicyObject, PLSAPR_POLICY_INFORMATION *PolicyInformation)
Definition: policy.c:70
NTSTATUS LsarSetPrimaryDomain(PLSA_DB_OBJECT PolicyObject, PLSAPR_POLICY_PRIMARY_DOM_INFO Info)
Definition: policy.c:829
DWORD AuditEvents[POLICY_AUDIT_EVENT_TYPE_COUNT]
Definition: lsasrv.h:72
struct _POLICY_LSA_SERVER_ROLE_INFO POLICY_LSA_SERVER_ROLE_INFO
NTSTATUS LsarSetAccountDomain(PLSA_DB_OBJECT PolicyObject, PLSAPR_POLICY_ACCOUNT_DOM_INFO Info)
Definition: policy.c:876
NTSTATUS LsarQueryServerRole(PLSA_DB_OBJECT PolicyObject, PLSAPR_POLICY_INFORMATION *PolicyInformation)
Definition: policy.c:398
NTSTATUS LsarSetServerRole(PLSA_DB_OBJECT PolicyObject, PPOLICY_LSA_SERVER_ROLE_INFO Info)
Definition: policy.c:923
struct TraceInfo Info
NTSTATUS WINAPI LsaIOpenPolicyTrusted(OUT LSAPR_HANDLE *PolicyHandle)
Definition: policy.c:15
uint32_t ULONG_PTR
Definition: typedefs.h:63
NTSTATUS LsarQueryAuditFull(PLSA_DB_OBJECT PolicyObject, PLSAPR_POLICY_INFORMATION *PolicyInformation)
Definition: policy.c:510
unsigned char * LPBYTE
Definition: typedefs.h:52
NTSTATUS LsarQueryDnsDomain(PLSA_DB_OBJECT PolicyObject, PLSAPR_POLICY_INFORMATION *PolicyInformation)
Definition: policy.c:542
NTSTATUS LsarQueryDefaultQuota(PLSA_DB_OBJECT PolicyObject, PLSAPR_POLICY_INFORMATION *PolicyInformation)
Definition: policy.c:446
PVOID LSAPR_HANDLE
Definition: msv1_0.h:260
#define FIXME(fmt,...)
Definition: debug.h:110
NTSTATUS LsarQueryLocalAccountDomain(PLSA_DB_OBJECT PolicyObject, PLSAPR_POLICY_INFORMATION *PolicyInformation)
Definition: policy.c:769
smooth NULL
Definition: ftsmooth.c:416
NTSTATUS LsarQueryModification(PLSA_DB_OBJECT PolicyObject, PLSAPR_POLICY_INFORMATION *PolicyInformation)
Definition: policy.c:478
NTSTATUS LsarQueryAuditLog(PLSA_DB_OBJECT PolicyObject, PLSAPR_POLICY_INFORMATION *PolicyInformation)
Definition: policy.c:38
Definition: bufpool.h:45
NTSYSAPI ULONG NTAPI RtlLengthSid(IN PSID Sid)
Definition: sid.c:150
NTSTATUS LsarSetDnsDomainInt(PLSA_DB_OBJECT PolicyObject, PLSAPR_POLICY_DNS_DOMAIN_INFO Info)
Definition: policy.c:1017
union _LSAPR_POLICY_INFORMATION * PLSAPR_POLICY_INFORMATION
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:585
#define TRACE(s)
Definition: solgame.cpp:4
NTSTATUS LsarQueryPdAccount(PLSA_DB_OBJECT PolicyObject, PLSAPR_POLICY_INFORMATION *PolicyInformation)
Definition: policy.c:267
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define WINAPI
Definition: msvc.h:8
unsigned long DWORD
Definition: ntddk_ex.h:95
NTSTATUS LsarSetAuditLog(PLSA_DB_OBJECT PolicyObject, PPOLICY_AUDIT_LOG_INFO Info)
Definition: policy.c:779
NTSTATUS LsarSetAuditFull(PLSA_DB_OBJECT PolicyObject, PPOLICY_AUDIT_FULL_QUERY_INFO Info)
Definition: policy.c:971
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
static const WCHAR L[]
Definition: oid.c:1250
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
RPC_UNICODE_STRING Name
Definition: msv1_0.h:283
unsigned short Length
Definition: msv1_0.h:53
POLICY_LSA_SERVER_ROLE LsaServerRole
Definition: ntsecapi.h:581
Status
Definition: gdiplustypes.h:24
struct _POLICY_DEFAULT_QUOTA_INFO POLICY_DEFAULT_QUOTA_INFO
NTSTATUS LsarSetLocalAccountDomain(PLSA_DB_OBJECT PolicyObject, PLSAPR_POLICY_ACCOUNT_DOM_INFO Info)
Definition: policy.c:1026
NTSTATUS LsarSetModification(PLSA_DB_OBJECT PolicyObject, PPOLICY_MODIFICATION_INFO Info)
Definition: policy.c:958
struct _GUID GUID
#define STATUS_OBJECT_NAME_NOT_FOUND
Definition: udferr_usr.h:149
NTSTATUS LsarSetDnsDomain(PLSA_DB_OBJECT PolicyObject, PLSAPR_POLICY_DNS_DOMAIN_INFO Info)
Definition: policy.c:1008
NTSTATUS LsarSetDefaultQuota(PLSA_DB_OBJECT PolicyObject, PPOLICY_DEFAULT_QUOTA_INFO Info)
Definition: policy.c:945
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define POLICY_ALL_ACCESS
Definition: ntsecapi.h:77
struct _UNICODE_STRING UNICODE_STRING
struct _POLICY_MODIFICATION_INFO POLICY_MODIFICATION_INFO
#define OUT
Definition: typedefs.h:39
unsigned int ULONG
Definition: retypes.h:1
#define ULONG_PTR
Definition: config.h:101
void *__RPC_USER MIDL_user_allocate(SIZE_T size)
Definition: irotp.c:371
GLfloat GLfloat p
Definition: glext.h:8902
WCHAR * LPWSTR
Definition: xmlstorage.h:184
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
return STATUS_SUCCESS
Definition: btrfs.c:2725
void __RPC_USER MIDL_user_free(void *p)
Definition: irotp.c:376
NTSTATUS LsapGetObjectAttribute(PLSA_DB_OBJECT DbObject, LPWSTR AttributeName, LPVOID AttributeData, PULONG AttributeSize)
Definition: database.c:1010
NTSTATUS LsarSetAuditEvents(PLSA_DB_OBJECT PolicyObject, PLSAPR_POLICY_AUDIT_EVENTS_INFO Info)
Definition: policy.c:792
unsigned short MaximumLength
Definition: msv1_0.h:54
wchar_t * Buffer
Definition: msv1_0.h:55