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,
767 uint16 level, /* input */
768 int num_sids, /* input */
769 const DOM_SID2 *sid, /* input */
770 DOM_R_REF **pp_ref, /* output */
771 LSA_TRANS_NAME_ENUM2 *names, /* input/output */
772 uint32 *pp_mapped_count)
776 const DOM_SID **sids = NULL;
777 DOM_R_REF *ref = NULL;
778 uint32 mapped_count = 0;
779 struct lsa_dom_info *dom_infos = NULL;
780 struct lsa_name_info *name_infos = NULL;
782 *pp_mapped_count = 0;
790 sids = TALLOC_ARRAY(p->mem_ctx, const DOM_SID *, num_sids);
791 ref = TALLOC_ZERO_P(p->mem_ctx, DOM_R_REF);
793 if (sids == NULL || ref == NULL) {
794 return NT_STATUS_NO_MEMORY;
797 for (i=0; i<num_sids; i++) {
798 sids[i] = &sid[i].sid;
801 status = lookup_sids(p->mem_ctx, num_sids, sids, level,
802 &dom_infos, &name_infos);
804 if (!NT_STATUS_IS_OK(status)) {
808 names->name = TALLOC_ARRAY(p->mem_ctx, LSA_TRANS_NAME2, num_sids);
809 names->uni_name = TALLOC_ARRAY(p->mem_ctx, UNISTR2, num_sids);
810 if ((names->name == NULL) || (names->uni_name == NULL)) {
811 return NT_STATUS_NO_MEMORY;
814 for (i=0; i<MAX_REF_DOMAINS; i++) {
816 if (!dom_infos[i].valid) {
820 if (init_dom_ref(ref, dom_infos[i].name,
821 &dom_infos[i].sid) != i) {
822 DEBUG(0, ("Domain %s mentioned twice??\n",
824 return NT_STATUS_INTERNAL_ERROR;
828 for (i=0; i<num_sids; i++) {
829 struct lsa_name_info *name = &name_infos[i];
831 if (name->type == SID_NAME_UNKNOWN) {
834 /* Unknown sids should return the string
835 * representation of the SID. Windows 2003 behaves
836 * rather erratic here, in many cases it returns the
837 * RID as 8 bytes hex, in others it returns the full
838 * SID. We (Jerry/VL) could not figure out which the
839 * hard cases are, so leave it with the SID. */
840 name->name = talloc_asprintf(p->mem_ctx, "%s",
843 if (name->name == NULL) {
844 return NT_STATUS_NO_MEMORY;
849 init_lsa_trans_name2(&names->name[i], &names->uni_name[i],
850 name->type, name->name, name->dom_idx);
853 names->num_entries = num_sids;
854 names->ptr_trans_names = 1;
855 names->num_entries2 = num_sids;
857 status = NT_STATUS_NONE_MAPPED;
858 if (mapped_count > 0) {
859 status = (mapped_count < num_sids) ?
860 STATUS_SOME_UNMAPPED : NT_STATUS_OK;
863 DEBUG(10, ("num_sids %d, mapped_count %d, status %s\n",
864 num_sids, mapped_count, nt_errstr(status)));
866 *pp_mapped_count = mapped_count;
872 /***************************************************************************
874 ***************************************************************************/
876 NTSTATUS _lsa_lookup_sids(pipes_struct *p,
877 LSA_Q_LOOKUP_SIDS *q_u,
878 LSA_R_LOOKUP_SIDS *r_u)
880 struct lsa_info *handle;
881 int num_sids = q_u->sids.num_entries;
882 uint32 mapped_count = 0;
883 DOM_R_REF *ref = NULL;
884 LSA_TRANS_NAME_ENUM2 names;
887 if ((q_u->level < 1) || (q_u->level > 6)) {
888 return NT_STATUS_INVALID_PARAMETER;
891 if (!find_policy_by_hnd(p, &q_u->pol, (void **)(void *)&handle)) {
892 return NT_STATUS_INVALID_HANDLE;
895 /* check if the user has enough rights */
896 if (!(handle->access & POLICY_LOOKUP_NAMES)) {
897 return NT_STATUS_ACCESS_DENIED;
900 if (num_sids > MAX_LOOKUP_SIDS) {
901 DEBUG(5,("_lsa_lookup_sids: limit of %d exceeded, requested %d\n",
902 MAX_LOOKUP_SIDS, num_sids));
903 return NT_STATUS_NONE_MAPPED;
906 r_u->status = _lsa_lookup_sids_internal(p,
914 /* Convert from LSA_TRANS_NAME_ENUM2 to LSA_TRANS_NAME_ENUM */
916 status = init_reply_lookup_sids(p->mem_ctx, r_u, ref, &names, mapped_count);
917 if (!NT_STATUS_IS_OK(status)) {
923 /***************************************************************************
925 ***************************************************************************/
927 NTSTATUS _lsa_lookup_sids2(pipes_struct *p,
928 LSA_Q_LOOKUP_SIDS2 *q_u,
929 LSA_R_LOOKUP_SIDS2 *r_u)
931 struct lsa_info *handle;
932 int num_sids = q_u->sids.num_entries;
933 uint32 mapped_count = 0;
934 DOM_R_REF *ref = NULL;
936 if ((q_u->level < 1) || (q_u->level > 6)) {
937 return NT_STATUS_INVALID_PARAMETER;
940 if (!find_policy_by_hnd(p, &q_u->pol, (void **)(void *)&handle)) {
941 return NT_STATUS_INVALID_HANDLE;
944 /* check if the user have enough rights */
945 if (!(handle->access & POLICY_LOOKUP_NAMES)) {
946 return NT_STATUS_ACCESS_DENIED;
949 if (num_sids > MAX_LOOKUP_SIDS) {
950 DEBUG(5,("_lsa_lookup_sids2: limit of %d exceeded, requested %d\n",
951 MAX_LOOKUP_SIDS, num_sids));
952 return NT_STATUS_NONE_MAPPED;
955 r_u->status = _lsa_lookup_sids_internal(p,
963 init_reply_lookup_sids2(r_u, ref, mapped_count);
967 /***************************************************************************
969 ***************************************************************************/
971 NTSTATUS _lsa_lookup_sids3(pipes_struct *p,
972 LSA_Q_LOOKUP_SIDS3 *q_u,
973 LSA_R_LOOKUP_SIDS3 *r_u)
975 int num_sids = q_u->sids.num_entries;
976 uint32 mapped_count = 0;
977 DOM_R_REF *ref = NULL;
979 if ((q_u->level < 1) || (q_u->level > 6)) {
980 return NT_STATUS_INVALID_PARAMETER;
983 /* No policy handle on this call. Restrict to crypto connections. */
984 if (p->auth.auth_type != PIPE_AUTH_TYPE_SCHANNEL) {
985 DEBUG(0,("_lsa_lookup_sids3: client %s not using schannel for netlogon\n",
986 get_remote_machine_name() ));
987 return NT_STATUS_INVALID_PARAMETER;
990 if (num_sids > MAX_LOOKUP_SIDS) {
991 DEBUG(5,("_lsa_lookup_sids3: limit of %d exceeded, requested %d\n",
992 MAX_LOOKUP_SIDS, num_sids));
993 return NT_STATUS_NONE_MAPPED;
996 r_u->status = _lsa_lookup_sids_internal(p,
1004 init_reply_lookup_sids3(r_u, ref, mapped_count);
1008 static int lsa_lookup_level_to_flags(uint16 level)
1014 flags = LOOKUP_NAME_ALL;
1017 flags = LOOKUP_NAME_DOMAIN|LOOKUP_NAME_REMOTE|LOOKUP_NAME_ISOLATED;
1020 flags = LOOKUP_NAME_DOMAIN|LOOKUP_NAME_ISOLATED;
1026 flags = LOOKUP_NAME_NONE;
1033 /***************************************************************************
1035 ***************************************************************************/
1037 NTSTATUS _lsa_LookupNames(pipes_struct *p,
1038 struct lsa_LookupNames *r)
1040 NTSTATUS status = NT_STATUS_NONE_MAPPED;
1041 struct lsa_info *handle;
1042 struct lsa_String *names = r->in.names;
1043 uint32 num_entries = r->in.num_names;
1044 struct lsa_RefDomainList *domains = NULL;
1045 struct lsa_TranslatedSid *rids = NULL;
1046 uint32 mapped_count = 0;
1049 if (num_entries > MAX_LOOKUP_SIDS) {
1050 num_entries = MAX_LOOKUP_SIDS;
1051 DEBUG(5,("_lsa_LookupNames: truncating name lookup list to %d\n",
1055 flags = lsa_lookup_level_to_flags(r->in.level);
1057 domains = TALLOC_ZERO_P(p->mem_ctx, struct lsa_RefDomainList);
1059 return NT_STATUS_NO_MEMORY;
1063 rids = TALLOC_ZERO_ARRAY(p->mem_ctx, struct lsa_TranslatedSid,
1066 return NT_STATUS_NO_MEMORY;
1072 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle)) {
1073 status = NT_STATUS_INVALID_HANDLE;
1077 /* check if the user have enough rights */
1078 if (!(handle->access & POLICY_LOOKUP_NAMES)) {
1079 status = NT_STATUS_ACCESS_DENIED;
1083 /* set up the LSA Lookup RIDs response */
1084 become_root(); /* lookup_name can require root privs */
1085 status = lookup_lsa_rids(p->mem_ctx, domains, rids, num_entries,
1086 names, flags, &mapped_count);
1091 if (NT_STATUS_IS_OK(status) && (num_entries != 0) ) {
1092 if (mapped_count == 0) {
1093 status = NT_STATUS_NONE_MAPPED;
1094 } else if (mapped_count != num_entries) {
1095 status = STATUS_SOME_UNMAPPED;
1099 *r->out.count = num_entries;
1100 *r->out.domains = domains;
1101 r->out.sids->sids = rids;
1102 r->out.sids->count = mapped_count;
1107 /***************************************************************************
1109 ***************************************************************************/
1111 NTSTATUS _lsa_LookupNames2(pipes_struct *p,
1112 struct lsa_LookupNames2 *r)
1115 struct lsa_LookupNames q;
1116 struct lsa_TransSidArray2 *sid_array2 = r->in.sids;
1117 struct lsa_TransSidArray *sid_array = NULL;
1120 sid_array = TALLOC_ZERO_P(p->mem_ctx, struct lsa_TransSidArray);
1122 return NT_STATUS_NO_MEMORY;
1125 q.in.handle = r->in.handle;
1126 q.in.num_names = r->in.num_names;
1127 q.in.names = r->in.names;
1128 q.in.level = r->in.level;
1129 q.in.sids = sid_array;
1130 q.in.count = r->in.count;
1131 /* we do not know what this is for */
1132 /* = r->in.unknown1; */
1133 /* = r->in.unknown2; */
1135 q.out.domains = r->out.domains;
1136 q.out.sids = sid_array;
1137 q.out.count = r->out.count;
1139 status = _lsa_LookupNames(p, &q);
1141 sid_array2->sids = TALLOC_ARRAY(p->mem_ctx, struct lsa_TranslatedSid2, sid_array->count);
1142 if (!sid_array2->sids) {
1143 return NT_STATUS_NO_MEMORY;
1146 for (i=0; i<sid_array->count; i++) {
1147 sid_array2->sids[i].sid_type = sid_array->sids[i].sid_type;
1148 sid_array2->sids[i].rid = sid_array->sids[i].rid;
1149 sid_array2->sids[i].sid_index = sid_array->sids[i].sid_index;
1150 sid_array2->sids[i].unknown = 0;
1153 r->out.sids = sid_array2;
1158 /***************************************************************************
1160 ***************************************************************************/
1162 NTSTATUS _lsa_LookupNames3(pipes_struct *p,
1163 struct lsa_LookupNames3 *r)
1166 struct lsa_info *handle;
1167 struct lsa_String *names = r->in.names;
1168 uint32 num_entries = r->in.num_names;
1169 struct lsa_RefDomainList *domains = NULL;
1170 struct lsa_TranslatedSid3 *trans_sids = NULL;
1171 uint32 mapped_count = 0;
1173 bool check_policy = true;
1175 switch (p->hdr_req.opnum) {
1176 case NDR_LSA_LOOKUPNAMES4:
1177 check_policy = false;
1179 case NDR_LSA_LOOKUPNAMES3:
1181 check_policy = true;
1184 if (num_entries > MAX_LOOKUP_SIDS) {
1185 num_entries = MAX_LOOKUP_SIDS;
1186 DEBUG(5,("_lsa_LookupNames3: truncating name lookup list to %d\n", num_entries));
1189 /* Probably the lookup_level is some sort of bitmask. */
1190 if (r->in.level == 1) {
1191 flags = LOOKUP_NAME_ALL;
1194 domains = TALLOC_ZERO_P(p->mem_ctx, struct lsa_RefDomainList);
1196 return NT_STATUS_NO_MEMORY;
1200 trans_sids = TALLOC_ZERO_ARRAY(p->mem_ctx, struct lsa_TranslatedSid3,
1203 return NT_STATUS_NO_MEMORY;
1211 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle)) {
1212 status = NT_STATUS_INVALID_HANDLE;
1216 /* check if the user have enough rights */
1217 if (!(handle->access & POLICY_LOOKUP_NAMES)) {
1218 status = NT_STATUS_ACCESS_DENIED;
1223 /* set up the LSA Lookup SIDs response */
1224 become_root(); /* lookup_name can require root privs */
1225 status = lookup_lsa_sids(p->mem_ctx, domains, trans_sids, num_entries,
1226 names, flags, &mapped_count);
1231 if (NT_STATUS_IS_OK(status)) {
1232 if (mapped_count == 0) {
1233 status = NT_STATUS_NONE_MAPPED;
1234 } else if (mapped_count != num_entries) {
1235 status = STATUS_SOME_UNMAPPED;
1239 *r->out.count = num_entries;
1240 *r->out.domains = domains;
1241 r->out.sids->sids = trans_sids;
1242 r->out.sids->count = mapped_count;
1247 /***************************************************************************
1249 ***************************************************************************/
1251 NTSTATUS _lsa_LookupNames4(pipes_struct *p,
1252 struct lsa_LookupNames4 *r)
1254 struct lsa_LookupNames3 q;
1256 /* No policy handle on this call. Restrict to crypto connections. */
1257 if (p->auth.auth_type != PIPE_AUTH_TYPE_SCHANNEL) {
1258 DEBUG(0,("_lsa_lookup_names4: client %s not using schannel for netlogon\n",
1259 get_remote_machine_name() ));
1260 return NT_STATUS_INVALID_PARAMETER;
1264 q.in.num_names = r->in.num_names;
1265 q.in.names = r->in.names;
1266 q.in.level = r->in.level;
1267 q.in.unknown1 = r->in.unknown1;
1268 q.in.unknown2 = r->in.unknown2;
1269 q.in.sids = r->in.sids;
1270 q.in.count = r->in.count;
1272 q.out.domains = r->out.domains;
1273 q.out.sids = r->out.sids;
1274 q.out.count = r->out.count;
1276 return _lsa_LookupNames3(p, &q);
1279 /***************************************************************************
1280 _lsa_close. Also weird - needs to check if lsa handle is correct. JRA.
1281 ***************************************************************************/
1283 NTSTATUS _lsa_Close(pipes_struct *p, struct lsa_Close *r)
1285 if (!find_policy_by_hnd(p, r->in.handle, NULL)) {
1286 return NT_STATUS_INVALID_HANDLE;
1289 close_policy_hnd(p, r->in.handle);
1290 return NT_STATUS_OK;
1293 /***************************************************************************
1294 ***************************************************************************/
1296 NTSTATUS _lsa_OpenSecret(pipes_struct *p, struct lsa_OpenSecret *r)
1298 return NT_STATUS_OBJECT_NAME_NOT_FOUND;
1301 /***************************************************************************
1302 ***************************************************************************/
1304 NTSTATUS _lsa_OpenTrustedDomain(pipes_struct *p, struct lsa_OpenTrustedDomain *r)
1306 return NT_STATUS_OBJECT_NAME_NOT_FOUND;
1309 /***************************************************************************
1310 ***************************************************************************/
1312 NTSTATUS _lsa_CreateTrustedDomain(pipes_struct *p, struct lsa_CreateTrustedDomain *r)
1314 return NT_STATUS_ACCESS_DENIED;
1317 /***************************************************************************
1318 ***************************************************************************/
1320 NTSTATUS _lsa_CreateSecret(pipes_struct *p, struct lsa_CreateSecret *r)
1322 return NT_STATUS_ACCESS_DENIED;
1325 /***************************************************************************
1326 ***************************************************************************/
1328 NTSTATUS _lsa_SetSecret(pipes_struct *p, struct lsa_SetSecret *r)
1330 return NT_STATUS_ACCESS_DENIED;
1333 /***************************************************************************
1335 ***************************************************************************/
1337 NTSTATUS _lsa_DeleteObject(pipes_struct *p,
1338 struct lsa_DeleteObject *r)
1340 return NT_STATUS_ACCESS_DENIED;
1343 /***************************************************************************
1345 ***************************************************************************/
1347 NTSTATUS _lsa_EnumPrivs(pipes_struct *p,
1348 struct lsa_EnumPrivs *r)
1350 struct lsa_info *handle;
1352 uint32 enum_context = *r->in.resume_handle;
1353 int num_privs = count_all_privileges();
1354 struct lsa_PrivEntry *entries = NULL;
1357 /* remember that the enum_context starts at 0 and not 1 */
1359 if ( enum_context >= num_privs )
1360 return NT_STATUS_NO_MORE_ENTRIES;
1362 DEBUG(10,("_lsa_EnumPrivs: enum_context:%d total entries:%d\n",
1363 enum_context, num_privs));
1365 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle))
1366 return NT_STATUS_INVALID_HANDLE;
1368 /* check if the user have enough rights
1369 I don't know if it's the right one. not documented. */
1371 if (!(handle->access & POLICY_VIEW_LOCAL_INFORMATION))
1372 return NT_STATUS_ACCESS_DENIED;
1375 entries = TALLOC_ZERO_ARRAY(p->mem_ctx, struct lsa_PrivEntry, num_privs);
1377 return NT_STATUS_NO_MEMORY;
1383 for (i = 0; i < num_privs; i++) {
1384 if( i < enum_context) {
1386 init_lsa_StringLarge(&entries[i].name, NULL);
1388 entries[i].luid.low = 0;
1389 entries[i].luid.high = 0;
1392 init_lsa_StringLarge(&entries[i].name, privs[i].name);
1394 luid = get_privilege_luid( &privs[i].se_priv );
1396 entries[i].luid.low = luid.luid.low;
1397 entries[i].luid.high = luid.luid.high;
1401 enum_context = num_privs;
1403 *r->out.resume_handle = enum_context;
1404 r->out.privs->count = num_privs;
1405 r->out.privs->privs = entries;
1407 return NT_STATUS_OK;
1410 /***************************************************************************
1411 _lsa_LookupPrivDisplayName
1412 ***************************************************************************/
1414 NTSTATUS _lsa_LookupPrivDisplayName(pipes_struct *p,
1415 struct lsa_LookupPrivDisplayName *r)
1417 struct lsa_info *handle;
1418 const char *description;
1419 struct lsa_StringLarge *lsa_name;
1421 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle))
1422 return NT_STATUS_INVALID_HANDLE;
1424 /* check if the user have enough rights */
1427 * I don't know if it's the right one. not documented.
1429 if (!(handle->access & POLICY_VIEW_LOCAL_INFORMATION))
1430 return NT_STATUS_ACCESS_DENIED;
1432 DEBUG(10,("_lsa_LookupPrivDisplayName: name = %s\n", r->in.name->string));
1434 description = get_privilege_dispname(r->in.name->string);
1436 DEBUG(10,("_lsa_LookupPrivDisplayName: doesn't exist\n"));
1437 return NT_STATUS_NO_SUCH_PRIVILEGE;
1440 DEBUG(10,("_lsa_LookupPrivDisplayName: display name = %s\n", description));
1442 lsa_name = TALLOC_ZERO_P(p->mem_ctx, struct lsa_StringLarge);
1444 return NT_STATUS_NO_MEMORY;
1447 init_lsa_StringLarge(lsa_name, description);
1449 *r->out.returned_language_id = r->in.language_id;
1450 *r->out.disp_name = lsa_name;
1452 return NT_STATUS_OK;
1455 /***************************************************************************
1457 ***************************************************************************/
1459 NTSTATUS _lsa_EnumAccounts(pipes_struct *p,
1460 struct lsa_EnumAccounts *r)
1462 struct lsa_info *handle;
1464 int i, j, num_entries;
1466 struct lsa_SidPtr *sids = NULL;
1468 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle))
1469 return NT_STATUS_INVALID_HANDLE;
1471 if (!(handle->access & POLICY_VIEW_LOCAL_INFORMATION))
1472 return NT_STATUS_ACCESS_DENIED;
1477 /* The only way we can currently find out all the SIDs that have been
1478 privileged is to scan all privileges */
1480 status = privilege_enumerate_accounts(&sid_list, &num_entries);
1481 if (!NT_STATUS_IS_OK(status)) {
1485 if (*r->in.resume_handle >= num_entries) {
1486 return NT_STATUS_NO_MORE_ENTRIES;
1489 if (num_entries - *r->in.resume_handle) {
1490 sids = TALLOC_ZERO_ARRAY(p->mem_ctx, struct lsa_SidPtr,
1491 num_entries - *r->in.resume_handle);
1493 SAFE_FREE(sid_list);
1494 return NT_STATUS_NO_MEMORY;
1497 for (i = *r->in.resume_handle, j = 0; i < num_entries; i++, j++) {
1498 sids[j].sid = sid_dup_talloc(p->mem_ctx, &sid_list[i]);
1500 SAFE_FREE(sid_list);
1501 return NT_STATUS_NO_MEMORY;
1506 talloc_free(sid_list);
1508 *r->out.resume_handle = num_entries;
1509 r->out.sids->num_sids = num_entries;
1510 r->out.sids->sids = sids;
1512 return NT_STATUS_OK;
1515 /***************************************************************************
1517 ***************************************************************************/
1519 NTSTATUS _lsa_GetUserName(pipes_struct *p,
1520 struct lsa_GetUserName *r)
1522 const char *username, *domname;
1523 user_struct *vuser = get_valid_user_struct(p->vuid);
1524 struct lsa_String *account_name = NULL;
1525 struct lsa_String *authority_name = NULL;
1528 return NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
1532 * I'm 99% sure this is not the right place to do this,
1533 * global_sid_Anonymous should probably be put into the token
1534 * instead of the guest id -- vl
1536 if (!lookup_sid(p->mem_ctx, &global_sid_Anonymous,
1537 &domname, &username, NULL)) {
1538 return NT_STATUS_NO_MEMORY;
1541 username = vuser->user.smb_name;
1542 domname = vuser->user.domain;
1545 account_name = TALLOC_ZERO_P(p->mem_ctx, struct lsa_String);
1546 if (!account_name) {
1547 return NT_STATUS_NO_MEMORY;
1550 authority_name = TALLOC_ZERO_P(p->mem_ctx, struct lsa_String);
1551 if (!authority_name) {
1552 return NT_STATUS_NO_MEMORY;
1555 init_lsa_String(account_name, username);
1556 init_lsa_String(authority_name, domname);
1558 *r->out.account_name = account_name;
1559 *r->out.authority_name = authority_name;
1561 return NT_STATUS_OK;
1564 /***************************************************************************
1566 ***************************************************************************/
1568 NTSTATUS _lsa_CreateAccount(pipes_struct *p,
1569 struct lsa_CreateAccount *r)
1571 struct lsa_info *handle;
1572 struct lsa_info *info;
1574 /* find the connection policy handle. */
1575 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle))
1576 return NT_STATUS_INVALID_HANDLE;
1578 /* check if the user have enough rights */
1581 * I don't know if it's the right one. not documented.
1582 * but guessed with rpcclient.
1584 if (!(handle->access & POLICY_GET_PRIVATE_INFORMATION))
1585 return NT_STATUS_ACCESS_DENIED;
1587 /* check to see if the pipe_user is a Domain Admin since
1588 account_pol.tdb was already opened as root, this is all we have */
1590 if ( !nt_token_check_domain_rid( p->pipe_user.nt_user_token, DOMAIN_GROUP_RID_ADMINS ) )
1591 return NT_STATUS_ACCESS_DENIED;
1593 if ( is_privileged_sid( r->in.sid ) )
1594 return NT_STATUS_OBJECT_NAME_COLLISION;
1596 /* associate the user/group SID with the (unique) handle. */
1598 if ((info = SMB_MALLOC_P(struct lsa_info)) == NULL)
1599 return NT_STATUS_NO_MEMORY;
1602 info->sid = *r->in.sid;
1603 info->access = r->in.access_mask;
1605 /* get a (unique) handle. open a policy on it. */
1606 if (!create_policy_hnd(p, r->out.acct_handle, free_lsa_info, (void *)info))
1607 return NT_STATUS_OBJECT_NAME_NOT_FOUND;
1609 return privilege_create_account( &info->sid );
1613 /***************************************************************************
1615 ***************************************************************************/
1617 NTSTATUS _lsa_OpenAccount(pipes_struct *p,
1618 struct lsa_OpenAccount *r)
1620 struct lsa_info *handle;
1621 struct lsa_info *info;
1623 /* find the connection policy handle. */
1624 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle))
1625 return NT_STATUS_INVALID_HANDLE;
1627 /* check if the user have enough rights */
1630 * I don't know if it's the right one. not documented.
1631 * but guessed with rpcclient.
1633 if (!(handle->access & POLICY_GET_PRIVATE_INFORMATION))
1634 return NT_STATUS_ACCESS_DENIED;
1636 /* TODO: Fis the parsing routine before reenabling this check! */
1638 if (!lookup_sid(&handle->sid, dom_name, name, &type))
1639 return NT_STATUS_ACCESS_DENIED;
1641 /* associate the user/group SID with the (unique) handle. */
1642 if ((info = SMB_MALLOC_P(struct lsa_info)) == NULL)
1643 return NT_STATUS_NO_MEMORY;
1646 info->sid = *r->in.sid;
1647 info->access = r->in.access_mask;
1649 /* get a (unique) handle. open a policy on it. */
1650 if (!create_policy_hnd(p, r->out.acct_handle, free_lsa_info, (void *)info))
1651 return NT_STATUS_OBJECT_NAME_NOT_FOUND;
1653 return NT_STATUS_OK;
1656 /***************************************************************************
1657 _lsa_EnumPrivsAccount
1658 For a given SID, enumerate all the privilege this account has.
1659 ***************************************************************************/
1661 NTSTATUS _lsa_EnumPrivsAccount(pipes_struct *p,
1662 struct lsa_EnumPrivsAccount *r)
1664 NTSTATUS status = NT_STATUS_OK;
1665 struct lsa_info *info=NULL;
1667 PRIVILEGE_SET privileges;
1668 struct lsa_PrivilegeSet *priv_set = NULL;
1669 struct lsa_LUIDAttribute *luid_attrs = NULL;
1672 /* find the connection policy handle. */
1673 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
1674 return NT_STATUS_INVALID_HANDLE;
1676 if ( !get_privileges_for_sids( &mask, &info->sid, 1 ) )
1677 return NT_STATUS_OBJECT_NAME_NOT_FOUND;
1679 privilege_set_init( &privileges );
1681 if ( se_priv_to_privilege_set( &privileges, &mask ) ) {
1683 DEBUG(10,("_lsa_EnumPrivsAccount: %s has %d privileges\n",
1684 sid_string_dbg(&info->sid),
1687 priv_set = TALLOC_ZERO_P(p->mem_ctx, struct lsa_PrivilegeSet);
1689 status = NT_STATUS_NO_MEMORY;
1693 luid_attrs = TALLOC_ZERO_ARRAY(p->mem_ctx,
1694 struct lsa_LUIDAttribute,
1697 status = NT_STATUS_NO_MEMORY;
1701 for (i=0; i<privileges.count; i++) {
1702 luid_attrs[i].luid.low = privileges.set[i].luid.low;
1703 luid_attrs[i].luid.high = privileges.set[i].luid.high;
1704 luid_attrs[i].attribute = privileges.set[i].attr;
1707 priv_set->count = privileges.count;
1708 priv_set->unknown = 0;
1709 priv_set->set = luid_attrs;
1711 *r->out.privs = priv_set;
1713 status = NT_STATUS_NO_SUCH_PRIVILEGE;
1717 privilege_set_free( &privileges );
1722 /***************************************************************************
1723 _lsa_GetSystemAccessAccount
1724 ***************************************************************************/
1726 NTSTATUS _lsa_GetSystemAccessAccount(pipes_struct *p,
1727 struct lsa_GetSystemAccessAccount *r)
1729 struct lsa_info *info=NULL;
1731 /* find the connection policy handle. */
1733 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
1734 return NT_STATUS_INVALID_HANDLE;
1736 if (!lookup_sid(p->mem_ctx, &info->sid, NULL, NULL, NULL))
1737 return NT_STATUS_ACCESS_DENIED;
1740 0x01 -> Log on locally
1741 0x02 -> Access this computer from network
1742 0x04 -> Log on as a batch job
1743 0x10 -> Log on as a service
1745 they can be ORed together
1748 *r->out.access_mask = PR_LOG_ON_LOCALLY | PR_ACCESS_FROM_NETWORK;
1750 return NT_STATUS_OK;
1753 /***************************************************************************
1754 update the systemaccount information
1755 ***************************************************************************/
1757 NTSTATUS _lsa_SetSystemAccessAccount(pipes_struct *p,
1758 struct lsa_SetSystemAccessAccount *r)
1760 struct lsa_info *info=NULL;
1763 /* find the connection policy handle. */
1764 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
1765 return NT_STATUS_INVALID_HANDLE;
1767 /* check to see if the pipe_user is a Domain Admin since
1768 account_pol.tdb was already opened as root, this is all we have */
1770 if ( !nt_token_check_domain_rid( p->pipe_user.nt_user_token, DOMAIN_GROUP_RID_ADMINS ) )
1771 return NT_STATUS_ACCESS_DENIED;
1773 if (!pdb_getgrsid(&map, info->sid))
1774 return NT_STATUS_NO_SUCH_GROUP;
1776 return pdb_update_group_mapping_entry(&map);
1779 /***************************************************************************
1780 _lsa_AddPrivilegesToAccount
1781 For a given SID, add some privileges.
1782 ***************************************************************************/
1784 NTSTATUS _lsa_AddPrivilegesToAccount(pipes_struct *p,
1785 struct lsa_AddPrivilegesToAccount *r)
1787 struct lsa_info *info = NULL;
1789 struct lsa_PrivilegeSet *set = NULL;
1791 /* find the connection policy handle. */
1792 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
1793 return NT_STATUS_INVALID_HANDLE;
1795 /* check to see if the pipe_user is root or a Domain Admin since
1796 account_pol.tdb was already opened as root, this is all we have */
1798 if ( p->pipe_user.ut.uid != sec_initial_uid()
1799 && !nt_token_check_domain_rid( p->pipe_user.nt_user_token, DOMAIN_GROUP_RID_ADMINS ) )
1801 return NT_STATUS_ACCESS_DENIED;
1805 if ( !privilege_set_to_se_priv( &mask, set ) )
1806 return NT_STATUS_NO_SUCH_PRIVILEGE;
1808 if ( !grant_privilege( &info->sid, &mask ) ) {
1809 DEBUG(3,("_lsa_AddPrivilegesToAccount: grant_privilege(%s) failed!\n",
1810 sid_string_dbg(&info->sid) ));
1811 DEBUG(3,("Privilege mask:\n"));
1812 dump_se_priv( DBGC_ALL, 3, &mask );
1813 return NT_STATUS_NO_SUCH_PRIVILEGE;
1816 return NT_STATUS_OK;
1819 /***************************************************************************
1820 _lsa_RemovePrivilegesFromAccount
1821 For a given SID, remove some privileges.
1822 ***************************************************************************/
1824 NTSTATUS _lsa_RemovePrivilegesFromAccount(pipes_struct *p,
1825 struct lsa_RemovePrivilegesFromAccount *r)
1827 struct lsa_info *info = NULL;
1829 struct lsa_PrivilegeSet *set = NULL;
1831 /* find the connection policy handle. */
1832 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
1833 return NT_STATUS_INVALID_HANDLE;
1835 /* check to see if the pipe_user is root or a Domain Admin since
1836 account_pol.tdb was already opened as root, this is all we have */
1838 if ( p->pipe_user.ut.uid != sec_initial_uid()
1839 && !nt_token_check_domain_rid( p->pipe_user.nt_user_token, DOMAIN_GROUP_RID_ADMINS ) )
1841 return NT_STATUS_ACCESS_DENIED;
1846 if ( !privilege_set_to_se_priv( &mask, set ) )
1847 return NT_STATUS_NO_SUCH_PRIVILEGE;
1849 if ( !revoke_privilege( &info->sid, &mask ) ) {
1850 DEBUG(3,("_lsa_RemovePrivilegesFromAccount: revoke_privilege(%s) failed!\n",
1851 sid_string_dbg(&info->sid) ));
1852 DEBUG(3,("Privilege mask:\n"));
1853 dump_se_priv( DBGC_ALL, 3, &mask );
1854 return NT_STATUS_NO_SUCH_PRIVILEGE;
1857 return NT_STATUS_OK;
1860 /***************************************************************************
1862 ***************************************************************************/
1864 NTSTATUS _lsa_QuerySecurity(pipes_struct *p,
1865 struct lsa_QuerySecurity *r)
1867 struct lsa_info *handle=NULL;
1868 SEC_DESC *psd = NULL;
1872 /* find the connection policy handle. */
1873 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle))
1874 return NT_STATUS_INVALID_HANDLE;
1876 /* check if the user have enough rights */
1877 if (!(handle->access & POLICY_VIEW_LOCAL_INFORMATION))
1878 return NT_STATUS_ACCESS_DENIED;
1881 switch (r->in.sec_info) {
1883 /* SD contains only the owner */
1885 status=lsa_get_generic_sd(p->mem_ctx, &psd, &sd_size);
1886 if(!NT_STATUS_IS_OK(status))
1887 return NT_STATUS_NO_MEMORY;
1890 if((*r->out.sdbuf = make_sec_desc_buf(p->mem_ctx, sd_size, psd)) == NULL)
1891 return NT_STATUS_NO_MEMORY;
1894 /* SD contains only the ACL */
1896 status=lsa_get_generic_sd(p->mem_ctx, &psd, &sd_size);
1897 if(!NT_STATUS_IS_OK(status))
1898 return NT_STATUS_NO_MEMORY;
1900 if((*r->out.sdbuf = make_sec_desc_buf(p->mem_ctx, sd_size, psd)) == NULL)
1901 return NT_STATUS_NO_MEMORY;
1904 return NT_STATUS_INVALID_LEVEL;
1910 #if 0 /* AD DC work in ongoing in Samba 4 */
1912 /***************************************************************************
1913 ***************************************************************************/
1915 NTSTATUS _lsa_query_info2(pipes_struct *p, LSA_Q_QUERY_INFO2 *q_u, LSA_R_QUERY_INFO2 *r_u)
1917 struct lsa_info *handle;
1918 const char *nb_name;
1919 char *dns_name = NULL;
1920 char *forest_name = NULL;
1921 DOM_SID *sid = NULL;
1926 r_u->status = NT_STATUS_OK;
1928 if (!find_policy_by_hnd(p, &q_u->pol, (void **)(void *)&handle))
1929 return NT_STATUS_INVALID_HANDLE;
1931 switch (q_u->info_class) {
1933 /* check if the user have enough rights */
1934 if (!(handle->access & POLICY_VIEW_LOCAL_INFORMATION))
1935 return NT_STATUS_ACCESS_DENIED;
1937 /* Request PolicyPrimaryDomainInformation. */
1938 switch (lp_server_role()) {
1939 case ROLE_DOMAIN_PDC:
1940 case ROLE_DOMAIN_BDC:
1941 nb_name = get_global_sam_name();
1942 /* ugly temp hack for these next two */
1944 /* This should be a 'netbios domain -> DNS domain' mapping */
1945 dnsdomname = get_mydnsdomname(p->mem_ctx);
1946 if (!dnsdomname || !*dnsdomname) {
1947 return NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
1949 strlower_m(dnsdomname);
1951 dns_name = dnsdomname;
1952 forest_name = dnsdomname;
1954 sid = get_global_sam_sid();
1955 secrets_fetch_domain_guid(lp_workgroup(), &guid);
1958 return NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
1960 init_dns_dom_info(&r_u->info.dns_dom_info, nb_name, dns_name,
1961 forest_name,&guid,sid);
1964 DEBUG(0,("_lsa_query_info2: unknown info level in Lsa Query: %d\n", q_u->info_class));
1965 r_u->status = NT_STATUS_INVALID_INFO_CLASS;
1969 if (NT_STATUS_IS_OK(r_u->status)) {
1971 r_u->info_class = q_u->info_class;
1976 #endif /* AD DC work in ongoing in Samba 4 */
1978 /***************************************************************************
1979 _lsa_AddAccountRights
1980 ***************************************************************************/
1982 NTSTATUS _lsa_AddAccountRights(pipes_struct *p,
1983 struct lsa_AddAccountRights *r)
1985 struct lsa_info *info = NULL;
1989 /* find the connection policy handle. */
1990 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
1991 return NT_STATUS_INVALID_HANDLE;
1993 /* check to see if the pipe_user is a Domain Admin since
1994 account_pol.tdb was already opened as root, this is all we have */
1996 if ( p->pipe_user.ut.uid != sec_initial_uid()
1997 && !nt_token_check_domain_rid( p->pipe_user.nt_user_token, DOMAIN_GROUP_RID_ADMINS ) )
1999 return NT_STATUS_ACCESS_DENIED;
2002 /* according to an NT4 PDC, you can add privileges to SIDs even without
2003 call_lsa_create_account() first. And you can use any arbitrary SID. */
2005 sid_copy( &sid, r->in.sid );
2007 for ( i=0; i < r->in.rights->count; i++ ) {
2009 const char *privname = r->in.rights->names[i].string;
2011 /* only try to add non-null strings */
2016 if ( !grant_privilege_by_name( &sid, privname ) ) {
2017 DEBUG(2,("_lsa_AddAccountRights: Failed to add privilege [%s]\n",
2019 return NT_STATUS_NO_SUCH_PRIVILEGE;
2023 return NT_STATUS_OK;
2026 /***************************************************************************
2027 _lsa_RemoveAccountRights
2028 ***************************************************************************/
2030 NTSTATUS _lsa_RemoveAccountRights(pipes_struct *p,
2031 struct lsa_RemoveAccountRights *r)
2033 struct lsa_info *info = NULL;
2036 const char *privname = NULL;
2038 /* find the connection policy handle. */
2039 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
2040 return NT_STATUS_INVALID_HANDLE;
2042 /* check to see if the pipe_user is a Domain Admin since
2043 account_pol.tdb was already opened as root, this is all we have */
2045 if ( p->pipe_user.ut.uid != sec_initial_uid()
2046 && !nt_token_check_domain_rid( p->pipe_user.nt_user_token, DOMAIN_GROUP_RID_ADMINS ) )
2048 return NT_STATUS_ACCESS_DENIED;
2051 sid_copy( &sid, r->in.sid );
2053 if ( r->in.remove_all ) {
2054 if ( !revoke_all_privileges( &sid ) )
2055 return NT_STATUS_ACCESS_DENIED;
2057 return NT_STATUS_OK;
2060 for ( i=0; i < r->in.rights->count; i++ ) {
2062 privname = r->in.rights->names[i].string;
2064 /* only try to add non-null strings */
2069 if ( !revoke_privilege_by_name( &sid, privname ) ) {
2070 DEBUG(2,("_lsa_RemoveAccountRights: Failed to revoke privilege [%s]\n",
2072 return NT_STATUS_NO_SUCH_PRIVILEGE;
2076 return NT_STATUS_OK;
2079 /*******************************************************************
2080 ********************************************************************/
2082 static NTSTATUS init_lsa_right_set(TALLOC_CTX *mem_ctx,
2083 struct lsa_RightSet *r,
2084 PRIVILEGE_SET *privileges)
2087 const char *privname;
2088 const char **privname_array = NULL;
2091 for (i=0; i<privileges->count; i++) {
2093 privname = luid_to_privilege_name(&privileges->set[i].luid);
2095 if (!add_string_to_array(mem_ctx, privname,
2096 &privname_array, &num_priv)) {
2097 return NT_STATUS_NO_MEMORY;
2104 r->names = TALLOC_ZERO_ARRAY(mem_ctx, struct lsa_StringLarge,
2107 return NT_STATUS_NO_MEMORY;
2110 for (i=0; i<num_priv; i++) {
2111 init_lsa_StringLarge(&r->names[i], privname_array[i]);
2114 r->count = num_priv;
2117 return NT_STATUS_OK;
2120 /***************************************************************************
2121 _lsa_EnumAccountRights
2122 ***************************************************************************/
2124 NTSTATUS _lsa_EnumAccountRights(pipes_struct *p,
2125 struct lsa_EnumAccountRights *r)
2128 struct lsa_info *info = NULL;
2130 PRIVILEGE_SET privileges;
2133 /* find the connection policy handle. */
2135 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
2136 return NT_STATUS_INVALID_HANDLE;
2138 /* according to an NT4 PDC, you can add privileges to SIDs even without
2139 call_lsa_create_account() first. And you can use any arbitrary SID. */
2141 sid_copy( &sid, r->in.sid );
2143 if ( !get_privileges_for_sids( &mask, &sid, 1 ) )
2144 return NT_STATUS_OBJECT_NAME_NOT_FOUND;
2146 privilege_set_init( &privileges );
2148 if ( se_priv_to_privilege_set( &privileges, &mask ) ) {
2150 DEBUG(10,("_lsa_EnumAccountRights: %s has %d privileges\n",
2151 sid_string_dbg(&sid), privileges.count));
2153 status = init_lsa_right_set(p->mem_ctx, r->out.rights, &privileges);
2155 status = NT_STATUS_NO_SUCH_PRIVILEGE;
2158 privilege_set_free( &privileges );
2163 /***************************************************************************
2164 _lsa_LookupPrivValue
2165 ***************************************************************************/
2167 NTSTATUS _lsa_LookupPrivValue(pipes_struct *p,
2168 struct lsa_LookupPrivValue *r)
2170 struct lsa_info *info = NULL;
2171 const char *name = NULL;
2172 LUID_ATTR priv_luid;
2175 /* find the connection policy handle. */
2177 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
2178 return NT_STATUS_INVALID_HANDLE;
2180 name = r->in.name->string;
2182 DEBUG(10,("_lsa_lookup_priv_value: name = %s\n", name));
2184 if ( !se_priv_from_name( name, &mask ) )
2185 return NT_STATUS_NO_SUCH_PRIVILEGE;
2187 priv_luid = get_privilege_luid( &mask );
2189 r->out.luid->low = priv_luid.luid.low;
2190 r->out.luid->high = priv_luid.luid.high;
2192 return NT_STATUS_OK;
2196 * From here on the server routines are just dummy ones to make smbd link with
2197 * librpc/gen_ndr/srv_lsa.c. These routines are actually never called, we are
2198 * pulling the server stubs across one by one.
2201 NTSTATUS _lsa_Delete(pipes_struct *p, struct lsa_Delete *r)
2203 p->rng_fault_state = True;
2204 return NT_STATUS_NOT_IMPLEMENTED;
2207 NTSTATUS _lsa_SetSecObj(pipes_struct *p, struct lsa_SetSecObj *r)
2209 p->rng_fault_state = True;
2210 return NT_STATUS_NOT_IMPLEMENTED;
2213 NTSTATUS _lsa_ChangePassword(pipes_struct *p, struct lsa_ChangePassword *r)
2215 p->rng_fault_state = True;
2216 return NT_STATUS_NOT_IMPLEMENTED;
2219 NTSTATUS _lsa_SetInfoPolicy(pipes_struct *p, struct lsa_SetInfoPolicy *r)
2221 p->rng_fault_state = True;
2222 return NT_STATUS_NOT_IMPLEMENTED;
2225 NTSTATUS _lsa_ClearAuditLog(pipes_struct *p, struct lsa_ClearAuditLog *r)
2227 p->rng_fault_state = True;
2228 return NT_STATUS_NOT_IMPLEMENTED;
2231 NTSTATUS _lsa_LookupSids(pipes_struct *p, struct lsa_LookupSids *r)
2233 p->rng_fault_state = True;
2234 return NT_STATUS_NOT_IMPLEMENTED;
2237 NTSTATUS _lsa_GetQuotasForAccount(pipes_struct *p, struct lsa_GetQuotasForAccount *r)
2239 p->rng_fault_state = True;
2240 return NT_STATUS_NOT_IMPLEMENTED;
2243 NTSTATUS _lsa_SetQuotasForAccount(pipes_struct *p, struct lsa_SetQuotasForAccount *r)
2245 p->rng_fault_state = True;
2246 return NT_STATUS_NOT_IMPLEMENTED;
2249 NTSTATUS _lsa_QueryTrustedDomainInfo(pipes_struct *p, struct lsa_QueryTrustedDomainInfo *r)
2251 p->rng_fault_state = True;
2252 return NT_STATUS_NOT_IMPLEMENTED;
2255 NTSTATUS _lsa_SetInformationTrustedDomain(pipes_struct *p, struct lsa_SetInformationTrustedDomain *r)
2257 p->rng_fault_state = True;
2258 return NT_STATUS_NOT_IMPLEMENTED;
2261 NTSTATUS _lsa_QuerySecret(pipes_struct *p, struct lsa_QuerySecret *r)
2263 p->rng_fault_state = True;
2264 return NT_STATUS_NOT_IMPLEMENTED;
2267 NTSTATUS _lsa_LookupPrivName(pipes_struct *p, struct lsa_LookupPrivName *r)
2269 p->rng_fault_state = True;
2270 return NT_STATUS_NOT_IMPLEMENTED;
2273 NTSTATUS _lsa_EnumAccountsWithUserRight(pipes_struct *p, struct lsa_EnumAccountsWithUserRight *r)
2275 p->rng_fault_state = True;
2276 return NT_STATUS_NOT_IMPLEMENTED;
2279 NTSTATUS _lsa_QueryTrustedDomainInfoBySid(pipes_struct *p, struct lsa_QueryTrustedDomainInfoBySid *r)
2281 p->rng_fault_state = True;
2282 return NT_STATUS_NOT_IMPLEMENTED;
2285 NTSTATUS _lsa_SetTrustedDomainInfo(pipes_struct *p, struct lsa_SetTrustedDomainInfo *r)
2287 p->rng_fault_state = True;
2288 return NT_STATUS_NOT_IMPLEMENTED;
2291 NTSTATUS _lsa_DeleteTrustedDomain(pipes_struct *p, struct lsa_DeleteTrustedDomain *r)
2293 p->rng_fault_state = True;
2294 return NT_STATUS_NOT_IMPLEMENTED;
2297 NTSTATUS _lsa_StorePrivateData(pipes_struct *p, struct lsa_StorePrivateData *r)
2299 p->rng_fault_state = True;
2300 return NT_STATUS_NOT_IMPLEMENTED;
2303 NTSTATUS _lsa_RetrievePrivateData(pipes_struct *p, struct lsa_RetrievePrivateData *r)
2305 p->rng_fault_state = True;
2306 return NT_STATUS_NOT_IMPLEMENTED;
2309 NTSTATUS _lsa_QueryInfoPolicy2(pipes_struct *p, struct lsa_QueryInfoPolicy2 *r)
2311 p->rng_fault_state = True;
2312 return NT_STATUS_NOT_IMPLEMENTED;
2315 NTSTATUS _lsa_SetInfoPolicy2(pipes_struct *p, struct lsa_SetInfoPolicy2 *r)
2317 p->rng_fault_state = True;
2318 return NT_STATUS_NOT_IMPLEMENTED;
2321 NTSTATUS _lsa_QueryTrustedDomainInfoByName(pipes_struct *p, struct lsa_QueryTrustedDomainInfoByName *r)
2323 p->rng_fault_state = True;
2324 return NT_STATUS_NOT_IMPLEMENTED;
2327 NTSTATUS _lsa_SetTrustedDomainInfoByName(pipes_struct *p, struct lsa_SetTrustedDomainInfoByName *r)
2329 p->rng_fault_state = True;
2330 return NT_STATUS_NOT_IMPLEMENTED;
2333 NTSTATUS _lsa_EnumTrustedDomainsEx(pipes_struct *p, struct lsa_EnumTrustedDomainsEx *r)
2335 p->rng_fault_state = True;
2336 return NT_STATUS_NOT_IMPLEMENTED;
2339 NTSTATUS _lsa_CreateTrustedDomainEx(pipes_struct *p, struct lsa_CreateTrustedDomainEx *r)
2341 p->rng_fault_state = True;
2342 return NT_STATUS_NOT_IMPLEMENTED;
2345 NTSTATUS _lsa_CloseTrustedDomainEx(pipes_struct *p, struct lsa_CloseTrustedDomainEx *r)
2347 p->rng_fault_state = True;
2348 return NT_STATUS_NOT_IMPLEMENTED;
2351 NTSTATUS _lsa_QueryDomainInformationPolicy(pipes_struct *p, struct lsa_QueryDomainInformationPolicy *r)
2353 p->rng_fault_state = True;
2354 return NT_STATUS_NOT_IMPLEMENTED;
2357 NTSTATUS _lsa_SetDomainInformationPolicy(pipes_struct *p, struct lsa_SetDomainInformationPolicy *r)
2359 p->rng_fault_state = True;
2360 return NT_STATUS_NOT_IMPLEMENTED;
2363 NTSTATUS _lsa_OpenTrustedDomainByName(pipes_struct *p, struct lsa_OpenTrustedDomainByName *r)
2365 p->rng_fault_state = True;
2366 return NT_STATUS_NOT_IMPLEMENTED;
2369 NTSTATUS _lsa_TestCall(pipes_struct *p, struct lsa_TestCall *r)
2371 p->rng_fault_state = True;
2372 return NT_STATUS_NOT_IMPLEMENTED;
2375 NTSTATUS _lsa_LookupSids2(pipes_struct *p, struct lsa_LookupSids2 *r)
2377 p->rng_fault_state = True;
2378 return NT_STATUS_NOT_IMPLEMENTED;
2381 NTSTATUS _lsa_CreateTrustedDomainEx2(pipes_struct *p, struct lsa_CreateTrustedDomainEx2 *r)
2383 p->rng_fault_state = True;
2384 return NT_STATUS_NOT_IMPLEMENTED;
2387 NTSTATUS _lsa_CREDRWRITE(pipes_struct *p, struct lsa_CREDRWRITE *r)
2389 p->rng_fault_state = True;
2390 return NT_STATUS_NOT_IMPLEMENTED;
2393 NTSTATUS _lsa_CREDRREAD(pipes_struct *p, struct lsa_CREDRREAD *r)
2395 p->rng_fault_state = True;
2396 return NT_STATUS_NOT_IMPLEMENTED;
2399 NTSTATUS _lsa_CREDRENUMERATE(pipes_struct *p, struct lsa_CREDRENUMERATE *r)
2401 p->rng_fault_state = True;
2402 return NT_STATUS_NOT_IMPLEMENTED;
2405 NTSTATUS _lsa_CREDRWRITEDOMAINCREDENTIALS(pipes_struct *p, struct lsa_CREDRWRITEDOMAINCREDENTIALS *r)
2407 p->rng_fault_state = True;
2408 return NT_STATUS_NOT_IMPLEMENTED;
2411 NTSTATUS _lsa_CREDRREADDOMAINCREDENTIALS(pipes_struct *p, struct lsa_CREDRREADDOMAINCREDENTIALS *r)
2413 p->rng_fault_state = True;
2414 return NT_STATUS_NOT_IMPLEMENTED;
2417 NTSTATUS _lsa_CREDRDELETE(pipes_struct *p, struct lsa_CREDRDELETE *r)
2419 p->rng_fault_state = True;
2420 return NT_STATUS_NOT_IMPLEMENTED;
2423 NTSTATUS _lsa_CREDRGETTARGETINFO(pipes_struct *p, struct lsa_CREDRGETTARGETINFO *r)
2425 p->rng_fault_state = True;
2426 return NT_STATUS_NOT_IMPLEMENTED;
2429 NTSTATUS _lsa_CREDRPROFILELOADED(pipes_struct *p, struct lsa_CREDRPROFILELOADED *r)
2431 p->rng_fault_state = True;
2432 return NT_STATUS_NOT_IMPLEMENTED;
2435 NTSTATUS _lsa_CREDRGETSESSIONTYPES(pipes_struct *p, struct lsa_CREDRGETSESSIONTYPES *r)
2437 p->rng_fault_state = True;
2438 return NT_STATUS_NOT_IMPLEMENTED;
2441 NTSTATUS _lsa_LSARREGISTERAUDITEVENT(pipes_struct *p, struct lsa_LSARREGISTERAUDITEVENT *r)
2443 p->rng_fault_state = True;
2444 return NT_STATUS_NOT_IMPLEMENTED;
2447 NTSTATUS _lsa_LSARGENAUDITEVENT(pipes_struct *p, struct lsa_LSARGENAUDITEVENT *r)
2449 p->rng_fault_state = True;
2450 return NT_STATUS_NOT_IMPLEMENTED;
2453 NTSTATUS _lsa_LSARUNREGISTERAUDITEVENT(pipes_struct *p, struct lsa_LSARUNREGISTERAUDITEVENT *r)
2455 p->rng_fault_state = True;
2456 return NT_STATUS_NOT_IMPLEMENTED;
2459 NTSTATUS _lsa_lsaRQueryForestTrustInformation(pipes_struct *p, struct lsa_lsaRQueryForestTrustInformation *r)
2461 p->rng_fault_state = True;
2462 return NT_STATUS_NOT_IMPLEMENTED;
2465 NTSTATUS _lsa_LSARSETFORESTTRUSTINFORMATION(pipes_struct *p, struct lsa_LSARSETFORESTTRUSTINFORMATION *r)
2467 p->rng_fault_state = True;
2468 return NT_STATUS_NOT_IMPLEMENTED;
2471 NTSTATUS _lsa_CREDRRENAME(pipes_struct *p, struct lsa_CREDRRENAME *r)
2473 p->rng_fault_state = True;
2474 return NT_STATUS_NOT_IMPLEMENTED;
2477 NTSTATUS _lsa_LookupSids3(pipes_struct *p, struct lsa_LookupSids3 *r)
2479 p->rng_fault_state = True;
2480 return NT_STATUS_NOT_IMPLEMENTED;
2483 NTSTATUS _lsa_LSAROPENPOLICYSCE(pipes_struct *p, struct lsa_LSAROPENPOLICYSCE *r)
2485 p->rng_fault_state = True;
2486 return NT_STATUS_NOT_IMPLEMENTED;
2489 NTSTATUS _lsa_LSARADTREGISTERSECURITYEVENTSOURCE(pipes_struct *p, struct lsa_LSARADTREGISTERSECURITYEVENTSOURCE *r)
2491 p->rng_fault_state = True;
2492 return NT_STATUS_NOT_IMPLEMENTED;
2495 NTSTATUS _lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE(pipes_struct *p, struct lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE *r)
2497 p->rng_fault_state = True;
2498 return NT_STATUS_NOT_IMPLEMENTED;
2501 NTSTATUS _lsa_LSARADTREPORTSECURITYEVENT(pipes_struct *p, struct lsa_LSARADTREPORTSECURITYEVENT *r)
2503 p->rng_fault_state = True;
2504 return NT_STATUS_NOT_IMPLEMENTED;