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.
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 3 of the License, or
17 * (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, see <http://www.gnu.org/licenses/>.
28 /* This is the implementation of the lsa server code. */
33 #define DBGC_CLASS DBGC_RPC_SRV
42 const struct generic_mapping lsa_generic_mapping = {
49 /***************************************************************************
50 init_lsa_ref_domain_list - adds a domain if it's not already in, returns the index.
51 ***************************************************************************/
53 static int init_lsa_ref_domain_list(TALLOC_CTX *mem_ctx,
54 struct lsa_RefDomainList *ref,
60 if (dom_name != NULL) {
61 for (num = 0; num < ref->count; num++) {
62 if (sid_equal(dom_sid, ref->domains[num].sid)) {
70 if (num >= MAX_REF_DOMAINS) {
71 /* index not found, already at maximum domain limit */
76 ref->max_size = MAX_REF_DOMAINS;
78 ref->domains = TALLOC_REALLOC_ARRAY(mem_ctx, ref->domains,
79 struct lsa_DomainInfo, ref->count);
84 init_lsa_StringLarge(&ref->domains[num].name, dom_name);
85 ref->domains[num].sid = sid_dup_talloc(mem_ctx, dom_sid);
86 if (!ref->domains[num].sid) {
94 /*******************************************************************
95 Function to free the per handle data.
96 ********************************************************************/
98 static void free_lsa_info(void *ptr)
100 struct lsa_info *lsa = (struct lsa_info *)ptr;
105 /***************************************************************************
106 initialize a lsa_DomainInfo structure.
107 ***************************************************************************/
109 static void init_dom_query_3(struct lsa_DomainInfo *r,
113 init_lsa_StringLarge(&r->name, name);
117 /***************************************************************************
118 initialize a lsa_DomainInfo structure.
119 ***************************************************************************/
121 static void init_dom_query_5(struct lsa_DomainInfo *r,
125 init_lsa_StringLarge(&r->name, name);
129 /***************************************************************************
130 init_dom_ref - adds a domain if it's not already in, returns the index.
131 ***************************************************************************/
133 static int init_dom_ref(DOM_R_REF *ref, const char *dom_name, DOM_SID *dom_sid)
137 if (dom_name != NULL) {
138 for (num = 0; num < ref->num_ref_doms_1; num++) {
139 if (sid_equal(dom_sid, &ref->ref_dom[num].ref_dom.sid))
143 num = ref->num_ref_doms_1;
146 if (num >= MAX_REF_DOMAINS) {
147 /* index not found, already at maximum domain limit */
151 ref->num_ref_doms_1 = num+1;
152 ref->ptr_ref_dom = 1;
153 ref->max_entries = MAX_REF_DOMAINS;
154 ref->num_ref_doms_2 = num+1;
156 ref->hdr_ref_dom[num].ptr_dom_sid = 1; /* dom sid cannot be NULL. */
158 init_unistr2(&ref->ref_dom[num].uni_dom_name, dom_name, UNI_FLAGS_NONE);
159 init_uni_hdr(&ref->hdr_ref_dom[num].hdr_dom_name, &ref->ref_dom[num].uni_dom_name);
161 init_dom_sid2(&ref->ref_dom[num].ref_dom, dom_sid );
166 /***************************************************************************
167 lookup_lsa_rids. Must be called as root for lookup_name to work.
168 ***************************************************************************/
170 static NTSTATUS lookup_lsa_rids(TALLOC_CTX *mem_ctx,
171 struct lsa_RefDomainList *ref,
172 struct lsa_TranslatedSid *prid,
173 uint32_t num_entries,
174 struct lsa_String *name,
176 uint32_t *pmapped_count)
178 uint32 mapped_count, i;
180 SMB_ASSERT(num_entries <= MAX_LOOKUP_SIDS);
185 for (i = 0; i < num_entries; i++) {
189 const char *full_name;
191 enum lsa_SidType type = SID_NAME_UNKNOWN;
193 /* Split name into domain and user component */
195 full_name = name[i].string;
196 if (full_name == NULL) {
197 return NT_STATUS_NO_MEMORY;
200 DEBUG(5, ("lookup_lsa_rids: looking up name %s\n", full_name));
202 /* We can ignore the result of lookup_name, it will not touch
203 "type" if it's not successful */
205 lookup_name(mem_ctx, full_name, flags, &domain, NULL,
210 case SID_NAME_DOM_GRP:
211 case SID_NAME_DOMAIN:
213 case SID_NAME_WKN_GRP:
214 DEBUG(5, ("init_lsa_rids: %s found\n", full_name));
215 /* Leave these unchanged */
218 /* Don't hand out anything but the list above */
219 DEBUG(5, ("init_lsa_rids: %s not found\n", full_name));
220 type = SID_NAME_UNKNOWN;
227 if (type != SID_NAME_UNKNOWN) {
228 sid_split_rid(&sid, &rid);
229 dom_idx = init_lsa_ref_domain_list(mem_ctx, ref, domain, &sid);
233 init_lsa_translated_sid(&prid[i], type, rid, dom_idx);
236 *pmapped_count = mapped_count;
240 /***************************************************************************
241 lookup_lsa_sids. Must be called as root for lookup_name to work.
242 ***************************************************************************/
244 static NTSTATUS lookup_lsa_sids(TALLOC_CTX *mem_ctx,
245 struct lsa_RefDomainList *ref,
246 struct lsa_TranslatedSid3 *trans_sids,
247 uint32_t num_entries,
248 struct lsa_String *name,
250 uint32 *pmapped_count)
252 uint32 mapped_count, i;
254 SMB_ASSERT(num_entries <= MAX_LOOKUP_SIDS);
259 for (i = 0; i < num_entries; i++) {
263 const char *full_name;
265 enum lsa_SidType type = SID_NAME_UNKNOWN;
267 /* Split name into domain and user component */
269 full_name = name[i].string;
270 if (full_name == NULL) {
271 return NT_STATUS_NO_MEMORY;
274 DEBUG(5, ("init_lsa_sids: looking up name %s\n", full_name));
276 /* We can ignore the result of lookup_name, it will not touch
277 "type" if it's not successful */
279 lookup_name(mem_ctx, full_name, flags, &domain, NULL,
284 case SID_NAME_DOM_GRP:
285 case SID_NAME_DOMAIN:
287 case SID_NAME_WKN_GRP:
288 DEBUG(5, ("init_lsa_sids: %s found\n", full_name));
289 /* Leave these unchanged */
292 /* Don't hand out anything but the list above */
293 DEBUG(5, ("init_lsa_sids: %s not found\n", full_name));
294 type = SID_NAME_UNKNOWN;
301 if (type != SID_NAME_UNKNOWN) {
303 sid_copy(&domain_sid, &sid);
304 sid_split_rid(&domain_sid, &rid);
305 dom_idx = init_lsa_ref_domain_list(mem_ctx, ref, domain, &domain_sid);
309 /* Initialize the lsa_TranslatedSid3 return. */
310 trans_sids[i].sid_type = type;
311 trans_sids[i].sid = sid_dup_talloc(mem_ctx, &sid);
312 trans_sids[i].sid_index = dom_idx;
315 *pmapped_count = mapped_count;
319 /***************************************************************************
320 Init_reply_lookup_sids.
321 ***************************************************************************/
323 static void init_reply_lookup_sids2(LSA_R_LOOKUP_SIDS2 *r_l,
327 r_l->ptr_dom_ref = ref ? 1 : 0;
329 r_l->mapped_count = mapped_count;
332 /***************************************************************************
333 Init_reply_lookup_sids.
334 ***************************************************************************/
336 static void init_reply_lookup_sids3(LSA_R_LOOKUP_SIDS3 *r_l,
340 r_l->ptr_dom_ref = ref ? 1 : 0;
342 r_l->mapped_count = mapped_count;
345 /***************************************************************************
346 Init_reply_lookup_sids.
347 ***************************************************************************/
349 static NTSTATUS init_reply_lookup_sids(TALLOC_CTX *mem_ctx,
350 LSA_R_LOOKUP_SIDS *r_l,
352 LSA_TRANS_NAME_ENUM2 *names,
355 LSA_TRANS_NAME_ENUM *oldnames = &r_l->names;
357 oldnames->num_entries = names->num_entries;
358 oldnames->ptr_trans_names = names->ptr_trans_names;
359 oldnames->num_entries2 = names->num_entries2;
360 oldnames->uni_name = names->uni_name;
362 if (names->num_entries) {
365 oldnames->name = TALLOC_ARRAY(mem_ctx, LSA_TRANS_NAME, names->num_entries);
367 if (!oldnames->name) {
368 return NT_STATUS_NO_MEMORY;
370 for (i = 0; i < names->num_entries; i++) {
371 oldnames->name[i].sid_name_use = names->name[i].sid_name_use;
372 oldnames->name[i].hdr_name = names->name[i].hdr_name;
373 oldnames->name[i].domain_idx = names->name[i].domain_idx;
377 r_l->ptr_dom_ref = ref ? 1 : 0;
379 r_l->mapped_count = mapped_count;
383 static NTSTATUS lsa_get_generic_sd(TALLOC_CTX *mem_ctx, SEC_DESC **sd, size_t *sd_size)
385 DOM_SID local_adm_sid;
393 init_sec_access(&mask, POLICY_EXECUTE);
394 init_sec_ace(&ace[0], &global_sid_World, SEC_ACE_TYPE_ACCESS_ALLOWED, mask, 0);
396 sid_copy(&adm_sid, get_global_sam_sid());
397 sid_append_rid(&adm_sid, DOMAIN_GROUP_RID_ADMINS);
398 init_sec_access(&mask, POLICY_ALL_ACCESS);
399 init_sec_ace(&ace[1], &adm_sid, SEC_ACE_TYPE_ACCESS_ALLOWED, mask, 0);
401 sid_copy(&local_adm_sid, &global_sid_Builtin);
402 sid_append_rid(&local_adm_sid, BUILTIN_ALIAS_RID_ADMINS);
403 init_sec_access(&mask, POLICY_ALL_ACCESS);
404 init_sec_ace(&ace[2], &local_adm_sid, SEC_ACE_TYPE_ACCESS_ALLOWED, mask, 0);
406 if((psa = make_sec_acl(mem_ctx, NT4_ACL_REVISION, 3, ace)) == NULL)
407 return NT_STATUS_NO_MEMORY;
409 if((*sd = make_sec_desc(mem_ctx, SECURITY_DESCRIPTOR_REVISION_1,
410 SEC_DESC_SELF_RELATIVE, &adm_sid, NULL, NULL,
411 psa, sd_size)) == NULL)
412 return NT_STATUS_NO_MEMORY;
417 #if 0 /* AD DC work in ongoing in Samba 4 */
419 /***************************************************************************
421 ***************************************************************************/
423 static void init_dns_dom_info(LSA_DNS_DOM_INFO *r_l, const char *nb_name,
424 const char *dns_name, const char *forest_name,
425 struct GUID *dom_guid, DOM_SID *dom_sid)
427 if (nb_name && *nb_name) {
428 init_unistr2(&r_l->uni_nb_dom_name, nb_name, UNI_FLAGS_NONE);
429 init_uni_hdr(&r_l->hdr_nb_dom_name, &r_l->uni_nb_dom_name);
430 r_l->hdr_nb_dom_name.uni_max_len += 2;
431 r_l->uni_nb_dom_name.uni_max_len += 1;
434 if (dns_name && *dns_name) {
435 init_unistr2(&r_l->uni_dns_dom_name, dns_name, UNI_FLAGS_NONE);
436 init_uni_hdr(&r_l->hdr_dns_dom_name, &r_l->uni_dns_dom_name);
437 r_l->hdr_dns_dom_name.uni_max_len += 2;
438 r_l->uni_dns_dom_name.uni_max_len += 1;
441 if (forest_name && *forest_name) {
442 init_unistr2(&r_l->uni_forest_name, forest_name, UNI_FLAGS_NONE);
443 init_uni_hdr(&r_l->hdr_forest_name, &r_l->uni_forest_name);
444 r_l->hdr_forest_name.uni_max_len += 2;
445 r_l->uni_forest_name.uni_max_len += 1;
448 /* how do we init the guid ? probably should write an init fn */
450 memcpy(&r_l->dom_guid, dom_guid, sizeof(struct GUID));
454 r_l->ptr_dom_sid = 1;
455 init_dom_sid2(&r_l->dom_sid, dom_sid);
458 #endif /* AD DC work in ongoing in Samba 4 */
461 /***************************************************************************
463 ***************************************************************************/
465 NTSTATUS _lsa_OpenPolicy2(pipes_struct *p,
466 struct lsa_OpenPolicy2 *r)
468 struct lsa_info *info;
469 SEC_DESC *psd = NULL;
471 uint32 des_access = r->in.access_mask;
476 /* map the generic bits to the lsa policy ones */
477 se_map_generic(&des_access, &lsa_generic_mapping);
479 /* get the generic lsa policy SD until we store it */
480 lsa_get_generic_sd(p->mem_ctx, &psd, &sd_size);
482 if(!se_access_check(psd, p->pipe_user.nt_user_token, des_access, &acc_granted, &status)) {
483 if (p->pipe_user.ut.uid != sec_initial_uid()) {
486 DEBUG(4,("ACCESS should be DENIED (granted: %#010x; required: %#010x)\n",
487 acc_granted, des_access));
488 DEBUGADD(4,("but overwritten by euid == 0\n"));
491 /* This is needed for lsa_open_account and rpcclient .... :-) */
493 if (p->pipe_user.ut.uid == sec_initial_uid())
494 acc_granted = POLICY_ALL_ACCESS;
496 /* associate the domain SID with the (unique) handle. */
497 if ((info = SMB_MALLOC_P(struct lsa_info)) == NULL)
498 return NT_STATUS_NO_MEMORY;
501 sid_copy(&info->sid,get_global_sam_sid());
502 info->access = acc_granted;
504 /* set up the LSA QUERY INFO response */
505 if (!create_policy_hnd(p, r->out.handle, free_lsa_info, (void *)info))
506 return NT_STATUS_OBJECT_NAME_NOT_FOUND;
511 /***************************************************************************
513 ***************************************************************************/
515 NTSTATUS _lsa_OpenPolicy(pipes_struct *p,
516 struct lsa_OpenPolicy *r)
518 struct lsa_info *info;
519 SEC_DESC *psd = NULL;
521 uint32 des_access= r->in.access_mask;
526 /* map the generic bits to the lsa policy ones */
527 se_map_generic(&des_access, &lsa_generic_mapping);
529 /* get the generic lsa policy SD until we store it */
530 lsa_get_generic_sd(p->mem_ctx, &psd, &sd_size);
532 if(!se_access_check(psd, p->pipe_user.nt_user_token, des_access, &acc_granted, &status)) {
533 if (geteuid() != 0) {
536 DEBUG(4,("ACCESS should be DENIED (granted: %#010x; required: %#010x)\n",
537 acc_granted, des_access));
538 DEBUGADD(4,("but overwritten by euid == 0\n"));
539 acc_granted = des_access;
542 /* associate the domain SID with the (unique) handle. */
543 if ((info = SMB_MALLOC_P(struct lsa_info)) == NULL)
544 return NT_STATUS_NO_MEMORY;
547 sid_copy(&info->sid,get_global_sam_sid());
548 info->access = acc_granted;
550 /* set up the LSA QUERY INFO response */
551 if (!create_policy_hnd(p, r->out.handle, free_lsa_info, (void *)info))
552 return NT_STATUS_OBJECT_NAME_NOT_FOUND;
557 /***************************************************************************
558 _lsa_EnumTrustDom - this needs fixing to do more than return NULL ! JRA.
560 ***************************************************************************/
562 NTSTATUS _lsa_EnumTrustDom(pipes_struct *p,
563 struct lsa_EnumTrustDom *r)
565 struct lsa_info *info;
567 struct trustdom_info **domains;
568 struct lsa_DomainInfo *lsa_domains = NULL;
572 * preferred length is set to 5 as a "our" preferred length
573 * nt sets this parameter to 2
574 * update (20.08.2002): it's not preferred length, but preferred size!
575 * it needs further investigation how to optimally choose this value
577 uint32 max_num_domains =
578 r->in.max_size < 5 ? r->in.max_size : 10;
583 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
584 return NT_STATUS_INVALID_HANDLE;
586 /* check if the user have enough rights */
587 if (!(info->access & POLICY_VIEW_LOCAL_INFORMATION))
588 return NT_STATUS_ACCESS_DENIED;
590 nt_status = pdb_enum_trusteddoms(p->mem_ctx, &num_domains, &domains);
592 if (!NT_STATUS_IS_OK(nt_status)) {
596 if (*r->in.resume_handle < num_domains) {
597 num_thistime = MIN(num_domains, max_num_domains);
599 nt_status = STATUS_MORE_ENTRIES;
601 if (*r->in.resume_handle + num_thistime > num_domains) {
602 num_thistime = num_domains - *r->in.resume_handle;
603 nt_status = NT_STATUS_OK;
606 next_idx = *r->in.resume_handle + num_thistime;
609 next_idx = 0xffffffff;
610 nt_status = NT_STATUS_NO_MORE_ENTRIES;
613 /* set up the lsa_enum_trust_dom response */
615 lsa_domains = TALLOC_ZERO_ARRAY(p->mem_ctx, struct lsa_DomainInfo,
618 return NT_STATUS_NO_MEMORY;
621 for (i=0; i<num_thistime; i++) {
622 init_lsa_StringLarge(&lsa_domains[i].name, domains[i]->name);
623 lsa_domains[i].sid = &domains[i]->sid;
626 *r->out.resume_handle = next_idx;
627 r->out.domains->count = num_thistime;
628 r->out.domains->domains = lsa_domains;
633 /***************************************************************************
635 ***************************************************************************/
637 NTSTATUS _lsa_QueryInfoPolicy(pipes_struct *p,
638 struct lsa_QueryInfoPolicy *r)
640 NTSTATUS status = NT_STATUS_OK;
641 struct lsa_info *handle;
645 union lsa_PolicyInformation *info = NULL;
647 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle))
648 return NT_STATUS_INVALID_HANDLE;
650 info = TALLOC_ZERO_P(p->mem_ctx, union lsa_PolicyInformation);
652 return NT_STATUS_NO_MEMORY;
655 switch (r->in.level) {
659 uint32 policy_def = LSA_AUDIT_POLICY_ALL;
661 /* check if the user have enough rights */
662 if (!(handle->access & POLICY_VIEW_AUDIT_INFORMATION)) {
663 DEBUG(10,("_lsa_QueryInfoPolicy: insufficient access rights\n"));
664 return NT_STATUS_ACCESS_DENIED;
667 /* fake info: We audit everything. ;) */
669 info->audit_events.auditing_mode = true;
670 info->audit_events.count = LSA_AUDIT_NUM_CATEGORIES;
671 info->audit_events.settings = TALLOC_ZERO_ARRAY(p->mem_ctx,
672 enum lsa_PolicyAuditPolicy,
673 info->audit_events.count);
674 if (!info->audit_events.settings) {
675 return NT_STATUS_NO_MEMORY;
678 info->audit_events.settings[LSA_AUDIT_CATEGORY_ACCOUNT_MANAGEMENT] = policy_def;
679 info->audit_events.settings[LSA_AUDIT_CATEGORY_FILE_AND_OBJECT_ACCESS] = policy_def;
680 info->audit_events.settings[LSA_AUDIT_CATEGORY_LOGON] = policy_def;
681 info->audit_events.settings[LSA_AUDIT_CATEGORY_PROCCESS_TRACKING] = policy_def;
682 info->audit_events.settings[LSA_AUDIT_CATEGORY_SECURITY_POLICY_CHANGES] = policy_def;
683 info->audit_events.settings[LSA_AUDIT_CATEGORY_SYSTEM] = policy_def;
684 info->audit_events.settings[LSA_AUDIT_CATEGORY_USE_OF_USER_RIGHTS] = policy_def;
689 /* check if the user have enough rights */
690 if (!(handle->access & POLICY_VIEW_LOCAL_INFORMATION))
691 return NT_STATUS_ACCESS_DENIED;
693 /* Request PolicyPrimaryDomainInformation. */
694 switch (lp_server_role()) {
695 case ROLE_DOMAIN_PDC:
696 case ROLE_DOMAIN_BDC:
697 name = get_global_sam_name();
698 sid = get_global_sam_sid();
700 case ROLE_DOMAIN_MEMBER:
701 name = lp_workgroup();
702 /* We need to return the Domain SID here. */
703 if (secrets_fetch_domain_sid(lp_workgroup(), &domain_sid))
706 return NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
708 case ROLE_STANDALONE:
709 name = lp_workgroup();
713 return NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
715 init_dom_query_3(&info->domain, name, sid);
718 /* check if the user have enough rights */
719 if (!(handle->access & POLICY_VIEW_LOCAL_INFORMATION))
720 return NT_STATUS_ACCESS_DENIED;
722 /* Request PolicyAccountDomainInformation. */
723 name = get_global_sam_name();
724 sid = get_global_sam_sid();
726 init_dom_query_5(&info->account_domain, name, sid);
729 /* check if the user have enough rights */
730 if (!(handle->access & POLICY_VIEW_LOCAL_INFORMATION))
731 return NT_STATUS_ACCESS_DENIED;
733 switch (lp_server_role()) {
734 case ROLE_DOMAIN_BDC:
736 * only a BDC is a backup controller
737 * of the domain, it controls.
743 * any other role is a primary
744 * of the domain, it controls.
751 DEBUG(0,("_lsa_QueryInfoPolicy: unknown info level in Lsa Query: %d\n",
753 status = NT_STATUS_INVALID_INFO_CLASS;
762 /***************************************************************************
763 _lsa_lookup_sids_internal
764 ***************************************************************************/
766 static NTSTATUS _lsa_lookup_sids_internal(pipes_struct *p,
768 uint16_t level, /* input */
769 int num_sids, /* input */
770 struct lsa_SidPtr *sid, /* input */
771 struct lsa_RefDomainList **pp_ref, /* input/output */
772 struct lsa_TranslatedName2 **pp_names,/* input/output */
773 uint32_t *pp_mapped_count) /* input/output */
777 const DOM_SID **sids = NULL;
778 struct lsa_RefDomainList *ref = NULL;
779 uint32 mapped_count = 0;
780 struct lsa_dom_info *dom_infos = NULL;
781 struct lsa_name_info *name_infos = NULL;
782 struct lsa_TranslatedName2 *names = NULL;
784 *pp_mapped_count = 0;
792 sids = TALLOC_ARRAY(p->mem_ctx, const DOM_SID *, num_sids);
793 ref = TALLOC_ZERO_P(p->mem_ctx, struct lsa_RefDomainList);
795 if (sids == NULL || ref == NULL) {
796 return NT_STATUS_NO_MEMORY;
799 for (i=0; i<num_sids; i++) {
800 sids[i] = sid[i].sid;
803 status = lookup_sids(p->mem_ctx, num_sids, sids, level,
804 &dom_infos, &name_infos);
806 if (!NT_STATUS_IS_OK(status)) {
810 names = TALLOC_ARRAY(p->mem_ctx, struct lsa_TranslatedName2, num_sids);
812 return NT_STATUS_NO_MEMORY;
815 for (i=0; i<MAX_REF_DOMAINS; i++) {
817 if (!dom_infos[i].valid) {
821 if (init_lsa_ref_domain_list(mem_ctx, ref,
823 &dom_infos[i].sid) != i) {
824 DEBUG(0, ("Domain %s mentioned twice??\n",
826 return NT_STATUS_INTERNAL_ERROR;
830 for (i=0; i<num_sids; i++) {
831 struct lsa_name_info *name = &name_infos[i];
833 if (name->type == SID_NAME_UNKNOWN) {
836 /* Unknown sids should return the string
837 * representation of the SID. Windows 2003 behaves
838 * rather erratic here, in many cases it returns the
839 * RID as 8 bytes hex, in others it returns the full
840 * SID. We (Jerry/VL) could not figure out which the
841 * hard cases are, so leave it with the SID. */
842 name->name = talloc_asprintf(p->mem_ctx, "%s",
845 if (name->name == NULL) {
846 return NT_STATUS_NO_MEMORY;
852 init_lsa_translated_name2(&names[i], name->type,
853 name->name, name->dom_idx, 0);
856 status = NT_STATUS_NONE_MAPPED;
857 if (mapped_count > 0) {
858 status = (mapped_count < num_sids) ?
859 STATUS_SOME_UNMAPPED : NT_STATUS_OK;
862 DEBUG(10, ("num_sids %d, mapped_count %d, status %s\n",
863 num_sids, mapped_count, nt_errstr(status)));
865 *pp_mapped_count = mapped_count;
872 /***************************************************************************
874 ***************************************************************************/
876 NTSTATUS _lsa_LookupSids(pipes_struct *p,
877 struct lsa_LookupSids *r)
880 struct lsa_info *handle;
881 int num_sids = r->in.sids->num_sids;
882 uint32 mapped_count = 0;
883 struct lsa_RefDomainList *domains = NULL;
884 struct lsa_TranslatedName *names_out = NULL;
885 struct lsa_TranslatedName2 *names = NULL;
888 if ((r->in.level < 1) || (r->in.level > 6)) {
889 return NT_STATUS_INVALID_PARAMETER;
892 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle)) {
893 return NT_STATUS_INVALID_HANDLE;
896 /* check if the user has enough rights */
897 if (!(handle->access & POLICY_LOOKUP_NAMES)) {
898 return NT_STATUS_ACCESS_DENIED;
901 if (num_sids > MAX_LOOKUP_SIDS) {
902 DEBUG(5,("_lsa_LookupSids: limit of %d exceeded, requested %d\n",
903 MAX_LOOKUP_SIDS, num_sids));
904 return NT_STATUS_NONE_MAPPED;
907 status = _lsa_lookup_sids_internal(p,
916 /* Convert from lsa_TranslatedName2 to lsa_TranslatedName */
917 names_out = TALLOC_ARRAY(p->mem_ctx, struct lsa_TranslatedName,
920 return NT_STATUS_NO_MEMORY;
923 for (i=0; i<num_sids; i++) {
924 names_out[i].sid_type = names[i].sid_type;
925 names_out[i].name = names[i].name;
926 names_out[i].sid_index = names[i].sid_index;
929 *r->out.domains = domains;
930 r->out.names->count = num_sids;
931 r->out.names->names = names_out;
932 *r->out.count = mapped_count;
937 /***************************************************************************
939 ***************************************************************************/
941 NTSTATUS _lsa_LookupSids2(pipes_struct *p,
942 struct lsa_LookupSids2 *r)
945 struct lsa_info *handle;
946 int num_sids = r->in.sids->num_sids;
947 uint32 mapped_count = 0;
948 struct lsa_RefDomainList *domains = NULL;
949 struct lsa_TranslatedName2 *names = NULL;
950 bool check_policy = true;
952 switch (p->hdr_req.opnum) {
953 case NDR_LSA_LOOKUPSIDS3:
954 check_policy = false;
956 case NDR_LSA_LOOKUPSIDS2:
961 if ((r->in.level < 1) || (r->in.level > 6)) {
962 return NT_STATUS_INVALID_PARAMETER;
966 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle)) {
967 return NT_STATUS_INVALID_HANDLE;
970 /* check if the user have enough rights */
971 if (!(handle->access & POLICY_LOOKUP_NAMES)) {
972 return NT_STATUS_ACCESS_DENIED;
976 if (num_sids > MAX_LOOKUP_SIDS) {
977 DEBUG(5,("_lsa_LookupSids2: limit of %d exceeded, requested %d\n",
978 MAX_LOOKUP_SIDS, num_sids));
979 return NT_STATUS_NONE_MAPPED;
982 status = _lsa_lookup_sids_internal(p,
991 *r->out.domains = domains;
992 r->out.names->count = num_sids;
993 r->out.names->names = names;
994 *r->out.count = mapped_count;
999 /***************************************************************************
1001 ***************************************************************************/
1003 NTSTATUS _lsa_LookupSids3(pipes_struct *p,
1004 struct lsa_LookupSids3 *r)
1006 struct lsa_LookupSids2 q;
1008 /* No policy handle on this call. Restrict to crypto connections. */
1009 if (p->auth.auth_type != PIPE_AUTH_TYPE_SCHANNEL) {
1010 DEBUG(0,("_lsa_LookupSids3: client %s not using schannel for netlogon\n",
1011 get_remote_machine_name() ));
1012 return NT_STATUS_INVALID_PARAMETER;
1016 q.in.sids = r->in.sids;
1017 q.in.level = r->in.level;
1018 q.in.unknown1 = r->in.unknown1;
1019 q.in.unknown2 = r->in.unknown2;
1020 q.in.names = r->in.names;
1021 q.in.count = r->in.count;
1023 q.out.domains = r->out.domains;
1024 q.out.names = r->out.names;
1025 q.out.count = r->out.count;
1027 return _lsa_LookupSids2(p, &q);
1030 /***************************************************************************
1031 ***************************************************************************/
1033 static int lsa_lookup_level_to_flags(uint16 level)
1039 flags = LOOKUP_NAME_ALL;
1042 flags = LOOKUP_NAME_DOMAIN|LOOKUP_NAME_REMOTE|LOOKUP_NAME_ISOLATED;
1045 flags = LOOKUP_NAME_DOMAIN|LOOKUP_NAME_ISOLATED;
1051 flags = LOOKUP_NAME_NONE;
1058 /***************************************************************************
1060 ***************************************************************************/
1062 NTSTATUS _lsa_LookupNames(pipes_struct *p,
1063 struct lsa_LookupNames *r)
1065 NTSTATUS status = NT_STATUS_NONE_MAPPED;
1066 struct lsa_info *handle;
1067 struct lsa_String *names = r->in.names;
1068 uint32 num_entries = r->in.num_names;
1069 struct lsa_RefDomainList *domains = NULL;
1070 struct lsa_TranslatedSid *rids = NULL;
1071 uint32 mapped_count = 0;
1074 if (num_entries > MAX_LOOKUP_SIDS) {
1075 num_entries = MAX_LOOKUP_SIDS;
1076 DEBUG(5,("_lsa_LookupNames: truncating name lookup list to %d\n",
1080 flags = lsa_lookup_level_to_flags(r->in.level);
1082 domains = TALLOC_ZERO_P(p->mem_ctx, struct lsa_RefDomainList);
1084 return NT_STATUS_NO_MEMORY;
1088 rids = TALLOC_ZERO_ARRAY(p->mem_ctx, struct lsa_TranslatedSid,
1091 return NT_STATUS_NO_MEMORY;
1097 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle)) {
1098 status = NT_STATUS_INVALID_HANDLE;
1102 /* check if the user have enough rights */
1103 if (!(handle->access & POLICY_LOOKUP_NAMES)) {
1104 status = NT_STATUS_ACCESS_DENIED;
1108 /* set up the LSA Lookup RIDs response */
1109 become_root(); /* lookup_name can require root privs */
1110 status = lookup_lsa_rids(p->mem_ctx, domains, rids, num_entries,
1111 names, flags, &mapped_count);
1116 if (NT_STATUS_IS_OK(status) && (num_entries != 0) ) {
1117 if (mapped_count == 0) {
1118 status = NT_STATUS_NONE_MAPPED;
1119 } else if (mapped_count != num_entries) {
1120 status = STATUS_SOME_UNMAPPED;
1124 *r->out.count = num_entries;
1125 *r->out.domains = domains;
1126 r->out.sids->sids = rids;
1127 r->out.sids->count = mapped_count;
1132 /***************************************************************************
1134 ***************************************************************************/
1136 NTSTATUS _lsa_LookupNames2(pipes_struct *p,
1137 struct lsa_LookupNames2 *r)
1140 struct lsa_LookupNames q;
1141 struct lsa_TransSidArray2 *sid_array2 = r->in.sids;
1142 struct lsa_TransSidArray *sid_array = NULL;
1145 sid_array = TALLOC_ZERO_P(p->mem_ctx, struct lsa_TransSidArray);
1147 return NT_STATUS_NO_MEMORY;
1150 q.in.handle = r->in.handle;
1151 q.in.num_names = r->in.num_names;
1152 q.in.names = r->in.names;
1153 q.in.level = r->in.level;
1154 q.in.sids = sid_array;
1155 q.in.count = r->in.count;
1156 /* we do not know what this is for */
1157 /* = r->in.unknown1; */
1158 /* = r->in.unknown2; */
1160 q.out.domains = r->out.domains;
1161 q.out.sids = sid_array;
1162 q.out.count = r->out.count;
1164 status = _lsa_LookupNames(p, &q);
1166 sid_array2->sids = TALLOC_ARRAY(p->mem_ctx, struct lsa_TranslatedSid2, sid_array->count);
1167 if (!sid_array2->sids) {
1168 return NT_STATUS_NO_MEMORY;
1171 for (i=0; i<sid_array->count; i++) {
1172 sid_array2->sids[i].sid_type = sid_array->sids[i].sid_type;
1173 sid_array2->sids[i].rid = sid_array->sids[i].rid;
1174 sid_array2->sids[i].sid_index = sid_array->sids[i].sid_index;
1175 sid_array2->sids[i].unknown = 0;
1178 r->out.sids = sid_array2;
1183 /***************************************************************************
1185 ***************************************************************************/
1187 NTSTATUS _lsa_LookupNames3(pipes_struct *p,
1188 struct lsa_LookupNames3 *r)
1191 struct lsa_info *handle;
1192 struct lsa_String *names = r->in.names;
1193 uint32 num_entries = r->in.num_names;
1194 struct lsa_RefDomainList *domains = NULL;
1195 struct lsa_TranslatedSid3 *trans_sids = NULL;
1196 uint32 mapped_count = 0;
1198 bool check_policy = true;
1200 switch (p->hdr_req.opnum) {
1201 case NDR_LSA_LOOKUPNAMES4:
1202 check_policy = false;
1204 case NDR_LSA_LOOKUPNAMES3:
1206 check_policy = true;
1209 if (num_entries > MAX_LOOKUP_SIDS) {
1210 num_entries = MAX_LOOKUP_SIDS;
1211 DEBUG(5,("_lsa_LookupNames3: truncating name lookup list to %d\n", num_entries));
1214 /* Probably the lookup_level is some sort of bitmask. */
1215 if (r->in.level == 1) {
1216 flags = LOOKUP_NAME_ALL;
1219 domains = TALLOC_ZERO_P(p->mem_ctx, struct lsa_RefDomainList);
1221 return NT_STATUS_NO_MEMORY;
1225 trans_sids = TALLOC_ZERO_ARRAY(p->mem_ctx, struct lsa_TranslatedSid3,
1228 return NT_STATUS_NO_MEMORY;
1236 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle)) {
1237 status = NT_STATUS_INVALID_HANDLE;
1241 /* check if the user have enough rights */
1242 if (!(handle->access & POLICY_LOOKUP_NAMES)) {
1243 status = NT_STATUS_ACCESS_DENIED;
1248 /* set up the LSA Lookup SIDs response */
1249 become_root(); /* lookup_name can require root privs */
1250 status = lookup_lsa_sids(p->mem_ctx, domains, trans_sids, num_entries,
1251 names, flags, &mapped_count);
1256 if (NT_STATUS_IS_OK(status)) {
1257 if (mapped_count == 0) {
1258 status = NT_STATUS_NONE_MAPPED;
1259 } else if (mapped_count != num_entries) {
1260 status = STATUS_SOME_UNMAPPED;
1264 *r->out.count = num_entries;
1265 *r->out.domains = domains;
1266 r->out.sids->sids = trans_sids;
1267 r->out.sids->count = mapped_count;
1272 /***************************************************************************
1274 ***************************************************************************/
1276 NTSTATUS _lsa_LookupNames4(pipes_struct *p,
1277 struct lsa_LookupNames4 *r)
1279 struct lsa_LookupNames3 q;
1281 /* No policy handle on this call. Restrict to crypto connections. */
1282 if (p->auth.auth_type != PIPE_AUTH_TYPE_SCHANNEL) {
1283 DEBUG(0,("_lsa_lookup_names4: client %s not using schannel for netlogon\n",
1284 get_remote_machine_name() ));
1285 return NT_STATUS_INVALID_PARAMETER;
1289 q.in.num_names = r->in.num_names;
1290 q.in.names = r->in.names;
1291 q.in.level = r->in.level;
1292 q.in.unknown1 = r->in.unknown1;
1293 q.in.unknown2 = r->in.unknown2;
1294 q.in.sids = r->in.sids;
1295 q.in.count = r->in.count;
1297 q.out.domains = r->out.domains;
1298 q.out.sids = r->out.sids;
1299 q.out.count = r->out.count;
1301 return _lsa_LookupNames3(p, &q);
1304 /***************************************************************************
1305 _lsa_close. Also weird - needs to check if lsa handle is correct. JRA.
1306 ***************************************************************************/
1308 NTSTATUS _lsa_Close(pipes_struct *p, struct lsa_Close *r)
1310 if (!find_policy_by_hnd(p, r->in.handle, NULL)) {
1311 return NT_STATUS_INVALID_HANDLE;
1314 close_policy_hnd(p, r->in.handle);
1315 return NT_STATUS_OK;
1318 /***************************************************************************
1319 ***************************************************************************/
1321 NTSTATUS _lsa_OpenSecret(pipes_struct *p, struct lsa_OpenSecret *r)
1323 return NT_STATUS_OBJECT_NAME_NOT_FOUND;
1326 /***************************************************************************
1327 ***************************************************************************/
1329 NTSTATUS _lsa_OpenTrustedDomain(pipes_struct *p, struct lsa_OpenTrustedDomain *r)
1331 return NT_STATUS_OBJECT_NAME_NOT_FOUND;
1334 /***************************************************************************
1335 ***************************************************************************/
1337 NTSTATUS _lsa_CreateTrustedDomain(pipes_struct *p, struct lsa_CreateTrustedDomain *r)
1339 return NT_STATUS_ACCESS_DENIED;
1342 /***************************************************************************
1343 ***************************************************************************/
1345 NTSTATUS _lsa_CreateSecret(pipes_struct *p, struct lsa_CreateSecret *r)
1347 return NT_STATUS_ACCESS_DENIED;
1350 /***************************************************************************
1351 ***************************************************************************/
1353 NTSTATUS _lsa_SetSecret(pipes_struct *p, struct lsa_SetSecret *r)
1355 return NT_STATUS_ACCESS_DENIED;
1358 /***************************************************************************
1360 ***************************************************************************/
1362 NTSTATUS _lsa_DeleteObject(pipes_struct *p,
1363 struct lsa_DeleteObject *r)
1365 return NT_STATUS_ACCESS_DENIED;
1368 /***************************************************************************
1370 ***************************************************************************/
1372 NTSTATUS _lsa_EnumPrivs(pipes_struct *p,
1373 struct lsa_EnumPrivs *r)
1375 struct lsa_info *handle;
1377 uint32 enum_context = *r->in.resume_handle;
1378 int num_privs = count_all_privileges();
1379 struct lsa_PrivEntry *entries = NULL;
1382 /* remember that the enum_context starts at 0 and not 1 */
1384 if ( enum_context >= num_privs )
1385 return NT_STATUS_NO_MORE_ENTRIES;
1387 DEBUG(10,("_lsa_EnumPrivs: enum_context:%d total entries:%d\n",
1388 enum_context, num_privs));
1390 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle))
1391 return NT_STATUS_INVALID_HANDLE;
1393 /* check if the user have enough rights
1394 I don't know if it's the right one. not documented. */
1396 if (!(handle->access & POLICY_VIEW_LOCAL_INFORMATION))
1397 return NT_STATUS_ACCESS_DENIED;
1400 entries = TALLOC_ZERO_ARRAY(p->mem_ctx, struct lsa_PrivEntry, num_privs);
1402 return NT_STATUS_NO_MEMORY;
1408 for (i = 0; i < num_privs; i++) {
1409 if( i < enum_context) {
1411 init_lsa_StringLarge(&entries[i].name, NULL);
1413 entries[i].luid.low = 0;
1414 entries[i].luid.high = 0;
1417 init_lsa_StringLarge(&entries[i].name, privs[i].name);
1419 luid = get_privilege_luid( &privs[i].se_priv );
1421 entries[i].luid.low = luid.luid.low;
1422 entries[i].luid.high = luid.luid.high;
1426 enum_context = num_privs;
1428 *r->out.resume_handle = enum_context;
1429 r->out.privs->count = num_privs;
1430 r->out.privs->privs = entries;
1432 return NT_STATUS_OK;
1435 /***************************************************************************
1436 _lsa_LookupPrivDisplayName
1437 ***************************************************************************/
1439 NTSTATUS _lsa_LookupPrivDisplayName(pipes_struct *p,
1440 struct lsa_LookupPrivDisplayName *r)
1442 struct lsa_info *handle;
1443 const char *description;
1444 struct lsa_StringLarge *lsa_name;
1446 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle))
1447 return NT_STATUS_INVALID_HANDLE;
1449 /* check if the user have enough rights */
1452 * I don't know if it's the right one. not documented.
1454 if (!(handle->access & POLICY_VIEW_LOCAL_INFORMATION))
1455 return NT_STATUS_ACCESS_DENIED;
1457 DEBUG(10,("_lsa_LookupPrivDisplayName: name = %s\n", r->in.name->string));
1459 description = get_privilege_dispname(r->in.name->string);
1461 DEBUG(10,("_lsa_LookupPrivDisplayName: doesn't exist\n"));
1462 return NT_STATUS_NO_SUCH_PRIVILEGE;
1465 DEBUG(10,("_lsa_LookupPrivDisplayName: display name = %s\n", description));
1467 lsa_name = TALLOC_ZERO_P(p->mem_ctx, struct lsa_StringLarge);
1469 return NT_STATUS_NO_MEMORY;
1472 init_lsa_StringLarge(lsa_name, description);
1474 *r->out.returned_language_id = r->in.language_id;
1475 *r->out.disp_name = lsa_name;
1477 return NT_STATUS_OK;
1480 /***************************************************************************
1482 ***************************************************************************/
1484 NTSTATUS _lsa_EnumAccounts(pipes_struct *p,
1485 struct lsa_EnumAccounts *r)
1487 struct lsa_info *handle;
1489 int i, j, num_entries;
1491 struct lsa_SidPtr *sids = NULL;
1493 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle))
1494 return NT_STATUS_INVALID_HANDLE;
1496 if (!(handle->access & POLICY_VIEW_LOCAL_INFORMATION))
1497 return NT_STATUS_ACCESS_DENIED;
1502 /* The only way we can currently find out all the SIDs that have been
1503 privileged is to scan all privileges */
1505 status = privilege_enumerate_accounts(&sid_list, &num_entries);
1506 if (!NT_STATUS_IS_OK(status)) {
1510 if (*r->in.resume_handle >= num_entries) {
1511 return NT_STATUS_NO_MORE_ENTRIES;
1514 if (num_entries - *r->in.resume_handle) {
1515 sids = TALLOC_ZERO_ARRAY(p->mem_ctx, struct lsa_SidPtr,
1516 num_entries - *r->in.resume_handle);
1518 SAFE_FREE(sid_list);
1519 return NT_STATUS_NO_MEMORY;
1522 for (i = *r->in.resume_handle, j = 0; i < num_entries; i++, j++) {
1523 sids[j].sid = sid_dup_talloc(p->mem_ctx, &sid_list[i]);
1525 SAFE_FREE(sid_list);
1526 return NT_STATUS_NO_MEMORY;
1531 talloc_free(sid_list);
1533 *r->out.resume_handle = num_entries;
1534 r->out.sids->num_sids = num_entries;
1535 r->out.sids->sids = sids;
1537 return NT_STATUS_OK;
1540 /***************************************************************************
1542 ***************************************************************************/
1544 NTSTATUS _lsa_GetUserName(pipes_struct *p,
1545 struct lsa_GetUserName *r)
1547 const char *username, *domname;
1548 user_struct *vuser = get_valid_user_struct(p->vuid);
1549 struct lsa_String *account_name = NULL;
1550 struct lsa_String *authority_name = NULL;
1553 return NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
1557 * I'm 99% sure this is not the right place to do this,
1558 * global_sid_Anonymous should probably be put into the token
1559 * instead of the guest id -- vl
1561 if (!lookup_sid(p->mem_ctx, &global_sid_Anonymous,
1562 &domname, &username, NULL)) {
1563 return NT_STATUS_NO_MEMORY;
1566 username = vuser->user.smb_name;
1567 domname = vuser->user.domain;
1570 account_name = TALLOC_ZERO_P(p->mem_ctx, struct lsa_String);
1571 if (!account_name) {
1572 return NT_STATUS_NO_MEMORY;
1575 authority_name = TALLOC_ZERO_P(p->mem_ctx, struct lsa_String);
1576 if (!authority_name) {
1577 return NT_STATUS_NO_MEMORY;
1580 init_lsa_String(account_name, username);
1581 init_lsa_String(authority_name, domname);
1583 *r->out.account_name = account_name;
1584 *r->out.authority_name = authority_name;
1586 return NT_STATUS_OK;
1589 /***************************************************************************
1591 ***************************************************************************/
1593 NTSTATUS _lsa_CreateAccount(pipes_struct *p,
1594 struct lsa_CreateAccount *r)
1596 struct lsa_info *handle;
1597 struct lsa_info *info;
1599 /* find the connection policy handle. */
1600 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle))
1601 return NT_STATUS_INVALID_HANDLE;
1603 /* check if the user have enough rights */
1606 * I don't know if it's the right one. not documented.
1607 * but guessed with rpcclient.
1609 if (!(handle->access & POLICY_GET_PRIVATE_INFORMATION))
1610 return NT_STATUS_ACCESS_DENIED;
1612 /* check to see if the pipe_user is a Domain Admin since
1613 account_pol.tdb was already opened as root, this is all we have */
1615 if ( !nt_token_check_domain_rid( p->pipe_user.nt_user_token, DOMAIN_GROUP_RID_ADMINS ) )
1616 return NT_STATUS_ACCESS_DENIED;
1618 if ( is_privileged_sid( r->in.sid ) )
1619 return NT_STATUS_OBJECT_NAME_COLLISION;
1621 /* associate the user/group SID with the (unique) handle. */
1623 if ((info = SMB_MALLOC_P(struct lsa_info)) == NULL)
1624 return NT_STATUS_NO_MEMORY;
1627 info->sid = *r->in.sid;
1628 info->access = r->in.access_mask;
1630 /* get a (unique) handle. open a policy on it. */
1631 if (!create_policy_hnd(p, r->out.acct_handle, free_lsa_info, (void *)info))
1632 return NT_STATUS_OBJECT_NAME_NOT_FOUND;
1634 return privilege_create_account( &info->sid );
1638 /***************************************************************************
1640 ***************************************************************************/
1642 NTSTATUS _lsa_OpenAccount(pipes_struct *p,
1643 struct lsa_OpenAccount *r)
1645 struct lsa_info *handle;
1646 struct lsa_info *info;
1648 /* find the connection policy handle. */
1649 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle))
1650 return NT_STATUS_INVALID_HANDLE;
1652 /* check if the user have enough rights */
1655 * I don't know if it's the right one. not documented.
1656 * but guessed with rpcclient.
1658 if (!(handle->access & POLICY_GET_PRIVATE_INFORMATION))
1659 return NT_STATUS_ACCESS_DENIED;
1661 /* TODO: Fis the parsing routine before reenabling this check! */
1663 if (!lookup_sid(&handle->sid, dom_name, name, &type))
1664 return NT_STATUS_ACCESS_DENIED;
1666 /* associate the user/group SID with the (unique) handle. */
1667 if ((info = SMB_MALLOC_P(struct lsa_info)) == NULL)
1668 return NT_STATUS_NO_MEMORY;
1671 info->sid = *r->in.sid;
1672 info->access = r->in.access_mask;
1674 /* get a (unique) handle. open a policy on it. */
1675 if (!create_policy_hnd(p, r->out.acct_handle, free_lsa_info, (void *)info))
1676 return NT_STATUS_OBJECT_NAME_NOT_FOUND;
1678 return NT_STATUS_OK;
1681 /***************************************************************************
1682 _lsa_EnumPrivsAccount
1683 For a given SID, enumerate all the privilege this account has.
1684 ***************************************************************************/
1686 NTSTATUS _lsa_EnumPrivsAccount(pipes_struct *p,
1687 struct lsa_EnumPrivsAccount *r)
1689 NTSTATUS status = NT_STATUS_OK;
1690 struct lsa_info *info=NULL;
1692 PRIVILEGE_SET privileges;
1693 struct lsa_PrivilegeSet *priv_set = NULL;
1694 struct lsa_LUIDAttribute *luid_attrs = NULL;
1697 /* find the connection policy handle. */
1698 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
1699 return NT_STATUS_INVALID_HANDLE;
1701 if ( !get_privileges_for_sids( &mask, &info->sid, 1 ) )
1702 return NT_STATUS_OBJECT_NAME_NOT_FOUND;
1704 privilege_set_init( &privileges );
1706 if ( se_priv_to_privilege_set( &privileges, &mask ) ) {
1708 DEBUG(10,("_lsa_EnumPrivsAccount: %s has %d privileges\n",
1709 sid_string_dbg(&info->sid),
1712 priv_set = TALLOC_ZERO_P(p->mem_ctx, struct lsa_PrivilegeSet);
1714 status = NT_STATUS_NO_MEMORY;
1718 luid_attrs = TALLOC_ZERO_ARRAY(p->mem_ctx,
1719 struct lsa_LUIDAttribute,
1722 status = NT_STATUS_NO_MEMORY;
1726 for (i=0; i<privileges.count; i++) {
1727 luid_attrs[i].luid.low = privileges.set[i].luid.low;
1728 luid_attrs[i].luid.high = privileges.set[i].luid.high;
1729 luid_attrs[i].attribute = privileges.set[i].attr;
1732 priv_set->count = privileges.count;
1733 priv_set->unknown = 0;
1734 priv_set->set = luid_attrs;
1736 *r->out.privs = priv_set;
1738 status = NT_STATUS_NO_SUCH_PRIVILEGE;
1742 privilege_set_free( &privileges );
1747 /***************************************************************************
1748 _lsa_GetSystemAccessAccount
1749 ***************************************************************************/
1751 NTSTATUS _lsa_GetSystemAccessAccount(pipes_struct *p,
1752 struct lsa_GetSystemAccessAccount *r)
1754 struct lsa_info *info=NULL;
1756 /* find the connection policy handle. */
1758 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
1759 return NT_STATUS_INVALID_HANDLE;
1761 if (!lookup_sid(p->mem_ctx, &info->sid, NULL, NULL, NULL))
1762 return NT_STATUS_ACCESS_DENIED;
1765 0x01 -> Log on locally
1766 0x02 -> Access this computer from network
1767 0x04 -> Log on as a batch job
1768 0x10 -> Log on as a service
1770 they can be ORed together
1773 *r->out.access_mask = PR_LOG_ON_LOCALLY | PR_ACCESS_FROM_NETWORK;
1775 return NT_STATUS_OK;
1778 /***************************************************************************
1779 update the systemaccount information
1780 ***************************************************************************/
1782 NTSTATUS _lsa_SetSystemAccessAccount(pipes_struct *p,
1783 struct lsa_SetSystemAccessAccount *r)
1785 struct lsa_info *info=NULL;
1788 /* find the connection policy handle. */
1789 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
1790 return NT_STATUS_INVALID_HANDLE;
1792 /* check to see if the pipe_user is a Domain Admin since
1793 account_pol.tdb was already opened as root, this is all we have */
1795 if ( !nt_token_check_domain_rid( p->pipe_user.nt_user_token, DOMAIN_GROUP_RID_ADMINS ) )
1796 return NT_STATUS_ACCESS_DENIED;
1798 if (!pdb_getgrsid(&map, info->sid))
1799 return NT_STATUS_NO_SUCH_GROUP;
1801 return pdb_update_group_mapping_entry(&map);
1804 /***************************************************************************
1805 _lsa_AddPrivilegesToAccount
1806 For a given SID, add some privileges.
1807 ***************************************************************************/
1809 NTSTATUS _lsa_AddPrivilegesToAccount(pipes_struct *p,
1810 struct lsa_AddPrivilegesToAccount *r)
1812 struct lsa_info *info = NULL;
1814 struct lsa_PrivilegeSet *set = NULL;
1816 /* find the connection policy handle. */
1817 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
1818 return NT_STATUS_INVALID_HANDLE;
1820 /* check to see if the pipe_user is root or a Domain Admin since
1821 account_pol.tdb was already opened as root, this is all we have */
1823 if ( p->pipe_user.ut.uid != sec_initial_uid()
1824 && !nt_token_check_domain_rid( p->pipe_user.nt_user_token, DOMAIN_GROUP_RID_ADMINS ) )
1826 return NT_STATUS_ACCESS_DENIED;
1830 if ( !privilege_set_to_se_priv( &mask, set ) )
1831 return NT_STATUS_NO_SUCH_PRIVILEGE;
1833 if ( !grant_privilege( &info->sid, &mask ) ) {
1834 DEBUG(3,("_lsa_AddPrivilegesToAccount: grant_privilege(%s) failed!\n",
1835 sid_string_dbg(&info->sid) ));
1836 DEBUG(3,("Privilege mask:\n"));
1837 dump_se_priv( DBGC_ALL, 3, &mask );
1838 return NT_STATUS_NO_SUCH_PRIVILEGE;
1841 return NT_STATUS_OK;
1844 /***************************************************************************
1845 _lsa_RemovePrivilegesFromAccount
1846 For a given SID, remove some privileges.
1847 ***************************************************************************/
1849 NTSTATUS _lsa_RemovePrivilegesFromAccount(pipes_struct *p,
1850 struct lsa_RemovePrivilegesFromAccount *r)
1852 struct lsa_info *info = NULL;
1854 struct lsa_PrivilegeSet *set = NULL;
1856 /* find the connection policy handle. */
1857 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
1858 return NT_STATUS_INVALID_HANDLE;
1860 /* check to see if the pipe_user is root or a Domain Admin since
1861 account_pol.tdb was already opened as root, this is all we have */
1863 if ( p->pipe_user.ut.uid != sec_initial_uid()
1864 && !nt_token_check_domain_rid( p->pipe_user.nt_user_token, DOMAIN_GROUP_RID_ADMINS ) )
1866 return NT_STATUS_ACCESS_DENIED;
1871 if ( !privilege_set_to_se_priv( &mask, set ) )
1872 return NT_STATUS_NO_SUCH_PRIVILEGE;
1874 if ( !revoke_privilege( &info->sid, &mask ) ) {
1875 DEBUG(3,("_lsa_RemovePrivilegesFromAccount: revoke_privilege(%s) failed!\n",
1876 sid_string_dbg(&info->sid) ));
1877 DEBUG(3,("Privilege mask:\n"));
1878 dump_se_priv( DBGC_ALL, 3, &mask );
1879 return NT_STATUS_NO_SUCH_PRIVILEGE;
1882 return NT_STATUS_OK;
1885 /***************************************************************************
1887 ***************************************************************************/
1889 NTSTATUS _lsa_QuerySecurity(pipes_struct *p,
1890 struct lsa_QuerySecurity *r)
1892 struct lsa_info *handle=NULL;
1893 SEC_DESC *psd = NULL;
1897 /* find the connection policy handle. */
1898 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle))
1899 return NT_STATUS_INVALID_HANDLE;
1901 /* check if the user have enough rights */
1902 if (!(handle->access & POLICY_VIEW_LOCAL_INFORMATION))
1903 return NT_STATUS_ACCESS_DENIED;
1906 switch (r->in.sec_info) {
1908 /* SD contains only the owner */
1910 status=lsa_get_generic_sd(p->mem_ctx, &psd, &sd_size);
1911 if(!NT_STATUS_IS_OK(status))
1912 return NT_STATUS_NO_MEMORY;
1915 if((*r->out.sdbuf = make_sec_desc_buf(p->mem_ctx, sd_size, psd)) == NULL)
1916 return NT_STATUS_NO_MEMORY;
1919 /* SD contains only the ACL */
1921 status=lsa_get_generic_sd(p->mem_ctx, &psd, &sd_size);
1922 if(!NT_STATUS_IS_OK(status))
1923 return NT_STATUS_NO_MEMORY;
1925 if((*r->out.sdbuf = make_sec_desc_buf(p->mem_ctx, sd_size, psd)) == NULL)
1926 return NT_STATUS_NO_MEMORY;
1929 return NT_STATUS_INVALID_LEVEL;
1935 #if 0 /* AD DC work in ongoing in Samba 4 */
1937 /***************************************************************************
1938 ***************************************************************************/
1940 NTSTATUS _lsa_query_info2(pipes_struct *p, LSA_Q_QUERY_INFO2 *q_u, LSA_R_QUERY_INFO2 *r_u)
1942 struct lsa_info *handle;
1943 const char *nb_name;
1944 char *dns_name = NULL;
1945 char *forest_name = NULL;
1946 DOM_SID *sid = NULL;
1951 r_u->status = NT_STATUS_OK;
1953 if (!find_policy_by_hnd(p, &q_u->pol, (void **)(void *)&handle))
1954 return NT_STATUS_INVALID_HANDLE;
1956 switch (q_u->info_class) {
1958 /* check if the user have enough rights */
1959 if (!(handle->access & POLICY_VIEW_LOCAL_INFORMATION))
1960 return NT_STATUS_ACCESS_DENIED;
1962 /* Request PolicyPrimaryDomainInformation. */
1963 switch (lp_server_role()) {
1964 case ROLE_DOMAIN_PDC:
1965 case ROLE_DOMAIN_BDC:
1966 nb_name = get_global_sam_name();
1967 /* ugly temp hack for these next two */
1969 /* This should be a 'netbios domain -> DNS domain' mapping */
1970 dnsdomname = get_mydnsdomname(p->mem_ctx);
1971 if (!dnsdomname || !*dnsdomname) {
1972 return NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
1974 strlower_m(dnsdomname);
1976 dns_name = dnsdomname;
1977 forest_name = dnsdomname;
1979 sid = get_global_sam_sid();
1980 secrets_fetch_domain_guid(lp_workgroup(), &guid);
1983 return NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
1985 init_dns_dom_info(&r_u->info.dns_dom_info, nb_name, dns_name,
1986 forest_name,&guid,sid);
1989 DEBUG(0,("_lsa_query_info2: unknown info level in Lsa Query: %d\n", q_u->info_class));
1990 r_u->status = NT_STATUS_INVALID_INFO_CLASS;
1994 if (NT_STATUS_IS_OK(r_u->status)) {
1996 r_u->info_class = q_u->info_class;
2001 #endif /* AD DC work in ongoing in Samba 4 */
2003 /***************************************************************************
2004 _lsa_AddAccountRights
2005 ***************************************************************************/
2007 NTSTATUS _lsa_AddAccountRights(pipes_struct *p,
2008 struct lsa_AddAccountRights *r)
2010 struct lsa_info *info = NULL;
2014 /* find the connection policy handle. */
2015 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
2016 return NT_STATUS_INVALID_HANDLE;
2018 /* check to see if the pipe_user is a Domain Admin since
2019 account_pol.tdb was already opened as root, this is all we have */
2021 if ( p->pipe_user.ut.uid != sec_initial_uid()
2022 && !nt_token_check_domain_rid( p->pipe_user.nt_user_token, DOMAIN_GROUP_RID_ADMINS ) )
2024 return NT_STATUS_ACCESS_DENIED;
2027 /* according to an NT4 PDC, you can add privileges to SIDs even without
2028 call_lsa_create_account() first. And you can use any arbitrary SID. */
2030 sid_copy( &sid, r->in.sid );
2032 for ( i=0; i < r->in.rights->count; i++ ) {
2034 const char *privname = r->in.rights->names[i].string;
2036 /* only try to add non-null strings */
2041 if ( !grant_privilege_by_name( &sid, privname ) ) {
2042 DEBUG(2,("_lsa_AddAccountRights: Failed to add privilege [%s]\n",
2044 return NT_STATUS_NO_SUCH_PRIVILEGE;
2048 return NT_STATUS_OK;
2051 /***************************************************************************
2052 _lsa_RemoveAccountRights
2053 ***************************************************************************/
2055 NTSTATUS _lsa_RemoveAccountRights(pipes_struct *p,
2056 struct lsa_RemoveAccountRights *r)
2058 struct lsa_info *info = NULL;
2061 const char *privname = NULL;
2063 /* find the connection policy handle. */
2064 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
2065 return NT_STATUS_INVALID_HANDLE;
2067 /* check to see if the pipe_user is a Domain Admin since
2068 account_pol.tdb was already opened as root, this is all we have */
2070 if ( p->pipe_user.ut.uid != sec_initial_uid()
2071 && !nt_token_check_domain_rid( p->pipe_user.nt_user_token, DOMAIN_GROUP_RID_ADMINS ) )
2073 return NT_STATUS_ACCESS_DENIED;
2076 sid_copy( &sid, r->in.sid );
2078 if ( r->in.remove_all ) {
2079 if ( !revoke_all_privileges( &sid ) )
2080 return NT_STATUS_ACCESS_DENIED;
2082 return NT_STATUS_OK;
2085 for ( i=0; i < r->in.rights->count; i++ ) {
2087 privname = r->in.rights->names[i].string;
2089 /* only try to add non-null strings */
2094 if ( !revoke_privilege_by_name( &sid, privname ) ) {
2095 DEBUG(2,("_lsa_RemoveAccountRights: Failed to revoke privilege [%s]\n",
2097 return NT_STATUS_NO_SUCH_PRIVILEGE;
2101 return NT_STATUS_OK;
2104 /*******************************************************************
2105 ********************************************************************/
2107 static NTSTATUS init_lsa_right_set(TALLOC_CTX *mem_ctx,
2108 struct lsa_RightSet *r,
2109 PRIVILEGE_SET *privileges)
2112 const char *privname;
2113 const char **privname_array = NULL;
2116 for (i=0; i<privileges->count; i++) {
2118 privname = luid_to_privilege_name(&privileges->set[i].luid);
2120 if (!add_string_to_array(mem_ctx, privname,
2121 &privname_array, &num_priv)) {
2122 return NT_STATUS_NO_MEMORY;
2129 r->names = TALLOC_ZERO_ARRAY(mem_ctx, struct lsa_StringLarge,
2132 return NT_STATUS_NO_MEMORY;
2135 for (i=0; i<num_priv; i++) {
2136 init_lsa_StringLarge(&r->names[i], privname_array[i]);
2139 r->count = num_priv;
2142 return NT_STATUS_OK;
2145 /***************************************************************************
2146 _lsa_EnumAccountRights
2147 ***************************************************************************/
2149 NTSTATUS _lsa_EnumAccountRights(pipes_struct *p,
2150 struct lsa_EnumAccountRights *r)
2153 struct lsa_info *info = NULL;
2155 PRIVILEGE_SET privileges;
2158 /* find the connection policy handle. */
2160 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
2161 return NT_STATUS_INVALID_HANDLE;
2163 /* according to an NT4 PDC, you can add privileges to SIDs even without
2164 call_lsa_create_account() first. And you can use any arbitrary SID. */
2166 sid_copy( &sid, r->in.sid );
2168 if ( !get_privileges_for_sids( &mask, &sid, 1 ) )
2169 return NT_STATUS_OBJECT_NAME_NOT_FOUND;
2171 privilege_set_init( &privileges );
2173 if ( se_priv_to_privilege_set( &privileges, &mask ) ) {
2175 DEBUG(10,("_lsa_EnumAccountRights: %s has %d privileges\n",
2176 sid_string_dbg(&sid), privileges.count));
2178 status = init_lsa_right_set(p->mem_ctx, r->out.rights, &privileges);
2180 status = NT_STATUS_NO_SUCH_PRIVILEGE;
2183 privilege_set_free( &privileges );
2188 /***************************************************************************
2189 _lsa_LookupPrivValue
2190 ***************************************************************************/
2192 NTSTATUS _lsa_LookupPrivValue(pipes_struct *p,
2193 struct lsa_LookupPrivValue *r)
2195 struct lsa_info *info = NULL;
2196 const char *name = NULL;
2197 LUID_ATTR priv_luid;
2200 /* find the connection policy handle. */
2202 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
2203 return NT_STATUS_INVALID_HANDLE;
2205 name = r->in.name->string;
2207 DEBUG(10,("_lsa_lookup_priv_value: name = %s\n", name));
2209 if ( !se_priv_from_name( name, &mask ) )
2210 return NT_STATUS_NO_SUCH_PRIVILEGE;
2212 priv_luid = get_privilege_luid( &mask );
2214 r->out.luid->low = priv_luid.luid.low;
2215 r->out.luid->high = priv_luid.luid.high;
2217 return NT_STATUS_OK;
2221 * From here on the server routines are just dummy ones to make smbd link with
2222 * librpc/gen_ndr/srv_lsa.c. These routines are actually never called, we are
2223 * pulling the server stubs across one by one.
2226 NTSTATUS _lsa_Delete(pipes_struct *p, struct lsa_Delete *r)
2228 p->rng_fault_state = True;
2229 return NT_STATUS_NOT_IMPLEMENTED;
2232 NTSTATUS _lsa_SetSecObj(pipes_struct *p, struct lsa_SetSecObj *r)
2234 p->rng_fault_state = True;
2235 return NT_STATUS_NOT_IMPLEMENTED;
2238 NTSTATUS _lsa_ChangePassword(pipes_struct *p, struct lsa_ChangePassword *r)
2240 p->rng_fault_state = True;
2241 return NT_STATUS_NOT_IMPLEMENTED;
2244 NTSTATUS _lsa_SetInfoPolicy(pipes_struct *p, struct lsa_SetInfoPolicy *r)
2246 p->rng_fault_state = True;
2247 return NT_STATUS_NOT_IMPLEMENTED;
2250 NTSTATUS _lsa_ClearAuditLog(pipes_struct *p, struct lsa_ClearAuditLog *r)
2252 p->rng_fault_state = True;
2253 return NT_STATUS_NOT_IMPLEMENTED;
2256 NTSTATUS _lsa_GetQuotasForAccount(pipes_struct *p, struct lsa_GetQuotasForAccount *r)
2258 p->rng_fault_state = True;
2259 return NT_STATUS_NOT_IMPLEMENTED;
2262 NTSTATUS _lsa_SetQuotasForAccount(pipes_struct *p, struct lsa_SetQuotasForAccount *r)
2264 p->rng_fault_state = True;
2265 return NT_STATUS_NOT_IMPLEMENTED;
2268 NTSTATUS _lsa_QueryTrustedDomainInfo(pipes_struct *p, struct lsa_QueryTrustedDomainInfo *r)
2270 p->rng_fault_state = True;
2271 return NT_STATUS_NOT_IMPLEMENTED;
2274 NTSTATUS _lsa_SetInformationTrustedDomain(pipes_struct *p, struct lsa_SetInformationTrustedDomain *r)
2276 p->rng_fault_state = True;
2277 return NT_STATUS_NOT_IMPLEMENTED;
2280 NTSTATUS _lsa_QuerySecret(pipes_struct *p, struct lsa_QuerySecret *r)
2282 p->rng_fault_state = True;
2283 return NT_STATUS_NOT_IMPLEMENTED;
2286 NTSTATUS _lsa_LookupPrivName(pipes_struct *p, struct lsa_LookupPrivName *r)
2288 p->rng_fault_state = True;
2289 return NT_STATUS_NOT_IMPLEMENTED;
2292 NTSTATUS _lsa_EnumAccountsWithUserRight(pipes_struct *p, struct lsa_EnumAccountsWithUserRight *r)
2294 p->rng_fault_state = True;
2295 return NT_STATUS_NOT_IMPLEMENTED;
2298 NTSTATUS _lsa_QueryTrustedDomainInfoBySid(pipes_struct *p, struct lsa_QueryTrustedDomainInfoBySid *r)
2300 p->rng_fault_state = True;
2301 return NT_STATUS_NOT_IMPLEMENTED;
2304 NTSTATUS _lsa_SetTrustedDomainInfo(pipes_struct *p, struct lsa_SetTrustedDomainInfo *r)
2306 p->rng_fault_state = True;
2307 return NT_STATUS_NOT_IMPLEMENTED;
2310 NTSTATUS _lsa_DeleteTrustedDomain(pipes_struct *p, struct lsa_DeleteTrustedDomain *r)
2312 p->rng_fault_state = True;
2313 return NT_STATUS_NOT_IMPLEMENTED;
2316 NTSTATUS _lsa_StorePrivateData(pipes_struct *p, struct lsa_StorePrivateData *r)
2318 p->rng_fault_state = True;
2319 return NT_STATUS_NOT_IMPLEMENTED;
2322 NTSTATUS _lsa_RetrievePrivateData(pipes_struct *p, struct lsa_RetrievePrivateData *r)
2324 p->rng_fault_state = True;
2325 return NT_STATUS_NOT_IMPLEMENTED;
2328 NTSTATUS _lsa_QueryInfoPolicy2(pipes_struct *p, struct lsa_QueryInfoPolicy2 *r)
2330 p->rng_fault_state = True;
2331 return NT_STATUS_NOT_IMPLEMENTED;
2334 NTSTATUS _lsa_SetInfoPolicy2(pipes_struct *p, struct lsa_SetInfoPolicy2 *r)
2336 p->rng_fault_state = True;
2337 return NT_STATUS_NOT_IMPLEMENTED;
2340 NTSTATUS _lsa_QueryTrustedDomainInfoByName(pipes_struct *p, struct lsa_QueryTrustedDomainInfoByName *r)
2342 p->rng_fault_state = True;
2343 return NT_STATUS_NOT_IMPLEMENTED;
2346 NTSTATUS _lsa_SetTrustedDomainInfoByName(pipes_struct *p, struct lsa_SetTrustedDomainInfoByName *r)
2348 p->rng_fault_state = True;
2349 return NT_STATUS_NOT_IMPLEMENTED;
2352 NTSTATUS _lsa_EnumTrustedDomainsEx(pipes_struct *p, struct lsa_EnumTrustedDomainsEx *r)
2354 p->rng_fault_state = True;
2355 return NT_STATUS_NOT_IMPLEMENTED;
2358 NTSTATUS _lsa_CreateTrustedDomainEx(pipes_struct *p, struct lsa_CreateTrustedDomainEx *r)
2360 p->rng_fault_state = True;
2361 return NT_STATUS_NOT_IMPLEMENTED;
2364 NTSTATUS _lsa_CloseTrustedDomainEx(pipes_struct *p, struct lsa_CloseTrustedDomainEx *r)
2366 p->rng_fault_state = True;
2367 return NT_STATUS_NOT_IMPLEMENTED;
2370 NTSTATUS _lsa_QueryDomainInformationPolicy(pipes_struct *p, struct lsa_QueryDomainInformationPolicy *r)
2372 p->rng_fault_state = True;
2373 return NT_STATUS_NOT_IMPLEMENTED;
2376 NTSTATUS _lsa_SetDomainInformationPolicy(pipes_struct *p, struct lsa_SetDomainInformationPolicy *r)
2378 p->rng_fault_state = True;
2379 return NT_STATUS_NOT_IMPLEMENTED;
2382 NTSTATUS _lsa_OpenTrustedDomainByName(pipes_struct *p, struct lsa_OpenTrustedDomainByName *r)
2384 p->rng_fault_state = True;
2385 return NT_STATUS_NOT_IMPLEMENTED;
2388 NTSTATUS _lsa_TestCall(pipes_struct *p, struct lsa_TestCall *r)
2390 p->rng_fault_state = True;
2391 return NT_STATUS_NOT_IMPLEMENTED;
2394 NTSTATUS _lsa_CreateTrustedDomainEx2(pipes_struct *p, struct lsa_CreateTrustedDomainEx2 *r)
2396 p->rng_fault_state = True;
2397 return NT_STATUS_NOT_IMPLEMENTED;
2400 NTSTATUS _lsa_CREDRWRITE(pipes_struct *p, struct lsa_CREDRWRITE *r)
2402 p->rng_fault_state = True;
2403 return NT_STATUS_NOT_IMPLEMENTED;
2406 NTSTATUS _lsa_CREDRREAD(pipes_struct *p, struct lsa_CREDRREAD *r)
2408 p->rng_fault_state = True;
2409 return NT_STATUS_NOT_IMPLEMENTED;
2412 NTSTATUS _lsa_CREDRENUMERATE(pipes_struct *p, struct lsa_CREDRENUMERATE *r)
2414 p->rng_fault_state = True;
2415 return NT_STATUS_NOT_IMPLEMENTED;
2418 NTSTATUS _lsa_CREDRWRITEDOMAINCREDENTIALS(pipes_struct *p, struct lsa_CREDRWRITEDOMAINCREDENTIALS *r)
2420 p->rng_fault_state = True;
2421 return NT_STATUS_NOT_IMPLEMENTED;
2424 NTSTATUS _lsa_CREDRREADDOMAINCREDENTIALS(pipes_struct *p, struct lsa_CREDRREADDOMAINCREDENTIALS *r)
2426 p->rng_fault_state = True;
2427 return NT_STATUS_NOT_IMPLEMENTED;
2430 NTSTATUS _lsa_CREDRDELETE(pipes_struct *p, struct lsa_CREDRDELETE *r)
2432 p->rng_fault_state = True;
2433 return NT_STATUS_NOT_IMPLEMENTED;
2436 NTSTATUS _lsa_CREDRGETTARGETINFO(pipes_struct *p, struct lsa_CREDRGETTARGETINFO *r)
2438 p->rng_fault_state = True;
2439 return NT_STATUS_NOT_IMPLEMENTED;
2442 NTSTATUS _lsa_CREDRPROFILELOADED(pipes_struct *p, struct lsa_CREDRPROFILELOADED *r)
2444 p->rng_fault_state = True;
2445 return NT_STATUS_NOT_IMPLEMENTED;
2448 NTSTATUS _lsa_CREDRGETSESSIONTYPES(pipes_struct *p, struct lsa_CREDRGETSESSIONTYPES *r)
2450 p->rng_fault_state = True;
2451 return NT_STATUS_NOT_IMPLEMENTED;
2454 NTSTATUS _lsa_LSARREGISTERAUDITEVENT(pipes_struct *p, struct lsa_LSARREGISTERAUDITEVENT *r)
2456 p->rng_fault_state = True;
2457 return NT_STATUS_NOT_IMPLEMENTED;
2460 NTSTATUS _lsa_LSARGENAUDITEVENT(pipes_struct *p, struct lsa_LSARGENAUDITEVENT *r)
2462 p->rng_fault_state = True;
2463 return NT_STATUS_NOT_IMPLEMENTED;
2466 NTSTATUS _lsa_LSARUNREGISTERAUDITEVENT(pipes_struct *p, struct lsa_LSARUNREGISTERAUDITEVENT *r)
2468 p->rng_fault_state = True;
2469 return NT_STATUS_NOT_IMPLEMENTED;
2472 NTSTATUS _lsa_lsaRQueryForestTrustInformation(pipes_struct *p, struct lsa_lsaRQueryForestTrustInformation *r)
2474 p->rng_fault_state = True;
2475 return NT_STATUS_NOT_IMPLEMENTED;
2478 NTSTATUS _lsa_LSARSETFORESTTRUSTINFORMATION(pipes_struct *p, struct lsa_LSARSETFORESTTRUSTINFORMATION *r)
2480 p->rng_fault_state = True;
2481 return NT_STATUS_NOT_IMPLEMENTED;
2484 NTSTATUS _lsa_CREDRRENAME(pipes_struct *p, struct lsa_CREDRRENAME *r)
2486 p->rng_fault_state = True;
2487 return NT_STATUS_NOT_IMPLEMENTED;
2490 NTSTATUS _lsa_LSAROPENPOLICYSCE(pipes_struct *p, struct lsa_LSAROPENPOLICYSCE *r)
2492 p->rng_fault_state = True;
2493 return NT_STATUS_NOT_IMPLEMENTED;
2496 NTSTATUS _lsa_LSARADTREGISTERSECURITYEVENTSOURCE(pipes_struct *p, struct lsa_LSARADTREGISTERSECURITYEVENTSOURCE *r)
2498 p->rng_fault_state = True;
2499 return NT_STATUS_NOT_IMPLEMENTED;
2502 NTSTATUS _lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE(pipes_struct *p, struct lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE *r)
2504 p->rng_fault_state = True;
2505 return NT_STATUS_NOT_IMPLEMENTED;
2508 NTSTATUS _lsa_LSARADTREPORTSECURITYEVENT(pipes_struct *p, struct lsa_LSARADTREPORTSECURITYEVENT *r)
2510 p->rng_fault_state = True;
2511 return NT_STATUS_NOT_IMPLEMENTED;