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 lookup_lsa_rids. Must be called as root for lookup_name to work.
131 ***************************************************************************/
133 static NTSTATUS lookup_lsa_rids(TALLOC_CTX *mem_ctx,
134 struct lsa_RefDomainList *ref,
135 struct lsa_TranslatedSid *prid,
136 uint32_t num_entries,
137 struct lsa_String *name,
139 uint32_t *pmapped_count)
141 uint32 mapped_count, i;
143 SMB_ASSERT(num_entries <= MAX_LOOKUP_SIDS);
148 for (i = 0; i < num_entries; i++) {
152 const char *full_name;
154 enum lsa_SidType type = SID_NAME_UNKNOWN;
156 /* Split name into domain and user component */
158 full_name = name[i].string;
159 if (full_name == NULL) {
160 return NT_STATUS_NO_MEMORY;
163 DEBUG(5, ("lookup_lsa_rids: looking up name %s\n", full_name));
165 /* We can ignore the result of lookup_name, it will not touch
166 "type" if it's not successful */
168 lookup_name(mem_ctx, full_name, flags, &domain, NULL,
173 case SID_NAME_DOM_GRP:
174 case SID_NAME_DOMAIN:
176 case SID_NAME_WKN_GRP:
177 DEBUG(5, ("init_lsa_rids: %s found\n", full_name));
178 /* Leave these unchanged */
181 /* Don't hand out anything but the list above */
182 DEBUG(5, ("init_lsa_rids: %s not found\n", full_name));
183 type = SID_NAME_UNKNOWN;
190 if (type != SID_NAME_UNKNOWN) {
191 sid_split_rid(&sid, &rid);
192 dom_idx = init_lsa_ref_domain_list(mem_ctx, ref, domain, &sid);
196 init_lsa_translated_sid(&prid[i], type, rid, dom_idx);
199 *pmapped_count = mapped_count;
203 /***************************************************************************
204 lookup_lsa_sids. Must be called as root for lookup_name to work.
205 ***************************************************************************/
207 static NTSTATUS lookup_lsa_sids(TALLOC_CTX *mem_ctx,
208 struct lsa_RefDomainList *ref,
209 struct lsa_TranslatedSid3 *trans_sids,
210 uint32_t num_entries,
211 struct lsa_String *name,
213 uint32 *pmapped_count)
215 uint32 mapped_count, i;
217 SMB_ASSERT(num_entries <= MAX_LOOKUP_SIDS);
222 for (i = 0; i < num_entries; i++) {
226 const char *full_name;
228 enum lsa_SidType type = SID_NAME_UNKNOWN;
230 /* Split name into domain and user component */
232 full_name = name[i].string;
233 if (full_name == NULL) {
234 return NT_STATUS_NO_MEMORY;
237 DEBUG(5, ("init_lsa_sids: looking up name %s\n", full_name));
239 /* We can ignore the result of lookup_name, it will not touch
240 "type" if it's not successful */
242 lookup_name(mem_ctx, full_name, flags, &domain, NULL,
247 case SID_NAME_DOM_GRP:
248 case SID_NAME_DOMAIN:
250 case SID_NAME_WKN_GRP:
251 DEBUG(5, ("init_lsa_sids: %s found\n", full_name));
252 /* Leave these unchanged */
255 /* Don't hand out anything but the list above */
256 DEBUG(5, ("init_lsa_sids: %s not found\n", full_name));
257 type = SID_NAME_UNKNOWN;
264 if (type != SID_NAME_UNKNOWN) {
266 sid_copy(&domain_sid, &sid);
267 sid_split_rid(&domain_sid, &rid);
268 dom_idx = init_lsa_ref_domain_list(mem_ctx, ref, domain, &domain_sid);
272 /* Initialize the lsa_TranslatedSid3 return. */
273 trans_sids[i].sid_type = type;
274 trans_sids[i].sid = sid_dup_talloc(mem_ctx, &sid);
275 trans_sids[i].sid_index = dom_idx;
278 *pmapped_count = mapped_count;
282 static NTSTATUS lsa_get_generic_sd(TALLOC_CTX *mem_ctx, SEC_DESC **sd, size_t *sd_size)
284 DOM_SID local_adm_sid;
292 init_sec_access(&mask, LSA_POLICY_EXECUTE);
293 init_sec_ace(&ace[0], &global_sid_World, SEC_ACE_TYPE_ACCESS_ALLOWED, mask, 0);
295 sid_copy(&adm_sid, get_global_sam_sid());
296 sid_append_rid(&adm_sid, DOMAIN_GROUP_RID_ADMINS);
297 init_sec_access(&mask, LSA_POLICY_ALL_ACCESS);
298 init_sec_ace(&ace[1], &adm_sid, SEC_ACE_TYPE_ACCESS_ALLOWED, mask, 0);
300 sid_copy(&local_adm_sid, &global_sid_Builtin);
301 sid_append_rid(&local_adm_sid, BUILTIN_ALIAS_RID_ADMINS);
302 init_sec_access(&mask, LSA_POLICY_ALL_ACCESS);
303 init_sec_ace(&ace[2], &local_adm_sid, SEC_ACE_TYPE_ACCESS_ALLOWED, mask, 0);
305 if((psa = make_sec_acl(mem_ctx, NT4_ACL_REVISION, 3, ace)) == NULL)
306 return NT_STATUS_NO_MEMORY;
308 if((*sd = make_sec_desc(mem_ctx, SECURITY_DESCRIPTOR_REVISION_1,
309 SEC_DESC_SELF_RELATIVE, &adm_sid, NULL, NULL,
310 psa, sd_size)) == NULL)
311 return NT_STATUS_NO_MEMORY;
316 #if 0 /* AD DC work in ongoing in Samba 4 */
318 /***************************************************************************
320 ***************************************************************************/
322 static void init_dns_dom_info(LSA_DNS_DOM_INFO *r_l, const char *nb_name,
323 const char *dns_name, const char *forest_name,
324 struct GUID *dom_guid, DOM_SID *dom_sid)
326 if (nb_name && *nb_name) {
327 init_unistr2(&r_l->uni_nb_dom_name, nb_name, UNI_FLAGS_NONE);
328 init_uni_hdr(&r_l->hdr_nb_dom_name, &r_l->uni_nb_dom_name);
329 r_l->hdr_nb_dom_name.uni_max_len += 2;
330 r_l->uni_nb_dom_name.uni_max_len += 1;
333 if (dns_name && *dns_name) {
334 init_unistr2(&r_l->uni_dns_dom_name, dns_name, UNI_FLAGS_NONE);
335 init_uni_hdr(&r_l->hdr_dns_dom_name, &r_l->uni_dns_dom_name);
336 r_l->hdr_dns_dom_name.uni_max_len += 2;
337 r_l->uni_dns_dom_name.uni_max_len += 1;
340 if (forest_name && *forest_name) {
341 init_unistr2(&r_l->uni_forest_name, forest_name, UNI_FLAGS_NONE);
342 init_uni_hdr(&r_l->hdr_forest_name, &r_l->uni_forest_name);
343 r_l->hdr_forest_name.uni_max_len += 2;
344 r_l->uni_forest_name.uni_max_len += 1;
347 /* how do we init the guid ? probably should write an init fn */
349 memcpy(&r_l->dom_guid, dom_guid, sizeof(struct GUID));
353 r_l->ptr_dom_sid = 1;
354 init_dom_sid2(&r_l->dom_sid, dom_sid);
357 #endif /* AD DC work in ongoing in Samba 4 */
360 /***************************************************************************
362 ***************************************************************************/
364 NTSTATUS _lsa_OpenPolicy2(pipes_struct *p,
365 struct lsa_OpenPolicy2 *r)
367 struct lsa_info *info;
368 SEC_DESC *psd = NULL;
370 uint32 des_access = r->in.access_mask;
375 /* map the generic bits to the lsa policy ones */
376 se_map_generic(&des_access, &lsa_generic_mapping);
378 /* get the generic lsa policy SD until we store it */
379 lsa_get_generic_sd(p->mem_ctx, &psd, &sd_size);
381 if(!se_access_check(psd, p->pipe_user.nt_user_token, des_access, &acc_granted, &status)) {
382 if (p->pipe_user.ut.uid != sec_initial_uid()) {
385 DEBUG(4,("ACCESS should be DENIED (granted: %#010x; required: %#010x)\n",
386 acc_granted, des_access));
387 DEBUGADD(4,("but overwritten by euid == 0\n"));
390 /* This is needed for lsa_open_account and rpcclient .... :-) */
392 if (p->pipe_user.ut.uid == sec_initial_uid())
393 acc_granted = LSA_POLICY_ALL_ACCESS;
395 /* associate the domain SID with the (unique) handle. */
396 if ((info = SMB_MALLOC_P(struct lsa_info)) == NULL)
397 return NT_STATUS_NO_MEMORY;
400 sid_copy(&info->sid,get_global_sam_sid());
401 info->access = acc_granted;
403 /* set up the LSA QUERY INFO response */
404 if (!create_policy_hnd(p, r->out.handle, free_lsa_info, (void *)info))
405 return NT_STATUS_OBJECT_NAME_NOT_FOUND;
410 /***************************************************************************
412 ***************************************************************************/
414 NTSTATUS _lsa_OpenPolicy(pipes_struct *p,
415 struct lsa_OpenPolicy *r)
417 struct lsa_info *info;
418 SEC_DESC *psd = NULL;
420 uint32 des_access= r->in.access_mask;
425 /* map the generic bits to the lsa policy ones */
426 se_map_generic(&des_access, &lsa_generic_mapping);
428 /* get the generic lsa policy SD until we store it */
429 lsa_get_generic_sd(p->mem_ctx, &psd, &sd_size);
431 if(!se_access_check(psd, p->pipe_user.nt_user_token, des_access, &acc_granted, &status)) {
432 if (geteuid() != 0) {
435 DEBUG(4,("ACCESS should be DENIED (granted: %#010x; required: %#010x)\n",
436 acc_granted, des_access));
437 DEBUGADD(4,("but overwritten by euid == 0\n"));
438 acc_granted = des_access;
441 /* associate the domain SID with the (unique) handle. */
442 if ((info = SMB_MALLOC_P(struct lsa_info)) == NULL)
443 return NT_STATUS_NO_MEMORY;
446 sid_copy(&info->sid,get_global_sam_sid());
447 info->access = acc_granted;
449 /* set up the LSA QUERY INFO response */
450 if (!create_policy_hnd(p, r->out.handle, free_lsa_info, (void *)info))
451 return NT_STATUS_OBJECT_NAME_NOT_FOUND;
456 /***************************************************************************
457 _lsa_EnumTrustDom - this needs fixing to do more than return NULL ! JRA.
459 ***************************************************************************/
461 NTSTATUS _lsa_EnumTrustDom(pipes_struct *p,
462 struct lsa_EnumTrustDom *r)
464 struct lsa_info *info;
466 struct trustdom_info **domains;
467 struct lsa_DomainInfo *lsa_domains = NULL;
471 * preferred length is set to 5 as a "our" preferred length
472 * nt sets this parameter to 2
473 * update (20.08.2002): it's not preferred length, but preferred size!
474 * it needs further investigation how to optimally choose this value
476 uint32 max_num_domains =
477 r->in.max_size < 5 ? r->in.max_size : 10;
482 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
483 return NT_STATUS_INVALID_HANDLE;
485 /* check if the user have enough rights */
486 if (!(info->access & LSA_POLICY_VIEW_LOCAL_INFORMATION))
487 return NT_STATUS_ACCESS_DENIED;
489 nt_status = pdb_enum_trusteddoms(p->mem_ctx, &num_domains, &domains);
491 if (!NT_STATUS_IS_OK(nt_status)) {
495 if (*r->in.resume_handle < num_domains) {
496 num_thistime = MIN(num_domains, max_num_domains);
498 nt_status = STATUS_MORE_ENTRIES;
500 if (*r->in.resume_handle + num_thistime > num_domains) {
501 num_thistime = num_domains - *r->in.resume_handle;
502 nt_status = NT_STATUS_OK;
505 next_idx = *r->in.resume_handle + num_thistime;
508 next_idx = 0xffffffff;
509 nt_status = NT_STATUS_NO_MORE_ENTRIES;
512 /* set up the lsa_enum_trust_dom response */
514 lsa_domains = TALLOC_ZERO_ARRAY(p->mem_ctx, struct lsa_DomainInfo,
517 return NT_STATUS_NO_MEMORY;
520 for (i=0; i<num_thistime; i++) {
521 init_lsa_StringLarge(&lsa_domains[i].name, domains[i]->name);
522 lsa_domains[i].sid = &domains[i]->sid;
525 *r->out.resume_handle = next_idx;
526 r->out.domains->count = num_thistime;
527 r->out.domains->domains = lsa_domains;
532 #define LSA_AUDIT_NUM_CATEGORIES_NT4 7
533 #define LSA_AUDIT_NUM_CATEGORIES_WIN2K 9
534 #define LSA_AUDIT_NUM_CATEGORIES LSA_AUDIT_NUM_CATEGORIES_NT4
536 /***************************************************************************
538 ***************************************************************************/
540 NTSTATUS _lsa_QueryInfoPolicy(pipes_struct *p,
541 struct lsa_QueryInfoPolicy *r)
543 NTSTATUS status = NT_STATUS_OK;
544 struct lsa_info *handle;
548 union lsa_PolicyInformation *info = NULL;
550 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle))
551 return NT_STATUS_INVALID_HANDLE;
553 info = TALLOC_ZERO_P(p->mem_ctx, union lsa_PolicyInformation);
555 return NT_STATUS_NO_MEMORY;
558 switch (r->in.level) {
562 uint32 policy_def = LSA_AUDIT_POLICY_ALL;
564 /* check if the user have enough rights */
565 if (!(handle->access & LSA_POLICY_VIEW_AUDIT_INFORMATION)) {
566 DEBUG(10,("_lsa_QueryInfoPolicy: insufficient access rights\n"));
567 return NT_STATUS_ACCESS_DENIED;
570 /* fake info: We audit everything. ;) */
572 info->audit_events.auditing_mode = true;
573 info->audit_events.count = LSA_AUDIT_NUM_CATEGORIES;
574 info->audit_events.settings = TALLOC_ZERO_ARRAY(p->mem_ctx,
575 enum lsa_PolicyAuditPolicy,
576 info->audit_events.count);
577 if (!info->audit_events.settings) {
578 return NT_STATUS_NO_MEMORY;
581 info->audit_events.settings[LSA_AUDIT_CATEGORY_ACCOUNT_MANAGEMENT] = policy_def;
582 info->audit_events.settings[LSA_AUDIT_CATEGORY_FILE_AND_OBJECT_ACCESS] = policy_def;
583 info->audit_events.settings[LSA_AUDIT_CATEGORY_LOGON] = policy_def;
584 info->audit_events.settings[LSA_AUDIT_CATEGORY_PROCCESS_TRACKING] = policy_def;
585 info->audit_events.settings[LSA_AUDIT_CATEGORY_SECURITY_POLICY_CHANGES] = policy_def;
586 info->audit_events.settings[LSA_AUDIT_CATEGORY_SYSTEM] = policy_def;
587 info->audit_events.settings[LSA_AUDIT_CATEGORY_USE_OF_USER_RIGHTS] = policy_def;
592 /* check if the user have enough rights */
593 if (!(handle->access & LSA_POLICY_VIEW_LOCAL_INFORMATION))
594 return NT_STATUS_ACCESS_DENIED;
596 /* Request PolicyPrimaryDomainInformation. */
597 switch (lp_server_role()) {
598 case ROLE_DOMAIN_PDC:
599 case ROLE_DOMAIN_BDC:
600 name = get_global_sam_name();
601 sid = get_global_sam_sid();
603 case ROLE_DOMAIN_MEMBER:
604 name = lp_workgroup();
605 /* We need to return the Domain SID here. */
606 if (secrets_fetch_domain_sid(lp_workgroup(), &domain_sid))
609 return NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
611 case ROLE_STANDALONE:
612 name = lp_workgroup();
616 return NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
618 init_dom_query_3(&info->domain, name, sid);
621 /* check if the user have enough rights */
622 if (!(handle->access & LSA_POLICY_VIEW_LOCAL_INFORMATION))
623 return NT_STATUS_ACCESS_DENIED;
625 /* Request PolicyAccountDomainInformation. */
626 name = get_global_sam_name();
627 sid = get_global_sam_sid();
629 init_dom_query_5(&info->account_domain, name, sid);
632 /* check if the user have enough rights */
633 if (!(handle->access & LSA_POLICY_VIEW_LOCAL_INFORMATION))
634 return NT_STATUS_ACCESS_DENIED;
636 switch (lp_server_role()) {
637 case ROLE_DOMAIN_BDC:
639 * only a BDC is a backup controller
640 * of the domain, it controls.
646 * any other role is a primary
647 * of the domain, it controls.
654 DEBUG(0,("_lsa_QueryInfoPolicy: unknown info level in Lsa Query: %d\n",
656 status = NT_STATUS_INVALID_INFO_CLASS;
665 /***************************************************************************
666 _lsa_lookup_sids_internal
667 ***************************************************************************/
669 static NTSTATUS _lsa_lookup_sids_internal(pipes_struct *p,
671 uint16_t level, /* input */
672 int num_sids, /* input */
673 struct lsa_SidPtr *sid, /* input */
674 struct lsa_RefDomainList **pp_ref, /* input/output */
675 struct lsa_TranslatedName2 **pp_names,/* input/output */
676 uint32_t *pp_mapped_count) /* input/output */
680 const DOM_SID **sids = NULL;
681 struct lsa_RefDomainList *ref = NULL;
682 uint32 mapped_count = 0;
683 struct lsa_dom_info *dom_infos = NULL;
684 struct lsa_name_info *name_infos = NULL;
685 struct lsa_TranslatedName2 *names = NULL;
687 *pp_mapped_count = 0;
695 sids = TALLOC_ARRAY(p->mem_ctx, const DOM_SID *, num_sids);
696 ref = TALLOC_ZERO_P(p->mem_ctx, struct lsa_RefDomainList);
698 if (sids == NULL || ref == NULL) {
699 return NT_STATUS_NO_MEMORY;
702 for (i=0; i<num_sids; i++) {
703 sids[i] = sid[i].sid;
706 status = lookup_sids(p->mem_ctx, num_sids, sids, level,
707 &dom_infos, &name_infos);
709 if (!NT_STATUS_IS_OK(status)) {
713 names = TALLOC_ARRAY(p->mem_ctx, struct lsa_TranslatedName2, num_sids);
715 return NT_STATUS_NO_MEMORY;
718 for (i=0; i<MAX_REF_DOMAINS; i++) {
720 if (!dom_infos[i].valid) {
724 if (init_lsa_ref_domain_list(mem_ctx, ref,
726 &dom_infos[i].sid) != i) {
727 DEBUG(0, ("Domain %s mentioned twice??\n",
729 return NT_STATUS_INTERNAL_ERROR;
733 for (i=0; i<num_sids; i++) {
734 struct lsa_name_info *name = &name_infos[i];
736 if (name->type == SID_NAME_UNKNOWN) {
739 /* Unknown sids should return the string
740 * representation of the SID. Windows 2003 behaves
741 * rather erratic here, in many cases it returns the
742 * RID as 8 bytes hex, in others it returns the full
743 * SID. We (Jerry/VL) could not figure out which the
744 * hard cases are, so leave it with the SID. */
745 name->name = talloc_asprintf(p->mem_ctx, "%s",
748 if (name->name == NULL) {
749 return NT_STATUS_NO_MEMORY;
755 init_lsa_translated_name2(&names[i], name->type,
756 name->name, name->dom_idx, 0);
759 status = NT_STATUS_NONE_MAPPED;
760 if (mapped_count > 0) {
761 status = (mapped_count < num_sids) ?
762 STATUS_SOME_UNMAPPED : NT_STATUS_OK;
765 DEBUG(10, ("num_sids %d, mapped_count %d, status %s\n",
766 num_sids, mapped_count, nt_errstr(status)));
768 *pp_mapped_count = mapped_count;
775 /***************************************************************************
777 ***************************************************************************/
779 NTSTATUS _lsa_LookupSids(pipes_struct *p,
780 struct lsa_LookupSids *r)
783 struct lsa_info *handle;
784 int num_sids = r->in.sids->num_sids;
785 uint32 mapped_count = 0;
786 struct lsa_RefDomainList *domains = NULL;
787 struct lsa_TranslatedName *names_out = NULL;
788 struct lsa_TranslatedName2 *names = NULL;
791 if ((r->in.level < 1) || (r->in.level > 6)) {
792 return NT_STATUS_INVALID_PARAMETER;
795 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle)) {
796 return NT_STATUS_INVALID_HANDLE;
799 /* check if the user has enough rights */
800 if (!(handle->access & LSA_POLICY_LOOKUP_NAMES)) {
801 return NT_STATUS_ACCESS_DENIED;
804 if (num_sids > MAX_LOOKUP_SIDS) {
805 DEBUG(5,("_lsa_LookupSids: limit of %d exceeded, requested %d\n",
806 MAX_LOOKUP_SIDS, num_sids));
807 return NT_STATUS_NONE_MAPPED;
810 status = _lsa_lookup_sids_internal(p,
819 /* Convert from lsa_TranslatedName2 to lsa_TranslatedName */
820 names_out = TALLOC_ARRAY(p->mem_ctx, struct lsa_TranslatedName,
823 return NT_STATUS_NO_MEMORY;
826 for (i=0; i<num_sids; i++) {
827 names_out[i].sid_type = names[i].sid_type;
828 names_out[i].name = names[i].name;
829 names_out[i].sid_index = names[i].sid_index;
832 *r->out.domains = domains;
833 r->out.names->count = num_sids;
834 r->out.names->names = names_out;
835 *r->out.count = mapped_count;
840 /***************************************************************************
842 ***************************************************************************/
844 NTSTATUS _lsa_LookupSids2(pipes_struct *p,
845 struct lsa_LookupSids2 *r)
848 struct lsa_info *handle;
849 int num_sids = r->in.sids->num_sids;
850 uint32 mapped_count = 0;
851 struct lsa_RefDomainList *domains = NULL;
852 struct lsa_TranslatedName2 *names = NULL;
853 bool check_policy = true;
855 switch (p->hdr_req.opnum) {
856 case NDR_LSA_LOOKUPSIDS3:
857 check_policy = false;
859 case NDR_LSA_LOOKUPSIDS2:
864 if ((r->in.level < 1) || (r->in.level > 6)) {
865 return NT_STATUS_INVALID_PARAMETER;
869 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle)) {
870 return NT_STATUS_INVALID_HANDLE;
873 /* check if the user have enough rights */
874 if (!(handle->access & LSA_POLICY_LOOKUP_NAMES)) {
875 return NT_STATUS_ACCESS_DENIED;
879 if (num_sids > MAX_LOOKUP_SIDS) {
880 DEBUG(5,("_lsa_LookupSids2: limit of %d exceeded, requested %d\n",
881 MAX_LOOKUP_SIDS, num_sids));
882 return NT_STATUS_NONE_MAPPED;
885 status = _lsa_lookup_sids_internal(p,
894 *r->out.domains = domains;
895 r->out.names->count = num_sids;
896 r->out.names->names = names;
897 *r->out.count = mapped_count;
902 /***************************************************************************
904 ***************************************************************************/
906 NTSTATUS _lsa_LookupSids3(pipes_struct *p,
907 struct lsa_LookupSids3 *r)
909 struct lsa_LookupSids2 q;
911 /* No policy handle on this call. Restrict to crypto connections. */
912 if (p->auth.auth_type != PIPE_AUTH_TYPE_SCHANNEL) {
913 DEBUG(0,("_lsa_LookupSids3: client %s not using schannel for netlogon\n",
914 get_remote_machine_name() ));
915 return NT_STATUS_INVALID_PARAMETER;
919 q.in.sids = r->in.sids;
920 q.in.level = r->in.level;
921 q.in.unknown1 = r->in.unknown1;
922 q.in.unknown2 = r->in.unknown2;
923 q.in.names = r->in.names;
924 q.in.count = r->in.count;
926 q.out.domains = r->out.domains;
927 q.out.names = r->out.names;
928 q.out.count = r->out.count;
930 return _lsa_LookupSids2(p, &q);
933 /***************************************************************************
934 ***************************************************************************/
936 static int lsa_lookup_level_to_flags(uint16 level)
942 flags = LOOKUP_NAME_ALL;
945 flags = LOOKUP_NAME_DOMAIN|LOOKUP_NAME_REMOTE|LOOKUP_NAME_ISOLATED;
948 flags = LOOKUP_NAME_DOMAIN|LOOKUP_NAME_ISOLATED;
954 flags = LOOKUP_NAME_NONE;
961 /***************************************************************************
963 ***************************************************************************/
965 NTSTATUS _lsa_LookupNames(pipes_struct *p,
966 struct lsa_LookupNames *r)
968 NTSTATUS status = NT_STATUS_NONE_MAPPED;
969 struct lsa_info *handle;
970 struct lsa_String *names = r->in.names;
971 uint32 num_entries = r->in.num_names;
972 struct lsa_RefDomainList *domains = NULL;
973 struct lsa_TranslatedSid *rids = NULL;
974 uint32 mapped_count = 0;
977 if (num_entries > MAX_LOOKUP_SIDS) {
978 num_entries = MAX_LOOKUP_SIDS;
979 DEBUG(5,("_lsa_LookupNames: truncating name lookup list to %d\n",
983 flags = lsa_lookup_level_to_flags(r->in.level);
985 domains = TALLOC_ZERO_P(p->mem_ctx, struct lsa_RefDomainList);
987 return NT_STATUS_NO_MEMORY;
991 rids = TALLOC_ZERO_ARRAY(p->mem_ctx, struct lsa_TranslatedSid,
994 return NT_STATUS_NO_MEMORY;
1000 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle)) {
1001 status = NT_STATUS_INVALID_HANDLE;
1005 /* check if the user have enough rights */
1006 if (!(handle->access & LSA_POLICY_LOOKUP_NAMES)) {
1007 status = NT_STATUS_ACCESS_DENIED;
1011 /* set up the LSA Lookup RIDs response */
1012 become_root(); /* lookup_name can require root privs */
1013 status = lookup_lsa_rids(p->mem_ctx, domains, rids, num_entries,
1014 names, flags, &mapped_count);
1019 if (NT_STATUS_IS_OK(status) && (num_entries != 0) ) {
1020 if (mapped_count == 0) {
1021 status = NT_STATUS_NONE_MAPPED;
1022 } else if (mapped_count != num_entries) {
1023 status = STATUS_SOME_UNMAPPED;
1027 *r->out.count = num_entries;
1028 *r->out.domains = domains;
1029 r->out.sids->sids = rids;
1030 r->out.sids->count = mapped_count;
1035 /***************************************************************************
1037 ***************************************************************************/
1039 NTSTATUS _lsa_LookupNames2(pipes_struct *p,
1040 struct lsa_LookupNames2 *r)
1043 struct lsa_LookupNames q;
1044 struct lsa_TransSidArray2 *sid_array2 = r->in.sids;
1045 struct lsa_TransSidArray *sid_array = NULL;
1048 sid_array = TALLOC_ZERO_P(p->mem_ctx, struct lsa_TransSidArray);
1050 return NT_STATUS_NO_MEMORY;
1053 q.in.handle = r->in.handle;
1054 q.in.num_names = r->in.num_names;
1055 q.in.names = r->in.names;
1056 q.in.level = r->in.level;
1057 q.in.sids = sid_array;
1058 q.in.count = r->in.count;
1059 /* we do not know what this is for */
1060 /* = r->in.unknown1; */
1061 /* = r->in.unknown2; */
1063 q.out.domains = r->out.domains;
1064 q.out.sids = sid_array;
1065 q.out.count = r->out.count;
1067 status = _lsa_LookupNames(p, &q);
1069 sid_array2->sids = TALLOC_ARRAY(p->mem_ctx, struct lsa_TranslatedSid2, sid_array->count);
1070 if (!sid_array2->sids) {
1071 return NT_STATUS_NO_MEMORY;
1074 for (i=0; i<sid_array->count; i++) {
1075 sid_array2->sids[i].sid_type = sid_array->sids[i].sid_type;
1076 sid_array2->sids[i].rid = sid_array->sids[i].rid;
1077 sid_array2->sids[i].sid_index = sid_array->sids[i].sid_index;
1078 sid_array2->sids[i].unknown = 0;
1081 r->out.sids = sid_array2;
1086 /***************************************************************************
1088 ***************************************************************************/
1090 NTSTATUS _lsa_LookupNames3(pipes_struct *p,
1091 struct lsa_LookupNames3 *r)
1094 struct lsa_info *handle;
1095 struct lsa_String *names = r->in.names;
1096 uint32 num_entries = r->in.num_names;
1097 struct lsa_RefDomainList *domains = NULL;
1098 struct lsa_TranslatedSid3 *trans_sids = NULL;
1099 uint32 mapped_count = 0;
1101 bool check_policy = true;
1103 switch (p->hdr_req.opnum) {
1104 case NDR_LSA_LOOKUPNAMES4:
1105 check_policy = false;
1107 case NDR_LSA_LOOKUPNAMES3:
1109 check_policy = true;
1112 if (num_entries > MAX_LOOKUP_SIDS) {
1113 num_entries = MAX_LOOKUP_SIDS;
1114 DEBUG(5,("_lsa_LookupNames3: truncating name lookup list to %d\n", num_entries));
1117 /* Probably the lookup_level is some sort of bitmask. */
1118 if (r->in.level == 1) {
1119 flags = LOOKUP_NAME_ALL;
1122 domains = TALLOC_ZERO_P(p->mem_ctx, struct lsa_RefDomainList);
1124 return NT_STATUS_NO_MEMORY;
1128 trans_sids = TALLOC_ZERO_ARRAY(p->mem_ctx, struct lsa_TranslatedSid3,
1131 return NT_STATUS_NO_MEMORY;
1139 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle)) {
1140 status = NT_STATUS_INVALID_HANDLE;
1144 /* check if the user have enough rights */
1145 if (!(handle->access & LSA_POLICY_LOOKUP_NAMES)) {
1146 status = NT_STATUS_ACCESS_DENIED;
1151 /* set up the LSA Lookup SIDs response */
1152 become_root(); /* lookup_name can require root privs */
1153 status = lookup_lsa_sids(p->mem_ctx, domains, trans_sids, num_entries,
1154 names, flags, &mapped_count);
1159 if (NT_STATUS_IS_OK(status)) {
1160 if (mapped_count == 0) {
1161 status = NT_STATUS_NONE_MAPPED;
1162 } else if (mapped_count != num_entries) {
1163 status = STATUS_SOME_UNMAPPED;
1167 *r->out.count = num_entries;
1168 *r->out.domains = domains;
1169 r->out.sids->sids = trans_sids;
1170 r->out.sids->count = mapped_count;
1175 /***************************************************************************
1177 ***************************************************************************/
1179 NTSTATUS _lsa_LookupNames4(pipes_struct *p,
1180 struct lsa_LookupNames4 *r)
1182 struct lsa_LookupNames3 q;
1184 /* No policy handle on this call. Restrict to crypto connections. */
1185 if (p->auth.auth_type != PIPE_AUTH_TYPE_SCHANNEL) {
1186 DEBUG(0,("_lsa_lookup_names4: client %s not using schannel for netlogon\n",
1187 get_remote_machine_name() ));
1188 return NT_STATUS_INVALID_PARAMETER;
1192 q.in.num_names = r->in.num_names;
1193 q.in.names = r->in.names;
1194 q.in.level = r->in.level;
1195 q.in.unknown1 = r->in.unknown1;
1196 q.in.unknown2 = r->in.unknown2;
1197 q.in.sids = r->in.sids;
1198 q.in.count = r->in.count;
1200 q.out.domains = r->out.domains;
1201 q.out.sids = r->out.sids;
1202 q.out.count = r->out.count;
1204 return _lsa_LookupNames3(p, &q);
1207 /***************************************************************************
1208 _lsa_close. Also weird - needs to check if lsa handle is correct. JRA.
1209 ***************************************************************************/
1211 NTSTATUS _lsa_Close(pipes_struct *p, struct lsa_Close *r)
1213 if (!find_policy_by_hnd(p, r->in.handle, NULL)) {
1214 return NT_STATUS_INVALID_HANDLE;
1217 close_policy_hnd(p, r->in.handle);
1218 return NT_STATUS_OK;
1221 /***************************************************************************
1222 ***************************************************************************/
1224 NTSTATUS _lsa_OpenSecret(pipes_struct *p, struct lsa_OpenSecret *r)
1226 return NT_STATUS_OBJECT_NAME_NOT_FOUND;
1229 /***************************************************************************
1230 ***************************************************************************/
1232 NTSTATUS _lsa_OpenTrustedDomain(pipes_struct *p, struct lsa_OpenTrustedDomain *r)
1234 return NT_STATUS_OBJECT_NAME_NOT_FOUND;
1237 /***************************************************************************
1238 ***************************************************************************/
1240 NTSTATUS _lsa_CreateTrustedDomain(pipes_struct *p, struct lsa_CreateTrustedDomain *r)
1242 return NT_STATUS_ACCESS_DENIED;
1245 /***************************************************************************
1246 ***************************************************************************/
1248 NTSTATUS _lsa_CreateSecret(pipes_struct *p, struct lsa_CreateSecret *r)
1250 return NT_STATUS_ACCESS_DENIED;
1253 /***************************************************************************
1254 ***************************************************************************/
1256 NTSTATUS _lsa_SetSecret(pipes_struct *p, struct lsa_SetSecret *r)
1258 return NT_STATUS_ACCESS_DENIED;
1261 /***************************************************************************
1263 ***************************************************************************/
1265 NTSTATUS _lsa_DeleteObject(pipes_struct *p,
1266 struct lsa_DeleteObject *r)
1268 return NT_STATUS_ACCESS_DENIED;
1271 /***************************************************************************
1273 ***************************************************************************/
1275 NTSTATUS _lsa_EnumPrivs(pipes_struct *p,
1276 struct lsa_EnumPrivs *r)
1278 struct lsa_info *handle;
1280 uint32 enum_context = *r->in.resume_handle;
1281 int num_privs = count_all_privileges();
1282 struct lsa_PrivEntry *entries = NULL;
1285 /* remember that the enum_context starts at 0 and not 1 */
1287 if ( enum_context >= num_privs )
1288 return NT_STATUS_NO_MORE_ENTRIES;
1290 DEBUG(10,("_lsa_EnumPrivs: enum_context:%d total entries:%d\n",
1291 enum_context, num_privs));
1293 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle))
1294 return NT_STATUS_INVALID_HANDLE;
1296 /* check if the user have enough rights
1297 I don't know if it's the right one. not documented. */
1299 if (!(handle->access & LSA_POLICY_VIEW_LOCAL_INFORMATION))
1300 return NT_STATUS_ACCESS_DENIED;
1303 entries = TALLOC_ZERO_ARRAY(p->mem_ctx, struct lsa_PrivEntry, num_privs);
1305 return NT_STATUS_NO_MEMORY;
1311 for (i = 0; i < num_privs; i++) {
1312 if( i < enum_context) {
1314 init_lsa_StringLarge(&entries[i].name, NULL);
1316 entries[i].luid.low = 0;
1317 entries[i].luid.high = 0;
1320 init_lsa_StringLarge(&entries[i].name, privs[i].name);
1322 luid = get_privilege_luid( &privs[i].se_priv );
1324 entries[i].luid.low = luid.luid.low;
1325 entries[i].luid.high = luid.luid.high;
1329 enum_context = num_privs;
1331 *r->out.resume_handle = enum_context;
1332 r->out.privs->count = num_privs;
1333 r->out.privs->privs = entries;
1335 return NT_STATUS_OK;
1338 /***************************************************************************
1339 _lsa_LookupPrivDisplayName
1340 ***************************************************************************/
1342 NTSTATUS _lsa_LookupPrivDisplayName(pipes_struct *p,
1343 struct lsa_LookupPrivDisplayName *r)
1345 struct lsa_info *handle;
1346 const char *description;
1347 struct lsa_StringLarge *lsa_name;
1349 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle))
1350 return NT_STATUS_INVALID_HANDLE;
1352 /* check if the user have enough rights */
1355 * I don't know if it's the right one. not documented.
1357 if (!(handle->access & LSA_POLICY_VIEW_LOCAL_INFORMATION))
1358 return NT_STATUS_ACCESS_DENIED;
1360 DEBUG(10,("_lsa_LookupPrivDisplayName: name = %s\n", r->in.name->string));
1362 description = get_privilege_dispname(r->in.name->string);
1364 DEBUG(10,("_lsa_LookupPrivDisplayName: doesn't exist\n"));
1365 return NT_STATUS_NO_SUCH_PRIVILEGE;
1368 DEBUG(10,("_lsa_LookupPrivDisplayName: display name = %s\n", description));
1370 lsa_name = TALLOC_ZERO_P(p->mem_ctx, struct lsa_StringLarge);
1372 return NT_STATUS_NO_MEMORY;
1375 init_lsa_StringLarge(lsa_name, description);
1377 *r->out.returned_language_id = r->in.language_id;
1378 *r->out.disp_name = lsa_name;
1380 return NT_STATUS_OK;
1383 /***************************************************************************
1385 ***************************************************************************/
1387 NTSTATUS _lsa_EnumAccounts(pipes_struct *p,
1388 struct lsa_EnumAccounts *r)
1390 struct lsa_info *handle;
1392 int i, j, num_entries;
1394 struct lsa_SidPtr *sids = NULL;
1396 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle))
1397 return NT_STATUS_INVALID_HANDLE;
1399 if (!(handle->access & LSA_POLICY_VIEW_LOCAL_INFORMATION))
1400 return NT_STATUS_ACCESS_DENIED;
1405 /* The only way we can currently find out all the SIDs that have been
1406 privileged is to scan all privileges */
1408 status = privilege_enumerate_accounts(&sid_list, &num_entries);
1409 if (!NT_STATUS_IS_OK(status)) {
1413 if (*r->in.resume_handle >= num_entries) {
1414 return NT_STATUS_NO_MORE_ENTRIES;
1417 if (num_entries - *r->in.resume_handle) {
1418 sids = TALLOC_ZERO_ARRAY(p->mem_ctx, struct lsa_SidPtr,
1419 num_entries - *r->in.resume_handle);
1421 SAFE_FREE(sid_list);
1422 return NT_STATUS_NO_MEMORY;
1425 for (i = *r->in.resume_handle, j = 0; i < num_entries; i++, j++) {
1426 sids[j].sid = sid_dup_talloc(p->mem_ctx, &sid_list[i]);
1428 SAFE_FREE(sid_list);
1429 return NT_STATUS_NO_MEMORY;
1434 talloc_free(sid_list);
1436 *r->out.resume_handle = num_entries;
1437 r->out.sids->num_sids = num_entries;
1438 r->out.sids->sids = sids;
1440 return NT_STATUS_OK;
1443 /***************************************************************************
1445 ***************************************************************************/
1447 NTSTATUS _lsa_GetUserName(pipes_struct *p,
1448 struct lsa_GetUserName *r)
1450 const char *username, *domname;
1451 user_struct *vuser = get_valid_user_struct(p->vuid);
1452 struct lsa_String *account_name = NULL;
1453 struct lsa_String *authority_name = NULL;
1456 return NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
1460 * I'm 99% sure this is not the right place to do this,
1461 * global_sid_Anonymous should probably be put into the token
1462 * instead of the guest id -- vl
1464 if (!lookup_sid(p->mem_ctx, &global_sid_Anonymous,
1465 &domname, &username, NULL)) {
1466 return NT_STATUS_NO_MEMORY;
1469 username = vuser->user.smb_name;
1470 domname = vuser->user.domain;
1473 account_name = TALLOC_ZERO_P(p->mem_ctx, struct lsa_String);
1474 if (!account_name) {
1475 return NT_STATUS_NO_MEMORY;
1478 authority_name = TALLOC_ZERO_P(p->mem_ctx, struct lsa_String);
1479 if (!authority_name) {
1480 return NT_STATUS_NO_MEMORY;
1483 init_lsa_String(account_name, username);
1484 init_lsa_String(authority_name, domname);
1486 *r->out.account_name = account_name;
1487 *r->out.authority_name = authority_name;
1489 return NT_STATUS_OK;
1492 /***************************************************************************
1494 ***************************************************************************/
1496 NTSTATUS _lsa_CreateAccount(pipes_struct *p,
1497 struct lsa_CreateAccount *r)
1499 struct lsa_info *handle;
1500 struct lsa_info *info;
1502 /* find the connection policy handle. */
1503 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle))
1504 return NT_STATUS_INVALID_HANDLE;
1506 /* check if the user have enough rights */
1509 * I don't know if it's the right one. not documented.
1510 * but guessed with rpcclient.
1512 if (!(handle->access & LSA_POLICY_GET_PRIVATE_INFORMATION))
1513 return NT_STATUS_ACCESS_DENIED;
1515 /* check to see if the pipe_user is a Domain Admin since
1516 account_pol.tdb was already opened as root, this is all we have */
1518 if ( !nt_token_check_domain_rid( p->pipe_user.nt_user_token, DOMAIN_GROUP_RID_ADMINS ) )
1519 return NT_STATUS_ACCESS_DENIED;
1521 if ( is_privileged_sid( r->in.sid ) )
1522 return NT_STATUS_OBJECT_NAME_COLLISION;
1524 /* associate the user/group SID with the (unique) handle. */
1526 if ((info = SMB_MALLOC_P(struct lsa_info)) == NULL)
1527 return NT_STATUS_NO_MEMORY;
1530 info->sid = *r->in.sid;
1531 info->access = r->in.access_mask;
1533 /* get a (unique) handle. open a policy on it. */
1534 if (!create_policy_hnd(p, r->out.acct_handle, free_lsa_info, (void *)info))
1535 return NT_STATUS_OBJECT_NAME_NOT_FOUND;
1537 return privilege_create_account( &info->sid );
1541 /***************************************************************************
1543 ***************************************************************************/
1545 NTSTATUS _lsa_OpenAccount(pipes_struct *p,
1546 struct lsa_OpenAccount *r)
1548 struct lsa_info *handle;
1549 struct lsa_info *info;
1551 /* find the connection policy handle. */
1552 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle))
1553 return NT_STATUS_INVALID_HANDLE;
1555 /* check if the user have enough rights */
1558 * I don't know if it's the right one. not documented.
1559 * but guessed with rpcclient.
1561 if (!(handle->access & LSA_POLICY_GET_PRIVATE_INFORMATION))
1562 return NT_STATUS_ACCESS_DENIED;
1564 /* TODO: Fis the parsing routine before reenabling this check! */
1566 if (!lookup_sid(&handle->sid, dom_name, name, &type))
1567 return NT_STATUS_ACCESS_DENIED;
1569 /* associate the user/group SID with the (unique) handle. */
1570 if ((info = SMB_MALLOC_P(struct lsa_info)) == NULL)
1571 return NT_STATUS_NO_MEMORY;
1574 info->sid = *r->in.sid;
1575 info->access = r->in.access_mask;
1577 /* get a (unique) handle. open a policy on it. */
1578 if (!create_policy_hnd(p, r->out.acct_handle, free_lsa_info, (void *)info))
1579 return NT_STATUS_OBJECT_NAME_NOT_FOUND;
1581 return NT_STATUS_OK;
1584 /***************************************************************************
1585 _lsa_EnumPrivsAccount
1586 For a given SID, enumerate all the privilege this account has.
1587 ***************************************************************************/
1589 NTSTATUS _lsa_EnumPrivsAccount(pipes_struct *p,
1590 struct lsa_EnumPrivsAccount *r)
1592 NTSTATUS status = NT_STATUS_OK;
1593 struct lsa_info *info=NULL;
1595 PRIVILEGE_SET privileges;
1596 struct lsa_PrivilegeSet *priv_set = NULL;
1597 struct lsa_LUIDAttribute *luid_attrs = NULL;
1600 /* find the connection policy handle. */
1601 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
1602 return NT_STATUS_INVALID_HANDLE;
1604 if ( !get_privileges_for_sids( &mask, &info->sid, 1 ) )
1605 return NT_STATUS_OBJECT_NAME_NOT_FOUND;
1607 privilege_set_init( &privileges );
1609 if ( se_priv_to_privilege_set( &privileges, &mask ) ) {
1611 DEBUG(10,("_lsa_EnumPrivsAccount: %s has %d privileges\n",
1612 sid_string_dbg(&info->sid),
1615 priv_set = TALLOC_ZERO_P(p->mem_ctx, struct lsa_PrivilegeSet);
1617 status = NT_STATUS_NO_MEMORY;
1621 luid_attrs = TALLOC_ZERO_ARRAY(p->mem_ctx,
1622 struct lsa_LUIDAttribute,
1625 status = NT_STATUS_NO_MEMORY;
1629 for (i=0; i<privileges.count; i++) {
1630 luid_attrs[i].luid.low = privileges.set[i].luid.low;
1631 luid_attrs[i].luid.high = privileges.set[i].luid.high;
1632 luid_attrs[i].attribute = privileges.set[i].attr;
1635 priv_set->count = privileges.count;
1636 priv_set->unknown = 0;
1637 priv_set->set = luid_attrs;
1639 *r->out.privs = priv_set;
1641 status = NT_STATUS_NO_SUCH_PRIVILEGE;
1645 privilege_set_free( &privileges );
1650 /***************************************************************************
1651 _lsa_GetSystemAccessAccount
1652 ***************************************************************************/
1654 NTSTATUS _lsa_GetSystemAccessAccount(pipes_struct *p,
1655 struct lsa_GetSystemAccessAccount *r)
1657 struct lsa_info *info=NULL;
1659 /* find the connection policy handle. */
1661 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
1662 return NT_STATUS_INVALID_HANDLE;
1664 if (!lookup_sid(p->mem_ctx, &info->sid, NULL, NULL, NULL))
1665 return NT_STATUS_ACCESS_DENIED;
1668 0x01 -> Log on locally
1669 0x02 -> Access this computer from network
1670 0x04 -> Log on as a batch job
1671 0x10 -> Log on as a service
1673 they can be ORed together
1676 *r->out.access_mask = PR_LOG_ON_LOCALLY | PR_ACCESS_FROM_NETWORK;
1678 return NT_STATUS_OK;
1681 /***************************************************************************
1682 update the systemaccount information
1683 ***************************************************************************/
1685 NTSTATUS _lsa_SetSystemAccessAccount(pipes_struct *p,
1686 struct lsa_SetSystemAccessAccount *r)
1688 struct lsa_info *info=NULL;
1691 /* find the connection policy handle. */
1692 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
1693 return NT_STATUS_INVALID_HANDLE;
1695 /* check to see if the pipe_user is a Domain Admin since
1696 account_pol.tdb was already opened as root, this is all we have */
1698 if ( !nt_token_check_domain_rid( p->pipe_user.nt_user_token, DOMAIN_GROUP_RID_ADMINS ) )
1699 return NT_STATUS_ACCESS_DENIED;
1701 if (!pdb_getgrsid(&map, info->sid))
1702 return NT_STATUS_NO_SUCH_GROUP;
1704 return pdb_update_group_mapping_entry(&map);
1707 /***************************************************************************
1708 _lsa_AddPrivilegesToAccount
1709 For a given SID, add some privileges.
1710 ***************************************************************************/
1712 NTSTATUS _lsa_AddPrivilegesToAccount(pipes_struct *p,
1713 struct lsa_AddPrivilegesToAccount *r)
1715 struct lsa_info *info = NULL;
1717 struct lsa_PrivilegeSet *set = NULL;
1719 /* find the connection policy handle. */
1720 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
1721 return NT_STATUS_INVALID_HANDLE;
1723 /* check to see if the pipe_user is root or a Domain Admin since
1724 account_pol.tdb was already opened as root, this is all we have */
1726 if ( p->pipe_user.ut.uid != sec_initial_uid()
1727 && !nt_token_check_domain_rid( p->pipe_user.nt_user_token, DOMAIN_GROUP_RID_ADMINS ) )
1729 return NT_STATUS_ACCESS_DENIED;
1733 if ( !privilege_set_to_se_priv( &mask, set ) )
1734 return NT_STATUS_NO_SUCH_PRIVILEGE;
1736 if ( !grant_privilege( &info->sid, &mask ) ) {
1737 DEBUG(3,("_lsa_AddPrivilegesToAccount: grant_privilege(%s) failed!\n",
1738 sid_string_dbg(&info->sid) ));
1739 DEBUG(3,("Privilege mask:\n"));
1740 dump_se_priv( DBGC_ALL, 3, &mask );
1741 return NT_STATUS_NO_SUCH_PRIVILEGE;
1744 return NT_STATUS_OK;
1747 /***************************************************************************
1748 _lsa_RemovePrivilegesFromAccount
1749 For a given SID, remove some privileges.
1750 ***************************************************************************/
1752 NTSTATUS _lsa_RemovePrivilegesFromAccount(pipes_struct *p,
1753 struct lsa_RemovePrivilegesFromAccount *r)
1755 struct lsa_info *info = NULL;
1757 struct lsa_PrivilegeSet *set = NULL;
1759 /* find the connection policy handle. */
1760 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
1761 return NT_STATUS_INVALID_HANDLE;
1763 /* check to see if the pipe_user is root or a Domain Admin since
1764 account_pol.tdb was already opened as root, this is all we have */
1766 if ( p->pipe_user.ut.uid != sec_initial_uid()
1767 && !nt_token_check_domain_rid( p->pipe_user.nt_user_token, DOMAIN_GROUP_RID_ADMINS ) )
1769 return NT_STATUS_ACCESS_DENIED;
1774 if ( !privilege_set_to_se_priv( &mask, set ) )
1775 return NT_STATUS_NO_SUCH_PRIVILEGE;
1777 if ( !revoke_privilege( &info->sid, &mask ) ) {
1778 DEBUG(3,("_lsa_RemovePrivilegesFromAccount: revoke_privilege(%s) failed!\n",
1779 sid_string_dbg(&info->sid) ));
1780 DEBUG(3,("Privilege mask:\n"));
1781 dump_se_priv( DBGC_ALL, 3, &mask );
1782 return NT_STATUS_NO_SUCH_PRIVILEGE;
1785 return NT_STATUS_OK;
1788 /***************************************************************************
1790 ***************************************************************************/
1792 NTSTATUS _lsa_QuerySecurity(pipes_struct *p,
1793 struct lsa_QuerySecurity *r)
1795 struct lsa_info *handle=NULL;
1796 SEC_DESC *psd = NULL;
1800 /* find the connection policy handle. */
1801 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle))
1802 return NT_STATUS_INVALID_HANDLE;
1804 /* check if the user have enough rights */
1805 if (!(handle->access & LSA_POLICY_VIEW_LOCAL_INFORMATION))
1806 return NT_STATUS_ACCESS_DENIED;
1809 switch (r->in.sec_info) {
1811 /* SD contains only the owner */
1813 status=lsa_get_generic_sd(p->mem_ctx, &psd, &sd_size);
1814 if(!NT_STATUS_IS_OK(status))
1815 return NT_STATUS_NO_MEMORY;
1818 if((*r->out.sdbuf = make_sec_desc_buf(p->mem_ctx, sd_size, psd)) == NULL)
1819 return NT_STATUS_NO_MEMORY;
1822 /* SD contains only the ACL */
1824 status=lsa_get_generic_sd(p->mem_ctx, &psd, &sd_size);
1825 if(!NT_STATUS_IS_OK(status))
1826 return NT_STATUS_NO_MEMORY;
1828 if((*r->out.sdbuf = make_sec_desc_buf(p->mem_ctx, sd_size, psd)) == NULL)
1829 return NT_STATUS_NO_MEMORY;
1832 return NT_STATUS_INVALID_LEVEL;
1838 #if 0 /* AD DC work in ongoing in Samba 4 */
1840 /***************************************************************************
1841 ***************************************************************************/
1843 NTSTATUS _lsa_query_info2(pipes_struct *p, LSA_Q_QUERY_INFO2 *q_u, LSA_R_QUERY_INFO2 *r_u)
1845 struct lsa_info *handle;
1846 const char *nb_name;
1847 char *dns_name = NULL;
1848 char *forest_name = NULL;
1849 DOM_SID *sid = NULL;
1854 r_u->status = NT_STATUS_OK;
1856 if (!find_policy_by_hnd(p, &q_u->pol, (void **)(void *)&handle))
1857 return NT_STATUS_INVALID_HANDLE;
1859 switch (q_u->info_class) {
1861 /* check if the user have enough rights */
1862 if (!(handle->access & LSA_POLICY_VIEW_LOCAL_INFORMATION))
1863 return NT_STATUS_ACCESS_DENIED;
1865 /* Request PolicyPrimaryDomainInformation. */
1866 switch (lp_server_role()) {
1867 case ROLE_DOMAIN_PDC:
1868 case ROLE_DOMAIN_BDC:
1869 nb_name = get_global_sam_name();
1870 /* ugly temp hack for these next two */
1872 /* This should be a 'netbios domain -> DNS domain' mapping */
1873 dnsdomname = get_mydnsdomname(p->mem_ctx);
1874 if (!dnsdomname || !*dnsdomname) {
1875 return NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
1877 strlower_m(dnsdomname);
1879 dns_name = dnsdomname;
1880 forest_name = dnsdomname;
1882 sid = get_global_sam_sid();
1883 secrets_fetch_domain_guid(lp_workgroup(), &guid);
1886 return NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
1888 init_dns_dom_info(&r_u->info.dns_dom_info, nb_name, dns_name,
1889 forest_name,&guid,sid);
1892 DEBUG(0,("_lsa_query_info2: unknown info level in Lsa Query: %d\n", q_u->info_class));
1893 r_u->status = NT_STATUS_INVALID_INFO_CLASS;
1897 if (NT_STATUS_IS_OK(r_u->status)) {
1899 r_u->info_class = q_u->info_class;
1904 #endif /* AD DC work in ongoing in Samba 4 */
1906 /***************************************************************************
1907 _lsa_AddAccountRights
1908 ***************************************************************************/
1910 NTSTATUS _lsa_AddAccountRights(pipes_struct *p,
1911 struct lsa_AddAccountRights *r)
1913 struct lsa_info *info = NULL;
1917 /* find the connection policy handle. */
1918 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
1919 return NT_STATUS_INVALID_HANDLE;
1921 /* check to see if the pipe_user is a Domain Admin since
1922 account_pol.tdb was already opened as root, this is all we have */
1924 if ( p->pipe_user.ut.uid != sec_initial_uid()
1925 && !nt_token_check_domain_rid( p->pipe_user.nt_user_token, DOMAIN_GROUP_RID_ADMINS ) )
1927 return NT_STATUS_ACCESS_DENIED;
1930 /* according to an NT4 PDC, you can add privileges to SIDs even without
1931 call_lsa_create_account() first. And you can use any arbitrary SID. */
1933 sid_copy( &sid, r->in.sid );
1935 for ( i=0; i < r->in.rights->count; i++ ) {
1937 const char *privname = r->in.rights->names[i].string;
1939 /* only try to add non-null strings */
1944 if ( !grant_privilege_by_name( &sid, privname ) ) {
1945 DEBUG(2,("_lsa_AddAccountRights: Failed to add privilege [%s]\n",
1947 return NT_STATUS_NO_SUCH_PRIVILEGE;
1951 return NT_STATUS_OK;
1954 /***************************************************************************
1955 _lsa_RemoveAccountRights
1956 ***************************************************************************/
1958 NTSTATUS _lsa_RemoveAccountRights(pipes_struct *p,
1959 struct lsa_RemoveAccountRights *r)
1961 struct lsa_info *info = NULL;
1964 const char *privname = NULL;
1966 /* find the connection policy handle. */
1967 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
1968 return NT_STATUS_INVALID_HANDLE;
1970 /* check to see if the pipe_user is a Domain Admin since
1971 account_pol.tdb was already opened as root, this is all we have */
1973 if ( p->pipe_user.ut.uid != sec_initial_uid()
1974 && !nt_token_check_domain_rid( p->pipe_user.nt_user_token, DOMAIN_GROUP_RID_ADMINS ) )
1976 return NT_STATUS_ACCESS_DENIED;
1979 sid_copy( &sid, r->in.sid );
1981 if ( r->in.remove_all ) {
1982 if ( !revoke_all_privileges( &sid ) )
1983 return NT_STATUS_ACCESS_DENIED;
1985 return NT_STATUS_OK;
1988 for ( i=0; i < r->in.rights->count; i++ ) {
1990 privname = r->in.rights->names[i].string;
1992 /* only try to add non-null strings */
1997 if ( !revoke_privilege_by_name( &sid, privname ) ) {
1998 DEBUG(2,("_lsa_RemoveAccountRights: Failed to revoke privilege [%s]\n",
2000 return NT_STATUS_NO_SUCH_PRIVILEGE;
2004 return NT_STATUS_OK;
2007 /*******************************************************************
2008 ********************************************************************/
2010 static NTSTATUS init_lsa_right_set(TALLOC_CTX *mem_ctx,
2011 struct lsa_RightSet *r,
2012 PRIVILEGE_SET *privileges)
2015 const char *privname;
2016 const char **privname_array = NULL;
2019 for (i=0; i<privileges->count; i++) {
2021 privname = luid_to_privilege_name(&privileges->set[i].luid);
2023 if (!add_string_to_array(mem_ctx, privname,
2024 &privname_array, &num_priv)) {
2025 return NT_STATUS_NO_MEMORY;
2032 r->names = TALLOC_ZERO_ARRAY(mem_ctx, struct lsa_StringLarge,
2035 return NT_STATUS_NO_MEMORY;
2038 for (i=0; i<num_priv; i++) {
2039 init_lsa_StringLarge(&r->names[i], privname_array[i]);
2042 r->count = num_priv;
2045 return NT_STATUS_OK;
2048 /***************************************************************************
2049 _lsa_EnumAccountRights
2050 ***************************************************************************/
2052 NTSTATUS _lsa_EnumAccountRights(pipes_struct *p,
2053 struct lsa_EnumAccountRights *r)
2056 struct lsa_info *info = NULL;
2058 PRIVILEGE_SET privileges;
2061 /* find the connection policy handle. */
2063 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
2064 return NT_STATUS_INVALID_HANDLE;
2066 /* according to an NT4 PDC, you can add privileges to SIDs even without
2067 call_lsa_create_account() first. And you can use any arbitrary SID. */
2069 sid_copy( &sid, r->in.sid );
2071 if ( !get_privileges_for_sids( &mask, &sid, 1 ) )
2072 return NT_STATUS_OBJECT_NAME_NOT_FOUND;
2074 privilege_set_init( &privileges );
2076 if ( se_priv_to_privilege_set( &privileges, &mask ) ) {
2078 DEBUG(10,("_lsa_EnumAccountRights: %s has %d privileges\n",
2079 sid_string_dbg(&sid), privileges.count));
2081 status = init_lsa_right_set(p->mem_ctx, r->out.rights, &privileges);
2083 status = NT_STATUS_NO_SUCH_PRIVILEGE;
2086 privilege_set_free( &privileges );
2091 /***************************************************************************
2092 _lsa_LookupPrivValue
2093 ***************************************************************************/
2095 NTSTATUS _lsa_LookupPrivValue(pipes_struct *p,
2096 struct lsa_LookupPrivValue *r)
2098 struct lsa_info *info = NULL;
2099 const char *name = NULL;
2100 LUID_ATTR priv_luid;
2103 /* find the connection policy handle. */
2105 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
2106 return NT_STATUS_INVALID_HANDLE;
2108 name = r->in.name->string;
2110 DEBUG(10,("_lsa_lookup_priv_value: name = %s\n", name));
2112 if ( !se_priv_from_name( name, &mask ) )
2113 return NT_STATUS_NO_SUCH_PRIVILEGE;
2115 priv_luid = get_privilege_luid( &mask );
2117 r->out.luid->low = priv_luid.luid.low;
2118 r->out.luid->high = priv_luid.luid.high;
2120 return NT_STATUS_OK;
2124 * From here on the server routines are just dummy ones to make smbd link with
2125 * librpc/gen_ndr/srv_lsa.c. These routines are actually never called, we are
2126 * pulling the server stubs across one by one.
2129 NTSTATUS _lsa_Delete(pipes_struct *p, struct lsa_Delete *r)
2131 p->rng_fault_state = True;
2132 return NT_STATUS_NOT_IMPLEMENTED;
2135 NTSTATUS _lsa_SetSecObj(pipes_struct *p, struct lsa_SetSecObj *r)
2137 p->rng_fault_state = True;
2138 return NT_STATUS_NOT_IMPLEMENTED;
2141 NTSTATUS _lsa_ChangePassword(pipes_struct *p, struct lsa_ChangePassword *r)
2143 p->rng_fault_state = True;
2144 return NT_STATUS_NOT_IMPLEMENTED;
2147 NTSTATUS _lsa_SetInfoPolicy(pipes_struct *p, struct lsa_SetInfoPolicy *r)
2149 p->rng_fault_state = True;
2150 return NT_STATUS_NOT_IMPLEMENTED;
2153 NTSTATUS _lsa_ClearAuditLog(pipes_struct *p, struct lsa_ClearAuditLog *r)
2155 p->rng_fault_state = True;
2156 return NT_STATUS_NOT_IMPLEMENTED;
2159 NTSTATUS _lsa_GetQuotasForAccount(pipes_struct *p, struct lsa_GetQuotasForAccount *r)
2161 p->rng_fault_state = True;
2162 return NT_STATUS_NOT_IMPLEMENTED;
2165 NTSTATUS _lsa_SetQuotasForAccount(pipes_struct *p, struct lsa_SetQuotasForAccount *r)
2167 p->rng_fault_state = True;
2168 return NT_STATUS_NOT_IMPLEMENTED;
2171 NTSTATUS _lsa_QueryTrustedDomainInfo(pipes_struct *p, struct lsa_QueryTrustedDomainInfo *r)
2173 p->rng_fault_state = True;
2174 return NT_STATUS_NOT_IMPLEMENTED;
2177 NTSTATUS _lsa_SetInformationTrustedDomain(pipes_struct *p, struct lsa_SetInformationTrustedDomain *r)
2179 p->rng_fault_state = True;
2180 return NT_STATUS_NOT_IMPLEMENTED;
2183 NTSTATUS _lsa_QuerySecret(pipes_struct *p, struct lsa_QuerySecret *r)
2185 p->rng_fault_state = True;
2186 return NT_STATUS_NOT_IMPLEMENTED;
2189 NTSTATUS _lsa_LookupPrivName(pipes_struct *p, struct lsa_LookupPrivName *r)
2191 p->rng_fault_state = True;
2192 return NT_STATUS_NOT_IMPLEMENTED;
2195 NTSTATUS _lsa_EnumAccountsWithUserRight(pipes_struct *p, struct lsa_EnumAccountsWithUserRight *r)
2197 p->rng_fault_state = True;
2198 return NT_STATUS_NOT_IMPLEMENTED;
2201 NTSTATUS _lsa_QueryTrustedDomainInfoBySid(pipes_struct *p, struct lsa_QueryTrustedDomainInfoBySid *r)
2203 p->rng_fault_state = True;
2204 return NT_STATUS_NOT_IMPLEMENTED;
2207 NTSTATUS _lsa_SetTrustedDomainInfo(pipes_struct *p, struct lsa_SetTrustedDomainInfo *r)
2209 p->rng_fault_state = True;
2210 return NT_STATUS_NOT_IMPLEMENTED;
2213 NTSTATUS _lsa_DeleteTrustedDomain(pipes_struct *p, struct lsa_DeleteTrustedDomain *r)
2215 p->rng_fault_state = True;
2216 return NT_STATUS_NOT_IMPLEMENTED;
2219 NTSTATUS _lsa_StorePrivateData(pipes_struct *p, struct lsa_StorePrivateData *r)
2221 p->rng_fault_state = True;
2222 return NT_STATUS_NOT_IMPLEMENTED;
2225 NTSTATUS _lsa_RetrievePrivateData(pipes_struct *p, struct lsa_RetrievePrivateData *r)
2227 p->rng_fault_state = True;
2228 return NT_STATUS_NOT_IMPLEMENTED;
2231 NTSTATUS _lsa_QueryInfoPolicy2(pipes_struct *p, struct lsa_QueryInfoPolicy2 *r)
2233 p->rng_fault_state = True;
2234 return NT_STATUS_NOT_IMPLEMENTED;
2237 NTSTATUS _lsa_SetInfoPolicy2(pipes_struct *p, struct lsa_SetInfoPolicy2 *r)
2239 p->rng_fault_state = True;
2240 return NT_STATUS_NOT_IMPLEMENTED;
2243 NTSTATUS _lsa_QueryTrustedDomainInfoByName(pipes_struct *p, struct lsa_QueryTrustedDomainInfoByName *r)
2245 p->rng_fault_state = True;
2246 return NT_STATUS_NOT_IMPLEMENTED;
2249 NTSTATUS _lsa_SetTrustedDomainInfoByName(pipes_struct *p, struct lsa_SetTrustedDomainInfoByName *r)
2251 p->rng_fault_state = True;
2252 return NT_STATUS_NOT_IMPLEMENTED;
2255 NTSTATUS _lsa_EnumTrustedDomainsEx(pipes_struct *p, struct lsa_EnumTrustedDomainsEx *r)
2257 p->rng_fault_state = True;
2258 return NT_STATUS_NOT_IMPLEMENTED;
2261 NTSTATUS _lsa_CreateTrustedDomainEx(pipes_struct *p, struct lsa_CreateTrustedDomainEx *r)
2263 p->rng_fault_state = True;
2264 return NT_STATUS_NOT_IMPLEMENTED;
2267 NTSTATUS _lsa_CloseTrustedDomainEx(pipes_struct *p, struct lsa_CloseTrustedDomainEx *r)
2269 p->rng_fault_state = True;
2270 return NT_STATUS_NOT_IMPLEMENTED;
2273 NTSTATUS _lsa_QueryDomainInformationPolicy(pipes_struct *p, struct lsa_QueryDomainInformationPolicy *r)
2275 p->rng_fault_state = True;
2276 return NT_STATUS_NOT_IMPLEMENTED;
2279 NTSTATUS _lsa_SetDomainInformationPolicy(pipes_struct *p, struct lsa_SetDomainInformationPolicy *r)
2281 p->rng_fault_state = True;
2282 return NT_STATUS_NOT_IMPLEMENTED;
2285 NTSTATUS _lsa_OpenTrustedDomainByName(pipes_struct *p, struct lsa_OpenTrustedDomainByName *r)
2287 p->rng_fault_state = True;
2288 return NT_STATUS_NOT_IMPLEMENTED;
2291 NTSTATUS _lsa_TestCall(pipes_struct *p, struct lsa_TestCall *r)
2293 p->rng_fault_state = True;
2294 return NT_STATUS_NOT_IMPLEMENTED;
2297 NTSTATUS _lsa_CreateTrustedDomainEx2(pipes_struct *p, struct lsa_CreateTrustedDomainEx2 *r)
2299 p->rng_fault_state = True;
2300 return NT_STATUS_NOT_IMPLEMENTED;
2303 NTSTATUS _lsa_CREDRWRITE(pipes_struct *p, struct lsa_CREDRWRITE *r)
2305 p->rng_fault_state = True;
2306 return NT_STATUS_NOT_IMPLEMENTED;
2309 NTSTATUS _lsa_CREDRREAD(pipes_struct *p, struct lsa_CREDRREAD *r)
2311 p->rng_fault_state = True;
2312 return NT_STATUS_NOT_IMPLEMENTED;
2315 NTSTATUS _lsa_CREDRENUMERATE(pipes_struct *p, struct lsa_CREDRENUMERATE *r)
2317 p->rng_fault_state = True;
2318 return NT_STATUS_NOT_IMPLEMENTED;
2321 NTSTATUS _lsa_CREDRWRITEDOMAINCREDENTIALS(pipes_struct *p, struct lsa_CREDRWRITEDOMAINCREDENTIALS *r)
2323 p->rng_fault_state = True;
2324 return NT_STATUS_NOT_IMPLEMENTED;
2327 NTSTATUS _lsa_CREDRREADDOMAINCREDENTIALS(pipes_struct *p, struct lsa_CREDRREADDOMAINCREDENTIALS *r)
2329 p->rng_fault_state = True;
2330 return NT_STATUS_NOT_IMPLEMENTED;
2333 NTSTATUS _lsa_CREDRDELETE(pipes_struct *p, struct lsa_CREDRDELETE *r)
2335 p->rng_fault_state = True;
2336 return NT_STATUS_NOT_IMPLEMENTED;
2339 NTSTATUS _lsa_CREDRGETTARGETINFO(pipes_struct *p, struct lsa_CREDRGETTARGETINFO *r)
2341 p->rng_fault_state = True;
2342 return NT_STATUS_NOT_IMPLEMENTED;
2345 NTSTATUS _lsa_CREDRPROFILELOADED(pipes_struct *p, struct lsa_CREDRPROFILELOADED *r)
2347 p->rng_fault_state = True;
2348 return NT_STATUS_NOT_IMPLEMENTED;
2351 NTSTATUS _lsa_CREDRGETSESSIONTYPES(pipes_struct *p, struct lsa_CREDRGETSESSIONTYPES *r)
2353 p->rng_fault_state = True;
2354 return NT_STATUS_NOT_IMPLEMENTED;
2357 NTSTATUS _lsa_LSARREGISTERAUDITEVENT(pipes_struct *p, struct lsa_LSARREGISTERAUDITEVENT *r)
2359 p->rng_fault_state = True;
2360 return NT_STATUS_NOT_IMPLEMENTED;
2363 NTSTATUS _lsa_LSARGENAUDITEVENT(pipes_struct *p, struct lsa_LSARGENAUDITEVENT *r)
2365 p->rng_fault_state = True;
2366 return NT_STATUS_NOT_IMPLEMENTED;
2369 NTSTATUS _lsa_LSARUNREGISTERAUDITEVENT(pipes_struct *p, struct lsa_LSARUNREGISTERAUDITEVENT *r)
2371 p->rng_fault_state = True;
2372 return NT_STATUS_NOT_IMPLEMENTED;
2375 NTSTATUS _lsa_lsaRQueryForestTrustInformation(pipes_struct *p, struct lsa_lsaRQueryForestTrustInformation *r)
2377 p->rng_fault_state = True;
2378 return NT_STATUS_NOT_IMPLEMENTED;
2381 NTSTATUS _lsa_LSARSETFORESTTRUSTINFORMATION(pipes_struct *p, struct lsa_LSARSETFORESTTRUSTINFORMATION *r)
2383 p->rng_fault_state = True;
2384 return NT_STATUS_NOT_IMPLEMENTED;
2387 NTSTATUS _lsa_CREDRRENAME(pipes_struct *p, struct lsa_CREDRRENAME *r)
2389 p->rng_fault_state = True;
2390 return NT_STATUS_NOT_IMPLEMENTED;
2393 NTSTATUS _lsa_LSAROPENPOLICYSCE(pipes_struct *p, struct lsa_LSAROPENPOLICYSCE *r)
2395 p->rng_fault_state = True;
2396 return NT_STATUS_NOT_IMPLEMENTED;
2399 NTSTATUS _lsa_LSARADTREGISTERSECURITYEVENTSOURCE(pipes_struct *p, struct lsa_LSARADTREGISTERSECURITYEVENTSOURCE *r)
2401 p->rng_fault_state = True;
2402 return NT_STATUS_NOT_IMPLEMENTED;
2405 NTSTATUS _lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE(pipes_struct *p, struct lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE *r)
2407 p->rng_fault_state = True;
2408 return NT_STATUS_NOT_IMPLEMENTED;
2411 NTSTATUS _lsa_LSARADTREPORTSECURITYEVENT(pipes_struct *p, struct lsa_LSARADTREPORTSECURITYEVENT *r)
2413 p->rng_fault_state = True;
2414 return NT_STATUS_NOT_IMPLEMENTED;