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 init_lsa_StringLarge(&ref->domains[num].name, dom_name);
86 ref->domains[num].sid = sid_dup_talloc(mem_ctx, dom_sid);
87 if (!ref->domains[num].sid) {
95 /*******************************************************************
96 Function to free the per handle data.
97 ********************************************************************/
99 static void free_lsa_info(void *ptr)
101 struct lsa_info *lsa = (struct lsa_info *)ptr;
106 /***************************************************************************
107 initialize a lsa_DomainInfo structure.
108 ***************************************************************************/
110 static void init_dom_query_3(struct lsa_DomainInfo *r,
114 init_lsa_StringLarge(&r->name, name);
118 /***************************************************************************
119 initialize a lsa_DomainInfo structure.
120 ***************************************************************************/
122 static void init_dom_query_5(struct lsa_DomainInfo *r,
126 init_lsa_StringLarge(&r->name, name);
130 /***************************************************************************
131 lookup_lsa_rids. Must be called as root for lookup_name to work.
132 ***************************************************************************/
134 static NTSTATUS lookup_lsa_rids(TALLOC_CTX *mem_ctx,
135 struct lsa_RefDomainList *ref,
136 struct lsa_TranslatedSid *prid,
137 uint32_t num_entries,
138 struct lsa_String *name,
140 uint32_t *pmapped_count)
142 uint32 mapped_count, i;
144 SMB_ASSERT(num_entries <= MAX_LOOKUP_SIDS);
149 for (i = 0; i < num_entries; i++) {
153 const char *full_name;
155 enum lsa_SidType type = SID_NAME_UNKNOWN;
157 /* Split name into domain and user component */
159 full_name = name[i].string;
160 if (full_name == NULL) {
161 return NT_STATUS_NO_MEMORY;
164 DEBUG(5, ("lookup_lsa_rids: looking up name %s\n", full_name));
166 /* We can ignore the result of lookup_name, it will not touch
167 "type" if it's not successful */
169 lookup_name(mem_ctx, full_name, flags, &domain, NULL,
174 case SID_NAME_DOM_GRP:
175 case SID_NAME_DOMAIN:
177 case SID_NAME_WKN_GRP:
178 DEBUG(5, ("init_lsa_rids: %s found\n", full_name));
179 /* Leave these unchanged */
182 /* Don't hand out anything but the list above */
183 DEBUG(5, ("init_lsa_rids: %s not found\n", full_name));
184 type = SID_NAME_UNKNOWN;
191 if (type != SID_NAME_UNKNOWN) {
192 sid_split_rid(&sid, &rid);
193 dom_idx = init_lsa_ref_domain_list(mem_ctx, ref, domain, &sid);
197 init_lsa_translated_sid(&prid[i], type, rid, dom_idx);
200 *pmapped_count = mapped_count;
204 /***************************************************************************
205 lookup_lsa_sids. Must be called as root for lookup_name to work.
206 ***************************************************************************/
208 static NTSTATUS lookup_lsa_sids(TALLOC_CTX *mem_ctx,
209 struct lsa_RefDomainList *ref,
210 struct lsa_TranslatedSid3 *trans_sids,
211 uint32_t num_entries,
212 struct lsa_String *name,
214 uint32 *pmapped_count)
216 uint32 mapped_count, i;
218 SMB_ASSERT(num_entries <= MAX_LOOKUP_SIDS);
223 for (i = 0; i < num_entries; i++) {
227 const char *full_name;
229 enum lsa_SidType type = SID_NAME_UNKNOWN;
231 /* Split name into domain and user component */
233 full_name = name[i].string;
234 if (full_name == NULL) {
235 return NT_STATUS_NO_MEMORY;
238 DEBUG(5, ("init_lsa_sids: looking up name %s\n", full_name));
240 /* We can ignore the result of lookup_name, it will not touch
241 "type" if it's not successful */
243 lookup_name(mem_ctx, full_name, flags, &domain, NULL,
248 case SID_NAME_DOM_GRP:
249 case SID_NAME_DOMAIN:
251 case SID_NAME_WKN_GRP:
252 DEBUG(5, ("init_lsa_sids: %s found\n", full_name));
253 /* Leave these unchanged */
256 /* Don't hand out anything but the list above */
257 DEBUG(5, ("init_lsa_sids: %s not found\n", full_name));
258 type = SID_NAME_UNKNOWN;
265 if (type != SID_NAME_UNKNOWN) {
267 sid_copy(&domain_sid, &sid);
268 sid_split_rid(&domain_sid, &rid);
269 dom_idx = init_lsa_ref_domain_list(mem_ctx, ref, domain, &domain_sid);
273 /* Initialize the lsa_TranslatedSid3 return. */
274 trans_sids[i].sid_type = type;
275 trans_sids[i].sid = sid_dup_talloc(mem_ctx, &sid);
276 trans_sids[i].sid_index = dom_idx;
279 *pmapped_count = mapped_count;
283 static NTSTATUS lsa_get_generic_sd(TALLOC_CTX *mem_ctx, SEC_DESC **sd, size_t *sd_size)
285 DOM_SID local_adm_sid;
293 init_sec_access(&mask, LSA_POLICY_EXECUTE);
294 init_sec_ace(&ace[0], &global_sid_World, SEC_ACE_TYPE_ACCESS_ALLOWED, mask, 0);
296 sid_copy(&adm_sid, get_global_sam_sid());
297 sid_append_rid(&adm_sid, DOMAIN_GROUP_RID_ADMINS);
298 init_sec_access(&mask, LSA_POLICY_ALL_ACCESS);
299 init_sec_ace(&ace[1], &adm_sid, SEC_ACE_TYPE_ACCESS_ALLOWED, mask, 0);
301 sid_copy(&local_adm_sid, &global_sid_Builtin);
302 sid_append_rid(&local_adm_sid, BUILTIN_ALIAS_RID_ADMINS);
303 init_sec_access(&mask, LSA_POLICY_ALL_ACCESS);
304 init_sec_ace(&ace[2], &local_adm_sid, SEC_ACE_TYPE_ACCESS_ALLOWED, mask, 0);
306 if((psa = make_sec_acl(mem_ctx, NT4_ACL_REVISION, 3, ace)) == NULL)
307 return NT_STATUS_NO_MEMORY;
309 if((*sd = make_sec_desc(mem_ctx, SECURITY_DESCRIPTOR_REVISION_1,
310 SEC_DESC_SELF_RELATIVE, &adm_sid, NULL, NULL,
311 psa, sd_size)) == NULL)
312 return NT_STATUS_NO_MEMORY;
317 #if 0 /* AD DC work in ongoing in Samba 4 */
319 /***************************************************************************
321 ***************************************************************************/
323 static void init_dns_dom_info(LSA_DNS_DOM_INFO *r_l, const char *nb_name,
324 const char *dns_name, const char *forest_name,
325 struct GUID *dom_guid, DOM_SID *dom_sid)
327 if (nb_name && *nb_name) {
328 init_unistr2(&r_l->uni_nb_dom_name, nb_name, UNI_FLAGS_NONE);
329 init_uni_hdr(&r_l->hdr_nb_dom_name, &r_l->uni_nb_dom_name);
330 r_l->hdr_nb_dom_name.uni_max_len += 2;
331 r_l->uni_nb_dom_name.uni_max_len += 1;
334 if (dns_name && *dns_name) {
335 init_unistr2(&r_l->uni_dns_dom_name, dns_name, UNI_FLAGS_NONE);
336 init_uni_hdr(&r_l->hdr_dns_dom_name, &r_l->uni_dns_dom_name);
337 r_l->hdr_dns_dom_name.uni_max_len += 2;
338 r_l->uni_dns_dom_name.uni_max_len += 1;
341 if (forest_name && *forest_name) {
342 init_unistr2(&r_l->uni_forest_name, forest_name, UNI_FLAGS_NONE);
343 init_uni_hdr(&r_l->hdr_forest_name, &r_l->uni_forest_name);
344 r_l->hdr_forest_name.uni_max_len += 2;
345 r_l->uni_forest_name.uni_max_len += 1;
348 /* how do we init the guid ? probably should write an init fn */
350 memcpy(&r_l->dom_guid, dom_guid, sizeof(struct GUID));
354 r_l->ptr_dom_sid = 1;
355 init_dom_sid2(&r_l->dom_sid, dom_sid);
358 #endif /* AD DC work in ongoing in Samba 4 */
361 /***************************************************************************
363 ***************************************************************************/
365 NTSTATUS _lsa_OpenPolicy2(pipes_struct *p,
366 struct lsa_OpenPolicy2 *r)
368 struct lsa_info *info;
369 SEC_DESC *psd = NULL;
371 uint32 des_access = r->in.access_mask;
376 /* map the generic bits to the lsa policy ones */
377 se_map_generic(&des_access, &lsa_generic_mapping);
379 /* get the generic lsa policy SD until we store it */
380 lsa_get_generic_sd(p->mem_ctx, &psd, &sd_size);
382 if(!se_access_check(psd, p->pipe_user.nt_user_token, des_access, &acc_granted, &status)) {
383 if (p->pipe_user.ut.uid != sec_initial_uid()) {
386 DEBUG(4,("ACCESS should be DENIED (granted: %#010x; required: %#010x)\n",
387 acc_granted, des_access));
388 DEBUGADD(4,("but overwritten by euid == 0\n"));
391 /* This is needed for lsa_open_account and rpcclient .... :-) */
393 if (p->pipe_user.ut.uid == sec_initial_uid())
394 acc_granted = LSA_POLICY_ALL_ACCESS;
396 /* associate the domain SID with the (unique) handle. */
397 if ((info = SMB_MALLOC_P(struct lsa_info)) == NULL)
398 return NT_STATUS_NO_MEMORY;
401 sid_copy(&info->sid,get_global_sam_sid());
402 info->access = acc_granted;
404 /* set up the LSA QUERY INFO response */
405 if (!create_policy_hnd(p, r->out.handle, free_lsa_info, (void *)info))
406 return NT_STATUS_OBJECT_NAME_NOT_FOUND;
411 /***************************************************************************
413 ***************************************************************************/
415 NTSTATUS _lsa_OpenPolicy(pipes_struct *p,
416 struct lsa_OpenPolicy *r)
418 struct lsa_info *info;
419 SEC_DESC *psd = NULL;
421 uint32 des_access= r->in.access_mask;
426 /* map the generic bits to the lsa policy ones */
427 se_map_generic(&des_access, &lsa_generic_mapping);
429 /* get the generic lsa policy SD until we store it */
430 lsa_get_generic_sd(p->mem_ctx, &psd, &sd_size);
432 if(!se_access_check(psd, p->pipe_user.nt_user_token, des_access, &acc_granted, &status)) {
433 if (geteuid() != 0) {
436 DEBUG(4,("ACCESS should be DENIED (granted: %#010x; required: %#010x)\n",
437 acc_granted, des_access));
438 DEBUGADD(4,("but overwritten by euid == 0\n"));
439 acc_granted = des_access;
442 /* associate the domain SID with the (unique) handle. */
443 if ((info = SMB_MALLOC_P(struct lsa_info)) == NULL)
444 return NT_STATUS_NO_MEMORY;
447 sid_copy(&info->sid,get_global_sam_sid());
448 info->access = acc_granted;
450 /* set up the LSA QUERY INFO response */
451 if (!create_policy_hnd(p, r->out.handle, free_lsa_info, (void *)info))
452 return NT_STATUS_OBJECT_NAME_NOT_FOUND;
457 /***************************************************************************
458 _lsa_EnumTrustDom - this needs fixing to do more than return NULL ! JRA.
460 ***************************************************************************/
462 NTSTATUS _lsa_EnumTrustDom(pipes_struct *p,
463 struct lsa_EnumTrustDom *r)
465 struct lsa_info *info;
467 struct trustdom_info **domains;
468 struct lsa_DomainInfo *lsa_domains = NULL;
472 * preferred length is set to 5 as a "our" preferred length
473 * nt sets this parameter to 2
474 * update (20.08.2002): it's not preferred length, but preferred size!
475 * it needs further investigation how to optimally choose this value
477 uint32 max_num_domains =
478 r->in.max_size < 5 ? r->in.max_size : 10;
483 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
484 return NT_STATUS_INVALID_HANDLE;
486 /* check if the user have enough rights */
487 if (!(info->access & LSA_POLICY_VIEW_LOCAL_INFORMATION))
488 return NT_STATUS_ACCESS_DENIED;
490 nt_status = pdb_enum_trusteddoms(p->mem_ctx, &num_domains, &domains);
492 if (!NT_STATUS_IS_OK(nt_status)) {
496 if (*r->in.resume_handle < num_domains) {
497 num_thistime = MIN(num_domains, max_num_domains);
499 nt_status = STATUS_MORE_ENTRIES;
501 if (*r->in.resume_handle + num_thistime > num_domains) {
502 num_thistime = num_domains - *r->in.resume_handle;
503 nt_status = NT_STATUS_OK;
506 next_idx = *r->in.resume_handle + num_thistime;
509 next_idx = 0xffffffff;
510 nt_status = NT_STATUS_NO_MORE_ENTRIES;
513 /* set up the lsa_enum_trust_dom response */
515 lsa_domains = TALLOC_ZERO_ARRAY(p->mem_ctx, struct lsa_DomainInfo,
518 return NT_STATUS_NO_MEMORY;
521 for (i=0; i<num_thistime; i++) {
522 init_lsa_StringLarge(&lsa_domains[i].name, domains[i]->name);
523 lsa_domains[i].sid = &domains[i]->sid;
526 *r->out.resume_handle = next_idx;
527 r->out.domains->count = num_thistime;
528 r->out.domains->domains = lsa_domains;
533 #define LSA_AUDIT_NUM_CATEGORIES_NT4 7
534 #define LSA_AUDIT_NUM_CATEGORIES_WIN2K 9
535 #define LSA_AUDIT_NUM_CATEGORIES LSA_AUDIT_NUM_CATEGORIES_NT4
537 /***************************************************************************
539 ***************************************************************************/
541 NTSTATUS _lsa_QueryInfoPolicy(pipes_struct *p,
542 struct lsa_QueryInfoPolicy *r)
544 NTSTATUS status = NT_STATUS_OK;
545 struct lsa_info *handle;
549 union lsa_PolicyInformation *info = NULL;
551 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle))
552 return NT_STATUS_INVALID_HANDLE;
554 info = TALLOC_ZERO_P(p->mem_ctx, union lsa_PolicyInformation);
556 return NT_STATUS_NO_MEMORY;
559 switch (r->in.level) {
563 uint32 policy_def = LSA_AUDIT_POLICY_ALL;
565 /* check if the user have enough rights */
566 if (!(handle->access & LSA_POLICY_VIEW_AUDIT_INFORMATION)) {
567 DEBUG(10,("_lsa_QueryInfoPolicy: insufficient access rights\n"));
568 return NT_STATUS_ACCESS_DENIED;
571 /* fake info: We audit everything. ;) */
573 info->audit_events.auditing_mode = true;
574 info->audit_events.count = LSA_AUDIT_NUM_CATEGORIES;
575 info->audit_events.settings = TALLOC_ZERO_ARRAY(p->mem_ctx,
576 enum lsa_PolicyAuditPolicy,
577 info->audit_events.count);
578 if (!info->audit_events.settings) {
579 return NT_STATUS_NO_MEMORY;
582 info->audit_events.settings[LSA_AUDIT_CATEGORY_ACCOUNT_MANAGEMENT] = policy_def;
583 info->audit_events.settings[LSA_AUDIT_CATEGORY_FILE_AND_OBJECT_ACCESS] = policy_def;
584 info->audit_events.settings[LSA_AUDIT_CATEGORY_LOGON] = policy_def;
585 info->audit_events.settings[LSA_AUDIT_CATEGORY_PROCCESS_TRACKING] = policy_def;
586 info->audit_events.settings[LSA_AUDIT_CATEGORY_SECURITY_POLICY_CHANGES] = policy_def;
587 info->audit_events.settings[LSA_AUDIT_CATEGORY_SYSTEM] = policy_def;
588 info->audit_events.settings[LSA_AUDIT_CATEGORY_USE_OF_USER_RIGHTS] = policy_def;
593 /* check if the user have enough rights */
594 if (!(handle->access & LSA_POLICY_VIEW_LOCAL_INFORMATION))
595 return NT_STATUS_ACCESS_DENIED;
597 /* Request PolicyPrimaryDomainInformation. */
598 switch (lp_server_role()) {
599 case ROLE_DOMAIN_PDC:
600 case ROLE_DOMAIN_BDC:
601 name = get_global_sam_name();
602 sid = get_global_sam_sid();
604 case ROLE_DOMAIN_MEMBER:
605 name = lp_workgroup();
606 /* We need to return the Domain SID here. */
607 if (secrets_fetch_domain_sid(lp_workgroup(), &domain_sid))
610 return NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
612 case ROLE_STANDALONE:
613 name = lp_workgroup();
617 return NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
619 init_dom_query_3(&info->domain, name, sid);
622 /* check if the user have enough rights */
623 if (!(handle->access & LSA_POLICY_VIEW_LOCAL_INFORMATION))
624 return NT_STATUS_ACCESS_DENIED;
626 /* Request PolicyAccountDomainInformation. */
627 name = get_global_sam_name();
628 sid = get_global_sam_sid();
630 init_dom_query_5(&info->account_domain, name, sid);
633 /* check if the user have enough rights */
634 if (!(handle->access & LSA_POLICY_VIEW_LOCAL_INFORMATION))
635 return NT_STATUS_ACCESS_DENIED;
637 switch (lp_server_role()) {
638 case ROLE_DOMAIN_BDC:
640 * only a BDC is a backup controller
641 * of the domain, it controls.
647 * any other role is a primary
648 * of the domain, it controls.
655 DEBUG(0,("_lsa_QueryInfoPolicy: unknown info level in Lsa Query: %d\n",
657 status = NT_STATUS_INVALID_INFO_CLASS;
666 /***************************************************************************
667 _lsa_lookup_sids_internal
668 ***************************************************************************/
670 static NTSTATUS _lsa_lookup_sids_internal(pipes_struct *p,
672 uint16_t level, /* input */
673 int num_sids, /* input */
674 struct lsa_SidPtr *sid, /* input */
675 struct lsa_RefDomainList **pp_ref, /* input/output */
676 struct lsa_TranslatedName2 **pp_names,/* input/output */
677 uint32_t *pp_mapped_count) /* input/output */
681 const DOM_SID **sids = NULL;
682 struct lsa_RefDomainList *ref = NULL;
683 uint32 mapped_count = 0;
684 struct lsa_dom_info *dom_infos = NULL;
685 struct lsa_name_info *name_infos = NULL;
686 struct lsa_TranslatedName2 *names = NULL;
688 *pp_mapped_count = 0;
696 sids = TALLOC_ARRAY(p->mem_ctx, const DOM_SID *, num_sids);
697 ref = TALLOC_ZERO_P(p->mem_ctx, struct lsa_RefDomainList);
699 if (sids == NULL || ref == NULL) {
700 return NT_STATUS_NO_MEMORY;
703 for (i=0; i<num_sids; i++) {
704 sids[i] = sid[i].sid;
707 status = lookup_sids(p->mem_ctx, num_sids, sids, level,
708 &dom_infos, &name_infos);
710 if (!NT_STATUS_IS_OK(status)) {
714 names = TALLOC_ARRAY(p->mem_ctx, struct lsa_TranslatedName2, num_sids);
716 return NT_STATUS_NO_MEMORY;
719 for (i=0; i<MAX_REF_DOMAINS; i++) {
721 if (!dom_infos[i].valid) {
725 if (init_lsa_ref_domain_list(mem_ctx, ref,
727 &dom_infos[i].sid) != i) {
728 DEBUG(0, ("Domain %s mentioned twice??\n",
730 return NT_STATUS_INTERNAL_ERROR;
734 for (i=0; i<num_sids; i++) {
735 struct lsa_name_info *name = &name_infos[i];
737 if (name->type == SID_NAME_UNKNOWN) {
740 /* Unknown sids should return the string
741 * representation of the SID. Windows 2003 behaves
742 * rather erratic here, in many cases it returns the
743 * RID as 8 bytes hex, in others it returns the full
744 * SID. We (Jerry/VL) could not figure out which the
745 * hard cases are, so leave it with the SID. */
746 name->name = talloc_asprintf(p->mem_ctx, "%s",
749 if (name->name == NULL) {
750 return NT_STATUS_NO_MEMORY;
756 init_lsa_translated_name2(&names[i], name->type,
757 name->name, name->dom_idx, 0);
760 status = NT_STATUS_NONE_MAPPED;
761 if (mapped_count > 0) {
762 status = (mapped_count < num_sids) ?
763 STATUS_SOME_UNMAPPED : NT_STATUS_OK;
766 DEBUG(10, ("num_sids %d, mapped_count %d, status %s\n",
767 num_sids, mapped_count, nt_errstr(status)));
769 *pp_mapped_count = mapped_count;
776 /***************************************************************************
778 ***************************************************************************/
780 NTSTATUS _lsa_LookupSids(pipes_struct *p,
781 struct lsa_LookupSids *r)
784 struct lsa_info *handle;
785 int num_sids = r->in.sids->num_sids;
786 uint32 mapped_count = 0;
787 struct lsa_RefDomainList *domains = NULL;
788 struct lsa_TranslatedName *names_out = NULL;
789 struct lsa_TranslatedName2 *names = NULL;
792 if ((r->in.level < 1) || (r->in.level > 6)) {
793 return NT_STATUS_INVALID_PARAMETER;
796 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle)) {
797 return NT_STATUS_INVALID_HANDLE;
800 /* check if the user has enough rights */
801 if (!(handle->access & LSA_POLICY_LOOKUP_NAMES)) {
802 return NT_STATUS_ACCESS_DENIED;
805 if (num_sids > MAX_LOOKUP_SIDS) {
806 DEBUG(5,("_lsa_LookupSids: limit of %d exceeded, requested %d\n",
807 MAX_LOOKUP_SIDS, num_sids));
808 return NT_STATUS_NONE_MAPPED;
811 status = _lsa_lookup_sids_internal(p,
820 /* Convert from lsa_TranslatedName2 to lsa_TranslatedName */
821 names_out = TALLOC_ARRAY(p->mem_ctx, struct lsa_TranslatedName,
824 return NT_STATUS_NO_MEMORY;
827 for (i=0; i<num_sids; i++) {
828 names_out[i].sid_type = names[i].sid_type;
829 names_out[i].name = names[i].name;
830 names_out[i].sid_index = names[i].sid_index;
833 *r->out.domains = domains;
834 r->out.names->count = num_sids;
835 r->out.names->names = names_out;
836 *r->out.count = mapped_count;
841 /***************************************************************************
843 ***************************************************************************/
845 NTSTATUS _lsa_LookupSids2(pipes_struct *p,
846 struct lsa_LookupSids2 *r)
849 struct lsa_info *handle;
850 int num_sids = r->in.sids->num_sids;
851 uint32 mapped_count = 0;
852 struct lsa_RefDomainList *domains = NULL;
853 struct lsa_TranslatedName2 *names = NULL;
854 bool check_policy = true;
856 switch (p->hdr_req.opnum) {
857 case NDR_LSA_LOOKUPSIDS3:
858 check_policy = false;
860 case NDR_LSA_LOOKUPSIDS2:
865 if ((r->in.level < 1) || (r->in.level > 6)) {
866 return NT_STATUS_INVALID_PARAMETER;
870 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle)) {
871 return NT_STATUS_INVALID_HANDLE;
874 /* check if the user have enough rights */
875 if (!(handle->access & LSA_POLICY_LOOKUP_NAMES)) {
876 return NT_STATUS_ACCESS_DENIED;
880 if (num_sids > MAX_LOOKUP_SIDS) {
881 DEBUG(5,("_lsa_LookupSids2: limit of %d exceeded, requested %d\n",
882 MAX_LOOKUP_SIDS, num_sids));
883 return NT_STATUS_NONE_MAPPED;
886 status = _lsa_lookup_sids_internal(p,
895 *r->out.domains = domains;
896 r->out.names->count = num_sids;
897 r->out.names->names = names;
898 *r->out.count = mapped_count;
903 /***************************************************************************
905 ***************************************************************************/
907 NTSTATUS _lsa_LookupSids3(pipes_struct *p,
908 struct lsa_LookupSids3 *r)
910 struct lsa_LookupSids2 q;
912 /* No policy handle on this call. Restrict to crypto connections. */
913 if (p->auth.auth_type != PIPE_AUTH_TYPE_SCHANNEL) {
914 DEBUG(0,("_lsa_LookupSids3: client %s not using schannel for netlogon\n",
915 get_remote_machine_name() ));
916 return NT_STATUS_INVALID_PARAMETER;
920 q.in.sids = r->in.sids;
921 q.in.level = r->in.level;
922 q.in.unknown1 = r->in.unknown1;
923 q.in.unknown2 = r->in.unknown2;
924 q.in.names = r->in.names;
925 q.in.count = r->in.count;
927 q.out.domains = r->out.domains;
928 q.out.names = r->out.names;
929 q.out.count = r->out.count;
931 return _lsa_LookupSids2(p, &q);
934 /***************************************************************************
935 ***************************************************************************/
937 static int lsa_lookup_level_to_flags(uint16 level)
943 flags = LOOKUP_NAME_ALL;
946 flags = LOOKUP_NAME_DOMAIN|LOOKUP_NAME_REMOTE|LOOKUP_NAME_ISOLATED;
949 flags = LOOKUP_NAME_DOMAIN|LOOKUP_NAME_ISOLATED;
955 flags = LOOKUP_NAME_NONE;
962 /***************************************************************************
964 ***************************************************************************/
966 NTSTATUS _lsa_LookupNames(pipes_struct *p,
967 struct lsa_LookupNames *r)
969 NTSTATUS status = NT_STATUS_NONE_MAPPED;
970 struct lsa_info *handle;
971 struct lsa_String *names = r->in.names;
972 uint32 num_entries = r->in.num_names;
973 struct lsa_RefDomainList *domains = NULL;
974 struct lsa_TranslatedSid *rids = NULL;
975 uint32 mapped_count = 0;
978 if (num_entries > MAX_LOOKUP_SIDS) {
979 num_entries = MAX_LOOKUP_SIDS;
980 DEBUG(5,("_lsa_LookupNames: truncating name lookup list to %d\n",
984 flags = lsa_lookup_level_to_flags(r->in.level);
986 domains = TALLOC_ZERO_P(p->mem_ctx, struct lsa_RefDomainList);
988 return NT_STATUS_NO_MEMORY;
992 rids = TALLOC_ZERO_ARRAY(p->mem_ctx, struct lsa_TranslatedSid,
995 return NT_STATUS_NO_MEMORY;
1001 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle)) {
1002 status = NT_STATUS_INVALID_HANDLE;
1006 /* check if the user have enough rights */
1007 if (!(handle->access & LSA_POLICY_LOOKUP_NAMES)) {
1008 status = NT_STATUS_ACCESS_DENIED;
1012 /* set up the LSA Lookup RIDs response */
1013 become_root(); /* lookup_name can require root privs */
1014 status = lookup_lsa_rids(p->mem_ctx, domains, rids, num_entries,
1015 names, flags, &mapped_count);
1020 if (NT_STATUS_IS_OK(status) && (num_entries != 0) ) {
1021 if (mapped_count == 0) {
1022 status = NT_STATUS_NONE_MAPPED;
1023 } else if (mapped_count != num_entries) {
1024 status = STATUS_SOME_UNMAPPED;
1028 *r->out.count = num_entries;
1029 *r->out.domains = domains;
1030 r->out.sids->sids = rids;
1031 r->out.sids->count = mapped_count;
1036 /***************************************************************************
1038 ***************************************************************************/
1040 NTSTATUS _lsa_LookupNames2(pipes_struct *p,
1041 struct lsa_LookupNames2 *r)
1044 struct lsa_LookupNames q;
1045 struct lsa_TransSidArray2 *sid_array2 = r->in.sids;
1046 struct lsa_TransSidArray *sid_array = NULL;
1049 sid_array = TALLOC_ZERO_P(p->mem_ctx, struct lsa_TransSidArray);
1051 return NT_STATUS_NO_MEMORY;
1054 q.in.handle = r->in.handle;
1055 q.in.num_names = r->in.num_names;
1056 q.in.names = r->in.names;
1057 q.in.level = r->in.level;
1058 q.in.sids = sid_array;
1059 q.in.count = r->in.count;
1060 /* we do not know what this is for */
1061 /* = r->in.unknown1; */
1062 /* = r->in.unknown2; */
1064 q.out.domains = r->out.domains;
1065 q.out.sids = sid_array;
1066 q.out.count = r->out.count;
1068 status = _lsa_LookupNames(p, &q);
1070 sid_array2->sids = TALLOC_ARRAY(p->mem_ctx, struct lsa_TranslatedSid2, sid_array->count);
1071 if (!sid_array2->sids) {
1072 return NT_STATUS_NO_MEMORY;
1075 for (i=0; i<sid_array->count; i++) {
1076 sid_array2->sids[i].sid_type = sid_array->sids[i].sid_type;
1077 sid_array2->sids[i].rid = sid_array->sids[i].rid;
1078 sid_array2->sids[i].sid_index = sid_array->sids[i].sid_index;
1079 sid_array2->sids[i].unknown = 0;
1082 r->out.sids = sid_array2;
1087 /***************************************************************************
1089 ***************************************************************************/
1091 NTSTATUS _lsa_LookupNames3(pipes_struct *p,
1092 struct lsa_LookupNames3 *r)
1095 struct lsa_info *handle;
1096 struct lsa_String *names = r->in.names;
1097 uint32 num_entries = r->in.num_names;
1098 struct lsa_RefDomainList *domains = NULL;
1099 struct lsa_TranslatedSid3 *trans_sids = NULL;
1100 uint32 mapped_count = 0;
1102 bool check_policy = true;
1104 switch (p->hdr_req.opnum) {
1105 case NDR_LSA_LOOKUPNAMES4:
1106 check_policy = false;
1108 case NDR_LSA_LOOKUPNAMES3:
1110 check_policy = true;
1113 if (num_entries > MAX_LOOKUP_SIDS) {
1114 num_entries = MAX_LOOKUP_SIDS;
1115 DEBUG(5,("_lsa_LookupNames3: truncating name lookup list to %d\n", num_entries));
1118 /* Probably the lookup_level is some sort of bitmask. */
1119 if (r->in.level == 1) {
1120 flags = LOOKUP_NAME_ALL;
1123 domains = TALLOC_ZERO_P(p->mem_ctx, struct lsa_RefDomainList);
1125 return NT_STATUS_NO_MEMORY;
1129 trans_sids = TALLOC_ZERO_ARRAY(p->mem_ctx, struct lsa_TranslatedSid3,
1132 return NT_STATUS_NO_MEMORY;
1140 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle)) {
1141 status = NT_STATUS_INVALID_HANDLE;
1145 /* check if the user have enough rights */
1146 if (!(handle->access & LSA_POLICY_LOOKUP_NAMES)) {
1147 status = NT_STATUS_ACCESS_DENIED;
1152 /* set up the LSA Lookup SIDs response */
1153 become_root(); /* lookup_name can require root privs */
1154 status = lookup_lsa_sids(p->mem_ctx, domains, trans_sids, num_entries,
1155 names, flags, &mapped_count);
1160 if (NT_STATUS_IS_OK(status)) {
1161 if (mapped_count == 0) {
1162 status = NT_STATUS_NONE_MAPPED;
1163 } else if (mapped_count != num_entries) {
1164 status = STATUS_SOME_UNMAPPED;
1168 *r->out.count = num_entries;
1169 *r->out.domains = domains;
1170 r->out.sids->sids = trans_sids;
1171 r->out.sids->count = mapped_count;
1176 /***************************************************************************
1178 ***************************************************************************/
1180 NTSTATUS _lsa_LookupNames4(pipes_struct *p,
1181 struct lsa_LookupNames4 *r)
1183 struct lsa_LookupNames3 q;
1185 /* No policy handle on this call. Restrict to crypto connections. */
1186 if (p->auth.auth_type != PIPE_AUTH_TYPE_SCHANNEL) {
1187 DEBUG(0,("_lsa_lookup_names4: client %s not using schannel for netlogon\n",
1188 get_remote_machine_name() ));
1189 return NT_STATUS_INVALID_PARAMETER;
1193 q.in.num_names = r->in.num_names;
1194 q.in.names = r->in.names;
1195 q.in.level = r->in.level;
1196 q.in.unknown1 = r->in.unknown1;
1197 q.in.unknown2 = r->in.unknown2;
1198 q.in.sids = r->in.sids;
1199 q.in.count = r->in.count;
1201 q.out.domains = r->out.domains;
1202 q.out.sids = r->out.sids;
1203 q.out.count = r->out.count;
1205 return _lsa_LookupNames3(p, &q);
1208 /***************************************************************************
1209 _lsa_close. Also weird - needs to check if lsa handle is correct. JRA.
1210 ***************************************************************************/
1212 NTSTATUS _lsa_Close(pipes_struct *p, struct lsa_Close *r)
1214 if (!find_policy_by_hnd(p, r->in.handle, NULL)) {
1215 return NT_STATUS_INVALID_HANDLE;
1218 close_policy_hnd(p, r->in.handle);
1219 return NT_STATUS_OK;
1222 /***************************************************************************
1223 ***************************************************************************/
1225 NTSTATUS _lsa_OpenSecret(pipes_struct *p, struct lsa_OpenSecret *r)
1227 return NT_STATUS_OBJECT_NAME_NOT_FOUND;
1230 /***************************************************************************
1231 ***************************************************************************/
1233 NTSTATUS _lsa_OpenTrustedDomain(pipes_struct *p, struct lsa_OpenTrustedDomain *r)
1235 return NT_STATUS_OBJECT_NAME_NOT_FOUND;
1238 /***************************************************************************
1239 ***************************************************************************/
1241 NTSTATUS _lsa_CreateTrustedDomain(pipes_struct *p, struct lsa_CreateTrustedDomain *r)
1243 return NT_STATUS_ACCESS_DENIED;
1246 /***************************************************************************
1247 ***************************************************************************/
1249 NTSTATUS _lsa_CreateSecret(pipes_struct *p, struct lsa_CreateSecret *r)
1251 return NT_STATUS_ACCESS_DENIED;
1254 /***************************************************************************
1255 ***************************************************************************/
1257 NTSTATUS _lsa_SetSecret(pipes_struct *p, struct lsa_SetSecret *r)
1259 return NT_STATUS_ACCESS_DENIED;
1262 /***************************************************************************
1264 ***************************************************************************/
1266 NTSTATUS _lsa_DeleteObject(pipes_struct *p,
1267 struct lsa_DeleteObject *r)
1269 return NT_STATUS_ACCESS_DENIED;
1272 /***************************************************************************
1274 ***************************************************************************/
1276 NTSTATUS _lsa_EnumPrivs(pipes_struct *p,
1277 struct lsa_EnumPrivs *r)
1279 struct lsa_info *handle;
1281 uint32 enum_context = *r->in.resume_handle;
1282 int num_privs = count_all_privileges();
1283 struct lsa_PrivEntry *entries = NULL;
1286 /* remember that the enum_context starts at 0 and not 1 */
1288 if ( enum_context >= num_privs )
1289 return NT_STATUS_NO_MORE_ENTRIES;
1291 DEBUG(10,("_lsa_EnumPrivs: enum_context:%d total entries:%d\n",
1292 enum_context, num_privs));
1294 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle))
1295 return NT_STATUS_INVALID_HANDLE;
1297 /* check if the user have enough rights
1298 I don't know if it's the right one. not documented. */
1300 if (!(handle->access & LSA_POLICY_VIEW_LOCAL_INFORMATION))
1301 return NT_STATUS_ACCESS_DENIED;
1304 entries = TALLOC_ZERO_ARRAY(p->mem_ctx, struct lsa_PrivEntry, num_privs);
1306 return NT_STATUS_NO_MEMORY;
1312 for (i = 0; i < num_privs; i++) {
1313 if( i < enum_context) {
1315 init_lsa_StringLarge(&entries[i].name, NULL);
1317 entries[i].luid.low = 0;
1318 entries[i].luid.high = 0;
1321 init_lsa_StringLarge(&entries[i].name, privs[i].name);
1323 luid = get_privilege_luid( &privs[i].se_priv );
1325 entries[i].luid.low = luid.luid.low;
1326 entries[i].luid.high = luid.luid.high;
1330 enum_context = num_privs;
1332 *r->out.resume_handle = enum_context;
1333 r->out.privs->count = num_privs;
1334 r->out.privs->privs = entries;
1336 return NT_STATUS_OK;
1339 /***************************************************************************
1340 _lsa_LookupPrivDisplayName
1341 ***************************************************************************/
1343 NTSTATUS _lsa_LookupPrivDisplayName(pipes_struct *p,
1344 struct lsa_LookupPrivDisplayName *r)
1346 struct lsa_info *handle;
1347 const char *description;
1348 struct lsa_StringLarge *lsa_name;
1350 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle))
1351 return NT_STATUS_INVALID_HANDLE;
1353 /* check if the user have enough rights */
1356 * I don't know if it's the right one. not documented.
1358 if (!(handle->access & LSA_POLICY_VIEW_LOCAL_INFORMATION))
1359 return NT_STATUS_ACCESS_DENIED;
1361 DEBUG(10,("_lsa_LookupPrivDisplayName: name = %s\n", r->in.name->string));
1363 description = get_privilege_dispname(r->in.name->string);
1365 DEBUG(10,("_lsa_LookupPrivDisplayName: doesn't exist\n"));
1366 return NT_STATUS_NO_SUCH_PRIVILEGE;
1369 DEBUG(10,("_lsa_LookupPrivDisplayName: display name = %s\n", description));
1371 lsa_name = TALLOC_ZERO_P(p->mem_ctx, struct lsa_StringLarge);
1373 return NT_STATUS_NO_MEMORY;
1376 init_lsa_StringLarge(lsa_name, description);
1378 *r->out.returned_language_id = r->in.language_id;
1379 *r->out.disp_name = lsa_name;
1381 return NT_STATUS_OK;
1384 /***************************************************************************
1386 ***************************************************************************/
1388 NTSTATUS _lsa_EnumAccounts(pipes_struct *p,
1389 struct lsa_EnumAccounts *r)
1391 struct lsa_info *handle;
1393 int i, j, num_entries;
1395 struct lsa_SidPtr *sids = NULL;
1397 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle))
1398 return NT_STATUS_INVALID_HANDLE;
1400 if (!(handle->access & LSA_POLICY_VIEW_LOCAL_INFORMATION))
1401 return NT_STATUS_ACCESS_DENIED;
1406 /* The only way we can currently find out all the SIDs that have been
1407 privileged is to scan all privileges */
1409 status = privilege_enumerate_accounts(&sid_list, &num_entries);
1410 if (!NT_STATUS_IS_OK(status)) {
1414 if (*r->in.resume_handle >= num_entries) {
1415 return NT_STATUS_NO_MORE_ENTRIES;
1418 if (num_entries - *r->in.resume_handle) {
1419 sids = TALLOC_ZERO_ARRAY(p->mem_ctx, struct lsa_SidPtr,
1420 num_entries - *r->in.resume_handle);
1422 SAFE_FREE(sid_list);
1423 return NT_STATUS_NO_MEMORY;
1426 for (i = *r->in.resume_handle, j = 0; i < num_entries; i++, j++) {
1427 sids[j].sid = sid_dup_talloc(p->mem_ctx, &sid_list[i]);
1429 SAFE_FREE(sid_list);
1430 return NT_STATUS_NO_MEMORY;
1435 talloc_free(sid_list);
1437 *r->out.resume_handle = num_entries;
1438 r->out.sids->num_sids = num_entries;
1439 r->out.sids->sids = sids;
1441 return NT_STATUS_OK;
1444 /***************************************************************************
1446 ***************************************************************************/
1448 NTSTATUS _lsa_GetUserName(pipes_struct *p,
1449 struct lsa_GetUserName *r)
1451 const char *username, *domname;
1452 user_struct *vuser = get_valid_user_struct(p->vuid);
1453 struct lsa_String *account_name = NULL;
1454 struct lsa_String *authority_name = NULL;
1457 return NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
1461 * I'm 99% sure this is not the right place to do this,
1462 * global_sid_Anonymous should probably be put into the token
1463 * instead of the guest id -- vl
1465 if (!lookup_sid(p->mem_ctx, &global_sid_Anonymous,
1466 &domname, &username, NULL)) {
1467 return NT_STATUS_NO_MEMORY;
1470 username = vuser->user.smb_name;
1471 domname = vuser->user.domain;
1474 account_name = TALLOC_ZERO_P(p->mem_ctx, struct lsa_String);
1475 if (!account_name) {
1476 return NT_STATUS_NO_MEMORY;
1479 authority_name = TALLOC_ZERO_P(p->mem_ctx, struct lsa_String);
1480 if (!authority_name) {
1481 return NT_STATUS_NO_MEMORY;
1484 init_lsa_String(account_name, username);
1485 init_lsa_String(authority_name, domname);
1487 *r->out.account_name = account_name;
1488 *r->out.authority_name = authority_name;
1490 return NT_STATUS_OK;
1493 /***************************************************************************
1495 ***************************************************************************/
1497 NTSTATUS _lsa_CreateAccount(pipes_struct *p,
1498 struct lsa_CreateAccount *r)
1500 struct lsa_info *handle;
1501 struct lsa_info *info;
1503 /* find the connection policy handle. */
1504 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle))
1505 return NT_STATUS_INVALID_HANDLE;
1507 /* check if the user have enough rights */
1510 * I don't know if it's the right one. not documented.
1511 * but guessed with rpcclient.
1513 if (!(handle->access & LSA_POLICY_GET_PRIVATE_INFORMATION))
1514 return NT_STATUS_ACCESS_DENIED;
1516 /* check to see if the pipe_user is a Domain Admin since
1517 account_pol.tdb was already opened as root, this is all we have */
1519 if ( !nt_token_check_domain_rid( p->pipe_user.nt_user_token, DOMAIN_GROUP_RID_ADMINS ) )
1520 return NT_STATUS_ACCESS_DENIED;
1522 if ( is_privileged_sid( r->in.sid ) )
1523 return NT_STATUS_OBJECT_NAME_COLLISION;
1525 /* associate the user/group SID with the (unique) handle. */
1527 if ((info = SMB_MALLOC_P(struct lsa_info)) == NULL)
1528 return NT_STATUS_NO_MEMORY;
1531 info->sid = *r->in.sid;
1532 info->access = r->in.access_mask;
1534 /* get a (unique) handle. open a policy on it. */
1535 if (!create_policy_hnd(p, r->out.acct_handle, free_lsa_info, (void *)info))
1536 return NT_STATUS_OBJECT_NAME_NOT_FOUND;
1538 return privilege_create_account( &info->sid );
1542 /***************************************************************************
1544 ***************************************************************************/
1546 NTSTATUS _lsa_OpenAccount(pipes_struct *p,
1547 struct lsa_OpenAccount *r)
1549 struct lsa_info *handle;
1550 struct lsa_info *info;
1552 /* find the connection policy handle. */
1553 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle))
1554 return NT_STATUS_INVALID_HANDLE;
1556 /* check if the user have enough rights */
1559 * I don't know if it's the right one. not documented.
1560 * but guessed with rpcclient.
1562 if (!(handle->access & LSA_POLICY_GET_PRIVATE_INFORMATION))
1563 return NT_STATUS_ACCESS_DENIED;
1565 /* TODO: Fis the parsing routine before reenabling this check! */
1567 if (!lookup_sid(&handle->sid, dom_name, name, &type))
1568 return NT_STATUS_ACCESS_DENIED;
1570 /* associate the user/group SID with the (unique) handle. */
1571 if ((info = SMB_MALLOC_P(struct lsa_info)) == NULL)
1572 return NT_STATUS_NO_MEMORY;
1575 info->sid = *r->in.sid;
1576 info->access = r->in.access_mask;
1578 /* get a (unique) handle. open a policy on it. */
1579 if (!create_policy_hnd(p, r->out.acct_handle, free_lsa_info, (void *)info))
1580 return NT_STATUS_OBJECT_NAME_NOT_FOUND;
1582 return NT_STATUS_OK;
1585 /***************************************************************************
1586 _lsa_EnumPrivsAccount
1587 For a given SID, enumerate all the privilege this account has.
1588 ***************************************************************************/
1590 NTSTATUS _lsa_EnumPrivsAccount(pipes_struct *p,
1591 struct lsa_EnumPrivsAccount *r)
1593 NTSTATUS status = NT_STATUS_OK;
1594 struct lsa_info *info=NULL;
1596 PRIVILEGE_SET privileges;
1597 struct lsa_PrivilegeSet *priv_set = NULL;
1598 struct lsa_LUIDAttribute *luid_attrs = NULL;
1601 /* find the connection policy handle. */
1602 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
1603 return NT_STATUS_INVALID_HANDLE;
1605 if ( !get_privileges_for_sids( &mask, &info->sid, 1 ) )
1606 return NT_STATUS_OBJECT_NAME_NOT_FOUND;
1608 privilege_set_init( &privileges );
1610 if ( se_priv_to_privilege_set( &privileges, &mask ) ) {
1612 DEBUG(10,("_lsa_EnumPrivsAccount: %s has %d privileges\n",
1613 sid_string_dbg(&info->sid),
1616 priv_set = TALLOC_ZERO_P(p->mem_ctx, struct lsa_PrivilegeSet);
1618 status = NT_STATUS_NO_MEMORY;
1622 luid_attrs = TALLOC_ZERO_ARRAY(p->mem_ctx,
1623 struct lsa_LUIDAttribute,
1626 status = NT_STATUS_NO_MEMORY;
1630 for (i=0; i<privileges.count; i++) {
1631 luid_attrs[i].luid.low = privileges.set[i].luid.low;
1632 luid_attrs[i].luid.high = privileges.set[i].luid.high;
1633 luid_attrs[i].attribute = privileges.set[i].attr;
1636 priv_set->count = privileges.count;
1637 priv_set->unknown = 0;
1638 priv_set->set = luid_attrs;
1640 *r->out.privs = priv_set;
1642 status = NT_STATUS_NO_SUCH_PRIVILEGE;
1646 privilege_set_free( &privileges );
1651 /***************************************************************************
1652 _lsa_GetSystemAccessAccount
1653 ***************************************************************************/
1655 NTSTATUS _lsa_GetSystemAccessAccount(pipes_struct *p,
1656 struct lsa_GetSystemAccessAccount *r)
1658 struct lsa_info *info=NULL;
1660 /* find the connection policy handle. */
1662 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
1663 return NT_STATUS_INVALID_HANDLE;
1665 if (!lookup_sid(p->mem_ctx, &info->sid, NULL, NULL, NULL))
1666 return NT_STATUS_ACCESS_DENIED;
1669 0x01 -> Log on locally
1670 0x02 -> Access this computer from network
1671 0x04 -> Log on as a batch job
1672 0x10 -> Log on as a service
1674 they can be ORed together
1677 *r->out.access_mask = PR_LOG_ON_LOCALLY | PR_ACCESS_FROM_NETWORK;
1679 return NT_STATUS_OK;
1682 /***************************************************************************
1683 update the systemaccount information
1684 ***************************************************************************/
1686 NTSTATUS _lsa_SetSystemAccessAccount(pipes_struct *p,
1687 struct lsa_SetSystemAccessAccount *r)
1689 struct lsa_info *info=NULL;
1692 /* find the connection policy handle. */
1693 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
1694 return NT_STATUS_INVALID_HANDLE;
1696 /* check to see if the pipe_user is a Domain Admin since
1697 account_pol.tdb was already opened as root, this is all we have */
1699 if ( !nt_token_check_domain_rid( p->pipe_user.nt_user_token, DOMAIN_GROUP_RID_ADMINS ) )
1700 return NT_STATUS_ACCESS_DENIED;
1702 if (!pdb_getgrsid(&map, info->sid))
1703 return NT_STATUS_NO_SUCH_GROUP;
1705 return pdb_update_group_mapping_entry(&map);
1708 /***************************************************************************
1709 _lsa_AddPrivilegesToAccount
1710 For a given SID, add some privileges.
1711 ***************************************************************************/
1713 NTSTATUS _lsa_AddPrivilegesToAccount(pipes_struct *p,
1714 struct lsa_AddPrivilegesToAccount *r)
1716 struct lsa_info *info = NULL;
1718 struct lsa_PrivilegeSet *set = NULL;
1720 /* find the connection policy handle. */
1721 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
1722 return NT_STATUS_INVALID_HANDLE;
1724 /* check to see if the pipe_user is root or a Domain Admin since
1725 account_pol.tdb was already opened as root, this is all we have */
1727 if ( p->pipe_user.ut.uid != sec_initial_uid()
1728 && !nt_token_check_domain_rid( p->pipe_user.nt_user_token, DOMAIN_GROUP_RID_ADMINS ) )
1730 return NT_STATUS_ACCESS_DENIED;
1734 if ( !privilege_set_to_se_priv( &mask, set ) )
1735 return NT_STATUS_NO_SUCH_PRIVILEGE;
1737 if ( !grant_privilege( &info->sid, &mask ) ) {
1738 DEBUG(3,("_lsa_AddPrivilegesToAccount: grant_privilege(%s) failed!\n",
1739 sid_string_dbg(&info->sid) ));
1740 DEBUG(3,("Privilege mask:\n"));
1741 dump_se_priv( DBGC_ALL, 3, &mask );
1742 return NT_STATUS_NO_SUCH_PRIVILEGE;
1745 return NT_STATUS_OK;
1748 /***************************************************************************
1749 _lsa_RemovePrivilegesFromAccount
1750 For a given SID, remove some privileges.
1751 ***************************************************************************/
1753 NTSTATUS _lsa_RemovePrivilegesFromAccount(pipes_struct *p,
1754 struct lsa_RemovePrivilegesFromAccount *r)
1756 struct lsa_info *info = NULL;
1758 struct lsa_PrivilegeSet *set = NULL;
1760 /* find the connection policy handle. */
1761 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
1762 return NT_STATUS_INVALID_HANDLE;
1764 /* check to see if the pipe_user is root or a Domain Admin since
1765 account_pol.tdb was already opened as root, this is all we have */
1767 if ( p->pipe_user.ut.uid != sec_initial_uid()
1768 && !nt_token_check_domain_rid( p->pipe_user.nt_user_token, DOMAIN_GROUP_RID_ADMINS ) )
1770 return NT_STATUS_ACCESS_DENIED;
1775 if ( !privilege_set_to_se_priv( &mask, set ) )
1776 return NT_STATUS_NO_SUCH_PRIVILEGE;
1778 if ( !revoke_privilege( &info->sid, &mask ) ) {
1779 DEBUG(3,("_lsa_RemovePrivilegesFromAccount: revoke_privilege(%s) failed!\n",
1780 sid_string_dbg(&info->sid) ));
1781 DEBUG(3,("Privilege mask:\n"));
1782 dump_se_priv( DBGC_ALL, 3, &mask );
1783 return NT_STATUS_NO_SUCH_PRIVILEGE;
1786 return NT_STATUS_OK;
1789 /***************************************************************************
1791 ***************************************************************************/
1793 NTSTATUS _lsa_QuerySecurity(pipes_struct *p,
1794 struct lsa_QuerySecurity *r)
1796 struct lsa_info *handle=NULL;
1797 SEC_DESC *psd = NULL;
1801 /* find the connection policy handle. */
1802 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle))
1803 return NT_STATUS_INVALID_HANDLE;
1805 /* check if the user have enough rights */
1806 if (!(handle->access & LSA_POLICY_VIEW_LOCAL_INFORMATION))
1807 return NT_STATUS_ACCESS_DENIED;
1810 switch (r->in.sec_info) {
1812 /* SD contains only the owner */
1814 status=lsa_get_generic_sd(p->mem_ctx, &psd, &sd_size);
1815 if(!NT_STATUS_IS_OK(status))
1816 return NT_STATUS_NO_MEMORY;
1819 if((*r->out.sdbuf = make_sec_desc_buf(p->mem_ctx, sd_size, psd)) == NULL)
1820 return NT_STATUS_NO_MEMORY;
1823 /* SD contains only the ACL */
1825 status=lsa_get_generic_sd(p->mem_ctx, &psd, &sd_size);
1826 if(!NT_STATUS_IS_OK(status))
1827 return NT_STATUS_NO_MEMORY;
1829 if((*r->out.sdbuf = make_sec_desc_buf(p->mem_ctx, sd_size, psd)) == NULL)
1830 return NT_STATUS_NO_MEMORY;
1833 return NT_STATUS_INVALID_LEVEL;
1839 #if 0 /* AD DC work in ongoing in Samba 4 */
1841 /***************************************************************************
1842 ***************************************************************************/
1844 NTSTATUS _lsa_query_info2(pipes_struct *p, LSA_Q_QUERY_INFO2 *q_u, LSA_R_QUERY_INFO2 *r_u)
1846 struct lsa_info *handle;
1847 const char *nb_name;
1848 char *dns_name = NULL;
1849 char *forest_name = NULL;
1850 DOM_SID *sid = NULL;
1855 r_u->status = NT_STATUS_OK;
1857 if (!find_policy_by_hnd(p, &q_u->pol, (void **)(void *)&handle))
1858 return NT_STATUS_INVALID_HANDLE;
1860 switch (q_u->info_class) {
1862 /* check if the user have enough rights */
1863 if (!(handle->access & LSA_POLICY_VIEW_LOCAL_INFORMATION))
1864 return NT_STATUS_ACCESS_DENIED;
1866 /* Request PolicyPrimaryDomainInformation. */
1867 switch (lp_server_role()) {
1868 case ROLE_DOMAIN_PDC:
1869 case ROLE_DOMAIN_BDC:
1870 nb_name = get_global_sam_name();
1871 /* ugly temp hack for these next two */
1873 /* This should be a 'netbios domain -> DNS domain' mapping */
1874 dnsdomname = get_mydnsdomname(p->mem_ctx);
1875 if (!dnsdomname || !*dnsdomname) {
1876 return NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
1878 strlower_m(dnsdomname);
1880 dns_name = dnsdomname;
1881 forest_name = dnsdomname;
1883 sid = get_global_sam_sid();
1884 secrets_fetch_domain_guid(lp_workgroup(), &guid);
1887 return NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
1889 init_dns_dom_info(&r_u->info.dns_dom_info, nb_name, dns_name,
1890 forest_name,&guid,sid);
1893 DEBUG(0,("_lsa_query_info2: unknown info level in Lsa Query: %d\n", q_u->info_class));
1894 r_u->status = NT_STATUS_INVALID_INFO_CLASS;
1898 if (NT_STATUS_IS_OK(r_u->status)) {
1900 r_u->info_class = q_u->info_class;
1905 #endif /* AD DC work in ongoing in Samba 4 */
1907 /***************************************************************************
1908 _lsa_AddAccountRights
1909 ***************************************************************************/
1911 NTSTATUS _lsa_AddAccountRights(pipes_struct *p,
1912 struct lsa_AddAccountRights *r)
1914 struct lsa_info *info = NULL;
1918 /* find the connection policy handle. */
1919 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
1920 return NT_STATUS_INVALID_HANDLE;
1922 /* check to see if the pipe_user is a Domain Admin since
1923 account_pol.tdb was already opened as root, this is all we have */
1925 if ( p->pipe_user.ut.uid != sec_initial_uid()
1926 && !nt_token_check_domain_rid( p->pipe_user.nt_user_token, DOMAIN_GROUP_RID_ADMINS ) )
1928 return NT_STATUS_ACCESS_DENIED;
1931 /* according to an NT4 PDC, you can add privileges to SIDs even without
1932 call_lsa_create_account() first. And you can use any arbitrary SID. */
1934 sid_copy( &sid, r->in.sid );
1936 for ( i=0; i < r->in.rights->count; i++ ) {
1938 const char *privname = r->in.rights->names[i].string;
1940 /* only try to add non-null strings */
1945 if ( !grant_privilege_by_name( &sid, privname ) ) {
1946 DEBUG(2,("_lsa_AddAccountRights: Failed to add privilege [%s]\n",
1948 return NT_STATUS_NO_SUCH_PRIVILEGE;
1952 return NT_STATUS_OK;
1955 /***************************************************************************
1956 _lsa_RemoveAccountRights
1957 ***************************************************************************/
1959 NTSTATUS _lsa_RemoveAccountRights(pipes_struct *p,
1960 struct lsa_RemoveAccountRights *r)
1962 struct lsa_info *info = NULL;
1965 const char *privname = NULL;
1967 /* find the connection policy handle. */
1968 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
1969 return NT_STATUS_INVALID_HANDLE;
1971 /* check to see if the pipe_user is a Domain Admin since
1972 account_pol.tdb was already opened as root, this is all we have */
1974 if ( p->pipe_user.ut.uid != sec_initial_uid()
1975 && !nt_token_check_domain_rid( p->pipe_user.nt_user_token, DOMAIN_GROUP_RID_ADMINS ) )
1977 return NT_STATUS_ACCESS_DENIED;
1980 sid_copy( &sid, r->in.sid );
1982 if ( r->in.remove_all ) {
1983 if ( !revoke_all_privileges( &sid ) )
1984 return NT_STATUS_ACCESS_DENIED;
1986 return NT_STATUS_OK;
1989 for ( i=0; i < r->in.rights->count; i++ ) {
1991 privname = r->in.rights->names[i].string;
1993 /* only try to add non-null strings */
1998 if ( !revoke_privilege_by_name( &sid, privname ) ) {
1999 DEBUG(2,("_lsa_RemoveAccountRights: Failed to revoke privilege [%s]\n",
2001 return NT_STATUS_NO_SUCH_PRIVILEGE;
2005 return NT_STATUS_OK;
2008 /*******************************************************************
2009 ********************************************************************/
2011 static NTSTATUS init_lsa_right_set(TALLOC_CTX *mem_ctx,
2012 struct lsa_RightSet *r,
2013 PRIVILEGE_SET *privileges)
2016 const char *privname;
2017 const char **privname_array = NULL;
2020 for (i=0; i<privileges->count; i++) {
2022 privname = luid_to_privilege_name(&privileges->set[i].luid);
2024 if (!add_string_to_array(mem_ctx, privname,
2025 &privname_array, &num_priv)) {
2026 return NT_STATUS_NO_MEMORY;
2033 r->names = TALLOC_ZERO_ARRAY(mem_ctx, struct lsa_StringLarge,
2036 return NT_STATUS_NO_MEMORY;
2039 for (i=0; i<num_priv; i++) {
2040 init_lsa_StringLarge(&r->names[i], privname_array[i]);
2043 r->count = num_priv;
2046 return NT_STATUS_OK;
2049 /***************************************************************************
2050 _lsa_EnumAccountRights
2051 ***************************************************************************/
2053 NTSTATUS _lsa_EnumAccountRights(pipes_struct *p,
2054 struct lsa_EnumAccountRights *r)
2057 struct lsa_info *info = NULL;
2059 PRIVILEGE_SET privileges;
2062 /* find the connection policy handle. */
2064 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
2065 return NT_STATUS_INVALID_HANDLE;
2067 /* according to an NT4 PDC, you can add privileges to SIDs even without
2068 call_lsa_create_account() first. And you can use any arbitrary SID. */
2070 sid_copy( &sid, r->in.sid );
2072 if ( !get_privileges_for_sids( &mask, &sid, 1 ) )
2073 return NT_STATUS_OBJECT_NAME_NOT_FOUND;
2075 privilege_set_init( &privileges );
2077 if ( se_priv_to_privilege_set( &privileges, &mask ) ) {
2079 DEBUG(10,("_lsa_EnumAccountRights: %s has %d privileges\n",
2080 sid_string_dbg(&sid), privileges.count));
2082 status = init_lsa_right_set(p->mem_ctx, r->out.rights, &privileges);
2084 status = NT_STATUS_NO_SUCH_PRIVILEGE;
2087 privilege_set_free( &privileges );
2092 /***************************************************************************
2093 _lsa_LookupPrivValue
2094 ***************************************************************************/
2096 NTSTATUS _lsa_LookupPrivValue(pipes_struct *p,
2097 struct lsa_LookupPrivValue *r)
2099 struct lsa_info *info = NULL;
2100 const char *name = NULL;
2101 LUID_ATTR priv_luid;
2104 /* find the connection policy handle. */
2106 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
2107 return NT_STATUS_INVALID_HANDLE;
2109 name = r->in.name->string;
2111 DEBUG(10,("_lsa_lookup_priv_value: name = %s\n", name));
2113 if ( !se_priv_from_name( name, &mask ) )
2114 return NT_STATUS_NO_SUCH_PRIVILEGE;
2116 priv_luid = get_privilege_luid( &mask );
2118 r->out.luid->low = priv_luid.luid.low;
2119 r->out.luid->high = priv_luid.luid.high;
2121 return NT_STATUS_OK;
2125 * From here on the server routines are just dummy ones to make smbd link with
2126 * librpc/gen_ndr/srv_lsa.c. These routines are actually never called, we are
2127 * pulling the server stubs across one by one.
2130 NTSTATUS _lsa_Delete(pipes_struct *p, struct lsa_Delete *r)
2132 p->rng_fault_state = True;
2133 return NT_STATUS_NOT_IMPLEMENTED;
2136 NTSTATUS _lsa_SetSecObj(pipes_struct *p, struct lsa_SetSecObj *r)
2138 p->rng_fault_state = True;
2139 return NT_STATUS_NOT_IMPLEMENTED;
2142 NTSTATUS _lsa_ChangePassword(pipes_struct *p, struct lsa_ChangePassword *r)
2144 p->rng_fault_state = True;
2145 return NT_STATUS_NOT_IMPLEMENTED;
2148 NTSTATUS _lsa_SetInfoPolicy(pipes_struct *p, struct lsa_SetInfoPolicy *r)
2150 p->rng_fault_state = True;
2151 return NT_STATUS_NOT_IMPLEMENTED;
2154 NTSTATUS _lsa_ClearAuditLog(pipes_struct *p, struct lsa_ClearAuditLog *r)
2156 p->rng_fault_state = True;
2157 return NT_STATUS_NOT_IMPLEMENTED;
2160 NTSTATUS _lsa_GetQuotasForAccount(pipes_struct *p, struct lsa_GetQuotasForAccount *r)
2162 p->rng_fault_state = True;
2163 return NT_STATUS_NOT_IMPLEMENTED;
2166 NTSTATUS _lsa_SetQuotasForAccount(pipes_struct *p, struct lsa_SetQuotasForAccount *r)
2168 p->rng_fault_state = True;
2169 return NT_STATUS_NOT_IMPLEMENTED;
2172 NTSTATUS _lsa_QueryTrustedDomainInfo(pipes_struct *p, struct lsa_QueryTrustedDomainInfo *r)
2174 p->rng_fault_state = True;
2175 return NT_STATUS_NOT_IMPLEMENTED;
2178 NTSTATUS _lsa_SetInformationTrustedDomain(pipes_struct *p, struct lsa_SetInformationTrustedDomain *r)
2180 p->rng_fault_state = True;
2181 return NT_STATUS_NOT_IMPLEMENTED;
2184 NTSTATUS _lsa_QuerySecret(pipes_struct *p, struct lsa_QuerySecret *r)
2186 p->rng_fault_state = True;
2187 return NT_STATUS_NOT_IMPLEMENTED;
2190 NTSTATUS _lsa_LookupPrivName(pipes_struct *p, struct lsa_LookupPrivName *r)
2192 p->rng_fault_state = True;
2193 return NT_STATUS_NOT_IMPLEMENTED;
2196 NTSTATUS _lsa_EnumAccountsWithUserRight(pipes_struct *p, struct lsa_EnumAccountsWithUserRight *r)
2198 p->rng_fault_state = True;
2199 return NT_STATUS_NOT_IMPLEMENTED;
2202 NTSTATUS _lsa_QueryTrustedDomainInfoBySid(pipes_struct *p, struct lsa_QueryTrustedDomainInfoBySid *r)
2204 p->rng_fault_state = True;
2205 return NT_STATUS_NOT_IMPLEMENTED;
2208 NTSTATUS _lsa_SetTrustedDomainInfo(pipes_struct *p, struct lsa_SetTrustedDomainInfo *r)
2210 p->rng_fault_state = True;
2211 return NT_STATUS_NOT_IMPLEMENTED;
2214 NTSTATUS _lsa_DeleteTrustedDomain(pipes_struct *p, struct lsa_DeleteTrustedDomain *r)
2216 p->rng_fault_state = True;
2217 return NT_STATUS_NOT_IMPLEMENTED;
2220 NTSTATUS _lsa_StorePrivateData(pipes_struct *p, struct lsa_StorePrivateData *r)
2222 p->rng_fault_state = True;
2223 return NT_STATUS_NOT_IMPLEMENTED;
2226 NTSTATUS _lsa_RetrievePrivateData(pipes_struct *p, struct lsa_RetrievePrivateData *r)
2228 p->rng_fault_state = True;
2229 return NT_STATUS_NOT_IMPLEMENTED;
2232 NTSTATUS _lsa_QueryInfoPolicy2(pipes_struct *p, struct lsa_QueryInfoPolicy2 *r)
2234 p->rng_fault_state = True;
2235 return NT_STATUS_NOT_IMPLEMENTED;
2238 NTSTATUS _lsa_SetInfoPolicy2(pipes_struct *p, struct lsa_SetInfoPolicy2 *r)
2240 p->rng_fault_state = True;
2241 return NT_STATUS_NOT_IMPLEMENTED;
2244 NTSTATUS _lsa_QueryTrustedDomainInfoByName(pipes_struct *p, struct lsa_QueryTrustedDomainInfoByName *r)
2246 p->rng_fault_state = True;
2247 return NT_STATUS_NOT_IMPLEMENTED;
2250 NTSTATUS _lsa_SetTrustedDomainInfoByName(pipes_struct *p, struct lsa_SetTrustedDomainInfoByName *r)
2252 p->rng_fault_state = True;
2253 return NT_STATUS_NOT_IMPLEMENTED;
2256 NTSTATUS _lsa_EnumTrustedDomainsEx(pipes_struct *p, struct lsa_EnumTrustedDomainsEx *r)
2258 p->rng_fault_state = True;
2259 return NT_STATUS_NOT_IMPLEMENTED;
2262 NTSTATUS _lsa_CreateTrustedDomainEx(pipes_struct *p, struct lsa_CreateTrustedDomainEx *r)
2264 p->rng_fault_state = True;
2265 return NT_STATUS_NOT_IMPLEMENTED;
2268 NTSTATUS _lsa_CloseTrustedDomainEx(pipes_struct *p, struct lsa_CloseTrustedDomainEx *r)
2270 p->rng_fault_state = True;
2271 return NT_STATUS_NOT_IMPLEMENTED;
2274 NTSTATUS _lsa_QueryDomainInformationPolicy(pipes_struct *p, struct lsa_QueryDomainInformationPolicy *r)
2276 p->rng_fault_state = True;
2277 return NT_STATUS_NOT_IMPLEMENTED;
2280 NTSTATUS _lsa_SetDomainInformationPolicy(pipes_struct *p, struct lsa_SetDomainInformationPolicy *r)
2282 p->rng_fault_state = True;
2283 return NT_STATUS_NOT_IMPLEMENTED;
2286 NTSTATUS _lsa_OpenTrustedDomainByName(pipes_struct *p, struct lsa_OpenTrustedDomainByName *r)
2288 p->rng_fault_state = True;
2289 return NT_STATUS_NOT_IMPLEMENTED;
2292 NTSTATUS _lsa_TestCall(pipes_struct *p, struct lsa_TestCall *r)
2294 p->rng_fault_state = True;
2295 return NT_STATUS_NOT_IMPLEMENTED;
2298 NTSTATUS _lsa_CreateTrustedDomainEx2(pipes_struct *p, struct lsa_CreateTrustedDomainEx2 *r)
2300 p->rng_fault_state = True;
2301 return NT_STATUS_NOT_IMPLEMENTED;
2304 NTSTATUS _lsa_CREDRWRITE(pipes_struct *p, struct lsa_CREDRWRITE *r)
2306 p->rng_fault_state = True;
2307 return NT_STATUS_NOT_IMPLEMENTED;
2310 NTSTATUS _lsa_CREDRREAD(pipes_struct *p, struct lsa_CREDRREAD *r)
2312 p->rng_fault_state = True;
2313 return NT_STATUS_NOT_IMPLEMENTED;
2316 NTSTATUS _lsa_CREDRENUMERATE(pipes_struct *p, struct lsa_CREDRENUMERATE *r)
2318 p->rng_fault_state = True;
2319 return NT_STATUS_NOT_IMPLEMENTED;
2322 NTSTATUS _lsa_CREDRWRITEDOMAINCREDENTIALS(pipes_struct *p, struct lsa_CREDRWRITEDOMAINCREDENTIALS *r)
2324 p->rng_fault_state = True;
2325 return NT_STATUS_NOT_IMPLEMENTED;
2328 NTSTATUS _lsa_CREDRREADDOMAINCREDENTIALS(pipes_struct *p, struct lsa_CREDRREADDOMAINCREDENTIALS *r)
2330 p->rng_fault_state = True;
2331 return NT_STATUS_NOT_IMPLEMENTED;
2334 NTSTATUS _lsa_CREDRDELETE(pipes_struct *p, struct lsa_CREDRDELETE *r)
2336 p->rng_fault_state = True;
2337 return NT_STATUS_NOT_IMPLEMENTED;
2340 NTSTATUS _lsa_CREDRGETTARGETINFO(pipes_struct *p, struct lsa_CREDRGETTARGETINFO *r)
2342 p->rng_fault_state = True;
2343 return NT_STATUS_NOT_IMPLEMENTED;
2346 NTSTATUS _lsa_CREDRPROFILELOADED(pipes_struct *p, struct lsa_CREDRPROFILELOADED *r)
2348 p->rng_fault_state = True;
2349 return NT_STATUS_NOT_IMPLEMENTED;
2352 NTSTATUS _lsa_CREDRGETSESSIONTYPES(pipes_struct *p, struct lsa_CREDRGETSESSIONTYPES *r)
2354 p->rng_fault_state = True;
2355 return NT_STATUS_NOT_IMPLEMENTED;
2358 NTSTATUS _lsa_LSARREGISTERAUDITEVENT(pipes_struct *p, struct lsa_LSARREGISTERAUDITEVENT *r)
2360 p->rng_fault_state = True;
2361 return NT_STATUS_NOT_IMPLEMENTED;
2364 NTSTATUS _lsa_LSARGENAUDITEVENT(pipes_struct *p, struct lsa_LSARGENAUDITEVENT *r)
2366 p->rng_fault_state = True;
2367 return NT_STATUS_NOT_IMPLEMENTED;
2370 NTSTATUS _lsa_LSARUNREGISTERAUDITEVENT(pipes_struct *p, struct lsa_LSARUNREGISTERAUDITEVENT *r)
2372 p->rng_fault_state = True;
2373 return NT_STATUS_NOT_IMPLEMENTED;
2376 NTSTATUS _lsa_lsaRQueryForestTrustInformation(pipes_struct *p, struct lsa_lsaRQueryForestTrustInformation *r)
2378 p->rng_fault_state = True;
2379 return NT_STATUS_NOT_IMPLEMENTED;
2382 NTSTATUS _lsa_LSARSETFORESTTRUSTINFORMATION(pipes_struct *p, struct lsa_LSARSETFORESTTRUSTINFORMATION *r)
2384 p->rng_fault_state = True;
2385 return NT_STATUS_NOT_IMPLEMENTED;
2388 NTSTATUS _lsa_CREDRRENAME(pipes_struct *p, struct lsa_CREDRRENAME *r)
2390 p->rng_fault_state = True;
2391 return NT_STATUS_NOT_IMPLEMENTED;
2394 NTSTATUS _lsa_LSAROPENPOLICYSCE(pipes_struct *p, struct lsa_LSAROPENPOLICYSCE *r)
2396 p->rng_fault_state = True;
2397 return NT_STATUS_NOT_IMPLEMENTED;
2400 NTSTATUS _lsa_LSARADTREGISTERSECURITYEVENTSOURCE(pipes_struct *p, struct lsa_LSARADTREGISTERSECURITYEVENTSOURCE *r)
2402 p->rng_fault_state = True;
2403 return NT_STATUS_NOT_IMPLEMENTED;
2406 NTSTATUS _lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE(pipes_struct *p, struct lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE *r)
2408 p->rng_fault_state = True;
2409 return NT_STATUS_NOT_IMPLEMENTED;
2412 NTSTATUS _lsa_LSARADTREPORTSECURITYEVENT(pipes_struct *p, struct lsa_LSARADTREPORTSECURITYEVENT *r)
2414 p->rng_fault_state = True;
2415 return NT_STATUS_NOT_IMPLEMENTED;