2 * Unix SMB/CIFS implementation.
3 * RPC Pipe client / server routines
4 * Copyright (C) Andrew Tridgell 1992-1997,
5 * Copyright (C) Luke Kenneth Casson Leighton 1996-1997,
6 * Copyright (C) Paul Ashton 1997,
7 * Copyright (C) Jeremy Allison 2001, 2006.
8 * Copyright (C) Rafal Szczesniak 2002,
9 * Copyright (C) Jim McDonough <jmcd@us.ibm.com> 2002,
10 * Copyright (C) Simo Sorce 2003.
11 * Copyright (C) Gerald (Jerry) Carter 2005.
12 * Copyright (C) Volker Lendecke 2005.
13 * Copyright (C) Guenther Deschner 2008.
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 3 of the License, or
18 * (at your option) any later version.
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, see <http://www.gnu.org/licenses/>.
29 /* This is the implementation of the lsa server code. */
34 #define DBGC_CLASS DBGC_RPC_SRV
36 #define MAX_LOOKUP_SIDS 0x5000 /* 20480 */
45 const struct generic_mapping lsa_generic_mapping
= {
52 /***************************************************************************
53 init_lsa_ref_domain_list - adds a domain if it's not already in, returns the index.
54 ***************************************************************************/
56 static int init_lsa_ref_domain_list(TALLOC_CTX
*mem_ctx
,
57 struct lsa_RefDomainList
*ref
,
63 if (dom_name
!= NULL
) {
64 for (num
= 0; num
< ref
->count
; num
++) {
65 if (sid_equal(dom_sid
, ref
->domains
[num
].sid
)) {
73 if (num
>= LSA_REF_DOMAIN_LIST_MULTIPLIER
) {
74 /* index not found, already at maximum domain limit */
79 ref
->max_size
= LSA_REF_DOMAIN_LIST_MULTIPLIER
;
81 ref
->domains
= TALLOC_REALLOC_ARRAY(mem_ctx
, ref
->domains
,
82 struct lsa_DomainInfo
, ref
->count
);
87 ZERO_STRUCT(ref
->domains
[num
]);
89 init_lsa_StringLarge(&ref
->domains
[num
].name
, dom_name
);
90 ref
->domains
[num
].sid
= sid_dup_talloc(mem_ctx
, dom_sid
);
91 if (!ref
->domains
[num
].sid
) {
99 /***************************************************************************
100 initialize a lsa_DomainInfo structure.
101 ***************************************************************************/
103 static void init_dom_query_3(struct lsa_DomainInfo
*r
,
107 init_lsa_StringLarge(&r
->name
, name
);
111 /***************************************************************************
112 initialize a lsa_DomainInfo structure.
113 ***************************************************************************/
115 static void init_dom_query_5(struct lsa_DomainInfo
*r
,
119 init_lsa_StringLarge(&r
->name
, name
);
123 /***************************************************************************
124 lookup_lsa_rids. Must be called as root for lookup_name to work.
125 ***************************************************************************/
127 static NTSTATUS
lookup_lsa_rids(TALLOC_CTX
*mem_ctx
,
128 struct lsa_RefDomainList
*ref
,
129 struct lsa_TranslatedSid
*prid
,
130 uint32_t num_entries
,
131 struct lsa_String
*name
,
133 uint32_t *pmapped_count
)
135 uint32 mapped_count
, i
;
137 SMB_ASSERT(num_entries
<= MAX_LOOKUP_SIDS
);
142 for (i
= 0; i
< num_entries
; i
++) {
146 const char *full_name
;
148 enum lsa_SidType type
= SID_NAME_UNKNOWN
;
150 /* Split name into domain and user component */
152 full_name
= name
[i
].string
;
153 if (full_name
== NULL
) {
154 return NT_STATUS_NO_MEMORY
;
157 DEBUG(5, ("lookup_lsa_rids: looking up name %s\n", full_name
));
159 /* We can ignore the result of lookup_name, it will not touch
160 "type" if it's not successful */
162 lookup_name(mem_ctx
, full_name
, flags
, &domain
, NULL
,
167 case SID_NAME_DOM_GRP
:
168 case SID_NAME_DOMAIN
:
170 case SID_NAME_WKN_GRP
:
171 DEBUG(5, ("init_lsa_rids: %s found\n", full_name
));
172 /* Leave these unchanged */
175 /* Don't hand out anything but the list above */
176 DEBUG(5, ("init_lsa_rids: %s not found\n", full_name
));
177 type
= SID_NAME_UNKNOWN
;
184 if (type
!= SID_NAME_UNKNOWN
) {
185 sid_split_rid(&sid
, &rid
);
186 dom_idx
= init_lsa_ref_domain_list(mem_ctx
, ref
, domain
, &sid
);
190 prid
[i
].sid_type
= type
;
192 prid
[i
].sid_index
= dom_idx
;
195 *pmapped_count
= mapped_count
;
199 /***************************************************************************
200 lookup_lsa_sids. Must be called as root for lookup_name to work.
201 ***************************************************************************/
203 static NTSTATUS
lookup_lsa_sids(TALLOC_CTX
*mem_ctx
,
204 struct lsa_RefDomainList
*ref
,
205 struct lsa_TranslatedSid3
*trans_sids
,
206 uint32_t num_entries
,
207 struct lsa_String
*name
,
209 uint32
*pmapped_count
)
211 uint32 mapped_count
, i
;
213 SMB_ASSERT(num_entries
<= MAX_LOOKUP_SIDS
);
218 for (i
= 0; i
< num_entries
; i
++) {
222 const char *full_name
;
224 enum lsa_SidType type
= SID_NAME_UNKNOWN
;
228 /* Split name into domain and user component */
230 full_name
= name
[i
].string
;
231 if (full_name
== NULL
) {
232 return NT_STATUS_NO_MEMORY
;
235 DEBUG(5, ("init_lsa_sids: looking up name %s\n", full_name
));
237 /* We can ignore the result of lookup_name, it will not touch
238 "type" if it's not successful */
240 lookup_name(mem_ctx
, full_name
, flags
, &domain
, NULL
,
245 case SID_NAME_DOM_GRP
:
246 case SID_NAME_DOMAIN
:
248 case SID_NAME_WKN_GRP
:
249 DEBUG(5, ("init_lsa_sids: %s found\n", full_name
));
250 /* Leave these unchanged */
253 /* Don't hand out anything but the list above */
254 DEBUG(5, ("init_lsa_sids: %s not found\n", full_name
));
255 type
= SID_NAME_UNKNOWN
;
262 if (type
!= SID_NAME_UNKNOWN
) {
264 sid_copy(&domain_sid
, &sid
);
265 sid_split_rid(&domain_sid
, &rid
);
266 dom_idx
= init_lsa_ref_domain_list(mem_ctx
, ref
, domain
, &domain_sid
);
270 /* Initialize the lsa_TranslatedSid3 return. */
271 trans_sids
[i
].sid_type
= type
;
272 trans_sids
[i
].sid
= sid_dup_talloc(mem_ctx
, &sid
);
273 trans_sids
[i
].sid_index
= dom_idx
;
276 *pmapped_count
= mapped_count
;
280 static NTSTATUS
lsa_get_generic_sd(TALLOC_CTX
*mem_ctx
, SEC_DESC
**sd
, size_t *sd_size
)
282 DOM_SID local_adm_sid
;
289 init_sec_ace(&ace
[0], &global_sid_World
, SEC_ACE_TYPE_ACCESS_ALLOWED
, LSA_POLICY_EXECUTE
, 0);
291 sid_copy(&adm_sid
, get_global_sam_sid());
292 sid_append_rid(&adm_sid
, DOMAIN_GROUP_RID_ADMINS
);
293 init_sec_ace(&ace
[1], &adm_sid
, SEC_ACE_TYPE_ACCESS_ALLOWED
, LSA_POLICY_ALL_ACCESS
, 0);
295 sid_copy(&local_adm_sid
, &global_sid_Builtin
);
296 sid_append_rid(&local_adm_sid
, BUILTIN_ALIAS_RID_ADMINS
);
297 init_sec_ace(&ace
[2], &local_adm_sid
, SEC_ACE_TYPE_ACCESS_ALLOWED
, LSA_POLICY_ALL_ACCESS
, 0);
299 if((psa
= make_sec_acl(mem_ctx
, NT4_ACL_REVISION
, 3, ace
)) == NULL
)
300 return NT_STATUS_NO_MEMORY
;
302 if((*sd
= make_sec_desc(mem_ctx
, SECURITY_DESCRIPTOR_REVISION_1
,
303 SEC_DESC_SELF_RELATIVE
, &adm_sid
, NULL
, NULL
,
304 psa
, sd_size
)) == NULL
)
305 return NT_STATUS_NO_MEMORY
;
310 #if 0 /* AD DC work in ongoing in Samba 4 */
312 /***************************************************************************
314 ***************************************************************************/
316 static void init_dns_dom_info(LSA_DNS_DOM_INFO
*r_l
, const char *nb_name
,
317 const char *dns_name
, const char *forest_name
,
318 struct GUID
*dom_guid
, DOM_SID
*dom_sid
)
320 if (nb_name
&& *nb_name
) {
321 init_unistr2(&r_l
->uni_nb_dom_name
, nb_name
, UNI_FLAGS_NONE
);
322 init_uni_hdr(&r_l
->hdr_nb_dom_name
, &r_l
->uni_nb_dom_name
);
323 r_l
->hdr_nb_dom_name
.uni_max_len
+= 2;
324 r_l
->uni_nb_dom_name
.uni_max_len
+= 1;
327 if (dns_name
&& *dns_name
) {
328 init_unistr2(&r_l
->uni_dns_dom_name
, dns_name
, UNI_FLAGS_NONE
);
329 init_uni_hdr(&r_l
->hdr_dns_dom_name
, &r_l
->uni_dns_dom_name
);
330 r_l
->hdr_dns_dom_name
.uni_max_len
+= 2;
331 r_l
->uni_dns_dom_name
.uni_max_len
+= 1;
334 if (forest_name
&& *forest_name
) {
335 init_unistr2(&r_l
->uni_forest_name
, forest_name
, UNI_FLAGS_NONE
);
336 init_uni_hdr(&r_l
->hdr_forest_name
, &r_l
->uni_forest_name
);
337 r_l
->hdr_forest_name
.uni_max_len
+= 2;
338 r_l
->uni_forest_name
.uni_max_len
+= 1;
341 /* how do we init the guid ? probably should write an init fn */
343 memcpy(&r_l
->dom_guid
, dom_guid
, sizeof(struct GUID
));
347 r_l
->ptr_dom_sid
= 1;
348 init_dom_sid2(&r_l
->dom_sid
, dom_sid
);
351 #endif /* AD DC work in ongoing in Samba 4 */
354 /***************************************************************************
356 ***************************************************************************/
358 NTSTATUS
_lsa_OpenPolicy2(pipes_struct
*p
,
359 struct lsa_OpenPolicy2
*r
)
361 struct lsa_info
*info
;
362 SEC_DESC
*psd
= NULL
;
364 uint32 des_access
= r
->in
.access_mask
;
369 /* map the generic bits to the lsa policy ones */
370 se_map_generic(&des_access
, &lsa_generic_mapping
);
372 /* get the generic lsa policy SD until we store it */
373 lsa_get_generic_sd(p
->mem_ctx
, &psd
, &sd_size
);
375 status
= se_access_check(psd
, p
->server_info
->ptok
, des_access
,
377 if (!NT_STATUS_IS_OK(status
)) {
378 if (p
->server_info
->utok
.uid
!= sec_initial_uid()) {
381 DEBUG(4,("ACCESS should be DENIED (granted: %#010x; required: %#010x)\n",
382 acc_granted
, des_access
));
383 DEBUGADD(4,("but overwritten by euid == 0\n"));
386 /* This is needed for lsa_open_account and rpcclient .... :-) */
388 if (p
->server_info
->utok
.uid
== sec_initial_uid())
389 acc_granted
= LSA_POLICY_ALL_ACCESS
;
391 /* associate the domain SID with the (unique) handle. */
392 info
= TALLOC_ZERO_P(p
->mem_ctx
, struct lsa_info
);
394 return NT_STATUS_NO_MEMORY
;
397 sid_copy(&info
->sid
,get_global_sam_sid());
398 info
->access
= acc_granted
;
400 /* set up the LSA QUERY INFO response */
401 if (!create_policy_hnd(p
, r
->out
.handle
, info
))
402 return NT_STATUS_OBJECT_NAME_NOT_FOUND
;
407 /***************************************************************************
409 ***************************************************************************/
411 NTSTATUS
_lsa_OpenPolicy(pipes_struct
*p
,
412 struct lsa_OpenPolicy
*r
)
414 struct lsa_info
*info
;
415 SEC_DESC
*psd
= NULL
;
417 uint32 des_access
= r
->in
.access_mask
;
422 /* map the generic bits to the lsa policy ones */
423 se_map_generic(&des_access
, &lsa_generic_mapping
);
425 /* get the generic lsa policy SD until we store it */
426 lsa_get_generic_sd(p
->mem_ctx
, &psd
, &sd_size
);
428 status
= se_access_check(psd
, p
->server_info
->ptok
, des_access
,
430 if (!NT_STATUS_IS_OK(status
)) {
431 if (p
->server_info
->utok
.uid
!= sec_initial_uid()) {
434 DEBUG(4,("ACCESS should be DENIED (granted: %#010x; required: %#010x)\n",
435 acc_granted
, des_access
));
436 DEBUGADD(4,("but overwritten by euid == 0\n"));
437 acc_granted
= des_access
;
440 /* associate the domain SID with the (unique) handle. */
441 info
= TALLOC_ZERO_P(p
->mem_ctx
, struct lsa_info
);
443 return NT_STATUS_NO_MEMORY
;
446 sid_copy(&info
->sid
,get_global_sam_sid());
447 info
->access
= acc_granted
;
449 /* set up the LSA QUERY INFO response */
450 if (!create_policy_hnd(p
, r
->out
.handle
, info
))
451 return NT_STATUS_OBJECT_NAME_NOT_FOUND
;
456 /***************************************************************************
457 _lsa_EnumTrustDom - this needs fixing to do more than return NULL ! JRA.
459 ***************************************************************************/
461 NTSTATUS
_lsa_EnumTrustDom(pipes_struct
*p
,
462 struct lsa_EnumTrustDom
*r
)
464 struct lsa_info
*info
;
466 struct trustdom_info
**domains
;
467 struct lsa_DomainInfo
*lsa_domains
= NULL
;
471 * preferred length is set to 5 as a "our" preferred length
472 * nt sets this parameter to 2
473 * update (20.08.2002): it's not preferred length, but preferred size!
474 * it needs further investigation how to optimally choose this value
476 uint32 max_num_domains
=
477 r
->in
.max_size
< 5 ? r
->in
.max_size
: 10;
482 if (!find_policy_by_hnd(p
, r
->in
.handle
, (void **)(void *)&info
))
483 return NT_STATUS_INVALID_HANDLE
;
485 /* check if the user has enough rights */
486 if (!(info
->access
& LSA_POLICY_VIEW_LOCAL_INFORMATION
))
487 return NT_STATUS_ACCESS_DENIED
;
490 nt_status
= pdb_enum_trusteddoms(p
->mem_ctx
, &num_domains
, &domains
);
493 if (!NT_STATUS_IS_OK(nt_status
)) {
497 if (*r
->in
.resume_handle
< num_domains
) {
498 num_thistime
= MIN(num_domains
, max_num_domains
);
500 nt_status
= STATUS_MORE_ENTRIES
;
502 if (*r
->in
.resume_handle
+ num_thistime
> num_domains
) {
503 num_thistime
= num_domains
- *r
->in
.resume_handle
;
504 nt_status
= NT_STATUS_OK
;
507 next_idx
= *r
->in
.resume_handle
+ num_thistime
;
510 next_idx
= 0xffffffff;
511 nt_status
= NT_STATUS_NO_MORE_ENTRIES
;
514 /* set up the lsa_enum_trust_dom response */
516 lsa_domains
= TALLOC_ZERO_ARRAY(p
->mem_ctx
, struct lsa_DomainInfo
,
519 return NT_STATUS_NO_MEMORY
;
522 for (i
=0; i
<num_thistime
; i
++) {
523 init_lsa_StringLarge(&lsa_domains
[i
].name
, domains
[i
]->name
);
524 lsa_domains
[i
].sid
= &domains
[i
]->sid
;
527 *r
->out
.resume_handle
= next_idx
;
528 r
->out
.domains
->count
= num_thistime
;
529 r
->out
.domains
->domains
= lsa_domains
;
534 #define LSA_AUDIT_NUM_CATEGORIES_NT4 7
535 #define LSA_AUDIT_NUM_CATEGORIES_WIN2K 9
536 #define LSA_AUDIT_NUM_CATEGORIES LSA_AUDIT_NUM_CATEGORIES_NT4
538 /***************************************************************************
540 ***************************************************************************/
542 NTSTATUS
_lsa_QueryInfoPolicy(pipes_struct
*p
,
543 struct lsa_QueryInfoPolicy
*r
)
545 NTSTATUS status
= NT_STATUS_OK
;
546 struct lsa_info
*handle
;
550 union lsa_PolicyInformation
*info
= NULL
;
552 if (!find_policy_by_hnd(p
, r
->in
.handle
, (void **)(void *)&handle
))
553 return NT_STATUS_INVALID_HANDLE
;
555 info
= TALLOC_ZERO_P(p
->mem_ctx
, union lsa_PolicyInformation
);
557 return NT_STATUS_NO_MEMORY
;
560 switch (r
->in
.level
) {
564 uint32 policy_def
= LSA_AUDIT_POLICY_ALL
;
566 /* check if the user has enough rights */
567 if (!(handle
->access
& LSA_POLICY_VIEW_AUDIT_INFORMATION
)) {
568 DEBUG(10,("_lsa_QueryInfoPolicy: insufficient access rights\n"));
569 return NT_STATUS_ACCESS_DENIED
;
572 /* fake info: We audit everything. ;) */
574 info
->audit_events
.auditing_mode
= true;
575 info
->audit_events
.count
= LSA_AUDIT_NUM_CATEGORIES
;
576 info
->audit_events
.settings
= TALLOC_ZERO_ARRAY(p
->mem_ctx
,
577 enum lsa_PolicyAuditPolicy
,
578 info
->audit_events
.count
);
579 if (!info
->audit_events
.settings
) {
580 return NT_STATUS_NO_MEMORY
;
583 info
->audit_events
.settings
[LSA_AUDIT_CATEGORY_ACCOUNT_MANAGEMENT
] = policy_def
;
584 info
->audit_events
.settings
[LSA_AUDIT_CATEGORY_FILE_AND_OBJECT_ACCESS
] = policy_def
;
585 info
->audit_events
.settings
[LSA_AUDIT_CATEGORY_LOGON
] = policy_def
;
586 info
->audit_events
.settings
[LSA_AUDIT_CATEGORY_PROCCESS_TRACKING
] = policy_def
;
587 info
->audit_events
.settings
[LSA_AUDIT_CATEGORY_SECURITY_POLICY_CHANGES
] = policy_def
;
588 info
->audit_events
.settings
[LSA_AUDIT_CATEGORY_SYSTEM
] = policy_def
;
589 info
->audit_events
.settings
[LSA_AUDIT_CATEGORY_USE_OF_USER_RIGHTS
] = policy_def
;
594 /* check if the user has enough rights */
595 if (!(handle
->access
& LSA_POLICY_VIEW_LOCAL_INFORMATION
))
596 return NT_STATUS_ACCESS_DENIED
;
598 /* Request PolicyPrimaryDomainInformation. */
599 switch (lp_server_role()) {
600 case ROLE_DOMAIN_PDC
:
601 case ROLE_DOMAIN_BDC
:
602 name
= get_global_sam_name();
603 sid
= sid_dup_talloc(p
->mem_ctx
, get_global_sam_sid());
605 return NT_STATUS_NO_MEMORY
;
608 case ROLE_DOMAIN_MEMBER
:
609 name
= lp_workgroup();
610 /* We need to return the Domain SID here. */
611 if (secrets_fetch_domain_sid(lp_workgroup(), &domain_sid
)) {
612 sid
= sid_dup_talloc(p
->mem_ctx
, &domain_sid
);
614 return NT_STATUS_NO_MEMORY
;
617 return NT_STATUS_CANT_ACCESS_DOMAIN_INFO
;
620 case ROLE_STANDALONE
:
621 name
= lp_workgroup();
625 return NT_STATUS_CANT_ACCESS_DOMAIN_INFO
;
627 init_dom_query_3(&info
->domain
, name
, sid
);
630 /* check if the user has enough rights */
631 if (!(handle
->access
& LSA_POLICY_VIEW_LOCAL_INFORMATION
))
632 return NT_STATUS_ACCESS_DENIED
;
634 /* Request PolicyAccountDomainInformation. */
635 name
= get_global_sam_name();
636 sid
= get_global_sam_sid();
638 init_dom_query_5(&info
->account_domain
, name
, sid
);
641 /* check if the user has enough rights */
642 if (!(handle
->access
& LSA_POLICY_VIEW_LOCAL_INFORMATION
))
643 return NT_STATUS_ACCESS_DENIED
;
645 switch (lp_server_role()) {
646 case ROLE_DOMAIN_BDC
:
648 * only a BDC is a backup controller
649 * of the domain, it controls.
651 info
->role
.role
= LSA_ROLE_BACKUP
;
655 * any other role is a primary
656 * of the domain, it controls.
658 info
->role
.role
= LSA_ROLE_PRIMARY
;
663 DEBUG(0,("_lsa_QueryInfoPolicy: unknown info level in Lsa Query: %d\n",
665 status
= NT_STATUS_INVALID_INFO_CLASS
;
674 /***************************************************************************
675 _lsa_lookup_sids_internal
676 ***************************************************************************/
678 static NTSTATUS
_lsa_lookup_sids_internal(pipes_struct
*p
,
680 uint16_t level
, /* input */
681 int num_sids
, /* input */
682 struct lsa_SidPtr
*sid
, /* input */
683 struct lsa_RefDomainList
**pp_ref
, /* input/output */
684 struct lsa_TranslatedName2
**pp_names
,/* input/output */
685 uint32_t *pp_mapped_count
) /* input/output */
689 const DOM_SID
**sids
= NULL
;
690 struct lsa_RefDomainList
*ref
= NULL
;
691 uint32 mapped_count
= 0;
692 struct lsa_dom_info
*dom_infos
= NULL
;
693 struct lsa_name_info
*name_infos
= NULL
;
694 struct lsa_TranslatedName2
*names
= NULL
;
696 *pp_mapped_count
= 0;
704 sids
= TALLOC_ARRAY(p
->mem_ctx
, const DOM_SID
*, num_sids
);
705 ref
= TALLOC_ZERO_P(p
->mem_ctx
, struct lsa_RefDomainList
);
707 if (sids
== NULL
|| ref
== NULL
) {
708 return NT_STATUS_NO_MEMORY
;
711 for (i
=0; i
<num_sids
; i
++) {
712 sids
[i
] = sid
[i
].sid
;
715 status
= lookup_sids(p
->mem_ctx
, num_sids
, sids
, level
,
716 &dom_infos
, &name_infos
);
718 if (!NT_STATUS_IS_OK(status
)) {
722 names
= TALLOC_ARRAY(p
->mem_ctx
, struct lsa_TranslatedName2
, num_sids
);
724 return NT_STATUS_NO_MEMORY
;
727 for (i
=0; i
<LSA_REF_DOMAIN_LIST_MULTIPLIER
; i
++) {
729 if (!dom_infos
[i
].valid
) {
733 if (init_lsa_ref_domain_list(mem_ctx
, ref
,
735 &dom_infos
[i
].sid
) != i
) {
736 DEBUG(0, ("Domain %s mentioned twice??\n",
738 return NT_STATUS_INTERNAL_ERROR
;
742 for (i
=0; i
<num_sids
; i
++) {
743 struct lsa_name_info
*name
= &name_infos
[i
];
745 if (name
->type
== SID_NAME_UNKNOWN
) {
748 /* Unknown sids should return the string
749 * representation of the SID. Windows 2003 behaves
750 * rather erratic here, in many cases it returns the
751 * RID as 8 bytes hex, in others it returns the full
752 * SID. We (Jerry/VL) could not figure out which the
753 * hard cases are, so leave it with the SID. */
754 name
->name
= talloc_asprintf(p
->mem_ctx
, "%s",
757 if (name
->name
== NULL
) {
758 return NT_STATUS_NO_MEMORY
;
764 names
[i
].sid_type
= name
->type
;
765 names
[i
].name
.string
= name
->name
;
766 names
[i
].sid_index
= name
->dom_idx
;
767 names
[i
].unknown
= 0;
770 status
= NT_STATUS_NONE_MAPPED
;
771 if (mapped_count
> 0) {
772 status
= (mapped_count
< num_sids
) ?
773 STATUS_SOME_UNMAPPED
: NT_STATUS_OK
;
776 DEBUG(10, ("num_sids %d, mapped_count %d, status %s\n",
777 num_sids
, mapped_count
, nt_errstr(status
)));
779 *pp_mapped_count
= mapped_count
;
786 /***************************************************************************
788 ***************************************************************************/
790 NTSTATUS
_lsa_LookupSids(pipes_struct
*p
,
791 struct lsa_LookupSids
*r
)
794 struct lsa_info
*handle
;
795 int num_sids
= r
->in
.sids
->num_sids
;
796 uint32 mapped_count
= 0;
797 struct lsa_RefDomainList
*domains
= NULL
;
798 struct lsa_TranslatedName
*names_out
= NULL
;
799 struct lsa_TranslatedName2
*names
= NULL
;
802 if ((r
->in
.level
< 1) || (r
->in
.level
> 6)) {
803 return NT_STATUS_INVALID_PARAMETER
;
806 if (!find_policy_by_hnd(p
, r
->in
.handle
, (void **)(void *)&handle
)) {
807 return NT_STATUS_INVALID_HANDLE
;
810 /* check if the user has enough rights */
811 if (!(handle
->access
& LSA_POLICY_LOOKUP_NAMES
)) {
812 return NT_STATUS_ACCESS_DENIED
;
815 if (num_sids
> MAX_LOOKUP_SIDS
) {
816 DEBUG(5,("_lsa_LookupSids: limit of %d exceeded, requested %d\n",
817 MAX_LOOKUP_SIDS
, num_sids
));
818 return NT_STATUS_NONE_MAPPED
;
821 status
= _lsa_lookup_sids_internal(p
,
830 if (NT_STATUS_IS_ERR(status
)) {
834 /* Convert from lsa_TranslatedName2 to lsa_TranslatedName */
835 names_out
= TALLOC_ARRAY(p
->mem_ctx
, struct lsa_TranslatedName
,
838 return NT_STATUS_NO_MEMORY
;
841 for (i
=0; i
<num_sids
; i
++) {
842 names_out
[i
].sid_type
= names
[i
].sid_type
;
843 names_out
[i
].name
= names
[i
].name
;
844 names_out
[i
].sid_index
= names
[i
].sid_index
;
847 *r
->out
.domains
= domains
;
848 r
->out
.names
->count
= num_sids
;
849 r
->out
.names
->names
= names_out
;
850 *r
->out
.count
= mapped_count
;
855 /***************************************************************************
857 ***************************************************************************/
859 NTSTATUS
_lsa_LookupSids2(pipes_struct
*p
,
860 struct lsa_LookupSids2
*r
)
863 struct lsa_info
*handle
;
864 int num_sids
= r
->in
.sids
->num_sids
;
865 uint32 mapped_count
= 0;
866 struct lsa_RefDomainList
*domains
= NULL
;
867 struct lsa_TranslatedName2
*names
= NULL
;
868 bool check_policy
= true;
870 switch (p
->hdr_req
.opnum
) {
871 case NDR_LSA_LOOKUPSIDS3
:
872 check_policy
= false;
874 case NDR_LSA_LOOKUPSIDS2
:
879 if ((r
->in
.level
< 1) || (r
->in
.level
> 6)) {
880 return NT_STATUS_INVALID_PARAMETER
;
884 if (!find_policy_by_hnd(p
, r
->in
.handle
, (void **)(void *)&handle
)) {
885 return NT_STATUS_INVALID_HANDLE
;
888 /* check if the user has enough rights */
889 if (!(handle
->access
& LSA_POLICY_LOOKUP_NAMES
)) {
890 return NT_STATUS_ACCESS_DENIED
;
894 if (num_sids
> MAX_LOOKUP_SIDS
) {
895 DEBUG(5,("_lsa_LookupSids2: limit of %d exceeded, requested %d\n",
896 MAX_LOOKUP_SIDS
, num_sids
));
897 return NT_STATUS_NONE_MAPPED
;
900 status
= _lsa_lookup_sids_internal(p
,
909 *r
->out
.domains
= domains
;
910 r
->out
.names
->count
= num_sids
;
911 r
->out
.names
->names
= names
;
912 *r
->out
.count
= mapped_count
;
917 /***************************************************************************
919 ***************************************************************************/
921 NTSTATUS
_lsa_LookupSids3(pipes_struct
*p
,
922 struct lsa_LookupSids3
*r
)
924 struct lsa_LookupSids2 q
;
926 /* No policy handle on this call. Restrict to crypto connections. */
927 if (p
->auth
.auth_type
!= PIPE_AUTH_TYPE_SCHANNEL
) {
928 DEBUG(0,("_lsa_LookupSids3: client %s not using schannel for netlogon\n",
929 get_remote_machine_name() ));
930 return NT_STATUS_INVALID_PARAMETER
;
934 q
.in
.sids
= r
->in
.sids
;
935 q
.in
.level
= r
->in
.level
;
936 q
.in
.unknown1
= r
->in
.unknown1
;
937 q
.in
.unknown2
= r
->in
.unknown2
;
938 q
.in
.names
= r
->in
.names
;
939 q
.in
.count
= r
->in
.count
;
941 q
.out
.domains
= r
->out
.domains
;
942 q
.out
.names
= r
->out
.names
;
943 q
.out
.count
= r
->out
.count
;
945 return _lsa_LookupSids2(p
, &q
);
948 /***************************************************************************
949 ***************************************************************************/
951 static int lsa_lookup_level_to_flags(uint16 level
)
957 flags
= LOOKUP_NAME_ALL
;
960 flags
= LOOKUP_NAME_DOMAIN
|LOOKUP_NAME_REMOTE
|LOOKUP_NAME_ISOLATED
;
963 flags
= LOOKUP_NAME_DOMAIN
|LOOKUP_NAME_ISOLATED
;
969 flags
= LOOKUP_NAME_NONE
;
976 /***************************************************************************
978 ***************************************************************************/
980 NTSTATUS
_lsa_LookupNames(pipes_struct
*p
,
981 struct lsa_LookupNames
*r
)
983 NTSTATUS status
= NT_STATUS_NONE_MAPPED
;
984 struct lsa_info
*handle
;
985 struct lsa_String
*names
= r
->in
.names
;
986 uint32 num_entries
= r
->in
.num_names
;
987 struct lsa_RefDomainList
*domains
= NULL
;
988 struct lsa_TranslatedSid
*rids
= NULL
;
989 uint32 mapped_count
= 0;
992 if (num_entries
> MAX_LOOKUP_SIDS
) {
993 num_entries
= MAX_LOOKUP_SIDS
;
994 DEBUG(5,("_lsa_LookupNames: truncating name lookup list to %d\n",
998 flags
= lsa_lookup_level_to_flags(r
->in
.level
);
1000 domains
= TALLOC_ZERO_P(p
->mem_ctx
, struct lsa_RefDomainList
);
1002 return NT_STATUS_NO_MEMORY
;
1006 rids
= TALLOC_ZERO_ARRAY(p
->mem_ctx
, struct lsa_TranslatedSid
,
1009 return NT_STATUS_NO_MEMORY
;
1015 if (!find_policy_by_hnd(p
, r
->in
.handle
, (void **)(void *)&handle
)) {
1016 status
= NT_STATUS_INVALID_HANDLE
;
1020 /* check if the user has enough rights */
1021 if (!(handle
->access
& LSA_POLICY_LOOKUP_NAMES
)) {
1022 status
= NT_STATUS_ACCESS_DENIED
;
1026 /* set up the LSA Lookup RIDs response */
1027 become_root(); /* lookup_name can require root privs */
1028 status
= lookup_lsa_rids(p
->mem_ctx
, domains
, rids
, num_entries
,
1029 names
, flags
, &mapped_count
);
1034 if (NT_STATUS_IS_OK(status
) && (num_entries
!= 0) ) {
1035 if (mapped_count
== 0) {
1036 status
= NT_STATUS_NONE_MAPPED
;
1037 } else if (mapped_count
!= num_entries
) {
1038 status
= STATUS_SOME_UNMAPPED
;
1042 *r
->out
.count
= mapped_count
;
1043 *r
->out
.domains
= domains
;
1044 r
->out
.sids
->sids
= rids
;
1045 r
->out
.sids
->count
= num_entries
;
1050 /***************************************************************************
1052 ***************************************************************************/
1054 NTSTATUS
_lsa_LookupNames2(pipes_struct
*p
,
1055 struct lsa_LookupNames2
*r
)
1058 struct lsa_LookupNames q
;
1059 struct lsa_TransSidArray2
*sid_array2
= r
->in
.sids
;
1060 struct lsa_TransSidArray
*sid_array
= NULL
;
1063 sid_array
= TALLOC_ZERO_P(p
->mem_ctx
, struct lsa_TransSidArray
);
1065 return NT_STATUS_NO_MEMORY
;
1068 q
.in
.handle
= r
->in
.handle
;
1069 q
.in
.num_names
= r
->in
.num_names
;
1070 q
.in
.names
= r
->in
.names
;
1071 q
.in
.level
= r
->in
.level
;
1072 q
.in
.sids
= sid_array
;
1073 q
.in
.count
= r
->in
.count
;
1074 /* we do not know what this is for */
1075 /* = r->in.unknown1; */
1076 /* = r->in.unknown2; */
1078 q
.out
.domains
= r
->out
.domains
;
1079 q
.out
.sids
= sid_array
;
1080 q
.out
.count
= r
->out
.count
;
1082 status
= _lsa_LookupNames(p
, &q
);
1084 sid_array2
->sids
= TALLOC_ARRAY(p
->mem_ctx
, struct lsa_TranslatedSid2
, sid_array
->count
);
1085 if (!sid_array2
->sids
) {
1086 return NT_STATUS_NO_MEMORY
;
1089 for (i
=0; i
<sid_array
->count
; i
++) {
1090 sid_array2
->sids
[i
].sid_type
= sid_array
->sids
[i
].sid_type
;
1091 sid_array2
->sids
[i
].rid
= sid_array
->sids
[i
].rid
;
1092 sid_array2
->sids
[i
].sid_index
= sid_array
->sids
[i
].sid_index
;
1093 sid_array2
->sids
[i
].unknown
= 0;
1096 r
->out
.sids
= sid_array2
;
1101 /***************************************************************************
1103 ***************************************************************************/
1105 NTSTATUS
_lsa_LookupNames3(pipes_struct
*p
,
1106 struct lsa_LookupNames3
*r
)
1109 struct lsa_info
*handle
;
1110 struct lsa_String
*names
= r
->in
.names
;
1111 uint32 num_entries
= r
->in
.num_names
;
1112 struct lsa_RefDomainList
*domains
= NULL
;
1113 struct lsa_TranslatedSid3
*trans_sids
= NULL
;
1114 uint32 mapped_count
= 0;
1116 bool check_policy
= true;
1118 switch (p
->hdr_req
.opnum
) {
1119 case NDR_LSA_LOOKUPNAMES4
:
1120 check_policy
= false;
1122 case NDR_LSA_LOOKUPNAMES3
:
1124 check_policy
= true;
1127 if (num_entries
> MAX_LOOKUP_SIDS
) {
1128 num_entries
= MAX_LOOKUP_SIDS
;
1129 DEBUG(5,("_lsa_LookupNames3: truncating name lookup list to %d\n", num_entries
));
1132 /* Probably the lookup_level is some sort of bitmask. */
1133 if (r
->in
.level
== 1) {
1134 flags
= LOOKUP_NAME_ALL
;
1137 domains
= TALLOC_ZERO_P(p
->mem_ctx
, struct lsa_RefDomainList
);
1139 return NT_STATUS_NO_MEMORY
;
1143 trans_sids
= TALLOC_ZERO_ARRAY(p
->mem_ctx
, struct lsa_TranslatedSid3
,
1146 return NT_STATUS_NO_MEMORY
;
1154 if (!find_policy_by_hnd(p
, r
->in
.handle
, (void **)(void *)&handle
)) {
1155 status
= NT_STATUS_INVALID_HANDLE
;
1159 /* check if the user has enough rights */
1160 if (!(handle
->access
& LSA_POLICY_LOOKUP_NAMES
)) {
1161 status
= NT_STATUS_ACCESS_DENIED
;
1166 /* set up the LSA Lookup SIDs response */
1167 become_root(); /* lookup_name can require root privs */
1168 status
= lookup_lsa_sids(p
->mem_ctx
, domains
, trans_sids
, num_entries
,
1169 names
, flags
, &mapped_count
);
1174 if (NT_STATUS_IS_OK(status
)) {
1175 if (mapped_count
== 0) {
1176 status
= NT_STATUS_NONE_MAPPED
;
1177 } else if (mapped_count
!= num_entries
) {
1178 status
= STATUS_SOME_UNMAPPED
;
1182 *r
->out
.count
= mapped_count
;
1183 *r
->out
.domains
= domains
;
1184 r
->out
.sids
->sids
= trans_sids
;
1185 r
->out
.sids
->count
= num_entries
;
1190 /***************************************************************************
1192 ***************************************************************************/
1194 NTSTATUS
_lsa_LookupNames4(pipes_struct
*p
,
1195 struct lsa_LookupNames4
*r
)
1197 struct lsa_LookupNames3 q
;
1199 /* No policy handle on this call. Restrict to crypto connections. */
1200 if (p
->auth
.auth_type
!= PIPE_AUTH_TYPE_SCHANNEL
) {
1201 DEBUG(0,("_lsa_lookup_names4: client %s not using schannel for netlogon\n",
1202 get_remote_machine_name() ));
1203 return NT_STATUS_INVALID_PARAMETER
;
1207 q
.in
.num_names
= r
->in
.num_names
;
1208 q
.in
.names
= r
->in
.names
;
1209 q
.in
.level
= r
->in
.level
;
1210 q
.in
.lookup_options
= r
->in
.lookup_options
;
1211 q
.in
.client_revision
= r
->in
.client_revision
;
1212 q
.in
.sids
= r
->in
.sids
;
1213 q
.in
.count
= r
->in
.count
;
1215 q
.out
.domains
= r
->out
.domains
;
1216 q
.out
.sids
= r
->out
.sids
;
1217 q
.out
.count
= r
->out
.count
;
1219 return _lsa_LookupNames3(p
, &q
);
1222 /***************************************************************************
1223 _lsa_close. Also weird - needs to check if lsa handle is correct. JRA.
1224 ***************************************************************************/
1226 NTSTATUS
_lsa_Close(pipes_struct
*p
, struct lsa_Close
*r
)
1228 if (!find_policy_by_hnd(p
, r
->in
.handle
, NULL
)) {
1229 return NT_STATUS_INVALID_HANDLE
;
1232 close_policy_hnd(p
, r
->in
.handle
);
1233 ZERO_STRUCTP(r
->out
.handle
);
1234 return NT_STATUS_OK
;
1237 /***************************************************************************
1238 ***************************************************************************/
1240 NTSTATUS
_lsa_OpenSecret(pipes_struct
*p
, struct lsa_OpenSecret
*r
)
1242 return NT_STATUS_OBJECT_NAME_NOT_FOUND
;
1245 /***************************************************************************
1246 ***************************************************************************/
1248 NTSTATUS
_lsa_OpenTrustedDomain(pipes_struct
*p
, struct lsa_OpenTrustedDomain
*r
)
1250 return NT_STATUS_OBJECT_NAME_NOT_FOUND
;
1253 /***************************************************************************
1254 ***************************************************************************/
1256 NTSTATUS
_lsa_CreateTrustedDomain(pipes_struct
*p
, struct lsa_CreateTrustedDomain
*r
)
1258 return NT_STATUS_ACCESS_DENIED
;
1261 /***************************************************************************
1262 ***************************************************************************/
1264 NTSTATUS
_lsa_CreateSecret(pipes_struct
*p
, struct lsa_CreateSecret
*r
)
1266 return NT_STATUS_ACCESS_DENIED
;
1269 /***************************************************************************
1270 ***************************************************************************/
1272 NTSTATUS
_lsa_SetSecret(pipes_struct
*p
, struct lsa_SetSecret
*r
)
1274 return NT_STATUS_ACCESS_DENIED
;
1277 /***************************************************************************
1279 ***************************************************************************/
1281 NTSTATUS
_lsa_DeleteObject(pipes_struct
*p
,
1282 struct lsa_DeleteObject
*r
)
1284 return NT_STATUS_ACCESS_DENIED
;
1287 /***************************************************************************
1289 ***************************************************************************/
1291 NTSTATUS
_lsa_EnumPrivs(pipes_struct
*p
,
1292 struct lsa_EnumPrivs
*r
)
1294 struct lsa_info
*handle
;
1296 uint32 enum_context
= *r
->in
.resume_handle
;
1297 int num_privs
= count_all_privileges();
1298 struct lsa_PrivEntry
*entries
= NULL
;
1301 /* remember that the enum_context starts at 0 and not 1 */
1303 if ( enum_context
>= num_privs
)
1304 return NT_STATUS_NO_MORE_ENTRIES
;
1306 DEBUG(10,("_lsa_EnumPrivs: enum_context:%d total entries:%d\n",
1307 enum_context
, num_privs
));
1309 if (!find_policy_by_hnd(p
, r
->in
.handle
, (void **)(void *)&handle
))
1310 return NT_STATUS_INVALID_HANDLE
;
1312 /* check if the user has enough rights
1313 I don't know if it's the right one. not documented. */
1315 if (!(handle
->access
& LSA_POLICY_VIEW_LOCAL_INFORMATION
))
1316 return NT_STATUS_ACCESS_DENIED
;
1319 entries
= TALLOC_ZERO_ARRAY(p
->mem_ctx
, struct lsa_PrivEntry
, num_privs
);
1321 return NT_STATUS_NO_MEMORY
;
1327 for (i
= 0; i
< num_privs
; i
++) {
1328 if( i
< enum_context
) {
1330 init_lsa_StringLarge(&entries
[i
].name
, NULL
);
1332 entries
[i
].luid
.low
= 0;
1333 entries
[i
].luid
.high
= 0;
1336 init_lsa_StringLarge(&entries
[i
].name
, privs
[i
].name
);
1338 luid
= get_privilege_luid( &privs
[i
].se_priv
);
1340 entries
[i
].luid
.low
= luid
.luid
.low
;
1341 entries
[i
].luid
.high
= luid
.luid
.high
;
1345 enum_context
= num_privs
;
1347 *r
->out
.resume_handle
= enum_context
;
1348 r
->out
.privs
->count
= num_privs
;
1349 r
->out
.privs
->privs
= entries
;
1351 return NT_STATUS_OK
;
1354 /***************************************************************************
1355 _lsa_LookupPrivDisplayName
1356 ***************************************************************************/
1358 NTSTATUS
_lsa_LookupPrivDisplayName(pipes_struct
*p
,
1359 struct lsa_LookupPrivDisplayName
*r
)
1361 struct lsa_info
*handle
;
1362 const char *description
;
1363 struct lsa_StringLarge
*lsa_name
;
1365 if (!find_policy_by_hnd(p
, r
->in
.handle
, (void **)(void *)&handle
))
1366 return NT_STATUS_INVALID_HANDLE
;
1368 /* check if the user has enough rights */
1371 * I don't know if it's the right one. not documented.
1373 if (!(handle
->access
& LSA_POLICY_VIEW_LOCAL_INFORMATION
))
1374 return NT_STATUS_ACCESS_DENIED
;
1376 DEBUG(10,("_lsa_LookupPrivDisplayName: name = %s\n", r
->in
.name
->string
));
1378 description
= get_privilege_dispname(r
->in
.name
->string
);
1380 DEBUG(10,("_lsa_LookupPrivDisplayName: doesn't exist\n"));
1381 return NT_STATUS_NO_SUCH_PRIVILEGE
;
1384 DEBUG(10,("_lsa_LookupPrivDisplayName: display name = %s\n", description
));
1386 lsa_name
= TALLOC_ZERO_P(p
->mem_ctx
, struct lsa_StringLarge
);
1388 return NT_STATUS_NO_MEMORY
;
1391 init_lsa_StringLarge(lsa_name
, description
);
1393 *r
->out
.returned_language_id
= r
->in
.language_id
;
1394 *r
->out
.disp_name
= lsa_name
;
1396 return NT_STATUS_OK
;
1399 /***************************************************************************
1401 ***************************************************************************/
1403 NTSTATUS
_lsa_EnumAccounts(pipes_struct
*p
,
1404 struct lsa_EnumAccounts
*r
)
1406 struct lsa_info
*handle
;
1408 int i
, j
, num_entries
;
1410 struct lsa_SidPtr
*sids
= NULL
;
1412 if (!find_policy_by_hnd(p
, r
->in
.handle
, (void **)(void *)&handle
))
1413 return NT_STATUS_INVALID_HANDLE
;
1415 if (!(handle
->access
& LSA_POLICY_VIEW_LOCAL_INFORMATION
))
1416 return NT_STATUS_ACCESS_DENIED
;
1421 /* The only way we can currently find out all the SIDs that have been
1422 privileged is to scan all privileges */
1424 status
= privilege_enumerate_accounts(&sid_list
, &num_entries
);
1425 if (!NT_STATUS_IS_OK(status
)) {
1429 if (*r
->in
.resume_handle
>= num_entries
) {
1430 return NT_STATUS_NO_MORE_ENTRIES
;
1433 if (num_entries
- *r
->in
.resume_handle
) {
1434 sids
= TALLOC_ZERO_ARRAY(p
->mem_ctx
, struct lsa_SidPtr
,
1435 num_entries
- *r
->in
.resume_handle
);
1437 talloc_free(sid_list
);
1438 return NT_STATUS_NO_MEMORY
;
1441 for (i
= *r
->in
.resume_handle
, j
= 0; i
< num_entries
; i
++, j
++) {
1442 sids
[j
].sid
= sid_dup_talloc(p
->mem_ctx
, &sid_list
[i
]);
1444 talloc_free(sid_list
);
1445 return NT_STATUS_NO_MEMORY
;
1450 talloc_free(sid_list
);
1452 *r
->out
.resume_handle
= num_entries
;
1453 r
->out
.sids
->num_sids
= num_entries
;
1454 r
->out
.sids
->sids
= sids
;
1456 return NT_STATUS_OK
;
1459 /***************************************************************************
1461 ***************************************************************************/
1463 NTSTATUS
_lsa_GetUserName(pipes_struct
*p
,
1464 struct lsa_GetUserName
*r
)
1466 const char *username
, *domname
;
1467 struct lsa_String
*account_name
= NULL
;
1468 struct lsa_String
*authority_name
= NULL
;
1470 if (r
->in
.account_name
&&
1471 *r
->in
.account_name
) {
1472 return NT_STATUS_INVALID_PARAMETER
;
1475 if (r
->in
.authority_name
&&
1476 *r
->in
.authority_name
) {
1477 return NT_STATUS_INVALID_PARAMETER
;
1480 if (p
->server_info
->guest
) {
1482 * I'm 99% sure this is not the right place to do this,
1483 * global_sid_Anonymous should probably be put into the token
1484 * instead of the guest id -- vl
1486 if (!lookup_sid(p
->mem_ctx
, &global_sid_Anonymous
,
1487 &domname
, &username
, NULL
)) {
1488 return NT_STATUS_NO_MEMORY
;
1491 username
= p
->server_info
->sanitized_username
;
1492 domname
= pdb_get_domain(p
->server_info
->sam_account
);
1495 account_name
= TALLOC_P(p
->mem_ctx
, struct lsa_String
);
1496 if (!account_name
) {
1497 return NT_STATUS_NO_MEMORY
;
1499 init_lsa_String(account_name
, username
);
1501 if (r
->out
.authority_name
) {
1502 authority_name
= TALLOC_P(p
->mem_ctx
, struct lsa_String
);
1503 if (!authority_name
) {
1504 return NT_STATUS_NO_MEMORY
;
1506 init_lsa_String(authority_name
, domname
);
1509 *r
->out
.account_name
= account_name
;
1510 if (r
->out
.authority_name
) {
1511 *r
->out
.authority_name
= authority_name
;
1514 return NT_STATUS_OK
;
1517 /***************************************************************************
1519 ***************************************************************************/
1521 NTSTATUS
_lsa_CreateAccount(pipes_struct
*p
,
1522 struct lsa_CreateAccount
*r
)
1524 struct lsa_info
*handle
;
1525 struct lsa_info
*info
;
1527 /* find the connection policy handle. */
1528 if (!find_policy_by_hnd(p
, r
->in
.handle
, (void **)(void *)&handle
))
1529 return NT_STATUS_INVALID_HANDLE
;
1531 /* check if the user has enough rights */
1534 * I don't know if it's the right one. not documented.
1535 * but guessed with rpcclient.
1537 if (!(handle
->access
& LSA_POLICY_GET_PRIVATE_INFORMATION
))
1538 return NT_STATUS_ACCESS_DENIED
;
1540 /* check to see if the pipe_user is a Domain Admin since
1541 account_pol.tdb was already opened as root, this is all we have */
1543 if ( p
->server_info
->utok
.uid
!= sec_initial_uid()
1544 && !nt_token_check_domain_rid( p
->server_info
->ptok
,
1545 DOMAIN_GROUP_RID_ADMINS
) )
1546 return NT_STATUS_ACCESS_DENIED
;
1548 if ( is_privileged_sid( r
->in
.sid
) )
1549 return NT_STATUS_OBJECT_NAME_COLLISION
;
1551 /* associate the user/group SID with the (unique) handle. */
1553 info
= TALLOC_ZERO_P(p
->mem_ctx
, struct lsa_info
);
1555 return NT_STATUS_NO_MEMORY
;
1558 info
->sid
= *r
->in
.sid
;
1559 info
->access
= r
->in
.access_mask
;
1561 /* get a (unique) handle. open a policy on it. */
1562 if (!create_policy_hnd(p
, r
->out
.acct_handle
, info
))
1563 return NT_STATUS_OBJECT_NAME_NOT_FOUND
;
1565 return privilege_create_account( &info
->sid
);
1569 /***************************************************************************
1571 ***************************************************************************/
1573 NTSTATUS
_lsa_OpenAccount(pipes_struct
*p
,
1574 struct lsa_OpenAccount
*r
)
1576 struct lsa_info
*handle
;
1577 struct lsa_info
*info
;
1579 /* find the connection policy handle. */
1580 if (!find_policy_by_hnd(p
, r
->in
.handle
, (void **)(void *)&handle
))
1581 return NT_STATUS_INVALID_HANDLE
;
1583 /* check if the user has enough rights */
1586 * I don't know if it's the right one. not documented.
1587 * but guessed with rpcclient.
1589 if (!(handle
->access
& LSA_POLICY_GET_PRIVATE_INFORMATION
))
1590 return NT_STATUS_ACCESS_DENIED
;
1592 /* TODO: Fis the parsing routine before reenabling this check! */
1594 if (!lookup_sid(&handle
->sid
, dom_name
, name
, &type
))
1595 return NT_STATUS_ACCESS_DENIED
;
1597 /* associate the user/group SID with the (unique) handle. */
1598 info
= TALLOC_ZERO_P(p
->mem_ctx
, struct lsa_info
);
1600 return NT_STATUS_NO_MEMORY
;
1603 info
->sid
= *r
->in
.sid
;
1604 info
->access
= r
->in
.access_mask
;
1606 /* get a (unique) handle. open a policy on it. */
1607 if (!create_policy_hnd(p
, r
->out
.acct_handle
, info
))
1608 return NT_STATUS_OBJECT_NAME_NOT_FOUND
;
1610 return NT_STATUS_OK
;
1613 /***************************************************************************
1614 _lsa_EnumPrivsAccount
1615 For a given SID, enumerate all the privilege this account has.
1616 ***************************************************************************/
1618 NTSTATUS
_lsa_EnumPrivsAccount(pipes_struct
*p
,
1619 struct lsa_EnumPrivsAccount
*r
)
1621 NTSTATUS status
= NT_STATUS_OK
;
1622 struct lsa_info
*info
=NULL
;
1624 PRIVILEGE_SET privileges
;
1625 struct lsa_PrivilegeSet
*priv_set
= NULL
;
1626 struct lsa_LUIDAttribute
*luid_attrs
= NULL
;
1629 /* find the connection policy handle. */
1630 if (!find_policy_by_hnd(p
, r
->in
.handle
, (void **)(void *)&info
))
1631 return NT_STATUS_INVALID_HANDLE
;
1633 if (!(info
->access
& LSA_POLICY_VIEW_LOCAL_INFORMATION
))
1634 return NT_STATUS_ACCESS_DENIED
;
1636 if ( !get_privileges_for_sids( &mask
, &info
->sid
, 1 ) )
1637 return NT_STATUS_OBJECT_NAME_NOT_FOUND
;
1639 privilege_set_init( &privileges
);
1641 if ( se_priv_to_privilege_set( &privileges
, &mask
) ) {
1643 DEBUG(10,("_lsa_EnumPrivsAccount: %s has %d privileges\n",
1644 sid_string_dbg(&info
->sid
),
1647 priv_set
= TALLOC_ZERO_P(p
->mem_ctx
, struct lsa_PrivilegeSet
);
1649 status
= NT_STATUS_NO_MEMORY
;
1653 luid_attrs
= TALLOC_ZERO_ARRAY(p
->mem_ctx
,
1654 struct lsa_LUIDAttribute
,
1657 status
= NT_STATUS_NO_MEMORY
;
1661 for (i
=0; i
<privileges
.count
; i
++) {
1662 luid_attrs
[i
].luid
.low
= privileges
.set
[i
].luid
.low
;
1663 luid_attrs
[i
].luid
.high
= privileges
.set
[i
].luid
.high
;
1664 luid_attrs
[i
].attribute
= privileges
.set
[i
].attr
;
1667 priv_set
->count
= privileges
.count
;
1668 priv_set
->unknown
= 0;
1669 priv_set
->set
= luid_attrs
;
1671 *r
->out
.privs
= priv_set
;
1673 status
= NT_STATUS_NO_SUCH_PRIVILEGE
;
1677 privilege_set_free( &privileges
);
1682 /***************************************************************************
1683 _lsa_GetSystemAccessAccount
1684 ***************************************************************************/
1686 NTSTATUS
_lsa_GetSystemAccessAccount(pipes_struct
*p
,
1687 struct lsa_GetSystemAccessAccount
*r
)
1689 struct lsa_info
*info
=NULL
;
1691 /* find the connection policy handle. */
1693 if (!find_policy_by_hnd(p
, r
->in
.handle
, (void **)(void *)&info
))
1694 return NT_STATUS_INVALID_HANDLE
;
1696 if (!(info
->access
& LSA_POLICY_VIEW_LOCAL_INFORMATION
))
1697 return NT_STATUS_ACCESS_DENIED
;
1699 if (!lookup_sid(p
->mem_ctx
, &info
->sid
, NULL
, NULL
, NULL
))
1700 return NT_STATUS_ACCESS_DENIED
;
1703 0x01 -> Log on locally
1704 0x02 -> Access this computer from network
1705 0x04 -> Log on as a batch job
1706 0x10 -> Log on as a service
1708 they can be ORed together
1711 *r
->out
.access_mask
= PR_LOG_ON_LOCALLY
| PR_ACCESS_FROM_NETWORK
;
1713 return NT_STATUS_OK
;
1716 /***************************************************************************
1717 update the systemaccount information
1718 ***************************************************************************/
1720 NTSTATUS
_lsa_SetSystemAccessAccount(pipes_struct
*p
,
1721 struct lsa_SetSystemAccessAccount
*r
)
1723 struct lsa_info
*info
=NULL
;
1726 /* find the connection policy handle. */
1727 if (!find_policy_by_hnd(p
, r
->in
.handle
, (void **)(void *)&info
))
1728 return NT_STATUS_INVALID_HANDLE
;
1730 /* check to see if the pipe_user is a Domain Admin since
1731 account_pol.tdb was already opened as root, this is all we have */
1733 if ( p
->server_info
->utok
.uid
!= sec_initial_uid()
1734 && !nt_token_check_domain_rid( p
->server_info
->ptok
,
1735 DOMAIN_GROUP_RID_ADMINS
) )
1736 return NT_STATUS_ACCESS_DENIED
;
1738 if (!pdb_getgrsid(&map
, info
->sid
))
1739 return NT_STATUS_NO_SUCH_GROUP
;
1741 return pdb_update_group_mapping_entry(&map
);
1744 /***************************************************************************
1745 _lsa_AddPrivilegesToAccount
1746 For a given SID, add some privileges.
1747 ***************************************************************************/
1749 NTSTATUS
_lsa_AddPrivilegesToAccount(pipes_struct
*p
,
1750 struct lsa_AddPrivilegesToAccount
*r
)
1752 struct lsa_info
*info
= NULL
;
1754 struct lsa_PrivilegeSet
*set
= NULL
;
1756 /* find the connection policy handle. */
1757 if (!find_policy_by_hnd(p
, r
->in
.handle
, (void **)(void *)&info
))
1758 return NT_STATUS_INVALID_HANDLE
;
1760 /* check to see if the pipe_user is root or a Domain Admin since
1761 account_pol.tdb was already opened as root, this is all we have */
1763 if ( p
->server_info
->utok
.uid
!= sec_initial_uid()
1764 && !nt_token_check_domain_rid( p
->server_info
->ptok
,
1765 DOMAIN_GROUP_RID_ADMINS
) )
1767 return NT_STATUS_ACCESS_DENIED
;
1771 if ( !privilege_set_to_se_priv( &mask
, set
) )
1772 return NT_STATUS_NO_SUCH_PRIVILEGE
;
1774 if ( !grant_privilege( &info
->sid
, &mask
) ) {
1775 DEBUG(3,("_lsa_AddPrivilegesToAccount: grant_privilege(%s) failed!\n",
1776 sid_string_dbg(&info
->sid
) ));
1777 DEBUG(3,("Privilege mask:\n"));
1778 dump_se_priv( DBGC_ALL
, 3, &mask
);
1779 return NT_STATUS_NO_SUCH_PRIVILEGE
;
1782 return NT_STATUS_OK
;
1785 /***************************************************************************
1786 _lsa_RemovePrivilegesFromAccount
1787 For a given SID, remove some privileges.
1788 ***************************************************************************/
1790 NTSTATUS
_lsa_RemovePrivilegesFromAccount(pipes_struct
*p
,
1791 struct lsa_RemovePrivilegesFromAccount
*r
)
1793 struct lsa_info
*info
= NULL
;
1795 struct lsa_PrivilegeSet
*set
= NULL
;
1797 /* find the connection policy handle. */
1798 if (!find_policy_by_hnd(p
, r
->in
.handle
, (void **)(void *)&info
))
1799 return NT_STATUS_INVALID_HANDLE
;
1801 /* check to see if the pipe_user is root or a Domain Admin since
1802 account_pol.tdb was already opened as root, this is all we have */
1804 if ( p
->server_info
->utok
.uid
!= sec_initial_uid()
1805 && !nt_token_check_domain_rid( p
->server_info
->ptok
,
1806 DOMAIN_GROUP_RID_ADMINS
) )
1808 return NT_STATUS_ACCESS_DENIED
;
1813 if ( !privilege_set_to_se_priv( &mask
, set
) )
1814 return NT_STATUS_NO_SUCH_PRIVILEGE
;
1816 if ( !revoke_privilege( &info
->sid
, &mask
) ) {
1817 DEBUG(3,("_lsa_RemovePrivilegesFromAccount: revoke_privilege(%s) failed!\n",
1818 sid_string_dbg(&info
->sid
) ));
1819 DEBUG(3,("Privilege mask:\n"));
1820 dump_se_priv( DBGC_ALL
, 3, &mask
);
1821 return NT_STATUS_NO_SUCH_PRIVILEGE
;
1824 return NT_STATUS_OK
;
1827 /***************************************************************************
1829 ***************************************************************************/
1831 NTSTATUS
_lsa_QuerySecurity(pipes_struct
*p
,
1832 struct lsa_QuerySecurity
*r
)
1834 struct lsa_info
*handle
=NULL
;
1835 SEC_DESC
*psd
= NULL
;
1839 /* find the connection policy handle. */
1840 if (!find_policy_by_hnd(p
, r
->in
.handle
, (void **)(void *)&handle
))
1841 return NT_STATUS_INVALID_HANDLE
;
1843 /* check if the user has enough rights */
1844 if (!(handle
->access
& LSA_POLICY_VIEW_LOCAL_INFORMATION
))
1845 return NT_STATUS_ACCESS_DENIED
;
1847 switch (r
->in
.sec_info
) {
1849 /* SD contains only the owner */
1851 status
=lsa_get_generic_sd(p
->mem_ctx
, &psd
, &sd_size
);
1852 if(!NT_STATUS_IS_OK(status
))
1853 return NT_STATUS_NO_MEMORY
;
1856 if((*r
->out
.sdbuf
= make_sec_desc_buf(p
->mem_ctx
, sd_size
, psd
)) == NULL
)
1857 return NT_STATUS_NO_MEMORY
;
1860 /* SD contains only the ACL */
1862 status
=lsa_get_generic_sd(p
->mem_ctx
, &psd
, &sd_size
);
1863 if(!NT_STATUS_IS_OK(status
))
1864 return NT_STATUS_NO_MEMORY
;
1866 if((*r
->out
.sdbuf
= make_sec_desc_buf(p
->mem_ctx
, sd_size
, psd
)) == NULL
)
1867 return NT_STATUS_NO_MEMORY
;
1870 return NT_STATUS_INVALID_LEVEL
;
1876 #if 0 /* AD DC work in ongoing in Samba 4 */
1878 /***************************************************************************
1879 ***************************************************************************/
1881 NTSTATUS
_lsa_query_info2(pipes_struct
*p
, LSA_Q_QUERY_INFO2
*q_u
, LSA_R_QUERY_INFO2
*r_u
)
1883 struct lsa_info
*handle
;
1884 const char *nb_name
;
1885 char *dns_name
= NULL
;
1886 char *forest_name
= NULL
;
1887 DOM_SID
*sid
= NULL
;
1892 r_u
->status
= NT_STATUS_OK
;
1894 if (!find_policy_by_hnd(p
, &q_u
->pol
, (void **)(void *)&handle
))
1895 return NT_STATUS_INVALID_HANDLE
;
1897 switch (q_u
->info_class
) {
1899 /* check if the user has enough rights */
1900 if (!(handle
->access
& LSA_POLICY_VIEW_LOCAL_INFORMATION
))
1901 return NT_STATUS_ACCESS_DENIED
;
1903 /* Request PolicyPrimaryDomainInformation. */
1904 switch (lp_server_role()) {
1905 case ROLE_DOMAIN_PDC
:
1906 case ROLE_DOMAIN_BDC
:
1907 nb_name
= get_global_sam_name();
1908 /* ugly temp hack for these next two */
1910 /* This should be a 'netbios domain -> DNS domain' mapping */
1911 dnsdomname
= get_mydnsdomname(p
->mem_ctx
);
1912 if (!dnsdomname
|| !*dnsdomname
) {
1913 return NT_STATUS_CANT_ACCESS_DOMAIN_INFO
;
1915 strlower_m(dnsdomname
);
1917 dns_name
= dnsdomname
;
1918 forest_name
= dnsdomname
;
1920 sid
= get_global_sam_sid();
1921 secrets_fetch_domain_guid(lp_workgroup(), &guid
);
1924 return NT_STATUS_CANT_ACCESS_DOMAIN_INFO
;
1926 init_dns_dom_info(&r_u
->info
.dns_dom_info
, nb_name
, dns_name
,
1927 forest_name
,&guid
,sid
);
1930 DEBUG(0,("_lsa_query_info2: unknown info level in Lsa Query: %d\n", q_u
->info_class
));
1931 r_u
->status
= NT_STATUS_INVALID_INFO_CLASS
;
1935 if (NT_STATUS_IS_OK(r_u
->status
)) {
1937 r_u
->info_class
= q_u
->info_class
;
1942 #endif /* AD DC work in ongoing in Samba 4 */
1944 /***************************************************************************
1945 _lsa_AddAccountRights
1946 ***************************************************************************/
1948 NTSTATUS
_lsa_AddAccountRights(pipes_struct
*p
,
1949 struct lsa_AddAccountRights
*r
)
1951 struct lsa_info
*info
= NULL
;
1955 /* find the connection policy handle. */
1956 if (!find_policy_by_hnd(p
, r
->in
.handle
, (void **)(void *)&info
))
1957 return NT_STATUS_INVALID_HANDLE
;
1959 /* check to see if the pipe_user is a Domain Admin since
1960 account_pol.tdb was already opened as root, this is all we have */
1962 if ( p
->server_info
->utok
.uid
!= sec_initial_uid()
1963 && !nt_token_check_domain_rid( p
->server_info
->ptok
,
1964 DOMAIN_GROUP_RID_ADMINS
) )
1966 return NT_STATUS_ACCESS_DENIED
;
1969 /* according to an NT4 PDC, you can add privileges to SIDs even without
1970 call_lsa_create_account() first. And you can use any arbitrary SID. */
1972 sid_copy( &sid
, r
->in
.sid
);
1974 for ( i
=0; i
< r
->in
.rights
->count
; i
++ ) {
1976 const char *privname
= r
->in
.rights
->names
[i
].string
;
1978 /* only try to add non-null strings */
1983 if ( !grant_privilege_by_name( &sid
, privname
) ) {
1984 DEBUG(2,("_lsa_AddAccountRights: Failed to add privilege [%s]\n",
1986 return NT_STATUS_NO_SUCH_PRIVILEGE
;
1990 return NT_STATUS_OK
;
1993 /***************************************************************************
1994 _lsa_RemoveAccountRights
1995 ***************************************************************************/
1997 NTSTATUS
_lsa_RemoveAccountRights(pipes_struct
*p
,
1998 struct lsa_RemoveAccountRights
*r
)
2000 struct lsa_info
*info
= NULL
;
2003 const char *privname
= NULL
;
2005 /* find the connection policy handle. */
2006 if (!find_policy_by_hnd(p
, r
->in
.handle
, (void **)(void *)&info
))
2007 return NT_STATUS_INVALID_HANDLE
;
2009 /* check to see if the pipe_user is a Domain Admin since
2010 account_pol.tdb was already opened as root, this is all we have */
2012 if ( p
->server_info
->utok
.uid
!= sec_initial_uid()
2013 && !nt_token_check_domain_rid( p
->server_info
->ptok
,
2014 DOMAIN_GROUP_RID_ADMINS
) )
2016 return NT_STATUS_ACCESS_DENIED
;
2019 sid_copy( &sid
, r
->in
.sid
);
2021 if ( r
->in
.remove_all
) {
2022 if ( !revoke_all_privileges( &sid
) )
2023 return NT_STATUS_ACCESS_DENIED
;
2025 return NT_STATUS_OK
;
2028 for ( i
=0; i
< r
->in
.rights
->count
; i
++ ) {
2030 privname
= r
->in
.rights
->names
[i
].string
;
2032 /* only try to add non-null strings */
2037 if ( !revoke_privilege_by_name( &sid
, privname
) ) {
2038 DEBUG(2,("_lsa_RemoveAccountRights: Failed to revoke privilege [%s]\n",
2040 return NT_STATUS_NO_SUCH_PRIVILEGE
;
2044 return NT_STATUS_OK
;
2047 /*******************************************************************
2048 ********************************************************************/
2050 static NTSTATUS
init_lsa_right_set(TALLOC_CTX
*mem_ctx
,
2051 struct lsa_RightSet
*r
,
2052 PRIVILEGE_SET
*privileges
)
2055 const char *privname
;
2056 const char **privname_array
= NULL
;
2059 for (i
=0; i
<privileges
->count
; i
++) {
2061 privname
= luid_to_privilege_name(&privileges
->set
[i
].luid
);
2063 if (!add_string_to_array(mem_ctx
, privname
,
2064 &privname_array
, &num_priv
)) {
2065 return NT_STATUS_NO_MEMORY
;
2072 r
->names
= TALLOC_ZERO_ARRAY(mem_ctx
, struct lsa_StringLarge
,
2075 return NT_STATUS_NO_MEMORY
;
2078 for (i
=0; i
<num_priv
; i
++) {
2079 init_lsa_StringLarge(&r
->names
[i
], privname_array
[i
]);
2082 r
->count
= num_priv
;
2085 return NT_STATUS_OK
;
2088 /***************************************************************************
2089 _lsa_EnumAccountRights
2090 ***************************************************************************/
2092 NTSTATUS
_lsa_EnumAccountRights(pipes_struct
*p
,
2093 struct lsa_EnumAccountRights
*r
)
2096 struct lsa_info
*info
= NULL
;
2098 PRIVILEGE_SET privileges
;
2101 /* find the connection policy handle. */
2103 if (!find_policy_by_hnd(p
, r
->in
.handle
, (void **)(void *)&info
))
2104 return NT_STATUS_INVALID_HANDLE
;
2106 if (!(info
->access
& LSA_POLICY_VIEW_LOCAL_INFORMATION
))
2107 return NT_STATUS_ACCESS_DENIED
;
2109 /* according to an NT4 PDC, you can add privileges to SIDs even without
2110 call_lsa_create_account() first. And you can use any arbitrary SID. */
2112 sid_copy( &sid
, r
->in
.sid
);
2114 if ( !get_privileges_for_sids( &mask
, &sid
, 1 ) )
2115 return NT_STATUS_OBJECT_NAME_NOT_FOUND
;
2117 privilege_set_init( &privileges
);
2119 if ( se_priv_to_privilege_set( &privileges
, &mask
) ) {
2121 DEBUG(10,("_lsa_EnumAccountRights: %s has %d privileges\n",
2122 sid_string_dbg(&sid
), privileges
.count
));
2124 status
= init_lsa_right_set(p
->mem_ctx
, r
->out
.rights
, &privileges
);
2126 status
= NT_STATUS_NO_SUCH_PRIVILEGE
;
2129 privilege_set_free( &privileges
);
2134 /***************************************************************************
2135 _lsa_LookupPrivValue
2136 ***************************************************************************/
2138 NTSTATUS
_lsa_LookupPrivValue(pipes_struct
*p
,
2139 struct lsa_LookupPrivValue
*r
)
2141 struct lsa_info
*info
= NULL
;
2142 const char *name
= NULL
;
2143 LUID_ATTR priv_luid
;
2146 /* find the connection policy handle. */
2148 if (!find_policy_by_hnd(p
, r
->in
.handle
, (void **)(void *)&info
))
2149 return NT_STATUS_INVALID_HANDLE
;
2151 if (!(info
->access
& LSA_POLICY_VIEW_LOCAL_INFORMATION
))
2152 return NT_STATUS_ACCESS_DENIED
;
2154 name
= r
->in
.name
->string
;
2156 DEBUG(10,("_lsa_lookup_priv_value: name = %s\n", name
));
2158 if ( !se_priv_from_name( name
, &mask
) )
2159 return NT_STATUS_NO_SUCH_PRIVILEGE
;
2161 priv_luid
= get_privilege_luid( &mask
);
2163 r
->out
.luid
->low
= priv_luid
.luid
.low
;
2164 r
->out
.luid
->high
= priv_luid
.luid
.high
;
2166 return NT_STATUS_OK
;
2170 * From here on the server routines are just dummy ones to make smbd link with
2171 * librpc/gen_ndr/srv_lsa.c. These routines are actually never called, we are
2172 * pulling the server stubs across one by one.
2175 NTSTATUS
_lsa_Delete(pipes_struct
*p
, struct lsa_Delete
*r
)
2177 p
->rng_fault_state
= True
;
2178 return NT_STATUS_NOT_IMPLEMENTED
;
2181 NTSTATUS
_lsa_SetSecObj(pipes_struct
*p
, struct lsa_SetSecObj
*r
)
2183 p
->rng_fault_state
= True
;
2184 return NT_STATUS_NOT_IMPLEMENTED
;
2187 NTSTATUS
_lsa_ChangePassword(pipes_struct
*p
, struct lsa_ChangePassword
*r
)
2189 p
->rng_fault_state
= True
;
2190 return NT_STATUS_NOT_IMPLEMENTED
;
2193 NTSTATUS
_lsa_SetInfoPolicy(pipes_struct
*p
, struct lsa_SetInfoPolicy
*r
)
2195 p
->rng_fault_state
= True
;
2196 return NT_STATUS_NOT_IMPLEMENTED
;
2199 NTSTATUS
_lsa_ClearAuditLog(pipes_struct
*p
, struct lsa_ClearAuditLog
*r
)
2201 p
->rng_fault_state
= True
;
2202 return NT_STATUS_NOT_IMPLEMENTED
;
2205 NTSTATUS
_lsa_GetQuotasForAccount(pipes_struct
*p
, struct lsa_GetQuotasForAccount
*r
)
2207 p
->rng_fault_state
= True
;
2208 return NT_STATUS_NOT_IMPLEMENTED
;
2211 NTSTATUS
_lsa_SetQuotasForAccount(pipes_struct
*p
, struct lsa_SetQuotasForAccount
*r
)
2213 p
->rng_fault_state
= True
;
2214 return NT_STATUS_NOT_IMPLEMENTED
;
2217 NTSTATUS
_lsa_QueryTrustedDomainInfo(pipes_struct
*p
, struct lsa_QueryTrustedDomainInfo
*r
)
2219 p
->rng_fault_state
= True
;
2220 return NT_STATUS_NOT_IMPLEMENTED
;
2223 NTSTATUS
_lsa_SetInformationTrustedDomain(pipes_struct
*p
, struct lsa_SetInformationTrustedDomain
*r
)
2225 p
->rng_fault_state
= True
;
2226 return NT_STATUS_NOT_IMPLEMENTED
;
2229 NTSTATUS
_lsa_QuerySecret(pipes_struct
*p
, struct lsa_QuerySecret
*r
)
2231 p
->rng_fault_state
= True
;
2232 return NT_STATUS_NOT_IMPLEMENTED
;
2235 NTSTATUS
_lsa_LookupPrivName(pipes_struct
*p
, struct lsa_LookupPrivName
*r
)
2237 p
->rng_fault_state
= True
;
2238 return NT_STATUS_NOT_IMPLEMENTED
;
2241 NTSTATUS
_lsa_EnumAccountsWithUserRight(pipes_struct
*p
, struct lsa_EnumAccountsWithUserRight
*r
)
2243 p
->rng_fault_state
= True
;
2244 return NT_STATUS_NOT_IMPLEMENTED
;
2247 NTSTATUS
_lsa_QueryTrustedDomainInfoBySid(pipes_struct
*p
, struct lsa_QueryTrustedDomainInfoBySid
*r
)
2249 p
->rng_fault_state
= True
;
2250 return NT_STATUS_NOT_IMPLEMENTED
;
2253 NTSTATUS
_lsa_SetTrustedDomainInfo(pipes_struct
*p
, struct lsa_SetTrustedDomainInfo
*r
)
2255 p
->rng_fault_state
= True
;
2256 return NT_STATUS_NOT_IMPLEMENTED
;
2259 NTSTATUS
_lsa_DeleteTrustedDomain(pipes_struct
*p
, struct lsa_DeleteTrustedDomain
*r
)
2261 p
->rng_fault_state
= True
;
2262 return NT_STATUS_NOT_IMPLEMENTED
;
2265 NTSTATUS
_lsa_StorePrivateData(pipes_struct
*p
, struct lsa_StorePrivateData
*r
)
2267 p
->rng_fault_state
= True
;
2268 return NT_STATUS_NOT_IMPLEMENTED
;
2271 NTSTATUS
_lsa_RetrievePrivateData(pipes_struct
*p
, struct lsa_RetrievePrivateData
*r
)
2273 p
->rng_fault_state
= True
;
2274 return NT_STATUS_NOT_IMPLEMENTED
;
2277 NTSTATUS
_lsa_QueryInfoPolicy2(pipes_struct
*p
, struct lsa_QueryInfoPolicy2
*r
)
2279 p
->rng_fault_state
= True
;
2280 return NT_STATUS_NOT_IMPLEMENTED
;
2283 NTSTATUS
_lsa_SetInfoPolicy2(pipes_struct
*p
, struct lsa_SetInfoPolicy2
*r
)
2285 p
->rng_fault_state
= True
;
2286 return NT_STATUS_NOT_IMPLEMENTED
;
2289 NTSTATUS
_lsa_QueryTrustedDomainInfoByName(pipes_struct
*p
, struct lsa_QueryTrustedDomainInfoByName
*r
)
2291 p
->rng_fault_state
= True
;
2292 return NT_STATUS_NOT_IMPLEMENTED
;
2295 NTSTATUS
_lsa_SetTrustedDomainInfoByName(pipes_struct
*p
, struct lsa_SetTrustedDomainInfoByName
*r
)
2297 p
->rng_fault_state
= True
;
2298 return NT_STATUS_NOT_IMPLEMENTED
;
2301 NTSTATUS
_lsa_EnumTrustedDomainsEx(pipes_struct
*p
, struct lsa_EnumTrustedDomainsEx
*r
)
2303 p
->rng_fault_state
= True
;
2304 return NT_STATUS_NOT_IMPLEMENTED
;
2307 NTSTATUS
_lsa_CreateTrustedDomainEx(pipes_struct
*p
, struct lsa_CreateTrustedDomainEx
*r
)
2309 p
->rng_fault_state
= True
;
2310 return NT_STATUS_NOT_IMPLEMENTED
;
2313 NTSTATUS
_lsa_CloseTrustedDomainEx(pipes_struct
*p
, struct lsa_CloseTrustedDomainEx
*r
)
2315 p
->rng_fault_state
= True
;
2316 return NT_STATUS_NOT_IMPLEMENTED
;
2319 NTSTATUS
_lsa_QueryDomainInformationPolicy(pipes_struct
*p
, struct lsa_QueryDomainInformationPolicy
*r
)
2321 p
->rng_fault_state
= True
;
2322 return NT_STATUS_NOT_IMPLEMENTED
;
2325 NTSTATUS
_lsa_SetDomainInformationPolicy(pipes_struct
*p
, struct lsa_SetDomainInformationPolicy
*r
)
2327 p
->rng_fault_state
= True
;
2328 return NT_STATUS_NOT_IMPLEMENTED
;
2331 NTSTATUS
_lsa_OpenTrustedDomainByName(pipes_struct
*p
, struct lsa_OpenTrustedDomainByName
*r
)
2333 p
->rng_fault_state
= True
;
2334 return NT_STATUS_NOT_IMPLEMENTED
;
2337 NTSTATUS
_lsa_TestCall(pipes_struct
*p
, struct lsa_TestCall
*r
)
2339 p
->rng_fault_state
= True
;
2340 return NT_STATUS_NOT_IMPLEMENTED
;
2343 NTSTATUS
_lsa_CreateTrustedDomainEx2(pipes_struct
*p
, struct lsa_CreateTrustedDomainEx2
*r
)
2345 p
->rng_fault_state
= True
;
2346 return NT_STATUS_NOT_IMPLEMENTED
;
2349 NTSTATUS
_lsa_CREDRWRITE(pipes_struct
*p
, struct lsa_CREDRWRITE
*r
)
2351 p
->rng_fault_state
= True
;
2352 return NT_STATUS_NOT_IMPLEMENTED
;
2355 NTSTATUS
_lsa_CREDRREAD(pipes_struct
*p
, struct lsa_CREDRREAD
*r
)
2357 p
->rng_fault_state
= True
;
2358 return NT_STATUS_NOT_IMPLEMENTED
;
2361 NTSTATUS
_lsa_CREDRENUMERATE(pipes_struct
*p
, struct lsa_CREDRENUMERATE
*r
)
2363 p
->rng_fault_state
= True
;
2364 return NT_STATUS_NOT_IMPLEMENTED
;
2367 NTSTATUS
_lsa_CREDRWRITEDOMAINCREDENTIALS(pipes_struct
*p
, struct lsa_CREDRWRITEDOMAINCREDENTIALS
*r
)
2369 p
->rng_fault_state
= True
;
2370 return NT_STATUS_NOT_IMPLEMENTED
;
2373 NTSTATUS
_lsa_CREDRREADDOMAINCREDENTIALS(pipes_struct
*p
, struct lsa_CREDRREADDOMAINCREDENTIALS
*r
)
2375 p
->rng_fault_state
= True
;
2376 return NT_STATUS_NOT_IMPLEMENTED
;
2379 NTSTATUS
_lsa_CREDRDELETE(pipes_struct
*p
, struct lsa_CREDRDELETE
*r
)
2381 p
->rng_fault_state
= True
;
2382 return NT_STATUS_NOT_IMPLEMENTED
;
2385 NTSTATUS
_lsa_CREDRGETTARGETINFO(pipes_struct
*p
, struct lsa_CREDRGETTARGETINFO
*r
)
2387 p
->rng_fault_state
= True
;
2388 return NT_STATUS_NOT_IMPLEMENTED
;
2391 NTSTATUS
_lsa_CREDRPROFILELOADED(pipes_struct
*p
, struct lsa_CREDRPROFILELOADED
*r
)
2393 p
->rng_fault_state
= True
;
2394 return NT_STATUS_NOT_IMPLEMENTED
;
2397 NTSTATUS
_lsa_CREDRGETSESSIONTYPES(pipes_struct
*p
, struct lsa_CREDRGETSESSIONTYPES
*r
)
2399 p
->rng_fault_state
= True
;
2400 return NT_STATUS_NOT_IMPLEMENTED
;
2403 NTSTATUS
_lsa_LSARREGISTERAUDITEVENT(pipes_struct
*p
, struct lsa_LSARREGISTERAUDITEVENT
*r
)
2405 p
->rng_fault_state
= True
;
2406 return NT_STATUS_NOT_IMPLEMENTED
;
2409 NTSTATUS
_lsa_LSARGENAUDITEVENT(pipes_struct
*p
, struct lsa_LSARGENAUDITEVENT
*r
)
2411 p
->rng_fault_state
= True
;
2412 return NT_STATUS_NOT_IMPLEMENTED
;
2415 NTSTATUS
_lsa_LSARUNREGISTERAUDITEVENT(pipes_struct
*p
, struct lsa_LSARUNREGISTERAUDITEVENT
*r
)
2417 p
->rng_fault_state
= True
;
2418 return NT_STATUS_NOT_IMPLEMENTED
;
2421 NTSTATUS
_lsa_lsaRQueryForestTrustInformation(pipes_struct
*p
, struct lsa_lsaRQueryForestTrustInformation
*r
)
2423 p
->rng_fault_state
= True
;
2424 return NT_STATUS_NOT_IMPLEMENTED
;
2427 NTSTATUS
_lsa_LSARSETFORESTTRUSTINFORMATION(pipes_struct
*p
, struct lsa_LSARSETFORESTTRUSTINFORMATION
*r
)
2429 p
->rng_fault_state
= True
;
2430 return NT_STATUS_NOT_IMPLEMENTED
;
2433 NTSTATUS
_lsa_CREDRRENAME(pipes_struct
*p
, struct lsa_CREDRRENAME
*r
)
2435 p
->rng_fault_state
= True
;
2436 return NT_STATUS_NOT_IMPLEMENTED
;
2439 NTSTATUS
_lsa_LSAROPENPOLICYSCE(pipes_struct
*p
, struct lsa_LSAROPENPOLICYSCE
*r
)
2441 p
->rng_fault_state
= True
;
2442 return NT_STATUS_NOT_IMPLEMENTED
;
2445 NTSTATUS
_lsa_LSARADTREGISTERSECURITYEVENTSOURCE(pipes_struct
*p
, struct lsa_LSARADTREGISTERSECURITYEVENTSOURCE
*r
)
2447 p
->rng_fault_state
= True
;
2448 return NT_STATUS_NOT_IMPLEMENTED
;
2451 NTSTATUS
_lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE(pipes_struct
*p
, struct lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE
*r
)
2453 p
->rng_fault_state
= True
;
2454 return NT_STATUS_NOT_IMPLEMENTED
;
2457 NTSTATUS
_lsa_LSARADTREPORTSECURITYEVENT(pipes_struct
*p
, struct lsa_LSARADTREPORTSECURITYEVENT
*r
)
2459 p
->rng_fault_state
= True
;
2460 return NT_STATUS_NOT_IMPLEMENTED
;