2 * Unix SMB/CIFS implementation.
3 * RPC Pipe client / server routines
4 * Copyright (C) Andrew Tridgell 1992-1997,
5 * Copyright (C) Luke Kenneth Casson Leighton 1996-1997,
6 * Copyright (C) Paul Ashton 1997,
7 * Copyright (C) Jeremy Allison 2001, 2006.
8 * Copyright (C) Rafal Szczesniak 2002,
9 * Copyright (C) Jim McDonough <jmcd@us.ibm.com> 2002,
10 * Copyright (C) Simo Sorce 2003.
11 * Copyright (C) Gerald (Jerry) Carter 2005.
12 * Copyright (C) Volker Lendecke 2005.
13 * Copyright (C) Guenther Deschner 2008.
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 3 of the License, or
18 * (at your option) any later version.
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, see <http://www.gnu.org/licenses/>.
29 /* This is the implementation of the lsa server code. */
34 #define DBGC_CLASS DBGC_RPC_SRV
43 const struct generic_mapping lsa_generic_mapping = {
50 /***************************************************************************
51 init_lsa_ref_domain_list - adds a domain if it's not already in, returns the index.
52 ***************************************************************************/
54 static int init_lsa_ref_domain_list(TALLOC_CTX *mem_ctx,
55 struct lsa_RefDomainList *ref,
61 if (dom_name != NULL) {
62 for (num = 0; num < ref->count; num++) {
63 if (sid_equal(dom_sid, ref->domains[num].sid)) {
71 if (num >= MAX_REF_DOMAINS) {
72 /* index not found, already at maximum domain limit */
77 ref->max_size = MAX_REF_DOMAINS;
79 ref->domains = TALLOC_REALLOC_ARRAY(mem_ctx, ref->domains,
80 struct lsa_DomainInfo, ref->count);
85 ZERO_STRUCT(ref->domains[num]);
87 init_lsa_StringLarge(&ref->domains[num].name, dom_name);
88 ref->domains[num].sid = sid_dup_talloc(mem_ctx, dom_sid);
89 if (!ref->domains[num].sid) {
97 /*******************************************************************
98 Function to free the per handle data.
99 ********************************************************************/
101 static void free_lsa_info(void *ptr)
103 struct lsa_info *lsa = (struct lsa_info *)ptr;
108 /***************************************************************************
109 initialize a lsa_DomainInfo structure.
110 ***************************************************************************/
112 static void init_dom_query_3(struct lsa_DomainInfo *r,
116 init_lsa_StringLarge(&r->name, name);
120 /***************************************************************************
121 initialize a lsa_DomainInfo structure.
122 ***************************************************************************/
124 static void init_dom_query_5(struct lsa_DomainInfo *r,
128 init_lsa_StringLarge(&r->name, name);
132 /***************************************************************************
133 lookup_lsa_rids. Must be called as root for lookup_name to work.
134 ***************************************************************************/
136 static NTSTATUS lookup_lsa_rids(TALLOC_CTX *mem_ctx,
137 struct lsa_RefDomainList *ref,
138 struct lsa_TranslatedSid *prid,
139 uint32_t num_entries,
140 struct lsa_String *name,
142 uint32_t *pmapped_count)
144 uint32 mapped_count, i;
146 SMB_ASSERT(num_entries <= MAX_LOOKUP_SIDS);
151 for (i = 0; i < num_entries; i++) {
155 const char *full_name;
157 enum lsa_SidType type = SID_NAME_UNKNOWN;
159 /* Split name into domain and user component */
161 full_name = name[i].string;
162 if (full_name == NULL) {
163 return NT_STATUS_NO_MEMORY;
166 DEBUG(5, ("lookup_lsa_rids: looking up name %s\n", full_name));
168 /* We can ignore the result of lookup_name, it will not touch
169 "type" if it's not successful */
171 lookup_name(mem_ctx, full_name, flags, &domain, NULL,
176 case SID_NAME_DOM_GRP:
177 case SID_NAME_DOMAIN:
179 case SID_NAME_WKN_GRP:
180 DEBUG(5, ("init_lsa_rids: %s found\n", full_name));
181 /* Leave these unchanged */
184 /* Don't hand out anything but the list above */
185 DEBUG(5, ("init_lsa_rids: %s not found\n", full_name));
186 type = SID_NAME_UNKNOWN;
193 if (type != SID_NAME_UNKNOWN) {
194 sid_split_rid(&sid, &rid);
195 dom_idx = init_lsa_ref_domain_list(mem_ctx, ref, domain, &sid);
199 init_lsa_translated_sid(&prid[i], type, rid, dom_idx);
202 *pmapped_count = mapped_count;
206 /***************************************************************************
207 lookup_lsa_sids. Must be called as root for lookup_name to work.
208 ***************************************************************************/
210 static NTSTATUS lookup_lsa_sids(TALLOC_CTX *mem_ctx,
211 struct lsa_RefDomainList *ref,
212 struct lsa_TranslatedSid3 *trans_sids,
213 uint32_t num_entries,
214 struct lsa_String *name,
216 uint32 *pmapped_count)
218 uint32 mapped_count, i;
220 SMB_ASSERT(num_entries <= MAX_LOOKUP_SIDS);
225 for (i = 0; i < num_entries; i++) {
229 const char *full_name;
231 enum lsa_SidType type = SID_NAME_UNKNOWN;
235 /* Split name into domain and user component */
237 full_name = name[i].string;
238 if (full_name == NULL) {
239 return NT_STATUS_NO_MEMORY;
242 DEBUG(5, ("init_lsa_sids: looking up name %s\n", full_name));
244 /* We can ignore the result of lookup_name, it will not touch
245 "type" if it's not successful */
247 lookup_name(mem_ctx, full_name, flags, &domain, NULL,
252 case SID_NAME_DOM_GRP:
253 case SID_NAME_DOMAIN:
255 case SID_NAME_WKN_GRP:
256 DEBUG(5, ("init_lsa_sids: %s found\n", full_name));
257 /* Leave these unchanged */
260 /* Don't hand out anything but the list above */
261 DEBUG(5, ("init_lsa_sids: %s not found\n", full_name));
262 type = SID_NAME_UNKNOWN;
269 if (type != SID_NAME_UNKNOWN) {
271 sid_copy(&domain_sid, &sid);
272 sid_split_rid(&domain_sid, &rid);
273 dom_idx = init_lsa_ref_domain_list(mem_ctx, ref, domain, &domain_sid);
277 /* Initialize the lsa_TranslatedSid3 return. */
278 trans_sids[i].sid_type = type;
279 trans_sids[i].sid = sid_dup_talloc(mem_ctx, &sid);
280 trans_sids[i].sid_index = dom_idx;
283 *pmapped_count = mapped_count;
287 static NTSTATUS lsa_get_generic_sd(TALLOC_CTX *mem_ctx, SEC_DESC **sd, size_t *sd_size)
289 DOM_SID local_adm_sid;
297 init_sec_access(&mask, LSA_POLICY_EXECUTE);
298 init_sec_ace(&ace[0], &global_sid_World, SEC_ACE_TYPE_ACCESS_ALLOWED, mask, 0);
300 sid_copy(&adm_sid, get_global_sam_sid());
301 sid_append_rid(&adm_sid, DOMAIN_GROUP_RID_ADMINS);
302 init_sec_access(&mask, LSA_POLICY_ALL_ACCESS);
303 init_sec_ace(&ace[1], &adm_sid, SEC_ACE_TYPE_ACCESS_ALLOWED, mask, 0);
305 sid_copy(&local_adm_sid, &global_sid_Builtin);
306 sid_append_rid(&local_adm_sid, BUILTIN_ALIAS_RID_ADMINS);
307 init_sec_access(&mask, LSA_POLICY_ALL_ACCESS);
308 init_sec_ace(&ace[2], &local_adm_sid, SEC_ACE_TYPE_ACCESS_ALLOWED, mask, 0);
310 if((psa = make_sec_acl(mem_ctx, NT4_ACL_REVISION, 3, ace)) == NULL)
311 return NT_STATUS_NO_MEMORY;
313 if((*sd = make_sec_desc(mem_ctx, SECURITY_DESCRIPTOR_REVISION_1,
314 SEC_DESC_SELF_RELATIVE, &adm_sid, NULL, NULL,
315 psa, sd_size)) == NULL)
316 return NT_STATUS_NO_MEMORY;
321 #if 0 /* AD DC work in ongoing in Samba 4 */
323 /***************************************************************************
325 ***************************************************************************/
327 static void init_dns_dom_info(LSA_DNS_DOM_INFO *r_l, const char *nb_name,
328 const char *dns_name, const char *forest_name,
329 struct GUID *dom_guid, DOM_SID *dom_sid)
331 if (nb_name && *nb_name) {
332 init_unistr2(&r_l->uni_nb_dom_name, nb_name, UNI_FLAGS_NONE);
333 init_uni_hdr(&r_l->hdr_nb_dom_name, &r_l->uni_nb_dom_name);
334 r_l->hdr_nb_dom_name.uni_max_len += 2;
335 r_l->uni_nb_dom_name.uni_max_len += 1;
338 if (dns_name && *dns_name) {
339 init_unistr2(&r_l->uni_dns_dom_name, dns_name, UNI_FLAGS_NONE);
340 init_uni_hdr(&r_l->hdr_dns_dom_name, &r_l->uni_dns_dom_name);
341 r_l->hdr_dns_dom_name.uni_max_len += 2;
342 r_l->uni_dns_dom_name.uni_max_len += 1;
345 if (forest_name && *forest_name) {
346 init_unistr2(&r_l->uni_forest_name, forest_name, UNI_FLAGS_NONE);
347 init_uni_hdr(&r_l->hdr_forest_name, &r_l->uni_forest_name);
348 r_l->hdr_forest_name.uni_max_len += 2;
349 r_l->uni_forest_name.uni_max_len += 1;
352 /* how do we init the guid ? probably should write an init fn */
354 memcpy(&r_l->dom_guid, dom_guid, sizeof(struct GUID));
358 r_l->ptr_dom_sid = 1;
359 init_dom_sid2(&r_l->dom_sid, dom_sid);
362 #endif /* AD DC work in ongoing in Samba 4 */
365 /***************************************************************************
367 ***************************************************************************/
369 NTSTATUS _lsa_OpenPolicy2(pipes_struct *p,
370 struct lsa_OpenPolicy2 *r)
372 struct lsa_info *info;
373 SEC_DESC *psd = NULL;
375 uint32 des_access = r->in.access_mask;
380 /* map the generic bits to the lsa policy ones */
381 se_map_generic(&des_access, &lsa_generic_mapping);
383 /* get the generic lsa policy SD until we store it */
384 lsa_get_generic_sd(p->mem_ctx, &psd, &sd_size);
386 if(!se_access_check(psd, p->pipe_user.nt_user_token, des_access, &acc_granted, &status)) {
387 if (p->pipe_user.ut.uid != sec_initial_uid()) {
390 DEBUG(4,("ACCESS should be DENIED (granted: %#010x; required: %#010x)\n",
391 acc_granted, des_access));
392 DEBUGADD(4,("but overwritten by euid == 0\n"));
395 /* This is needed for lsa_open_account and rpcclient .... :-) */
397 if (p->pipe_user.ut.uid == sec_initial_uid())
398 acc_granted = LSA_POLICY_ALL_ACCESS;
400 /* associate the domain SID with the (unique) handle. */
401 if ((info = SMB_MALLOC_P(struct lsa_info)) == NULL)
402 return NT_STATUS_NO_MEMORY;
405 sid_copy(&info->sid,get_global_sam_sid());
406 info->access = acc_granted;
408 /* set up the LSA QUERY INFO response */
409 if (!create_policy_hnd(p, r->out.handle, free_lsa_info, (void *)info))
410 return NT_STATUS_OBJECT_NAME_NOT_FOUND;
415 /***************************************************************************
417 ***************************************************************************/
419 NTSTATUS _lsa_OpenPolicy(pipes_struct *p,
420 struct lsa_OpenPolicy *r)
422 struct lsa_info *info;
423 SEC_DESC *psd = NULL;
425 uint32 des_access= r->in.access_mask;
430 /* map the generic bits to the lsa policy ones */
431 se_map_generic(&des_access, &lsa_generic_mapping);
433 /* get the generic lsa policy SD until we store it */
434 lsa_get_generic_sd(p->mem_ctx, &psd, &sd_size);
436 if(!se_access_check(psd, p->pipe_user.nt_user_token, des_access, &acc_granted, &status)) {
437 if (geteuid() != 0) {
440 DEBUG(4,("ACCESS should be DENIED (granted: %#010x; required: %#010x)\n",
441 acc_granted, des_access));
442 DEBUGADD(4,("but overwritten by euid == 0\n"));
443 acc_granted = des_access;
446 /* associate the domain SID with the (unique) handle. */
447 if ((info = SMB_MALLOC_P(struct lsa_info)) == NULL)
448 return NT_STATUS_NO_MEMORY;
451 sid_copy(&info->sid,get_global_sam_sid());
452 info->access = acc_granted;
454 /* set up the LSA QUERY INFO response */
455 if (!create_policy_hnd(p, r->out.handle, free_lsa_info, (void *)info))
456 return NT_STATUS_OBJECT_NAME_NOT_FOUND;
461 /***************************************************************************
462 _lsa_EnumTrustDom - this needs fixing to do more than return NULL ! JRA.
464 ***************************************************************************/
466 NTSTATUS _lsa_EnumTrustDom(pipes_struct *p,
467 struct lsa_EnumTrustDom *r)
469 struct lsa_info *info;
471 struct trustdom_info **domains;
472 struct lsa_DomainInfo *lsa_domains = NULL;
476 * preferred length is set to 5 as a "our" preferred length
477 * nt sets this parameter to 2
478 * update (20.08.2002): it's not preferred length, but preferred size!
479 * it needs further investigation how to optimally choose this value
481 uint32 max_num_domains =
482 r->in.max_size < 5 ? r->in.max_size : 10;
487 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
488 return NT_STATUS_INVALID_HANDLE;
490 /* check if the user have enough rights */
491 if (!(info->access & LSA_POLICY_VIEW_LOCAL_INFORMATION))
492 return NT_STATUS_ACCESS_DENIED;
494 nt_status = pdb_enum_trusteddoms(p->mem_ctx, &num_domains, &domains);
496 if (!NT_STATUS_IS_OK(nt_status)) {
500 if (*r->in.resume_handle < num_domains) {
501 num_thistime = MIN(num_domains, max_num_domains);
503 nt_status = STATUS_MORE_ENTRIES;
505 if (*r->in.resume_handle + num_thistime > num_domains) {
506 num_thistime = num_domains - *r->in.resume_handle;
507 nt_status = NT_STATUS_OK;
510 next_idx = *r->in.resume_handle + num_thistime;
513 next_idx = 0xffffffff;
514 nt_status = NT_STATUS_NO_MORE_ENTRIES;
517 /* set up the lsa_enum_trust_dom response */
519 lsa_domains = TALLOC_ZERO_ARRAY(p->mem_ctx, struct lsa_DomainInfo,
522 return NT_STATUS_NO_MEMORY;
525 for (i=0; i<num_thistime; i++) {
526 init_lsa_StringLarge(&lsa_domains[i].name, domains[i]->name);
527 lsa_domains[i].sid = &domains[i]->sid;
530 *r->out.resume_handle = next_idx;
531 r->out.domains->count = num_thistime;
532 r->out.domains->domains = lsa_domains;
537 #define LSA_AUDIT_NUM_CATEGORIES_NT4 7
538 #define LSA_AUDIT_NUM_CATEGORIES_WIN2K 9
539 #define LSA_AUDIT_NUM_CATEGORIES LSA_AUDIT_NUM_CATEGORIES_NT4
541 /***************************************************************************
543 ***************************************************************************/
545 NTSTATUS _lsa_QueryInfoPolicy(pipes_struct *p,
546 struct lsa_QueryInfoPolicy *r)
548 NTSTATUS status = NT_STATUS_OK;
549 struct lsa_info *handle;
553 union lsa_PolicyInformation *info = NULL;
555 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle))
556 return NT_STATUS_INVALID_HANDLE;
558 info = TALLOC_ZERO_P(p->mem_ctx, union lsa_PolicyInformation);
560 return NT_STATUS_NO_MEMORY;
563 switch (r->in.level) {
567 uint32 policy_def = LSA_AUDIT_POLICY_ALL;
569 /* check if the user have enough rights */
570 if (!(handle->access & LSA_POLICY_VIEW_AUDIT_INFORMATION)) {
571 DEBUG(10,("_lsa_QueryInfoPolicy: insufficient access rights\n"));
572 return NT_STATUS_ACCESS_DENIED;
575 /* fake info: We audit everything. ;) */
577 info->audit_events.auditing_mode = true;
578 info->audit_events.count = LSA_AUDIT_NUM_CATEGORIES;
579 info->audit_events.settings = TALLOC_ZERO_ARRAY(p->mem_ctx,
580 enum lsa_PolicyAuditPolicy,
581 info->audit_events.count);
582 if (!info->audit_events.settings) {
583 return NT_STATUS_NO_MEMORY;
586 info->audit_events.settings[LSA_AUDIT_CATEGORY_ACCOUNT_MANAGEMENT] = policy_def;
587 info->audit_events.settings[LSA_AUDIT_CATEGORY_FILE_AND_OBJECT_ACCESS] = policy_def;
588 info->audit_events.settings[LSA_AUDIT_CATEGORY_LOGON] = policy_def;
589 info->audit_events.settings[LSA_AUDIT_CATEGORY_PROCCESS_TRACKING] = policy_def;
590 info->audit_events.settings[LSA_AUDIT_CATEGORY_SECURITY_POLICY_CHANGES] = policy_def;
591 info->audit_events.settings[LSA_AUDIT_CATEGORY_SYSTEM] = policy_def;
592 info->audit_events.settings[LSA_AUDIT_CATEGORY_USE_OF_USER_RIGHTS] = policy_def;
597 /* check if the user have enough rights */
598 if (!(handle->access & LSA_POLICY_VIEW_LOCAL_INFORMATION))
599 return NT_STATUS_ACCESS_DENIED;
601 /* Request PolicyPrimaryDomainInformation. */
602 switch (lp_server_role()) {
603 case ROLE_DOMAIN_PDC:
604 case ROLE_DOMAIN_BDC:
605 name = get_global_sam_name();
606 sid = get_global_sam_sid();
608 case ROLE_DOMAIN_MEMBER:
609 name = lp_workgroup();
610 /* We need to return the Domain SID here. */
611 if (secrets_fetch_domain_sid(lp_workgroup(), &domain_sid))
614 return NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
616 case ROLE_STANDALONE:
617 name = lp_workgroup();
621 return NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
623 init_dom_query_3(&info->domain, name, sid);
626 /* check if the user have enough rights */
627 if (!(handle->access & LSA_POLICY_VIEW_LOCAL_INFORMATION))
628 return NT_STATUS_ACCESS_DENIED;
630 /* Request PolicyAccountDomainInformation. */
631 name = get_global_sam_name();
632 sid = get_global_sam_sid();
634 init_dom_query_5(&info->account_domain, name, sid);
637 /* check if the user have enough rights */
638 if (!(handle->access & LSA_POLICY_VIEW_LOCAL_INFORMATION))
639 return NT_STATUS_ACCESS_DENIED;
641 switch (lp_server_role()) {
642 case ROLE_DOMAIN_BDC:
644 * only a BDC is a backup controller
645 * of the domain, it controls.
651 * any other role is a primary
652 * of the domain, it controls.
659 DEBUG(0,("_lsa_QueryInfoPolicy: unknown info level in Lsa Query: %d\n",
661 status = NT_STATUS_INVALID_INFO_CLASS;
670 /***************************************************************************
671 _lsa_lookup_sids_internal
672 ***************************************************************************/
674 static NTSTATUS _lsa_lookup_sids_internal(pipes_struct *p,
676 uint16_t level, /* input */
677 int num_sids, /* input */
678 struct lsa_SidPtr *sid, /* input */
679 struct lsa_RefDomainList **pp_ref, /* input/output */
680 struct lsa_TranslatedName2 **pp_names,/* input/output */
681 uint32_t *pp_mapped_count) /* input/output */
685 const DOM_SID **sids = NULL;
686 struct lsa_RefDomainList *ref = NULL;
687 uint32 mapped_count = 0;
688 struct lsa_dom_info *dom_infos = NULL;
689 struct lsa_name_info *name_infos = NULL;
690 struct lsa_TranslatedName2 *names = NULL;
692 *pp_mapped_count = 0;
700 sids = TALLOC_ARRAY(p->mem_ctx, const DOM_SID *, num_sids);
701 ref = TALLOC_ZERO_P(p->mem_ctx, struct lsa_RefDomainList);
703 if (sids == NULL || ref == NULL) {
704 return NT_STATUS_NO_MEMORY;
707 for (i=0; i<num_sids; i++) {
708 sids[i] = sid[i].sid;
711 status = lookup_sids(p->mem_ctx, num_sids, sids, level,
712 &dom_infos, &name_infos);
714 if (!NT_STATUS_IS_OK(status)) {
718 names = TALLOC_ARRAY(p->mem_ctx, struct lsa_TranslatedName2, num_sids);
720 return NT_STATUS_NO_MEMORY;
723 for (i=0; i<MAX_REF_DOMAINS; i++) {
725 if (!dom_infos[i].valid) {
729 if (init_lsa_ref_domain_list(mem_ctx, ref,
731 &dom_infos[i].sid) != i) {
732 DEBUG(0, ("Domain %s mentioned twice??\n",
734 return NT_STATUS_INTERNAL_ERROR;
738 for (i=0; i<num_sids; i++) {
739 struct lsa_name_info *name = &name_infos[i];
741 if (name->type == SID_NAME_UNKNOWN) {
744 /* Unknown sids should return the string
745 * representation of the SID. Windows 2003 behaves
746 * rather erratic here, in many cases it returns the
747 * RID as 8 bytes hex, in others it returns the full
748 * SID. We (Jerry/VL) could not figure out which the
749 * hard cases are, so leave it with the SID. */
750 name->name = talloc_asprintf(p->mem_ctx, "%s",
753 if (name->name == NULL) {
754 return NT_STATUS_NO_MEMORY;
760 init_lsa_translated_name2(&names[i], name->type,
761 name->name, name->dom_idx, 0);
764 status = NT_STATUS_NONE_MAPPED;
765 if (mapped_count > 0) {
766 status = (mapped_count < num_sids) ?
767 STATUS_SOME_UNMAPPED : NT_STATUS_OK;
770 DEBUG(10, ("num_sids %d, mapped_count %d, status %s\n",
771 num_sids, mapped_count, nt_errstr(status)));
773 *pp_mapped_count = mapped_count;
780 /***************************************************************************
782 ***************************************************************************/
784 NTSTATUS _lsa_LookupSids(pipes_struct *p,
785 struct lsa_LookupSids *r)
788 struct lsa_info *handle;
789 int num_sids = r->in.sids->num_sids;
790 uint32 mapped_count = 0;
791 struct lsa_RefDomainList *domains = NULL;
792 struct lsa_TranslatedName *names_out = NULL;
793 struct lsa_TranslatedName2 *names = NULL;
796 if ((r->in.level < 1) || (r->in.level > 6)) {
797 return NT_STATUS_INVALID_PARAMETER;
800 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle)) {
801 return NT_STATUS_INVALID_HANDLE;
804 /* check if the user has enough rights */
805 if (!(handle->access & LSA_POLICY_LOOKUP_NAMES)) {
806 return NT_STATUS_ACCESS_DENIED;
809 if (num_sids > MAX_LOOKUP_SIDS) {
810 DEBUG(5,("_lsa_LookupSids: limit of %d exceeded, requested %d\n",
811 MAX_LOOKUP_SIDS, num_sids));
812 return NT_STATUS_NONE_MAPPED;
815 status = _lsa_lookup_sids_internal(p,
824 /* Convert from lsa_TranslatedName2 to lsa_TranslatedName */
825 names_out = TALLOC_ARRAY(p->mem_ctx, struct lsa_TranslatedName,
828 return NT_STATUS_NO_MEMORY;
831 for (i=0; i<num_sids; i++) {
832 names_out[i].sid_type = names[i].sid_type;
833 names_out[i].name = names[i].name;
834 names_out[i].sid_index = names[i].sid_index;
837 *r->out.domains = domains;
838 r->out.names->count = num_sids;
839 r->out.names->names = names_out;
840 *r->out.count = mapped_count;
845 /***************************************************************************
847 ***************************************************************************/
849 NTSTATUS _lsa_LookupSids2(pipes_struct *p,
850 struct lsa_LookupSids2 *r)
853 struct lsa_info *handle;
854 int num_sids = r->in.sids->num_sids;
855 uint32 mapped_count = 0;
856 struct lsa_RefDomainList *domains = NULL;
857 struct lsa_TranslatedName2 *names = NULL;
858 bool check_policy = true;
860 switch (p->hdr_req.opnum) {
861 case NDR_LSA_LOOKUPSIDS3:
862 check_policy = false;
864 case NDR_LSA_LOOKUPSIDS2:
869 if ((r->in.level < 1) || (r->in.level > 6)) {
870 return NT_STATUS_INVALID_PARAMETER;
874 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle)) {
875 return NT_STATUS_INVALID_HANDLE;
878 /* check if the user have enough rights */
879 if (!(handle->access & LSA_POLICY_LOOKUP_NAMES)) {
880 return NT_STATUS_ACCESS_DENIED;
884 if (num_sids > MAX_LOOKUP_SIDS) {
885 DEBUG(5,("_lsa_LookupSids2: limit of %d exceeded, requested %d\n",
886 MAX_LOOKUP_SIDS, num_sids));
887 return NT_STATUS_NONE_MAPPED;
890 status = _lsa_lookup_sids_internal(p,
899 *r->out.domains = domains;
900 r->out.names->count = num_sids;
901 r->out.names->names = names;
902 *r->out.count = mapped_count;
907 /***************************************************************************
909 ***************************************************************************/
911 NTSTATUS _lsa_LookupSids3(pipes_struct *p,
912 struct lsa_LookupSids3 *r)
914 struct lsa_LookupSids2 q;
916 /* No policy handle on this call. Restrict to crypto connections. */
917 if (p->auth.auth_type != PIPE_AUTH_TYPE_SCHANNEL) {
918 DEBUG(0,("_lsa_LookupSids3: client %s not using schannel for netlogon\n",
919 get_remote_machine_name() ));
920 return NT_STATUS_INVALID_PARAMETER;
924 q.in.sids = r->in.sids;
925 q.in.level = r->in.level;
926 q.in.unknown1 = r->in.unknown1;
927 q.in.unknown2 = r->in.unknown2;
928 q.in.names = r->in.names;
929 q.in.count = r->in.count;
931 q.out.domains = r->out.domains;
932 q.out.names = r->out.names;
933 q.out.count = r->out.count;
935 return _lsa_LookupSids2(p, &q);
938 /***************************************************************************
939 ***************************************************************************/
941 static int lsa_lookup_level_to_flags(uint16 level)
947 flags = LOOKUP_NAME_ALL;
950 flags = LOOKUP_NAME_DOMAIN|LOOKUP_NAME_REMOTE|LOOKUP_NAME_ISOLATED;
953 flags = LOOKUP_NAME_DOMAIN|LOOKUP_NAME_ISOLATED;
959 flags = LOOKUP_NAME_NONE;
966 /***************************************************************************
968 ***************************************************************************/
970 NTSTATUS _lsa_LookupNames(pipes_struct *p,
971 struct lsa_LookupNames *r)
973 NTSTATUS status = NT_STATUS_NONE_MAPPED;
974 struct lsa_info *handle;
975 struct lsa_String *names = r->in.names;
976 uint32 num_entries = r->in.num_names;
977 struct lsa_RefDomainList *domains = NULL;
978 struct lsa_TranslatedSid *rids = NULL;
979 uint32 mapped_count = 0;
982 if (num_entries > MAX_LOOKUP_SIDS) {
983 num_entries = MAX_LOOKUP_SIDS;
984 DEBUG(5,("_lsa_LookupNames: truncating name lookup list to %d\n",
988 flags = lsa_lookup_level_to_flags(r->in.level);
990 domains = TALLOC_ZERO_P(p->mem_ctx, struct lsa_RefDomainList);
992 return NT_STATUS_NO_MEMORY;
996 rids = TALLOC_ZERO_ARRAY(p->mem_ctx, struct lsa_TranslatedSid,
999 return NT_STATUS_NO_MEMORY;
1005 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle)) {
1006 status = NT_STATUS_INVALID_HANDLE;
1010 /* check if the user have enough rights */
1011 if (!(handle->access & LSA_POLICY_LOOKUP_NAMES)) {
1012 status = NT_STATUS_ACCESS_DENIED;
1016 /* set up the LSA Lookup RIDs response */
1017 become_root(); /* lookup_name can require root privs */
1018 status = lookup_lsa_rids(p->mem_ctx, domains, rids, num_entries,
1019 names, flags, &mapped_count);
1024 if (NT_STATUS_IS_OK(status) && (num_entries != 0) ) {
1025 if (mapped_count == 0) {
1026 status = NT_STATUS_NONE_MAPPED;
1027 } else if (mapped_count != num_entries) {
1028 status = STATUS_SOME_UNMAPPED;
1032 *r->out.count = num_entries;
1033 *r->out.domains = domains;
1034 r->out.sids->sids = rids;
1035 r->out.sids->count = mapped_count;
1040 /***************************************************************************
1042 ***************************************************************************/
1044 NTSTATUS _lsa_LookupNames2(pipes_struct *p,
1045 struct lsa_LookupNames2 *r)
1048 struct lsa_LookupNames q;
1049 struct lsa_TransSidArray2 *sid_array2 = r->in.sids;
1050 struct lsa_TransSidArray *sid_array = NULL;
1053 sid_array = TALLOC_ZERO_P(p->mem_ctx, struct lsa_TransSidArray);
1055 return NT_STATUS_NO_MEMORY;
1058 q.in.handle = r->in.handle;
1059 q.in.num_names = r->in.num_names;
1060 q.in.names = r->in.names;
1061 q.in.level = r->in.level;
1062 q.in.sids = sid_array;
1063 q.in.count = r->in.count;
1064 /* we do not know what this is for */
1065 /* = r->in.unknown1; */
1066 /* = r->in.unknown2; */
1068 q.out.domains = r->out.domains;
1069 q.out.sids = sid_array;
1070 q.out.count = r->out.count;
1072 status = _lsa_LookupNames(p, &q);
1074 sid_array2->sids = TALLOC_ARRAY(p->mem_ctx, struct lsa_TranslatedSid2, sid_array->count);
1075 if (!sid_array2->sids) {
1076 return NT_STATUS_NO_MEMORY;
1079 for (i=0; i<sid_array->count; i++) {
1080 sid_array2->sids[i].sid_type = sid_array->sids[i].sid_type;
1081 sid_array2->sids[i].rid = sid_array->sids[i].rid;
1082 sid_array2->sids[i].sid_index = sid_array->sids[i].sid_index;
1083 sid_array2->sids[i].unknown = 0;
1086 r->out.sids = sid_array2;
1091 /***************************************************************************
1093 ***************************************************************************/
1095 NTSTATUS _lsa_LookupNames3(pipes_struct *p,
1096 struct lsa_LookupNames3 *r)
1099 struct lsa_info *handle;
1100 struct lsa_String *names = r->in.names;
1101 uint32 num_entries = r->in.num_names;
1102 struct lsa_RefDomainList *domains = NULL;
1103 struct lsa_TranslatedSid3 *trans_sids = NULL;
1104 uint32 mapped_count = 0;
1106 bool check_policy = true;
1108 switch (p->hdr_req.opnum) {
1109 case NDR_LSA_LOOKUPNAMES4:
1110 check_policy = false;
1112 case NDR_LSA_LOOKUPNAMES3:
1114 check_policy = true;
1117 if (num_entries > MAX_LOOKUP_SIDS) {
1118 num_entries = MAX_LOOKUP_SIDS;
1119 DEBUG(5,("_lsa_LookupNames3: truncating name lookup list to %d\n", num_entries));
1122 /* Probably the lookup_level is some sort of bitmask. */
1123 if (r->in.level == 1) {
1124 flags = LOOKUP_NAME_ALL;
1127 domains = TALLOC_ZERO_P(p->mem_ctx, struct lsa_RefDomainList);
1129 return NT_STATUS_NO_MEMORY;
1133 trans_sids = TALLOC_ZERO_ARRAY(p->mem_ctx, struct lsa_TranslatedSid3,
1136 return NT_STATUS_NO_MEMORY;
1144 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle)) {
1145 status = NT_STATUS_INVALID_HANDLE;
1149 /* check if the user have enough rights */
1150 if (!(handle->access & LSA_POLICY_LOOKUP_NAMES)) {
1151 status = NT_STATUS_ACCESS_DENIED;
1156 /* set up the LSA Lookup SIDs response */
1157 become_root(); /* lookup_name can require root privs */
1158 status = lookup_lsa_sids(p->mem_ctx, domains, trans_sids, num_entries,
1159 names, flags, &mapped_count);
1164 if (NT_STATUS_IS_OK(status)) {
1165 if (mapped_count == 0) {
1166 status = NT_STATUS_NONE_MAPPED;
1167 } else if (mapped_count != num_entries) {
1168 status = STATUS_SOME_UNMAPPED;
1172 *r->out.count = num_entries;
1173 *r->out.domains = domains;
1174 r->out.sids->sids = trans_sids;
1175 r->out.sids->count = mapped_count;
1180 /***************************************************************************
1182 ***************************************************************************/
1184 NTSTATUS _lsa_LookupNames4(pipes_struct *p,
1185 struct lsa_LookupNames4 *r)
1187 struct lsa_LookupNames3 q;
1189 /* No policy handle on this call. Restrict to crypto connections. */
1190 if (p->auth.auth_type != PIPE_AUTH_TYPE_SCHANNEL) {
1191 DEBUG(0,("_lsa_lookup_names4: client %s not using schannel for netlogon\n",
1192 get_remote_machine_name() ));
1193 return NT_STATUS_INVALID_PARAMETER;
1197 q.in.num_names = r->in.num_names;
1198 q.in.names = r->in.names;
1199 q.in.level = r->in.level;
1200 q.in.unknown1 = r->in.unknown1;
1201 q.in.unknown2 = r->in.unknown2;
1202 q.in.sids = r->in.sids;
1203 q.in.count = r->in.count;
1205 q.out.domains = r->out.domains;
1206 q.out.sids = r->out.sids;
1207 q.out.count = r->out.count;
1209 return _lsa_LookupNames3(p, &q);
1212 /***************************************************************************
1213 _lsa_close. Also weird - needs to check if lsa handle is correct. JRA.
1214 ***************************************************************************/
1216 NTSTATUS _lsa_Close(pipes_struct *p, struct lsa_Close *r)
1218 if (!find_policy_by_hnd(p, r->in.handle, NULL)) {
1219 return NT_STATUS_INVALID_HANDLE;
1222 close_policy_hnd(p, r->in.handle);
1223 ZERO_STRUCTP(r->out.handle);
1224 return NT_STATUS_OK;
1227 /***************************************************************************
1228 ***************************************************************************/
1230 NTSTATUS _lsa_OpenSecret(pipes_struct *p, struct lsa_OpenSecret *r)
1232 return NT_STATUS_OBJECT_NAME_NOT_FOUND;
1235 /***************************************************************************
1236 ***************************************************************************/
1238 NTSTATUS _lsa_OpenTrustedDomain(pipes_struct *p, struct lsa_OpenTrustedDomain *r)
1240 return NT_STATUS_OBJECT_NAME_NOT_FOUND;
1243 /***************************************************************************
1244 ***************************************************************************/
1246 NTSTATUS _lsa_CreateTrustedDomain(pipes_struct *p, struct lsa_CreateTrustedDomain *r)
1248 return NT_STATUS_ACCESS_DENIED;
1251 /***************************************************************************
1252 ***************************************************************************/
1254 NTSTATUS _lsa_CreateSecret(pipes_struct *p, struct lsa_CreateSecret *r)
1256 return NT_STATUS_ACCESS_DENIED;
1259 /***************************************************************************
1260 ***************************************************************************/
1262 NTSTATUS _lsa_SetSecret(pipes_struct *p, struct lsa_SetSecret *r)
1264 return NT_STATUS_ACCESS_DENIED;
1267 /***************************************************************************
1269 ***************************************************************************/
1271 NTSTATUS _lsa_DeleteObject(pipes_struct *p,
1272 struct lsa_DeleteObject *r)
1274 return NT_STATUS_ACCESS_DENIED;
1277 /***************************************************************************
1279 ***************************************************************************/
1281 NTSTATUS _lsa_EnumPrivs(pipes_struct *p,
1282 struct lsa_EnumPrivs *r)
1284 struct lsa_info *handle;
1286 uint32 enum_context = *r->in.resume_handle;
1287 int num_privs = count_all_privileges();
1288 struct lsa_PrivEntry *entries = NULL;
1291 /* remember that the enum_context starts at 0 and not 1 */
1293 if ( enum_context >= num_privs )
1294 return NT_STATUS_NO_MORE_ENTRIES;
1296 DEBUG(10,("_lsa_EnumPrivs: enum_context:%d total entries:%d\n",
1297 enum_context, num_privs));
1299 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle))
1300 return NT_STATUS_INVALID_HANDLE;
1302 /* check if the user have enough rights
1303 I don't know if it's the right one. not documented. */
1305 if (!(handle->access & LSA_POLICY_VIEW_LOCAL_INFORMATION))
1306 return NT_STATUS_ACCESS_DENIED;
1309 entries = TALLOC_ZERO_ARRAY(p->mem_ctx, struct lsa_PrivEntry, num_privs);
1311 return NT_STATUS_NO_MEMORY;
1317 for (i = 0; i < num_privs; i++) {
1318 if( i < enum_context) {
1320 init_lsa_StringLarge(&entries[i].name, NULL);
1322 entries[i].luid.low = 0;
1323 entries[i].luid.high = 0;
1326 init_lsa_StringLarge(&entries[i].name, privs[i].name);
1328 luid = get_privilege_luid( &privs[i].se_priv );
1330 entries[i].luid.low = luid.luid.low;
1331 entries[i].luid.high = luid.luid.high;
1335 enum_context = num_privs;
1337 *r->out.resume_handle = enum_context;
1338 r->out.privs->count = num_privs;
1339 r->out.privs->privs = entries;
1341 return NT_STATUS_OK;
1344 /***************************************************************************
1345 _lsa_LookupPrivDisplayName
1346 ***************************************************************************/
1348 NTSTATUS _lsa_LookupPrivDisplayName(pipes_struct *p,
1349 struct lsa_LookupPrivDisplayName *r)
1351 struct lsa_info *handle;
1352 const char *description;
1353 struct lsa_StringLarge *lsa_name;
1355 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle))
1356 return NT_STATUS_INVALID_HANDLE;
1358 /* check if the user have enough rights */
1361 * I don't know if it's the right one. not documented.
1363 if (!(handle->access & LSA_POLICY_VIEW_LOCAL_INFORMATION))
1364 return NT_STATUS_ACCESS_DENIED;
1366 DEBUG(10,("_lsa_LookupPrivDisplayName: name = %s\n", r->in.name->string));
1368 description = get_privilege_dispname(r->in.name->string);
1370 DEBUG(10,("_lsa_LookupPrivDisplayName: doesn't exist\n"));
1371 return NT_STATUS_NO_SUCH_PRIVILEGE;
1374 DEBUG(10,("_lsa_LookupPrivDisplayName: display name = %s\n", description));
1376 lsa_name = TALLOC_ZERO_P(p->mem_ctx, struct lsa_StringLarge);
1378 return NT_STATUS_NO_MEMORY;
1381 init_lsa_StringLarge(lsa_name, description);
1383 *r->out.returned_language_id = r->in.language_id;
1384 *r->out.disp_name = lsa_name;
1386 return NT_STATUS_OK;
1389 /***************************************************************************
1391 ***************************************************************************/
1393 NTSTATUS _lsa_EnumAccounts(pipes_struct *p,
1394 struct lsa_EnumAccounts *r)
1396 struct lsa_info *handle;
1398 int i, j, num_entries;
1400 struct lsa_SidPtr *sids = NULL;
1402 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle))
1403 return NT_STATUS_INVALID_HANDLE;
1405 if (!(handle->access & LSA_POLICY_VIEW_LOCAL_INFORMATION))
1406 return NT_STATUS_ACCESS_DENIED;
1411 /* The only way we can currently find out all the SIDs that have been
1412 privileged is to scan all privileges */
1414 status = privilege_enumerate_accounts(&sid_list, &num_entries);
1415 if (!NT_STATUS_IS_OK(status)) {
1419 if (*r->in.resume_handle >= num_entries) {
1420 return NT_STATUS_NO_MORE_ENTRIES;
1423 if (num_entries - *r->in.resume_handle) {
1424 sids = TALLOC_ZERO_ARRAY(p->mem_ctx, struct lsa_SidPtr,
1425 num_entries - *r->in.resume_handle);
1427 SAFE_FREE(sid_list);
1428 return NT_STATUS_NO_MEMORY;
1431 for (i = *r->in.resume_handle, j = 0; i < num_entries; i++, j++) {
1432 sids[j].sid = sid_dup_talloc(p->mem_ctx, &sid_list[i]);
1434 SAFE_FREE(sid_list);
1435 return NT_STATUS_NO_MEMORY;
1440 talloc_free(sid_list);
1442 *r->out.resume_handle = num_entries;
1443 r->out.sids->num_sids = num_entries;
1444 r->out.sids->sids = sids;
1446 return NT_STATUS_OK;
1449 /***************************************************************************
1451 ***************************************************************************/
1453 NTSTATUS _lsa_GetUserName(pipes_struct *p,
1454 struct lsa_GetUserName *r)
1456 const char *username, *domname;
1457 user_struct *vuser = get_valid_user_struct(p->vuid);
1458 struct lsa_String *account_name = NULL;
1459 struct lsa_String *authority_name = NULL;
1462 return NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
1466 * I'm 99% sure this is not the right place to do this,
1467 * global_sid_Anonymous should probably be put into the token
1468 * instead of the guest id -- vl
1470 if (!lookup_sid(p->mem_ctx, &global_sid_Anonymous,
1471 &domname, &username, NULL)) {
1472 return NT_STATUS_NO_MEMORY;
1475 username = vuser->user.smb_name;
1476 domname = vuser->user.domain;
1479 account_name = TALLOC_ZERO_P(p->mem_ctx, struct lsa_String);
1480 if (!account_name) {
1481 return NT_STATUS_NO_MEMORY;
1484 authority_name = TALLOC_ZERO_P(p->mem_ctx, struct lsa_String);
1485 if (!authority_name) {
1486 return NT_STATUS_NO_MEMORY;
1489 init_lsa_String(account_name, username);
1490 init_lsa_String(authority_name, domname);
1492 *r->out.account_name = account_name;
1493 *r->out.authority_name = authority_name;
1495 return NT_STATUS_OK;
1498 /***************************************************************************
1500 ***************************************************************************/
1502 NTSTATUS _lsa_CreateAccount(pipes_struct *p,
1503 struct lsa_CreateAccount *r)
1505 struct lsa_info *handle;
1506 struct lsa_info *info;
1508 /* find the connection policy handle. */
1509 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle))
1510 return NT_STATUS_INVALID_HANDLE;
1512 /* check if the user have enough rights */
1515 * I don't know if it's the right one. not documented.
1516 * but guessed with rpcclient.
1518 if (!(handle->access & LSA_POLICY_GET_PRIVATE_INFORMATION))
1519 return NT_STATUS_ACCESS_DENIED;
1521 /* check to see if the pipe_user is a Domain Admin since
1522 account_pol.tdb was already opened as root, this is all we have */
1524 if ( !nt_token_check_domain_rid( p->pipe_user.nt_user_token, DOMAIN_GROUP_RID_ADMINS ) )
1525 return NT_STATUS_ACCESS_DENIED;
1527 if ( is_privileged_sid( r->in.sid ) )
1528 return NT_STATUS_OBJECT_NAME_COLLISION;
1530 /* associate the user/group SID with the (unique) handle. */
1532 if ((info = SMB_MALLOC_P(struct lsa_info)) == NULL)
1533 return NT_STATUS_NO_MEMORY;
1536 info->sid = *r->in.sid;
1537 info->access = r->in.access_mask;
1539 /* get a (unique) handle. open a policy on it. */
1540 if (!create_policy_hnd(p, r->out.acct_handle, free_lsa_info, (void *)info))
1541 return NT_STATUS_OBJECT_NAME_NOT_FOUND;
1543 return privilege_create_account( &info->sid );
1547 /***************************************************************************
1549 ***************************************************************************/
1551 NTSTATUS _lsa_OpenAccount(pipes_struct *p,
1552 struct lsa_OpenAccount *r)
1554 struct lsa_info *handle;
1555 struct lsa_info *info;
1557 /* find the connection policy handle. */
1558 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle))
1559 return NT_STATUS_INVALID_HANDLE;
1561 /* check if the user have enough rights */
1564 * I don't know if it's the right one. not documented.
1565 * but guessed with rpcclient.
1567 if (!(handle->access & LSA_POLICY_GET_PRIVATE_INFORMATION))
1568 return NT_STATUS_ACCESS_DENIED;
1570 /* TODO: Fis the parsing routine before reenabling this check! */
1572 if (!lookup_sid(&handle->sid, dom_name, name, &type))
1573 return NT_STATUS_ACCESS_DENIED;
1575 /* associate the user/group SID with the (unique) handle. */
1576 if ((info = SMB_MALLOC_P(struct lsa_info)) == NULL)
1577 return NT_STATUS_NO_MEMORY;
1580 info->sid = *r->in.sid;
1581 info->access = r->in.access_mask;
1583 /* get a (unique) handle. open a policy on it. */
1584 if (!create_policy_hnd(p, r->out.acct_handle, free_lsa_info, (void *)info))
1585 return NT_STATUS_OBJECT_NAME_NOT_FOUND;
1587 return NT_STATUS_OK;
1590 /***************************************************************************
1591 _lsa_EnumPrivsAccount
1592 For a given SID, enumerate all the privilege this account has.
1593 ***************************************************************************/
1595 NTSTATUS _lsa_EnumPrivsAccount(pipes_struct *p,
1596 struct lsa_EnumPrivsAccount *r)
1598 NTSTATUS status = NT_STATUS_OK;
1599 struct lsa_info *info=NULL;
1601 PRIVILEGE_SET privileges;
1602 struct lsa_PrivilegeSet *priv_set = NULL;
1603 struct lsa_LUIDAttribute *luid_attrs = NULL;
1606 /* find the connection policy handle. */
1607 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
1608 return NT_STATUS_INVALID_HANDLE;
1610 if ( !get_privileges_for_sids( &mask, &info->sid, 1 ) )
1611 return NT_STATUS_OBJECT_NAME_NOT_FOUND;
1613 privilege_set_init( &privileges );
1615 if ( se_priv_to_privilege_set( &privileges, &mask ) ) {
1617 DEBUG(10,("_lsa_EnumPrivsAccount: %s has %d privileges\n",
1618 sid_string_dbg(&info->sid),
1621 priv_set = TALLOC_ZERO_P(p->mem_ctx, struct lsa_PrivilegeSet);
1623 status = NT_STATUS_NO_MEMORY;
1627 luid_attrs = TALLOC_ZERO_ARRAY(p->mem_ctx,
1628 struct lsa_LUIDAttribute,
1631 status = NT_STATUS_NO_MEMORY;
1635 for (i=0; i<privileges.count; i++) {
1636 luid_attrs[i].luid.low = privileges.set[i].luid.low;
1637 luid_attrs[i].luid.high = privileges.set[i].luid.high;
1638 luid_attrs[i].attribute = privileges.set[i].attr;
1641 priv_set->count = privileges.count;
1642 priv_set->unknown = 0;
1643 priv_set->set = luid_attrs;
1645 *r->out.privs = priv_set;
1647 status = NT_STATUS_NO_SUCH_PRIVILEGE;
1651 privilege_set_free( &privileges );
1656 /***************************************************************************
1657 _lsa_GetSystemAccessAccount
1658 ***************************************************************************/
1660 NTSTATUS _lsa_GetSystemAccessAccount(pipes_struct *p,
1661 struct lsa_GetSystemAccessAccount *r)
1663 struct lsa_info *info=NULL;
1665 /* find the connection policy handle. */
1667 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
1668 return NT_STATUS_INVALID_HANDLE;
1670 if (!lookup_sid(p->mem_ctx, &info->sid, NULL, NULL, NULL))
1671 return NT_STATUS_ACCESS_DENIED;
1674 0x01 -> Log on locally
1675 0x02 -> Access this computer from network
1676 0x04 -> Log on as a batch job
1677 0x10 -> Log on as a service
1679 they can be ORed together
1682 *r->out.access_mask = PR_LOG_ON_LOCALLY | PR_ACCESS_FROM_NETWORK;
1684 return NT_STATUS_OK;
1687 /***************************************************************************
1688 update the systemaccount information
1689 ***************************************************************************/
1691 NTSTATUS _lsa_SetSystemAccessAccount(pipes_struct *p,
1692 struct lsa_SetSystemAccessAccount *r)
1694 struct lsa_info *info=NULL;
1697 /* find the connection policy handle. */
1698 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
1699 return NT_STATUS_INVALID_HANDLE;
1701 /* check to see if the pipe_user is a Domain Admin since
1702 account_pol.tdb was already opened as root, this is all we have */
1704 if ( !nt_token_check_domain_rid( p->pipe_user.nt_user_token, DOMAIN_GROUP_RID_ADMINS ) )
1705 return NT_STATUS_ACCESS_DENIED;
1707 if (!pdb_getgrsid(&map, info->sid))
1708 return NT_STATUS_NO_SUCH_GROUP;
1710 return pdb_update_group_mapping_entry(&map);
1713 /***************************************************************************
1714 _lsa_AddPrivilegesToAccount
1715 For a given SID, add some privileges.
1716 ***************************************************************************/
1718 NTSTATUS _lsa_AddPrivilegesToAccount(pipes_struct *p,
1719 struct lsa_AddPrivilegesToAccount *r)
1721 struct lsa_info *info = NULL;
1723 struct lsa_PrivilegeSet *set = NULL;
1725 /* find the connection policy handle. */
1726 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
1727 return NT_STATUS_INVALID_HANDLE;
1729 /* check to see if the pipe_user is root or a Domain Admin since
1730 account_pol.tdb was already opened as root, this is all we have */
1732 if ( p->pipe_user.ut.uid != sec_initial_uid()
1733 && !nt_token_check_domain_rid( p->pipe_user.nt_user_token, DOMAIN_GROUP_RID_ADMINS ) )
1735 return NT_STATUS_ACCESS_DENIED;
1739 if ( !privilege_set_to_se_priv( &mask, set ) )
1740 return NT_STATUS_NO_SUCH_PRIVILEGE;
1742 if ( !grant_privilege( &info->sid, &mask ) ) {
1743 DEBUG(3,("_lsa_AddPrivilegesToAccount: grant_privilege(%s) failed!\n",
1744 sid_string_dbg(&info->sid) ));
1745 DEBUG(3,("Privilege mask:\n"));
1746 dump_se_priv( DBGC_ALL, 3, &mask );
1747 return NT_STATUS_NO_SUCH_PRIVILEGE;
1750 return NT_STATUS_OK;
1753 /***************************************************************************
1754 _lsa_RemovePrivilegesFromAccount
1755 For a given SID, remove some privileges.
1756 ***************************************************************************/
1758 NTSTATUS _lsa_RemovePrivilegesFromAccount(pipes_struct *p,
1759 struct lsa_RemovePrivilegesFromAccount *r)
1761 struct lsa_info *info = NULL;
1763 struct lsa_PrivilegeSet *set = NULL;
1765 /* find the connection policy handle. */
1766 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
1767 return NT_STATUS_INVALID_HANDLE;
1769 /* check to see if the pipe_user is root or a Domain Admin since
1770 account_pol.tdb was already opened as root, this is all we have */
1772 if ( p->pipe_user.ut.uid != sec_initial_uid()
1773 && !nt_token_check_domain_rid( p->pipe_user.nt_user_token, DOMAIN_GROUP_RID_ADMINS ) )
1775 return NT_STATUS_ACCESS_DENIED;
1780 if ( !privilege_set_to_se_priv( &mask, set ) )
1781 return NT_STATUS_NO_SUCH_PRIVILEGE;
1783 if ( !revoke_privilege( &info->sid, &mask ) ) {
1784 DEBUG(3,("_lsa_RemovePrivilegesFromAccount: revoke_privilege(%s) failed!\n",
1785 sid_string_dbg(&info->sid) ));
1786 DEBUG(3,("Privilege mask:\n"));
1787 dump_se_priv( DBGC_ALL, 3, &mask );
1788 return NT_STATUS_NO_SUCH_PRIVILEGE;
1791 return NT_STATUS_OK;
1794 /***************************************************************************
1796 ***************************************************************************/
1798 NTSTATUS _lsa_QuerySecurity(pipes_struct *p,
1799 struct lsa_QuerySecurity *r)
1801 struct lsa_info *handle=NULL;
1802 SEC_DESC *psd = NULL;
1806 /* find the connection policy handle. */
1807 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle))
1808 return NT_STATUS_INVALID_HANDLE;
1810 /* check if the user have enough rights */
1811 if (!(handle->access & LSA_POLICY_VIEW_LOCAL_INFORMATION))
1812 return NT_STATUS_ACCESS_DENIED;
1815 switch (r->in.sec_info) {
1817 /* SD contains only the owner */
1819 status=lsa_get_generic_sd(p->mem_ctx, &psd, &sd_size);
1820 if(!NT_STATUS_IS_OK(status))
1821 return NT_STATUS_NO_MEMORY;
1824 if((*r->out.sdbuf = make_sec_desc_buf(p->mem_ctx, sd_size, psd)) == NULL)
1825 return NT_STATUS_NO_MEMORY;
1828 /* SD contains only the ACL */
1830 status=lsa_get_generic_sd(p->mem_ctx, &psd, &sd_size);
1831 if(!NT_STATUS_IS_OK(status))
1832 return NT_STATUS_NO_MEMORY;
1834 if((*r->out.sdbuf = make_sec_desc_buf(p->mem_ctx, sd_size, psd)) == NULL)
1835 return NT_STATUS_NO_MEMORY;
1838 return NT_STATUS_INVALID_LEVEL;
1844 #if 0 /* AD DC work in ongoing in Samba 4 */
1846 /***************************************************************************
1847 ***************************************************************************/
1849 NTSTATUS _lsa_query_info2(pipes_struct *p, LSA_Q_QUERY_INFO2 *q_u, LSA_R_QUERY_INFO2 *r_u)
1851 struct lsa_info *handle;
1852 const char *nb_name;
1853 char *dns_name = NULL;
1854 char *forest_name = NULL;
1855 DOM_SID *sid = NULL;
1860 r_u->status = NT_STATUS_OK;
1862 if (!find_policy_by_hnd(p, &q_u->pol, (void **)(void *)&handle))
1863 return NT_STATUS_INVALID_HANDLE;
1865 switch (q_u->info_class) {
1867 /* check if the user have enough rights */
1868 if (!(handle->access & LSA_POLICY_VIEW_LOCAL_INFORMATION))
1869 return NT_STATUS_ACCESS_DENIED;
1871 /* Request PolicyPrimaryDomainInformation. */
1872 switch (lp_server_role()) {
1873 case ROLE_DOMAIN_PDC:
1874 case ROLE_DOMAIN_BDC:
1875 nb_name = get_global_sam_name();
1876 /* ugly temp hack for these next two */
1878 /* This should be a 'netbios domain -> DNS domain' mapping */
1879 dnsdomname = get_mydnsdomname(p->mem_ctx);
1880 if (!dnsdomname || !*dnsdomname) {
1881 return NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
1883 strlower_m(dnsdomname);
1885 dns_name = dnsdomname;
1886 forest_name = dnsdomname;
1888 sid = get_global_sam_sid();
1889 secrets_fetch_domain_guid(lp_workgroup(), &guid);
1892 return NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
1894 init_dns_dom_info(&r_u->info.dns_dom_info, nb_name, dns_name,
1895 forest_name,&guid,sid);
1898 DEBUG(0,("_lsa_query_info2: unknown info level in Lsa Query: %d\n", q_u->info_class));
1899 r_u->status = NT_STATUS_INVALID_INFO_CLASS;
1903 if (NT_STATUS_IS_OK(r_u->status)) {
1905 r_u->info_class = q_u->info_class;
1910 #endif /* AD DC work in ongoing in Samba 4 */
1912 /***************************************************************************
1913 _lsa_AddAccountRights
1914 ***************************************************************************/
1916 NTSTATUS _lsa_AddAccountRights(pipes_struct *p,
1917 struct lsa_AddAccountRights *r)
1919 struct lsa_info *info = NULL;
1923 /* find the connection policy handle. */
1924 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
1925 return NT_STATUS_INVALID_HANDLE;
1927 /* check to see if the pipe_user is a Domain Admin since
1928 account_pol.tdb was already opened as root, this is all we have */
1930 if ( p->pipe_user.ut.uid != sec_initial_uid()
1931 && !nt_token_check_domain_rid( p->pipe_user.nt_user_token, DOMAIN_GROUP_RID_ADMINS ) )
1933 return NT_STATUS_ACCESS_DENIED;
1936 /* according to an NT4 PDC, you can add privileges to SIDs even without
1937 call_lsa_create_account() first. And you can use any arbitrary SID. */
1939 sid_copy( &sid, r->in.sid );
1941 for ( i=0; i < r->in.rights->count; i++ ) {
1943 const char *privname = r->in.rights->names[i].string;
1945 /* only try to add non-null strings */
1950 if ( !grant_privilege_by_name( &sid, privname ) ) {
1951 DEBUG(2,("_lsa_AddAccountRights: Failed to add privilege [%s]\n",
1953 return NT_STATUS_NO_SUCH_PRIVILEGE;
1957 return NT_STATUS_OK;
1960 /***************************************************************************
1961 _lsa_RemoveAccountRights
1962 ***************************************************************************/
1964 NTSTATUS _lsa_RemoveAccountRights(pipes_struct *p,
1965 struct lsa_RemoveAccountRights *r)
1967 struct lsa_info *info = NULL;
1970 const char *privname = NULL;
1972 /* find the connection policy handle. */
1973 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
1974 return NT_STATUS_INVALID_HANDLE;
1976 /* check to see if the pipe_user is a Domain Admin since
1977 account_pol.tdb was already opened as root, this is all we have */
1979 if ( p->pipe_user.ut.uid != sec_initial_uid()
1980 && !nt_token_check_domain_rid( p->pipe_user.nt_user_token, DOMAIN_GROUP_RID_ADMINS ) )
1982 return NT_STATUS_ACCESS_DENIED;
1985 sid_copy( &sid, r->in.sid );
1987 if ( r->in.remove_all ) {
1988 if ( !revoke_all_privileges( &sid ) )
1989 return NT_STATUS_ACCESS_DENIED;
1991 return NT_STATUS_OK;
1994 for ( i=0; i < r->in.rights->count; i++ ) {
1996 privname = r->in.rights->names[i].string;
1998 /* only try to add non-null strings */
2003 if ( !revoke_privilege_by_name( &sid, privname ) ) {
2004 DEBUG(2,("_lsa_RemoveAccountRights: Failed to revoke privilege [%s]\n",
2006 return NT_STATUS_NO_SUCH_PRIVILEGE;
2010 return NT_STATUS_OK;
2013 /*******************************************************************
2014 ********************************************************************/
2016 static NTSTATUS init_lsa_right_set(TALLOC_CTX *mem_ctx,
2017 struct lsa_RightSet *r,
2018 PRIVILEGE_SET *privileges)
2021 const char *privname;
2022 const char **privname_array = NULL;
2025 for (i=0; i<privileges->count; i++) {
2027 privname = luid_to_privilege_name(&privileges->set[i].luid);
2029 if (!add_string_to_array(mem_ctx, privname,
2030 &privname_array, &num_priv)) {
2031 return NT_STATUS_NO_MEMORY;
2038 r->names = TALLOC_ZERO_ARRAY(mem_ctx, struct lsa_StringLarge,
2041 return NT_STATUS_NO_MEMORY;
2044 for (i=0; i<num_priv; i++) {
2045 init_lsa_StringLarge(&r->names[i], privname_array[i]);
2048 r->count = num_priv;
2051 return NT_STATUS_OK;
2054 /***************************************************************************
2055 _lsa_EnumAccountRights
2056 ***************************************************************************/
2058 NTSTATUS _lsa_EnumAccountRights(pipes_struct *p,
2059 struct lsa_EnumAccountRights *r)
2062 struct lsa_info *info = NULL;
2064 PRIVILEGE_SET privileges;
2067 /* find the connection policy handle. */
2069 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
2070 return NT_STATUS_INVALID_HANDLE;
2072 /* according to an NT4 PDC, you can add privileges to SIDs even without
2073 call_lsa_create_account() first. And you can use any arbitrary SID. */
2075 sid_copy( &sid, r->in.sid );
2077 if ( !get_privileges_for_sids( &mask, &sid, 1 ) )
2078 return NT_STATUS_OBJECT_NAME_NOT_FOUND;
2080 privilege_set_init( &privileges );
2082 if ( se_priv_to_privilege_set( &privileges, &mask ) ) {
2084 DEBUG(10,("_lsa_EnumAccountRights: %s has %d privileges\n",
2085 sid_string_dbg(&sid), privileges.count));
2087 status = init_lsa_right_set(p->mem_ctx, r->out.rights, &privileges);
2089 status = NT_STATUS_NO_SUCH_PRIVILEGE;
2092 privilege_set_free( &privileges );
2097 /***************************************************************************
2098 _lsa_LookupPrivValue
2099 ***************************************************************************/
2101 NTSTATUS _lsa_LookupPrivValue(pipes_struct *p,
2102 struct lsa_LookupPrivValue *r)
2104 struct lsa_info *info = NULL;
2105 const char *name = NULL;
2106 LUID_ATTR priv_luid;
2109 /* find the connection policy handle. */
2111 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
2112 return NT_STATUS_INVALID_HANDLE;
2114 name = r->in.name->string;
2116 DEBUG(10,("_lsa_lookup_priv_value: name = %s\n", name));
2118 if ( !se_priv_from_name( name, &mask ) )
2119 return NT_STATUS_NO_SUCH_PRIVILEGE;
2121 priv_luid = get_privilege_luid( &mask );
2123 r->out.luid->low = priv_luid.luid.low;
2124 r->out.luid->high = priv_luid.luid.high;
2126 return NT_STATUS_OK;
2130 * From here on the server routines are just dummy ones to make smbd link with
2131 * librpc/gen_ndr/srv_lsa.c. These routines are actually never called, we are
2132 * pulling the server stubs across one by one.
2135 NTSTATUS _lsa_Delete(pipes_struct *p, struct lsa_Delete *r)
2137 p->rng_fault_state = True;
2138 return NT_STATUS_NOT_IMPLEMENTED;
2141 NTSTATUS _lsa_SetSecObj(pipes_struct *p, struct lsa_SetSecObj *r)
2143 p->rng_fault_state = True;
2144 return NT_STATUS_NOT_IMPLEMENTED;
2147 NTSTATUS _lsa_ChangePassword(pipes_struct *p, struct lsa_ChangePassword *r)
2149 p->rng_fault_state = True;
2150 return NT_STATUS_NOT_IMPLEMENTED;
2153 NTSTATUS _lsa_SetInfoPolicy(pipes_struct *p, struct lsa_SetInfoPolicy *r)
2155 p->rng_fault_state = True;
2156 return NT_STATUS_NOT_IMPLEMENTED;
2159 NTSTATUS _lsa_ClearAuditLog(pipes_struct *p, struct lsa_ClearAuditLog *r)
2161 p->rng_fault_state = True;
2162 return NT_STATUS_NOT_IMPLEMENTED;
2165 NTSTATUS _lsa_GetQuotasForAccount(pipes_struct *p, struct lsa_GetQuotasForAccount *r)
2167 p->rng_fault_state = True;
2168 return NT_STATUS_NOT_IMPLEMENTED;
2171 NTSTATUS _lsa_SetQuotasForAccount(pipes_struct *p, struct lsa_SetQuotasForAccount *r)
2173 p->rng_fault_state = True;
2174 return NT_STATUS_NOT_IMPLEMENTED;
2177 NTSTATUS _lsa_QueryTrustedDomainInfo(pipes_struct *p, struct lsa_QueryTrustedDomainInfo *r)
2179 p->rng_fault_state = True;
2180 return NT_STATUS_NOT_IMPLEMENTED;
2183 NTSTATUS _lsa_SetInformationTrustedDomain(pipes_struct *p, struct lsa_SetInformationTrustedDomain *r)
2185 p->rng_fault_state = True;
2186 return NT_STATUS_NOT_IMPLEMENTED;
2189 NTSTATUS _lsa_QuerySecret(pipes_struct *p, struct lsa_QuerySecret *r)
2191 p->rng_fault_state = True;
2192 return NT_STATUS_NOT_IMPLEMENTED;
2195 NTSTATUS _lsa_LookupPrivName(pipes_struct *p, struct lsa_LookupPrivName *r)
2197 p->rng_fault_state = True;
2198 return NT_STATUS_NOT_IMPLEMENTED;
2201 NTSTATUS _lsa_EnumAccountsWithUserRight(pipes_struct *p, struct lsa_EnumAccountsWithUserRight *r)
2203 p->rng_fault_state = True;
2204 return NT_STATUS_NOT_IMPLEMENTED;
2207 NTSTATUS _lsa_QueryTrustedDomainInfoBySid(pipes_struct *p, struct lsa_QueryTrustedDomainInfoBySid *r)
2209 p->rng_fault_state = True;
2210 return NT_STATUS_NOT_IMPLEMENTED;
2213 NTSTATUS _lsa_SetTrustedDomainInfo(pipes_struct *p, struct lsa_SetTrustedDomainInfo *r)
2215 p->rng_fault_state = True;
2216 return NT_STATUS_NOT_IMPLEMENTED;
2219 NTSTATUS _lsa_DeleteTrustedDomain(pipes_struct *p, struct lsa_DeleteTrustedDomain *r)
2221 p->rng_fault_state = True;
2222 return NT_STATUS_NOT_IMPLEMENTED;
2225 NTSTATUS _lsa_StorePrivateData(pipes_struct *p, struct lsa_StorePrivateData *r)
2227 p->rng_fault_state = True;
2228 return NT_STATUS_NOT_IMPLEMENTED;
2231 NTSTATUS _lsa_RetrievePrivateData(pipes_struct *p, struct lsa_RetrievePrivateData *r)
2233 p->rng_fault_state = True;
2234 return NT_STATUS_NOT_IMPLEMENTED;
2237 NTSTATUS _lsa_QueryInfoPolicy2(pipes_struct *p, struct lsa_QueryInfoPolicy2 *r)
2239 p->rng_fault_state = True;
2240 return NT_STATUS_NOT_IMPLEMENTED;
2243 NTSTATUS _lsa_SetInfoPolicy2(pipes_struct *p, struct lsa_SetInfoPolicy2 *r)
2245 p->rng_fault_state = True;
2246 return NT_STATUS_NOT_IMPLEMENTED;
2249 NTSTATUS _lsa_QueryTrustedDomainInfoByName(pipes_struct *p, struct lsa_QueryTrustedDomainInfoByName *r)
2251 p->rng_fault_state = True;
2252 return NT_STATUS_NOT_IMPLEMENTED;
2255 NTSTATUS _lsa_SetTrustedDomainInfoByName(pipes_struct *p, struct lsa_SetTrustedDomainInfoByName *r)
2257 p->rng_fault_state = True;
2258 return NT_STATUS_NOT_IMPLEMENTED;
2261 NTSTATUS _lsa_EnumTrustedDomainsEx(pipes_struct *p, struct lsa_EnumTrustedDomainsEx *r)
2263 p->rng_fault_state = True;
2264 return NT_STATUS_NOT_IMPLEMENTED;
2267 NTSTATUS _lsa_CreateTrustedDomainEx(pipes_struct *p, struct lsa_CreateTrustedDomainEx *r)
2269 p->rng_fault_state = True;
2270 return NT_STATUS_NOT_IMPLEMENTED;
2273 NTSTATUS _lsa_CloseTrustedDomainEx(pipes_struct *p, struct lsa_CloseTrustedDomainEx *r)
2275 p->rng_fault_state = True;
2276 return NT_STATUS_NOT_IMPLEMENTED;
2279 NTSTATUS _lsa_QueryDomainInformationPolicy(pipes_struct *p, struct lsa_QueryDomainInformationPolicy *r)
2281 p->rng_fault_state = True;
2282 return NT_STATUS_NOT_IMPLEMENTED;
2285 NTSTATUS _lsa_SetDomainInformationPolicy(pipes_struct *p, struct lsa_SetDomainInformationPolicy *r)
2287 p->rng_fault_state = True;
2288 return NT_STATUS_NOT_IMPLEMENTED;
2291 NTSTATUS _lsa_OpenTrustedDomainByName(pipes_struct *p, struct lsa_OpenTrustedDomainByName *r)
2293 p->rng_fault_state = True;
2294 return NT_STATUS_NOT_IMPLEMENTED;
2297 NTSTATUS _lsa_TestCall(pipes_struct *p, struct lsa_TestCall *r)
2299 p->rng_fault_state = True;
2300 return NT_STATUS_NOT_IMPLEMENTED;
2303 NTSTATUS _lsa_CreateTrustedDomainEx2(pipes_struct *p, struct lsa_CreateTrustedDomainEx2 *r)
2305 p->rng_fault_state = True;
2306 return NT_STATUS_NOT_IMPLEMENTED;
2309 NTSTATUS _lsa_CREDRWRITE(pipes_struct *p, struct lsa_CREDRWRITE *r)
2311 p->rng_fault_state = True;
2312 return NT_STATUS_NOT_IMPLEMENTED;
2315 NTSTATUS _lsa_CREDRREAD(pipes_struct *p, struct lsa_CREDRREAD *r)
2317 p->rng_fault_state = True;
2318 return NT_STATUS_NOT_IMPLEMENTED;
2321 NTSTATUS _lsa_CREDRENUMERATE(pipes_struct *p, struct lsa_CREDRENUMERATE *r)
2323 p->rng_fault_state = True;
2324 return NT_STATUS_NOT_IMPLEMENTED;
2327 NTSTATUS _lsa_CREDRWRITEDOMAINCREDENTIALS(pipes_struct *p, struct lsa_CREDRWRITEDOMAINCREDENTIALS *r)
2329 p->rng_fault_state = True;
2330 return NT_STATUS_NOT_IMPLEMENTED;
2333 NTSTATUS _lsa_CREDRREADDOMAINCREDENTIALS(pipes_struct *p, struct lsa_CREDRREADDOMAINCREDENTIALS *r)
2335 p->rng_fault_state = True;
2336 return NT_STATUS_NOT_IMPLEMENTED;
2339 NTSTATUS _lsa_CREDRDELETE(pipes_struct *p, struct lsa_CREDRDELETE *r)
2341 p->rng_fault_state = True;
2342 return NT_STATUS_NOT_IMPLEMENTED;
2345 NTSTATUS _lsa_CREDRGETTARGETINFO(pipes_struct *p, struct lsa_CREDRGETTARGETINFO *r)
2347 p->rng_fault_state = True;
2348 return NT_STATUS_NOT_IMPLEMENTED;
2351 NTSTATUS _lsa_CREDRPROFILELOADED(pipes_struct *p, struct lsa_CREDRPROFILELOADED *r)
2353 p->rng_fault_state = True;
2354 return NT_STATUS_NOT_IMPLEMENTED;
2357 NTSTATUS _lsa_CREDRGETSESSIONTYPES(pipes_struct *p, struct lsa_CREDRGETSESSIONTYPES *r)
2359 p->rng_fault_state = True;
2360 return NT_STATUS_NOT_IMPLEMENTED;
2363 NTSTATUS _lsa_LSARREGISTERAUDITEVENT(pipes_struct *p, struct lsa_LSARREGISTERAUDITEVENT *r)
2365 p->rng_fault_state = True;
2366 return NT_STATUS_NOT_IMPLEMENTED;
2369 NTSTATUS _lsa_LSARGENAUDITEVENT(pipes_struct *p, struct lsa_LSARGENAUDITEVENT *r)
2371 p->rng_fault_state = True;
2372 return NT_STATUS_NOT_IMPLEMENTED;
2375 NTSTATUS _lsa_LSARUNREGISTERAUDITEVENT(pipes_struct *p, struct lsa_LSARUNREGISTERAUDITEVENT *r)
2377 p->rng_fault_state = True;
2378 return NT_STATUS_NOT_IMPLEMENTED;
2381 NTSTATUS _lsa_lsaRQueryForestTrustInformation(pipes_struct *p, struct lsa_lsaRQueryForestTrustInformation *r)
2383 p->rng_fault_state = True;
2384 return NT_STATUS_NOT_IMPLEMENTED;
2387 NTSTATUS _lsa_LSARSETFORESTTRUSTINFORMATION(pipes_struct *p, struct lsa_LSARSETFORESTTRUSTINFORMATION *r)
2389 p->rng_fault_state = True;
2390 return NT_STATUS_NOT_IMPLEMENTED;
2393 NTSTATUS _lsa_CREDRRENAME(pipes_struct *p, struct lsa_CREDRRENAME *r)
2395 p->rng_fault_state = True;
2396 return NT_STATUS_NOT_IMPLEMENTED;
2399 NTSTATUS _lsa_LSAROPENPOLICYSCE(pipes_struct *p, struct lsa_LSAROPENPOLICYSCE *r)
2401 p->rng_fault_state = True;
2402 return NT_STATUS_NOT_IMPLEMENTED;
2405 NTSTATUS _lsa_LSARADTREGISTERSECURITYEVENTSOURCE(pipes_struct *p, struct lsa_LSARADTREGISTERSECURITYEVENTSOURCE *r)
2407 p->rng_fault_state = True;
2408 return NT_STATUS_NOT_IMPLEMENTED;
2411 NTSTATUS _lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE(pipes_struct *p, struct lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE *r)
2413 p->rng_fault_state = True;
2414 return NT_STATUS_NOT_IMPLEMENTED;
2417 NTSTATUS _lsa_LSARADTREPORTSECURITYEVENT(pipes_struct *p, struct lsa_LSARADTREPORTSECURITYEVENT *r)
2419 p->rng_fault_state = True;
2420 return NT_STATUS_NOT_IMPLEMENTED;