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
36 #define MAX_LOOKUP_SIDS 0x5000 /* 20480 */
45 const struct generic_mapping lsa_generic_mapping = {
52 /***************************************************************************
53 init_lsa_ref_domain_list - adds a domain if it's not already in, returns the index.
54 ***************************************************************************/
56 static int init_lsa_ref_domain_list(TALLOC_CTX *mem_ctx,
57 struct lsa_RefDomainList *ref,
63 if (dom_name != NULL) {
64 for (num = 0; num < ref->count; num++) {
65 if (sid_equal(dom_sid, ref->domains[num].sid)) {
73 if (num >= LSA_REF_DOMAIN_LIST_MULTIPLIER) {
74 /* index not found, already at maximum domain limit */
79 ref->max_size = LSA_REF_DOMAIN_LIST_MULTIPLIER;
81 ref->domains = TALLOC_REALLOC_ARRAY(mem_ctx, ref->domains,
82 struct lsa_DomainInfo, ref->count);
87 ZERO_STRUCT(ref->domains[num]);
89 init_lsa_StringLarge(&ref->domains[num].name, dom_name);
90 ref->domains[num].sid = sid_dup_talloc(mem_ctx, dom_sid);
91 if (!ref->domains[num].sid) {
99 /*******************************************************************
100 Function to free the per handle data.
101 ********************************************************************/
103 static void free_lsa_info(void *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 prid[i].sid_type = type;
201 prid[i].sid_index = dom_idx;
204 *pmapped_count = mapped_count;
208 /***************************************************************************
209 lookup_lsa_sids. Must be called as root for lookup_name to work.
210 ***************************************************************************/
212 static NTSTATUS lookup_lsa_sids(TALLOC_CTX *mem_ctx,
213 struct lsa_RefDomainList *ref,
214 struct lsa_TranslatedSid3 *trans_sids,
215 uint32_t num_entries,
216 struct lsa_String *name,
218 uint32 *pmapped_count)
220 uint32 mapped_count, i;
222 SMB_ASSERT(num_entries <= MAX_LOOKUP_SIDS);
227 for (i = 0; i < num_entries; i++) {
231 const char *full_name;
233 enum lsa_SidType type = SID_NAME_UNKNOWN;
237 /* Split name into domain and user component */
239 full_name = name[i].string;
240 if (full_name == NULL) {
241 return NT_STATUS_NO_MEMORY;
244 DEBUG(5, ("init_lsa_sids: looking up name %s\n", full_name));
246 /* We can ignore the result of lookup_name, it will not touch
247 "type" if it's not successful */
249 lookup_name(mem_ctx, full_name, flags, &domain, NULL,
254 case SID_NAME_DOM_GRP:
255 case SID_NAME_DOMAIN:
257 case SID_NAME_WKN_GRP:
258 DEBUG(5, ("init_lsa_sids: %s found\n", full_name));
259 /* Leave these unchanged */
262 /* Don't hand out anything but the list above */
263 DEBUG(5, ("init_lsa_sids: %s not found\n", full_name));
264 type = SID_NAME_UNKNOWN;
271 if (type != SID_NAME_UNKNOWN) {
273 sid_copy(&domain_sid, &sid);
274 sid_split_rid(&domain_sid, &rid);
275 dom_idx = init_lsa_ref_domain_list(mem_ctx, ref, domain, &domain_sid);
279 /* Initialize the lsa_TranslatedSid3 return. */
280 trans_sids[i].sid_type = type;
281 trans_sids[i].sid = sid_dup_talloc(mem_ctx, &sid);
282 trans_sids[i].sid_index = dom_idx;
285 *pmapped_count = mapped_count;
289 static NTSTATUS lsa_get_generic_sd(TALLOC_CTX *mem_ctx, SEC_DESC **sd, size_t *sd_size)
291 DOM_SID local_adm_sid;
298 init_sec_ace(&ace[0], &global_sid_World, SEC_ACE_TYPE_ACCESS_ALLOWED, LSA_POLICY_EXECUTE, 0);
300 sid_copy(&adm_sid, get_global_sam_sid());
301 sid_append_rid(&adm_sid, DOMAIN_GROUP_RID_ADMINS);
302 init_sec_ace(&ace[1], &adm_sid, SEC_ACE_TYPE_ACCESS_ALLOWED, LSA_POLICY_ALL_ACCESS, 0);
304 sid_copy(&local_adm_sid, &global_sid_Builtin);
305 sid_append_rid(&local_adm_sid, BUILTIN_ALIAS_RID_ADMINS);
306 init_sec_ace(&ace[2], &local_adm_sid, SEC_ACE_TYPE_ACCESS_ALLOWED, LSA_POLICY_ALL_ACCESS, 0);
308 if((psa = make_sec_acl(mem_ctx, NT4_ACL_REVISION, 3, ace)) == NULL)
309 return NT_STATUS_NO_MEMORY;
311 if((*sd = make_sec_desc(mem_ctx, SECURITY_DESCRIPTOR_REVISION_1,
312 SEC_DESC_SELF_RELATIVE, &adm_sid, NULL, NULL,
313 psa, sd_size)) == NULL)
314 return NT_STATUS_NO_MEMORY;
319 #if 0 /* AD DC work in ongoing in Samba 4 */
321 /***************************************************************************
323 ***************************************************************************/
325 static void init_dns_dom_info(LSA_DNS_DOM_INFO *r_l, const char *nb_name,
326 const char *dns_name, const char *forest_name,
327 struct GUID *dom_guid, DOM_SID *dom_sid)
329 if (nb_name && *nb_name) {
330 init_unistr2(&r_l->uni_nb_dom_name, nb_name, UNI_FLAGS_NONE);
331 init_uni_hdr(&r_l->hdr_nb_dom_name, &r_l->uni_nb_dom_name);
332 r_l->hdr_nb_dom_name.uni_max_len += 2;
333 r_l->uni_nb_dom_name.uni_max_len += 1;
336 if (dns_name && *dns_name) {
337 init_unistr2(&r_l->uni_dns_dom_name, dns_name, UNI_FLAGS_NONE);
338 init_uni_hdr(&r_l->hdr_dns_dom_name, &r_l->uni_dns_dom_name);
339 r_l->hdr_dns_dom_name.uni_max_len += 2;
340 r_l->uni_dns_dom_name.uni_max_len += 1;
343 if (forest_name && *forest_name) {
344 init_unistr2(&r_l->uni_forest_name, forest_name, UNI_FLAGS_NONE);
345 init_uni_hdr(&r_l->hdr_forest_name, &r_l->uni_forest_name);
346 r_l->hdr_forest_name.uni_max_len += 2;
347 r_l->uni_forest_name.uni_max_len += 1;
350 /* how do we init the guid ? probably should write an init fn */
352 memcpy(&r_l->dom_guid, dom_guid, sizeof(struct GUID));
356 r_l->ptr_dom_sid = 1;
357 init_dom_sid2(&r_l->dom_sid, dom_sid);
360 #endif /* AD DC work in ongoing in Samba 4 */
363 /***************************************************************************
365 ***************************************************************************/
367 NTSTATUS _lsa_OpenPolicy2(pipes_struct *p,
368 struct lsa_OpenPolicy2 *r)
370 struct lsa_info *info;
371 SEC_DESC *psd = NULL;
373 uint32 des_access = r->in.access_mask;
378 /* map the generic bits to the lsa policy ones */
379 se_map_generic(&des_access, &lsa_generic_mapping);
381 /* get the generic lsa policy SD until we store it */
382 lsa_get_generic_sd(p->mem_ctx, &psd, &sd_size);
384 status = se_access_check(psd, p->server_info->ptok, des_access,
386 if (!NT_STATUS_IS_OK(status)) {
387 if (p->server_info->utok.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->server_info->utok.uid == sec_initial_uid())
398 acc_granted = LSA_POLICY_ALL_ACCESS;
400 /* associate the domain SID with the (unique) handle. */
401 info = TALLOC_ZERO_P(NULL, struct lsa_info);
403 return NT_STATUS_NO_MEMORY;
406 sid_copy(&info->sid,get_global_sam_sid());
407 info->access = acc_granted;
409 /* set up the LSA QUERY INFO response */
410 if (!create_policy_hnd(p, r->out.handle, free_lsa_info, (void *)info))
411 return NT_STATUS_OBJECT_NAME_NOT_FOUND;
416 /***************************************************************************
418 ***************************************************************************/
420 NTSTATUS _lsa_OpenPolicy(pipes_struct *p,
421 struct lsa_OpenPolicy *r)
423 struct lsa_info *info;
424 SEC_DESC *psd = NULL;
426 uint32 des_access= r->in.access_mask;
431 /* map the generic bits to the lsa policy ones */
432 se_map_generic(&des_access, &lsa_generic_mapping);
434 /* get the generic lsa policy SD until we store it */
435 lsa_get_generic_sd(p->mem_ctx, &psd, &sd_size);
437 status = se_access_check(psd, p->server_info->ptok, des_access,
439 if (!NT_STATUS_IS_OK(status)) {
440 if (p->server_info->utok.uid != sec_initial_uid()) {
443 DEBUG(4,("ACCESS should be DENIED (granted: %#010x; required: %#010x)\n",
444 acc_granted, des_access));
445 DEBUGADD(4,("but overwritten by euid == 0\n"));
446 acc_granted = des_access;
449 /* associate the domain SID with the (unique) handle. */
450 info = TALLOC_ZERO_P(NULL, struct lsa_info);
452 return NT_STATUS_NO_MEMORY;
455 sid_copy(&info->sid,get_global_sam_sid());
456 info->access = acc_granted;
458 /* set up the LSA QUERY INFO response */
459 if (!create_policy_hnd(p, r->out.handle, free_lsa_info, (void *)info))
460 return NT_STATUS_OBJECT_NAME_NOT_FOUND;
465 /***************************************************************************
466 _lsa_EnumTrustDom - this needs fixing to do more than return NULL ! JRA.
468 ***************************************************************************/
470 NTSTATUS _lsa_EnumTrustDom(pipes_struct *p,
471 struct lsa_EnumTrustDom *r)
473 struct lsa_info *info;
475 struct trustdom_info **domains;
476 struct lsa_DomainInfo *lsa_domains = NULL;
480 * preferred length is set to 5 as a "our" preferred length
481 * nt sets this parameter to 2
482 * update (20.08.2002): it's not preferred length, but preferred size!
483 * it needs further investigation how to optimally choose this value
485 uint32 max_num_domains =
486 r->in.max_size < 5 ? r->in.max_size : 10;
491 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
492 return NT_STATUS_INVALID_HANDLE;
494 /* check if the user has enough rights */
495 if (!(info->access & LSA_POLICY_VIEW_LOCAL_INFORMATION))
496 return NT_STATUS_ACCESS_DENIED;
499 nt_status = pdb_enum_trusteddoms(p->mem_ctx, &num_domains, &domains);
502 if (!NT_STATUS_IS_OK(nt_status)) {
506 if (*r->in.resume_handle < num_domains) {
507 num_thistime = MIN(num_domains, max_num_domains);
509 nt_status = STATUS_MORE_ENTRIES;
511 if (*r->in.resume_handle + num_thistime > num_domains) {
512 num_thistime = num_domains - *r->in.resume_handle;
513 nt_status = NT_STATUS_OK;
516 next_idx = *r->in.resume_handle + num_thistime;
519 next_idx = 0xffffffff;
520 nt_status = NT_STATUS_NO_MORE_ENTRIES;
523 /* set up the lsa_enum_trust_dom response */
525 lsa_domains = TALLOC_ZERO_ARRAY(p->mem_ctx, struct lsa_DomainInfo,
528 return NT_STATUS_NO_MEMORY;
531 for (i=0; i<num_thistime; i++) {
532 init_lsa_StringLarge(&lsa_domains[i].name, domains[i]->name);
533 lsa_domains[i].sid = &domains[i]->sid;
536 *r->out.resume_handle = next_idx;
537 r->out.domains->count = num_thistime;
538 r->out.domains->domains = lsa_domains;
543 #define LSA_AUDIT_NUM_CATEGORIES_NT4 7
544 #define LSA_AUDIT_NUM_CATEGORIES_WIN2K 9
545 #define LSA_AUDIT_NUM_CATEGORIES LSA_AUDIT_NUM_CATEGORIES_NT4
547 /***************************************************************************
549 ***************************************************************************/
551 NTSTATUS _lsa_QueryInfoPolicy(pipes_struct *p,
552 struct lsa_QueryInfoPolicy *r)
554 NTSTATUS status = NT_STATUS_OK;
555 struct lsa_info *handle;
559 union lsa_PolicyInformation *info = NULL;
561 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle))
562 return NT_STATUS_INVALID_HANDLE;
564 info = TALLOC_ZERO_P(p->mem_ctx, union lsa_PolicyInformation);
566 return NT_STATUS_NO_MEMORY;
569 switch (r->in.level) {
573 uint32 policy_def = LSA_AUDIT_POLICY_ALL;
575 /* check if the user has enough rights */
576 if (!(handle->access & LSA_POLICY_VIEW_AUDIT_INFORMATION)) {
577 DEBUG(10,("_lsa_QueryInfoPolicy: insufficient access rights\n"));
578 return NT_STATUS_ACCESS_DENIED;
581 /* fake info: We audit everything. ;) */
583 info->audit_events.auditing_mode = true;
584 info->audit_events.count = LSA_AUDIT_NUM_CATEGORIES;
585 info->audit_events.settings = TALLOC_ZERO_ARRAY(p->mem_ctx,
586 enum lsa_PolicyAuditPolicy,
587 info->audit_events.count);
588 if (!info->audit_events.settings) {
589 return NT_STATUS_NO_MEMORY;
592 info->audit_events.settings[LSA_AUDIT_CATEGORY_ACCOUNT_MANAGEMENT] = policy_def;
593 info->audit_events.settings[LSA_AUDIT_CATEGORY_FILE_AND_OBJECT_ACCESS] = policy_def;
594 info->audit_events.settings[LSA_AUDIT_CATEGORY_LOGON] = policy_def;
595 info->audit_events.settings[LSA_AUDIT_CATEGORY_PROCCESS_TRACKING] = policy_def;
596 info->audit_events.settings[LSA_AUDIT_CATEGORY_SECURITY_POLICY_CHANGES] = policy_def;
597 info->audit_events.settings[LSA_AUDIT_CATEGORY_SYSTEM] = policy_def;
598 info->audit_events.settings[LSA_AUDIT_CATEGORY_USE_OF_USER_RIGHTS] = policy_def;
603 /* check if the user has enough rights */
604 if (!(handle->access & LSA_POLICY_VIEW_LOCAL_INFORMATION))
605 return NT_STATUS_ACCESS_DENIED;
607 /* Request PolicyPrimaryDomainInformation. */
608 switch (lp_server_role()) {
609 case ROLE_DOMAIN_PDC:
610 case ROLE_DOMAIN_BDC:
611 name = get_global_sam_name();
612 sid = sid_dup_talloc(p->mem_ctx, get_global_sam_sid());
614 return NT_STATUS_NO_MEMORY;
617 case ROLE_DOMAIN_MEMBER:
618 name = lp_workgroup();
619 /* We need to return the Domain SID here. */
620 if (secrets_fetch_domain_sid(lp_workgroup(), &domain_sid)) {
621 sid = sid_dup_talloc(p->mem_ctx, &domain_sid);
623 return NT_STATUS_NO_MEMORY;
626 return NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
629 case ROLE_STANDALONE:
630 name = lp_workgroup();
634 return NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
636 init_dom_query_3(&info->domain, name, sid);
639 /* check if the user has enough rights */
640 if (!(handle->access & LSA_POLICY_VIEW_LOCAL_INFORMATION))
641 return NT_STATUS_ACCESS_DENIED;
643 /* Request PolicyAccountDomainInformation. */
644 name = get_global_sam_name();
645 sid = get_global_sam_sid();
647 init_dom_query_5(&info->account_domain, name, sid);
650 /* check if the user has enough rights */
651 if (!(handle->access & LSA_POLICY_VIEW_LOCAL_INFORMATION))
652 return NT_STATUS_ACCESS_DENIED;
654 switch (lp_server_role()) {
655 case ROLE_DOMAIN_BDC:
657 * only a BDC is a backup controller
658 * of the domain, it controls.
664 * any other role is a primary
665 * of the domain, it controls.
672 DEBUG(0,("_lsa_QueryInfoPolicy: unknown info level in Lsa Query: %d\n",
674 status = NT_STATUS_INVALID_INFO_CLASS;
683 /***************************************************************************
684 _lsa_lookup_sids_internal
685 ***************************************************************************/
687 static NTSTATUS _lsa_lookup_sids_internal(pipes_struct *p,
689 uint16_t level, /* input */
690 int num_sids, /* input */
691 struct lsa_SidPtr *sid, /* input */
692 struct lsa_RefDomainList **pp_ref, /* input/output */
693 struct lsa_TranslatedName2 **pp_names,/* input/output */
694 uint32_t *pp_mapped_count) /* input/output */
698 const DOM_SID **sids = NULL;
699 struct lsa_RefDomainList *ref = NULL;
700 uint32 mapped_count = 0;
701 struct lsa_dom_info *dom_infos = NULL;
702 struct lsa_name_info *name_infos = NULL;
703 struct lsa_TranslatedName2 *names = NULL;
705 *pp_mapped_count = 0;
713 sids = TALLOC_ARRAY(p->mem_ctx, const DOM_SID *, num_sids);
714 ref = TALLOC_ZERO_P(p->mem_ctx, struct lsa_RefDomainList);
716 if (sids == NULL || ref == NULL) {
717 return NT_STATUS_NO_MEMORY;
720 for (i=0; i<num_sids; i++) {
721 sids[i] = sid[i].sid;
724 status = lookup_sids(p->mem_ctx, num_sids, sids, level,
725 &dom_infos, &name_infos);
727 if (!NT_STATUS_IS_OK(status)) {
731 names = TALLOC_ARRAY(p->mem_ctx, struct lsa_TranslatedName2, num_sids);
733 return NT_STATUS_NO_MEMORY;
736 for (i=0; i<LSA_REF_DOMAIN_LIST_MULTIPLIER; i++) {
738 if (!dom_infos[i].valid) {
742 if (init_lsa_ref_domain_list(mem_ctx, ref,
744 &dom_infos[i].sid) != i) {
745 DEBUG(0, ("Domain %s mentioned twice??\n",
747 return NT_STATUS_INTERNAL_ERROR;
751 for (i=0; i<num_sids; i++) {
752 struct lsa_name_info *name = &name_infos[i];
754 if (name->type == SID_NAME_UNKNOWN) {
757 /* Unknown sids should return the string
758 * representation of the SID. Windows 2003 behaves
759 * rather erratic here, in many cases it returns the
760 * RID as 8 bytes hex, in others it returns the full
761 * SID. We (Jerry/VL) could not figure out which the
762 * hard cases are, so leave it with the SID. */
763 name->name = talloc_asprintf(p->mem_ctx, "%s",
766 if (name->name == NULL) {
767 return NT_STATUS_NO_MEMORY;
773 names[i].sid_type = name->type;
774 names[i].name.string = name->name;
775 names[i].sid_index = name->dom_idx;
776 names[i].unknown = 0;
779 status = NT_STATUS_NONE_MAPPED;
780 if (mapped_count > 0) {
781 status = (mapped_count < num_sids) ?
782 STATUS_SOME_UNMAPPED : NT_STATUS_OK;
785 DEBUG(10, ("num_sids %d, mapped_count %d, status %s\n",
786 num_sids, mapped_count, nt_errstr(status)));
788 *pp_mapped_count = mapped_count;
795 /***************************************************************************
797 ***************************************************************************/
799 NTSTATUS _lsa_LookupSids(pipes_struct *p,
800 struct lsa_LookupSids *r)
803 struct lsa_info *handle;
804 int num_sids = r->in.sids->num_sids;
805 uint32 mapped_count = 0;
806 struct lsa_RefDomainList *domains = NULL;
807 struct lsa_TranslatedName *names_out = NULL;
808 struct lsa_TranslatedName2 *names = NULL;
811 if ((r->in.level < 1) || (r->in.level > 6)) {
812 return NT_STATUS_INVALID_PARAMETER;
815 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle)) {
816 return NT_STATUS_INVALID_HANDLE;
819 /* check if the user has enough rights */
820 if (!(handle->access & LSA_POLICY_LOOKUP_NAMES)) {
821 return NT_STATUS_ACCESS_DENIED;
824 if (num_sids > MAX_LOOKUP_SIDS) {
825 DEBUG(5,("_lsa_LookupSids: limit of %d exceeded, requested %d\n",
826 MAX_LOOKUP_SIDS, num_sids));
827 return NT_STATUS_NONE_MAPPED;
830 status = _lsa_lookup_sids_internal(p,
839 /* Convert from lsa_TranslatedName2 to lsa_TranslatedName */
840 names_out = TALLOC_ARRAY(p->mem_ctx, struct lsa_TranslatedName,
843 return NT_STATUS_NO_MEMORY;
846 for (i=0; i<num_sids; i++) {
847 names_out[i].sid_type = names[i].sid_type;
848 names_out[i].name = names[i].name;
849 names_out[i].sid_index = names[i].sid_index;
852 *r->out.domains = domains;
853 r->out.names->count = num_sids;
854 r->out.names->names = names_out;
855 *r->out.count = mapped_count;
860 /***************************************************************************
862 ***************************************************************************/
864 NTSTATUS _lsa_LookupSids2(pipes_struct *p,
865 struct lsa_LookupSids2 *r)
868 struct lsa_info *handle;
869 int num_sids = r->in.sids->num_sids;
870 uint32 mapped_count = 0;
871 struct lsa_RefDomainList *domains = NULL;
872 struct lsa_TranslatedName2 *names = NULL;
873 bool check_policy = true;
875 switch (p->hdr_req.opnum) {
876 case NDR_LSA_LOOKUPSIDS3:
877 check_policy = false;
879 case NDR_LSA_LOOKUPSIDS2:
884 if ((r->in.level < 1) || (r->in.level > 6)) {
885 return NT_STATUS_INVALID_PARAMETER;
889 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle)) {
890 return NT_STATUS_INVALID_HANDLE;
893 /* check if the user has enough rights */
894 if (!(handle->access & LSA_POLICY_LOOKUP_NAMES)) {
895 return NT_STATUS_ACCESS_DENIED;
899 if (num_sids > MAX_LOOKUP_SIDS) {
900 DEBUG(5,("_lsa_LookupSids2: limit of %d exceeded, requested %d\n",
901 MAX_LOOKUP_SIDS, num_sids));
902 return NT_STATUS_NONE_MAPPED;
905 status = _lsa_lookup_sids_internal(p,
914 *r->out.domains = domains;
915 r->out.names->count = num_sids;
916 r->out.names->names = names;
917 *r->out.count = mapped_count;
922 /***************************************************************************
924 ***************************************************************************/
926 NTSTATUS _lsa_LookupSids3(pipes_struct *p,
927 struct lsa_LookupSids3 *r)
929 struct lsa_LookupSids2 q;
931 /* No policy handle on this call. Restrict to crypto connections. */
932 if (p->auth.auth_type != PIPE_AUTH_TYPE_SCHANNEL) {
933 DEBUG(0,("_lsa_LookupSids3: client %s not using schannel for netlogon\n",
934 get_remote_machine_name() ));
935 return NT_STATUS_INVALID_PARAMETER;
939 q.in.sids = r->in.sids;
940 q.in.level = r->in.level;
941 q.in.unknown1 = r->in.unknown1;
942 q.in.unknown2 = r->in.unknown2;
943 q.in.names = r->in.names;
944 q.in.count = r->in.count;
946 q.out.domains = r->out.domains;
947 q.out.names = r->out.names;
948 q.out.count = r->out.count;
950 return _lsa_LookupSids2(p, &q);
953 /***************************************************************************
954 ***************************************************************************/
956 static int lsa_lookup_level_to_flags(uint16 level)
962 flags = LOOKUP_NAME_ALL;
965 flags = LOOKUP_NAME_DOMAIN|LOOKUP_NAME_REMOTE|LOOKUP_NAME_ISOLATED;
968 flags = LOOKUP_NAME_DOMAIN|LOOKUP_NAME_ISOLATED;
974 flags = LOOKUP_NAME_NONE;
981 /***************************************************************************
983 ***************************************************************************/
985 NTSTATUS _lsa_LookupNames(pipes_struct *p,
986 struct lsa_LookupNames *r)
988 NTSTATUS status = NT_STATUS_NONE_MAPPED;
989 struct lsa_info *handle;
990 struct lsa_String *names = r->in.names;
991 uint32 num_entries = r->in.num_names;
992 struct lsa_RefDomainList *domains = NULL;
993 struct lsa_TranslatedSid *rids = NULL;
994 uint32 mapped_count = 0;
997 if (num_entries > MAX_LOOKUP_SIDS) {
998 num_entries = MAX_LOOKUP_SIDS;
999 DEBUG(5,("_lsa_LookupNames: truncating name lookup list to %d\n",
1003 flags = lsa_lookup_level_to_flags(r->in.level);
1005 domains = TALLOC_ZERO_P(p->mem_ctx, struct lsa_RefDomainList);
1007 return NT_STATUS_NO_MEMORY;
1011 rids = TALLOC_ZERO_ARRAY(p->mem_ctx, struct lsa_TranslatedSid,
1014 return NT_STATUS_NO_MEMORY;
1020 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle)) {
1021 status = NT_STATUS_INVALID_HANDLE;
1025 /* check if the user has enough rights */
1026 if (!(handle->access & LSA_POLICY_LOOKUP_NAMES)) {
1027 status = NT_STATUS_ACCESS_DENIED;
1031 /* set up the LSA Lookup RIDs response */
1032 become_root(); /* lookup_name can require root privs */
1033 status = lookup_lsa_rids(p->mem_ctx, domains, rids, num_entries,
1034 names, flags, &mapped_count);
1039 if (NT_STATUS_IS_OK(status) && (num_entries != 0) ) {
1040 if (mapped_count == 0) {
1041 status = NT_STATUS_NONE_MAPPED;
1042 } else if (mapped_count != num_entries) {
1043 status = STATUS_SOME_UNMAPPED;
1047 *r->out.count = mapped_count;
1048 *r->out.domains = domains;
1049 r->out.sids->sids = rids;
1050 r->out.sids->count = num_entries;
1055 /***************************************************************************
1057 ***************************************************************************/
1059 NTSTATUS _lsa_LookupNames2(pipes_struct *p,
1060 struct lsa_LookupNames2 *r)
1063 struct lsa_LookupNames q;
1064 struct lsa_TransSidArray2 *sid_array2 = r->in.sids;
1065 struct lsa_TransSidArray *sid_array = NULL;
1068 sid_array = TALLOC_ZERO_P(p->mem_ctx, struct lsa_TransSidArray);
1070 return NT_STATUS_NO_MEMORY;
1073 q.in.handle = r->in.handle;
1074 q.in.num_names = r->in.num_names;
1075 q.in.names = r->in.names;
1076 q.in.level = r->in.level;
1077 q.in.sids = sid_array;
1078 q.in.count = r->in.count;
1079 /* we do not know what this is for */
1080 /* = r->in.unknown1; */
1081 /* = r->in.unknown2; */
1083 q.out.domains = r->out.domains;
1084 q.out.sids = sid_array;
1085 q.out.count = r->out.count;
1087 status = _lsa_LookupNames(p, &q);
1089 sid_array2->sids = TALLOC_ARRAY(p->mem_ctx, struct lsa_TranslatedSid2, sid_array->count);
1090 if (!sid_array2->sids) {
1091 return NT_STATUS_NO_MEMORY;
1094 for (i=0; i<sid_array->count; i++) {
1095 sid_array2->sids[i].sid_type = sid_array->sids[i].sid_type;
1096 sid_array2->sids[i].rid = sid_array->sids[i].rid;
1097 sid_array2->sids[i].sid_index = sid_array->sids[i].sid_index;
1098 sid_array2->sids[i].unknown = 0;
1101 r->out.sids = sid_array2;
1106 /***************************************************************************
1108 ***************************************************************************/
1110 NTSTATUS _lsa_LookupNames3(pipes_struct *p,
1111 struct lsa_LookupNames3 *r)
1114 struct lsa_info *handle;
1115 struct lsa_String *names = r->in.names;
1116 uint32 num_entries = r->in.num_names;
1117 struct lsa_RefDomainList *domains = NULL;
1118 struct lsa_TranslatedSid3 *trans_sids = NULL;
1119 uint32 mapped_count = 0;
1121 bool check_policy = true;
1123 switch (p->hdr_req.opnum) {
1124 case NDR_LSA_LOOKUPNAMES4:
1125 check_policy = false;
1127 case NDR_LSA_LOOKUPNAMES3:
1129 check_policy = true;
1132 if (num_entries > MAX_LOOKUP_SIDS) {
1133 num_entries = MAX_LOOKUP_SIDS;
1134 DEBUG(5,("_lsa_LookupNames3: truncating name lookup list to %d\n", num_entries));
1137 /* Probably the lookup_level is some sort of bitmask. */
1138 if (r->in.level == 1) {
1139 flags = LOOKUP_NAME_ALL;
1142 domains = TALLOC_ZERO_P(p->mem_ctx, struct lsa_RefDomainList);
1144 return NT_STATUS_NO_MEMORY;
1148 trans_sids = TALLOC_ZERO_ARRAY(p->mem_ctx, struct lsa_TranslatedSid3,
1151 return NT_STATUS_NO_MEMORY;
1159 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle)) {
1160 status = NT_STATUS_INVALID_HANDLE;
1164 /* check if the user has enough rights */
1165 if (!(handle->access & LSA_POLICY_LOOKUP_NAMES)) {
1166 status = NT_STATUS_ACCESS_DENIED;
1171 /* set up the LSA Lookup SIDs response */
1172 become_root(); /* lookup_name can require root privs */
1173 status = lookup_lsa_sids(p->mem_ctx, domains, trans_sids, num_entries,
1174 names, flags, &mapped_count);
1179 if (NT_STATUS_IS_OK(status)) {
1180 if (mapped_count == 0) {
1181 status = NT_STATUS_NONE_MAPPED;
1182 } else if (mapped_count != num_entries) {
1183 status = STATUS_SOME_UNMAPPED;
1187 *r->out.count = mapped_count;
1188 *r->out.domains = domains;
1189 r->out.sids->sids = trans_sids;
1190 r->out.sids->count = num_entries;
1195 /***************************************************************************
1197 ***************************************************************************/
1199 NTSTATUS _lsa_LookupNames4(pipes_struct *p,
1200 struct lsa_LookupNames4 *r)
1202 struct lsa_LookupNames3 q;
1204 /* No policy handle on this call. Restrict to crypto connections. */
1205 if (p->auth.auth_type != PIPE_AUTH_TYPE_SCHANNEL) {
1206 DEBUG(0,("_lsa_lookup_names4: client %s not using schannel for netlogon\n",
1207 get_remote_machine_name() ));
1208 return NT_STATUS_INVALID_PARAMETER;
1212 q.in.num_names = r->in.num_names;
1213 q.in.names = r->in.names;
1214 q.in.level = r->in.level;
1215 q.in.lookup_options = r->in.lookup_options;
1216 q.in.client_revision = r->in.client_revision;
1217 q.in.sids = r->in.sids;
1218 q.in.count = r->in.count;
1220 q.out.domains = r->out.domains;
1221 q.out.sids = r->out.sids;
1222 q.out.count = r->out.count;
1224 return _lsa_LookupNames3(p, &q);
1227 /***************************************************************************
1228 _lsa_close. Also weird - needs to check if lsa handle is correct. JRA.
1229 ***************************************************************************/
1231 NTSTATUS _lsa_Close(pipes_struct *p, struct lsa_Close *r)
1233 if (!find_policy_by_hnd(p, r->in.handle, NULL)) {
1234 return NT_STATUS_INVALID_HANDLE;
1237 close_policy_hnd(p, r->in.handle);
1238 ZERO_STRUCTP(r->out.handle);
1239 return NT_STATUS_OK;
1242 /***************************************************************************
1243 ***************************************************************************/
1245 NTSTATUS _lsa_OpenSecret(pipes_struct *p, struct lsa_OpenSecret *r)
1247 return NT_STATUS_OBJECT_NAME_NOT_FOUND;
1250 /***************************************************************************
1251 ***************************************************************************/
1253 NTSTATUS _lsa_OpenTrustedDomain(pipes_struct *p, struct lsa_OpenTrustedDomain *r)
1255 return NT_STATUS_OBJECT_NAME_NOT_FOUND;
1258 /***************************************************************************
1259 ***************************************************************************/
1261 NTSTATUS _lsa_CreateTrustedDomain(pipes_struct *p, struct lsa_CreateTrustedDomain *r)
1263 return NT_STATUS_ACCESS_DENIED;
1266 /***************************************************************************
1267 ***************************************************************************/
1269 NTSTATUS _lsa_CreateSecret(pipes_struct *p, struct lsa_CreateSecret *r)
1271 return NT_STATUS_ACCESS_DENIED;
1274 /***************************************************************************
1275 ***************************************************************************/
1277 NTSTATUS _lsa_SetSecret(pipes_struct *p, struct lsa_SetSecret *r)
1279 return NT_STATUS_ACCESS_DENIED;
1282 /***************************************************************************
1284 ***************************************************************************/
1286 NTSTATUS _lsa_DeleteObject(pipes_struct *p,
1287 struct lsa_DeleteObject *r)
1289 return NT_STATUS_ACCESS_DENIED;
1292 /***************************************************************************
1294 ***************************************************************************/
1296 NTSTATUS _lsa_EnumPrivs(pipes_struct *p,
1297 struct lsa_EnumPrivs *r)
1299 struct lsa_info *handle;
1301 uint32 enum_context = *r->in.resume_handle;
1302 int num_privs = count_all_privileges();
1303 struct lsa_PrivEntry *entries = NULL;
1306 /* remember that the enum_context starts at 0 and not 1 */
1308 if ( enum_context >= num_privs )
1309 return NT_STATUS_NO_MORE_ENTRIES;
1311 DEBUG(10,("_lsa_EnumPrivs: enum_context:%d total entries:%d\n",
1312 enum_context, num_privs));
1314 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle))
1315 return NT_STATUS_INVALID_HANDLE;
1317 /* check if the user has enough rights
1318 I don't know if it's the right one. not documented. */
1320 if (!(handle->access & LSA_POLICY_VIEW_LOCAL_INFORMATION))
1321 return NT_STATUS_ACCESS_DENIED;
1324 entries = TALLOC_ZERO_ARRAY(p->mem_ctx, struct lsa_PrivEntry, num_privs);
1326 return NT_STATUS_NO_MEMORY;
1332 for (i = 0; i < num_privs; i++) {
1333 if( i < enum_context) {
1335 init_lsa_StringLarge(&entries[i].name, NULL);
1337 entries[i].luid.low = 0;
1338 entries[i].luid.high = 0;
1341 init_lsa_StringLarge(&entries[i].name, privs[i].name);
1343 luid = get_privilege_luid( &privs[i].se_priv );
1345 entries[i].luid.low = luid.luid.low;
1346 entries[i].luid.high = luid.luid.high;
1350 enum_context = num_privs;
1352 *r->out.resume_handle = enum_context;
1353 r->out.privs->count = num_privs;
1354 r->out.privs->privs = entries;
1356 return NT_STATUS_OK;
1359 /***************************************************************************
1360 _lsa_LookupPrivDisplayName
1361 ***************************************************************************/
1363 NTSTATUS _lsa_LookupPrivDisplayName(pipes_struct *p,
1364 struct lsa_LookupPrivDisplayName *r)
1366 struct lsa_info *handle;
1367 const char *description;
1368 struct lsa_StringLarge *lsa_name;
1370 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle))
1371 return NT_STATUS_INVALID_HANDLE;
1373 /* check if the user has enough rights */
1376 * I don't know if it's the right one. not documented.
1378 if (!(handle->access & LSA_POLICY_VIEW_LOCAL_INFORMATION))
1379 return NT_STATUS_ACCESS_DENIED;
1381 DEBUG(10,("_lsa_LookupPrivDisplayName: name = %s\n", r->in.name->string));
1383 description = get_privilege_dispname(r->in.name->string);
1385 DEBUG(10,("_lsa_LookupPrivDisplayName: doesn't exist\n"));
1386 return NT_STATUS_NO_SUCH_PRIVILEGE;
1389 DEBUG(10,("_lsa_LookupPrivDisplayName: display name = %s\n", description));
1391 lsa_name = TALLOC_ZERO_P(p->mem_ctx, struct lsa_StringLarge);
1393 return NT_STATUS_NO_MEMORY;
1396 init_lsa_StringLarge(lsa_name, description);
1398 *r->out.returned_language_id = r->in.language_id;
1399 *r->out.disp_name = lsa_name;
1401 return NT_STATUS_OK;
1404 /***************************************************************************
1406 ***************************************************************************/
1408 NTSTATUS _lsa_EnumAccounts(pipes_struct *p,
1409 struct lsa_EnumAccounts *r)
1411 struct lsa_info *handle;
1413 int i, j, num_entries;
1415 struct lsa_SidPtr *sids = NULL;
1417 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle))
1418 return NT_STATUS_INVALID_HANDLE;
1420 if (!(handle->access & LSA_POLICY_VIEW_LOCAL_INFORMATION))
1421 return NT_STATUS_ACCESS_DENIED;
1426 /* The only way we can currently find out all the SIDs that have been
1427 privileged is to scan all privileges */
1429 status = privilege_enumerate_accounts(&sid_list, &num_entries);
1430 if (!NT_STATUS_IS_OK(status)) {
1434 if (*r->in.resume_handle >= num_entries) {
1435 return NT_STATUS_NO_MORE_ENTRIES;
1438 if (num_entries - *r->in.resume_handle) {
1439 sids = TALLOC_ZERO_ARRAY(p->mem_ctx, struct lsa_SidPtr,
1440 num_entries - *r->in.resume_handle);
1442 SAFE_FREE(sid_list);
1443 return NT_STATUS_NO_MEMORY;
1446 for (i = *r->in.resume_handle, j = 0; i < num_entries; i++, j++) {
1447 sids[j].sid = sid_dup_talloc(p->mem_ctx, &sid_list[i]);
1449 SAFE_FREE(sid_list);
1450 return NT_STATUS_NO_MEMORY;
1455 talloc_free(sid_list);
1457 *r->out.resume_handle = num_entries;
1458 r->out.sids->num_sids = num_entries;
1459 r->out.sids->sids = sids;
1461 return NT_STATUS_OK;
1464 /***************************************************************************
1466 ***************************************************************************/
1468 NTSTATUS _lsa_GetUserName(pipes_struct *p,
1469 struct lsa_GetUserName *r)
1471 const char *username, *domname;
1472 struct lsa_String *account_name = NULL;
1473 struct lsa_String *authority_name = NULL;
1475 if (r->in.account_name &&
1476 *r->in.account_name) {
1477 return NT_STATUS_INVALID_PARAMETER;
1480 if (r->in.authority_name &&
1481 *r->in.authority_name) {
1482 return NT_STATUS_INVALID_PARAMETER;
1485 if (p->server_info->guest) {
1487 * I'm 99% sure this is not the right place to do this,
1488 * global_sid_Anonymous should probably be put into the token
1489 * instead of the guest id -- vl
1491 if (!lookup_sid(p->mem_ctx, &global_sid_Anonymous,
1492 &domname, &username, NULL)) {
1493 return NT_STATUS_NO_MEMORY;
1496 username = p->server_info->sanitized_username;
1497 domname = pdb_get_domain(p->server_info->sam_account);
1500 account_name = TALLOC_P(p->mem_ctx, struct lsa_String);
1501 if (!account_name) {
1502 return NT_STATUS_NO_MEMORY;
1504 init_lsa_String(account_name, username);
1506 if (r->out.authority_name) {
1507 authority_name = TALLOC_P(p->mem_ctx, struct lsa_String);
1508 if (!authority_name) {
1509 return NT_STATUS_NO_MEMORY;
1511 init_lsa_String(authority_name, domname);
1514 *r->out.account_name = account_name;
1515 if (r->out.authority_name) {
1516 *r->out.authority_name = authority_name;
1519 return NT_STATUS_OK;
1522 /***************************************************************************
1524 ***************************************************************************/
1526 NTSTATUS _lsa_CreateAccount(pipes_struct *p,
1527 struct lsa_CreateAccount *r)
1529 struct lsa_info *handle;
1530 struct lsa_info *info;
1532 /* find the connection policy handle. */
1533 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle))
1534 return NT_STATUS_INVALID_HANDLE;
1536 /* check if the user has enough rights */
1539 * I don't know if it's the right one. not documented.
1540 * but guessed with rpcclient.
1542 if (!(handle->access & LSA_POLICY_GET_PRIVATE_INFORMATION))
1543 return NT_STATUS_ACCESS_DENIED;
1545 /* check to see if the pipe_user is a Domain Admin since
1546 account_pol.tdb was already opened as root, this is all we have */
1548 if ( p->server_info->utok.uid != sec_initial_uid()
1549 && !nt_token_check_domain_rid( p->server_info->ptok,
1550 DOMAIN_GROUP_RID_ADMINS ) )
1551 return NT_STATUS_ACCESS_DENIED;
1553 if ( is_privileged_sid( r->in.sid ) )
1554 return NT_STATUS_OBJECT_NAME_COLLISION;
1556 /* associate the user/group SID with the (unique) handle. */
1558 info = TALLOC_ZERO_P(NULL, struct lsa_info);
1560 return NT_STATUS_NO_MEMORY;
1563 info->sid = *r->in.sid;
1564 info->access = r->in.access_mask;
1566 /* get a (unique) handle. open a policy on it. */
1567 if (!create_policy_hnd(p, r->out.acct_handle, free_lsa_info, (void *)info))
1568 return NT_STATUS_OBJECT_NAME_NOT_FOUND;
1570 return privilege_create_account( &info->sid );
1574 /***************************************************************************
1576 ***************************************************************************/
1578 NTSTATUS _lsa_OpenAccount(pipes_struct *p,
1579 struct lsa_OpenAccount *r)
1581 struct lsa_info *handle;
1582 struct lsa_info *info;
1584 /* find the connection policy handle. */
1585 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle))
1586 return NT_STATUS_INVALID_HANDLE;
1588 /* check if the user has enough rights */
1591 * I don't know if it's the right one. not documented.
1592 * but guessed with rpcclient.
1594 if (!(handle->access & LSA_POLICY_GET_PRIVATE_INFORMATION))
1595 return NT_STATUS_ACCESS_DENIED;
1597 /* TODO: Fis the parsing routine before reenabling this check! */
1599 if (!lookup_sid(&handle->sid, dom_name, name, &type))
1600 return NT_STATUS_ACCESS_DENIED;
1602 /* associate the user/group SID with the (unique) handle. */
1603 info = TALLOC_ZERO_P(NULL, struct lsa_info);
1605 return NT_STATUS_NO_MEMORY;
1608 info->sid = *r->in.sid;
1609 info->access = r->in.access_mask;
1611 /* get a (unique) handle. open a policy on it. */
1612 if (!create_policy_hnd(p, r->out.acct_handle, free_lsa_info, (void *)info))
1613 return NT_STATUS_OBJECT_NAME_NOT_FOUND;
1615 return NT_STATUS_OK;
1618 /***************************************************************************
1619 _lsa_EnumPrivsAccount
1620 For a given SID, enumerate all the privilege this account has.
1621 ***************************************************************************/
1623 NTSTATUS _lsa_EnumPrivsAccount(pipes_struct *p,
1624 struct lsa_EnumPrivsAccount *r)
1626 NTSTATUS status = NT_STATUS_OK;
1627 struct lsa_info *info=NULL;
1629 PRIVILEGE_SET privileges;
1630 struct lsa_PrivilegeSet *priv_set = NULL;
1631 struct lsa_LUIDAttribute *luid_attrs = NULL;
1634 /* find the connection policy handle. */
1635 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
1636 return NT_STATUS_INVALID_HANDLE;
1638 if (!(info->access & LSA_POLICY_VIEW_LOCAL_INFORMATION))
1639 return NT_STATUS_ACCESS_DENIED;
1641 if ( !get_privileges_for_sids( &mask, &info->sid, 1 ) )
1642 return NT_STATUS_OBJECT_NAME_NOT_FOUND;
1644 privilege_set_init( &privileges );
1646 if ( se_priv_to_privilege_set( &privileges, &mask ) ) {
1648 DEBUG(10,("_lsa_EnumPrivsAccount: %s has %d privileges\n",
1649 sid_string_dbg(&info->sid),
1652 priv_set = TALLOC_ZERO_P(p->mem_ctx, struct lsa_PrivilegeSet);
1654 status = NT_STATUS_NO_MEMORY;
1658 luid_attrs = TALLOC_ZERO_ARRAY(p->mem_ctx,
1659 struct lsa_LUIDAttribute,
1662 status = NT_STATUS_NO_MEMORY;
1666 for (i=0; i<privileges.count; i++) {
1667 luid_attrs[i].luid.low = privileges.set[i].luid.low;
1668 luid_attrs[i].luid.high = privileges.set[i].luid.high;
1669 luid_attrs[i].attribute = privileges.set[i].attr;
1672 priv_set->count = privileges.count;
1673 priv_set->unknown = 0;
1674 priv_set->set = luid_attrs;
1676 *r->out.privs = priv_set;
1678 status = NT_STATUS_NO_SUCH_PRIVILEGE;
1682 privilege_set_free( &privileges );
1687 /***************************************************************************
1688 _lsa_GetSystemAccessAccount
1689 ***************************************************************************/
1691 NTSTATUS _lsa_GetSystemAccessAccount(pipes_struct *p,
1692 struct lsa_GetSystemAccessAccount *r)
1694 struct lsa_info *info=NULL;
1696 /* find the connection policy handle. */
1698 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
1699 return NT_STATUS_INVALID_HANDLE;
1701 if (!(info->access & LSA_POLICY_VIEW_LOCAL_INFORMATION))
1702 return NT_STATUS_ACCESS_DENIED;
1704 if (!lookup_sid(p->mem_ctx, &info->sid, NULL, NULL, NULL))
1705 return NT_STATUS_ACCESS_DENIED;
1708 0x01 -> Log on locally
1709 0x02 -> Access this computer from network
1710 0x04 -> Log on as a batch job
1711 0x10 -> Log on as a service
1713 they can be ORed together
1716 *r->out.access_mask = PR_LOG_ON_LOCALLY | PR_ACCESS_FROM_NETWORK;
1718 return NT_STATUS_OK;
1721 /***************************************************************************
1722 update the systemaccount information
1723 ***************************************************************************/
1725 NTSTATUS _lsa_SetSystemAccessAccount(pipes_struct *p,
1726 struct lsa_SetSystemAccessAccount *r)
1728 struct lsa_info *info=NULL;
1731 /* find the connection policy handle. */
1732 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
1733 return NT_STATUS_INVALID_HANDLE;
1735 /* check to see if the pipe_user is a Domain Admin since
1736 account_pol.tdb was already opened as root, this is all we have */
1738 if ( p->server_info->utok.uid != sec_initial_uid()
1739 && !nt_token_check_domain_rid( p->server_info->ptok,
1740 DOMAIN_GROUP_RID_ADMINS ) )
1741 return NT_STATUS_ACCESS_DENIED;
1743 if (!pdb_getgrsid(&map, info->sid))
1744 return NT_STATUS_NO_SUCH_GROUP;
1746 return pdb_update_group_mapping_entry(&map);
1749 /***************************************************************************
1750 _lsa_AddPrivilegesToAccount
1751 For a given SID, add some privileges.
1752 ***************************************************************************/
1754 NTSTATUS _lsa_AddPrivilegesToAccount(pipes_struct *p,
1755 struct lsa_AddPrivilegesToAccount *r)
1757 struct lsa_info *info = NULL;
1759 struct lsa_PrivilegeSet *set = NULL;
1761 /* find the connection policy handle. */
1762 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
1763 return NT_STATUS_INVALID_HANDLE;
1765 /* check to see if the pipe_user is root or a Domain Admin since
1766 account_pol.tdb was already opened as root, this is all we have */
1768 if ( p->server_info->utok.uid != sec_initial_uid()
1769 && !nt_token_check_domain_rid( p->server_info->ptok,
1770 DOMAIN_GROUP_RID_ADMINS ) )
1772 return NT_STATUS_ACCESS_DENIED;
1776 if ( !privilege_set_to_se_priv( &mask, set ) )
1777 return NT_STATUS_NO_SUCH_PRIVILEGE;
1779 if ( !grant_privilege( &info->sid, &mask ) ) {
1780 DEBUG(3,("_lsa_AddPrivilegesToAccount: grant_privilege(%s) failed!\n",
1781 sid_string_dbg(&info->sid) ));
1782 DEBUG(3,("Privilege mask:\n"));
1783 dump_se_priv( DBGC_ALL, 3, &mask );
1784 return NT_STATUS_NO_SUCH_PRIVILEGE;
1787 return NT_STATUS_OK;
1790 /***************************************************************************
1791 _lsa_RemovePrivilegesFromAccount
1792 For a given SID, remove some privileges.
1793 ***************************************************************************/
1795 NTSTATUS _lsa_RemovePrivilegesFromAccount(pipes_struct *p,
1796 struct lsa_RemovePrivilegesFromAccount *r)
1798 struct lsa_info *info = NULL;
1800 struct lsa_PrivilegeSet *set = NULL;
1802 /* find the connection policy handle. */
1803 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
1804 return NT_STATUS_INVALID_HANDLE;
1806 /* check to see if the pipe_user is root or a Domain Admin since
1807 account_pol.tdb was already opened as root, this is all we have */
1809 if ( p->server_info->utok.uid != sec_initial_uid()
1810 && !nt_token_check_domain_rid( p->server_info->ptok,
1811 DOMAIN_GROUP_RID_ADMINS ) )
1813 return NT_STATUS_ACCESS_DENIED;
1818 if ( !privilege_set_to_se_priv( &mask, set ) )
1819 return NT_STATUS_NO_SUCH_PRIVILEGE;
1821 if ( !revoke_privilege( &info->sid, &mask ) ) {
1822 DEBUG(3,("_lsa_RemovePrivilegesFromAccount: revoke_privilege(%s) failed!\n",
1823 sid_string_dbg(&info->sid) ));
1824 DEBUG(3,("Privilege mask:\n"));
1825 dump_se_priv( DBGC_ALL, 3, &mask );
1826 return NT_STATUS_NO_SUCH_PRIVILEGE;
1829 return NT_STATUS_OK;
1832 /***************************************************************************
1834 ***************************************************************************/
1836 NTSTATUS _lsa_QuerySecurity(pipes_struct *p,
1837 struct lsa_QuerySecurity *r)
1839 struct lsa_info *handle=NULL;
1840 SEC_DESC *psd = NULL;
1844 /* find the connection policy handle. */
1845 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle))
1846 return NT_STATUS_INVALID_HANDLE;
1848 /* check if the user has enough rights */
1849 if (!(handle->access & LSA_POLICY_VIEW_LOCAL_INFORMATION))
1850 return NT_STATUS_ACCESS_DENIED;
1852 switch (r->in.sec_info) {
1854 /* SD contains only the owner */
1856 status=lsa_get_generic_sd(p->mem_ctx, &psd, &sd_size);
1857 if(!NT_STATUS_IS_OK(status))
1858 return NT_STATUS_NO_MEMORY;
1861 if((*r->out.sdbuf = make_sec_desc_buf(p->mem_ctx, sd_size, psd)) == NULL)
1862 return NT_STATUS_NO_MEMORY;
1865 /* SD contains only the ACL */
1867 status=lsa_get_generic_sd(p->mem_ctx, &psd, &sd_size);
1868 if(!NT_STATUS_IS_OK(status))
1869 return NT_STATUS_NO_MEMORY;
1871 if((*r->out.sdbuf = make_sec_desc_buf(p->mem_ctx, sd_size, psd)) == NULL)
1872 return NT_STATUS_NO_MEMORY;
1875 return NT_STATUS_INVALID_LEVEL;
1881 #if 0 /* AD DC work in ongoing in Samba 4 */
1883 /***************************************************************************
1884 ***************************************************************************/
1886 NTSTATUS _lsa_query_info2(pipes_struct *p, LSA_Q_QUERY_INFO2 *q_u, LSA_R_QUERY_INFO2 *r_u)
1888 struct lsa_info *handle;
1889 const char *nb_name;
1890 char *dns_name = NULL;
1891 char *forest_name = NULL;
1892 DOM_SID *sid = NULL;
1897 r_u->status = NT_STATUS_OK;
1899 if (!find_policy_by_hnd(p, &q_u->pol, (void **)(void *)&handle))
1900 return NT_STATUS_INVALID_HANDLE;
1902 switch (q_u->info_class) {
1904 /* check if the user has enough rights */
1905 if (!(handle->access & LSA_POLICY_VIEW_LOCAL_INFORMATION))
1906 return NT_STATUS_ACCESS_DENIED;
1908 /* Request PolicyPrimaryDomainInformation. */
1909 switch (lp_server_role()) {
1910 case ROLE_DOMAIN_PDC:
1911 case ROLE_DOMAIN_BDC:
1912 nb_name = get_global_sam_name();
1913 /* ugly temp hack for these next two */
1915 /* This should be a 'netbios domain -> DNS domain' mapping */
1916 dnsdomname = get_mydnsdomname(p->mem_ctx);
1917 if (!dnsdomname || !*dnsdomname) {
1918 return NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
1920 strlower_m(dnsdomname);
1922 dns_name = dnsdomname;
1923 forest_name = dnsdomname;
1925 sid = get_global_sam_sid();
1926 secrets_fetch_domain_guid(lp_workgroup(), &guid);
1929 return NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
1931 init_dns_dom_info(&r_u->info.dns_dom_info, nb_name, dns_name,
1932 forest_name,&guid,sid);
1935 DEBUG(0,("_lsa_query_info2: unknown info level in Lsa Query: %d\n", q_u->info_class));
1936 r_u->status = NT_STATUS_INVALID_INFO_CLASS;
1940 if (NT_STATUS_IS_OK(r_u->status)) {
1942 r_u->info_class = q_u->info_class;
1947 #endif /* AD DC work in ongoing in Samba 4 */
1949 /***************************************************************************
1950 _lsa_AddAccountRights
1951 ***************************************************************************/
1953 NTSTATUS _lsa_AddAccountRights(pipes_struct *p,
1954 struct lsa_AddAccountRights *r)
1956 struct lsa_info *info = NULL;
1960 /* find the connection policy handle. */
1961 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
1962 return NT_STATUS_INVALID_HANDLE;
1964 /* check to see if the pipe_user is a Domain Admin since
1965 account_pol.tdb was already opened as root, this is all we have */
1967 if ( p->server_info->utok.uid != sec_initial_uid()
1968 && !nt_token_check_domain_rid( p->server_info->ptok,
1969 DOMAIN_GROUP_RID_ADMINS ) )
1971 return NT_STATUS_ACCESS_DENIED;
1974 /* according to an NT4 PDC, you can add privileges to SIDs even without
1975 call_lsa_create_account() first. And you can use any arbitrary SID. */
1977 sid_copy( &sid, r->in.sid );
1979 for ( i=0; i < r->in.rights->count; i++ ) {
1981 const char *privname = r->in.rights->names[i].string;
1983 /* only try to add non-null strings */
1988 if ( !grant_privilege_by_name( &sid, privname ) ) {
1989 DEBUG(2,("_lsa_AddAccountRights: Failed to add privilege [%s]\n",
1991 return NT_STATUS_NO_SUCH_PRIVILEGE;
1995 return NT_STATUS_OK;
1998 /***************************************************************************
1999 _lsa_RemoveAccountRights
2000 ***************************************************************************/
2002 NTSTATUS _lsa_RemoveAccountRights(pipes_struct *p,
2003 struct lsa_RemoveAccountRights *r)
2005 struct lsa_info *info = NULL;
2008 const char *privname = NULL;
2010 /* find the connection policy handle. */
2011 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
2012 return NT_STATUS_INVALID_HANDLE;
2014 /* check to see if the pipe_user is a Domain Admin since
2015 account_pol.tdb was already opened as root, this is all we have */
2017 if ( p->server_info->utok.uid != sec_initial_uid()
2018 && !nt_token_check_domain_rid( p->server_info->ptok,
2019 DOMAIN_GROUP_RID_ADMINS ) )
2021 return NT_STATUS_ACCESS_DENIED;
2024 sid_copy( &sid, r->in.sid );
2026 if ( r->in.remove_all ) {
2027 if ( !revoke_all_privileges( &sid ) )
2028 return NT_STATUS_ACCESS_DENIED;
2030 return NT_STATUS_OK;
2033 for ( i=0; i < r->in.rights->count; i++ ) {
2035 privname = r->in.rights->names[i].string;
2037 /* only try to add non-null strings */
2042 if ( !revoke_privilege_by_name( &sid, privname ) ) {
2043 DEBUG(2,("_lsa_RemoveAccountRights: Failed to revoke privilege [%s]\n",
2045 return NT_STATUS_NO_SUCH_PRIVILEGE;
2049 return NT_STATUS_OK;
2052 /*******************************************************************
2053 ********************************************************************/
2055 static NTSTATUS init_lsa_right_set(TALLOC_CTX *mem_ctx,
2056 struct lsa_RightSet *r,
2057 PRIVILEGE_SET *privileges)
2060 const char *privname;
2061 const char **privname_array = NULL;
2064 for (i=0; i<privileges->count; i++) {
2066 privname = luid_to_privilege_name(&privileges->set[i].luid);
2068 if (!add_string_to_array(mem_ctx, privname,
2069 &privname_array, &num_priv)) {
2070 return NT_STATUS_NO_MEMORY;
2077 r->names = TALLOC_ZERO_ARRAY(mem_ctx, struct lsa_StringLarge,
2080 return NT_STATUS_NO_MEMORY;
2083 for (i=0; i<num_priv; i++) {
2084 init_lsa_StringLarge(&r->names[i], privname_array[i]);
2087 r->count = num_priv;
2090 return NT_STATUS_OK;
2093 /***************************************************************************
2094 _lsa_EnumAccountRights
2095 ***************************************************************************/
2097 NTSTATUS _lsa_EnumAccountRights(pipes_struct *p,
2098 struct lsa_EnumAccountRights *r)
2101 struct lsa_info *info = NULL;
2103 PRIVILEGE_SET privileges;
2106 /* find the connection policy handle. */
2108 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
2109 return NT_STATUS_INVALID_HANDLE;
2111 if (!(info->access & LSA_POLICY_VIEW_LOCAL_INFORMATION))
2112 return NT_STATUS_ACCESS_DENIED;
2114 /* according to an NT4 PDC, you can add privileges to SIDs even without
2115 call_lsa_create_account() first. And you can use any arbitrary SID. */
2117 sid_copy( &sid, r->in.sid );
2119 if ( !get_privileges_for_sids( &mask, &sid, 1 ) )
2120 return NT_STATUS_OBJECT_NAME_NOT_FOUND;
2122 privilege_set_init( &privileges );
2124 if ( se_priv_to_privilege_set( &privileges, &mask ) ) {
2126 DEBUG(10,("_lsa_EnumAccountRights: %s has %d privileges\n",
2127 sid_string_dbg(&sid), privileges.count));
2129 status = init_lsa_right_set(p->mem_ctx, r->out.rights, &privileges);
2131 status = NT_STATUS_NO_SUCH_PRIVILEGE;
2134 privilege_set_free( &privileges );
2139 /***************************************************************************
2140 _lsa_LookupPrivValue
2141 ***************************************************************************/
2143 NTSTATUS _lsa_LookupPrivValue(pipes_struct *p,
2144 struct lsa_LookupPrivValue *r)
2146 struct lsa_info *info = NULL;
2147 const char *name = NULL;
2148 LUID_ATTR priv_luid;
2151 /* find the connection policy handle. */
2153 if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
2154 return NT_STATUS_INVALID_HANDLE;
2156 if (!(info->access & LSA_POLICY_VIEW_LOCAL_INFORMATION))
2157 return NT_STATUS_ACCESS_DENIED;
2159 name = r->in.name->string;
2161 DEBUG(10,("_lsa_lookup_priv_value: name = %s\n", name));
2163 if ( !se_priv_from_name( name, &mask ) )
2164 return NT_STATUS_NO_SUCH_PRIVILEGE;
2166 priv_luid = get_privilege_luid( &mask );
2168 r->out.luid->low = priv_luid.luid.low;
2169 r->out.luid->high = priv_luid.luid.high;
2171 return NT_STATUS_OK;
2175 * From here on the server routines are just dummy ones to make smbd link with
2176 * librpc/gen_ndr/srv_lsa.c. These routines are actually never called, we are
2177 * pulling the server stubs across one by one.
2180 NTSTATUS _lsa_Delete(pipes_struct *p, struct lsa_Delete *r)
2182 p->rng_fault_state = True;
2183 return NT_STATUS_NOT_IMPLEMENTED;
2186 NTSTATUS _lsa_SetSecObj(pipes_struct *p, struct lsa_SetSecObj *r)
2188 p->rng_fault_state = True;
2189 return NT_STATUS_NOT_IMPLEMENTED;
2192 NTSTATUS _lsa_ChangePassword(pipes_struct *p, struct lsa_ChangePassword *r)
2194 p->rng_fault_state = True;
2195 return NT_STATUS_NOT_IMPLEMENTED;
2198 NTSTATUS _lsa_SetInfoPolicy(pipes_struct *p, struct lsa_SetInfoPolicy *r)
2200 p->rng_fault_state = True;
2201 return NT_STATUS_NOT_IMPLEMENTED;
2204 NTSTATUS _lsa_ClearAuditLog(pipes_struct *p, struct lsa_ClearAuditLog *r)
2206 p->rng_fault_state = True;
2207 return NT_STATUS_NOT_IMPLEMENTED;
2210 NTSTATUS _lsa_GetQuotasForAccount(pipes_struct *p, struct lsa_GetQuotasForAccount *r)
2212 p->rng_fault_state = True;
2213 return NT_STATUS_NOT_IMPLEMENTED;
2216 NTSTATUS _lsa_SetQuotasForAccount(pipes_struct *p, struct lsa_SetQuotasForAccount *r)
2218 p->rng_fault_state = True;
2219 return NT_STATUS_NOT_IMPLEMENTED;
2222 NTSTATUS _lsa_QueryTrustedDomainInfo(pipes_struct *p, struct lsa_QueryTrustedDomainInfo *r)
2224 p->rng_fault_state = True;
2225 return NT_STATUS_NOT_IMPLEMENTED;
2228 NTSTATUS _lsa_SetInformationTrustedDomain(pipes_struct *p, struct lsa_SetInformationTrustedDomain *r)
2230 p->rng_fault_state = True;
2231 return NT_STATUS_NOT_IMPLEMENTED;
2234 NTSTATUS _lsa_QuerySecret(pipes_struct *p, struct lsa_QuerySecret *r)
2236 p->rng_fault_state = True;
2237 return NT_STATUS_NOT_IMPLEMENTED;
2240 NTSTATUS _lsa_LookupPrivName(pipes_struct *p, struct lsa_LookupPrivName *r)
2242 p->rng_fault_state = True;
2243 return NT_STATUS_NOT_IMPLEMENTED;
2246 NTSTATUS _lsa_EnumAccountsWithUserRight(pipes_struct *p, struct lsa_EnumAccountsWithUserRight *r)
2248 p->rng_fault_state = True;
2249 return NT_STATUS_NOT_IMPLEMENTED;
2252 NTSTATUS _lsa_QueryTrustedDomainInfoBySid(pipes_struct *p, struct lsa_QueryTrustedDomainInfoBySid *r)
2254 p->rng_fault_state = True;
2255 return NT_STATUS_NOT_IMPLEMENTED;
2258 NTSTATUS _lsa_SetTrustedDomainInfo(pipes_struct *p, struct lsa_SetTrustedDomainInfo *r)
2260 p->rng_fault_state = True;
2261 return NT_STATUS_NOT_IMPLEMENTED;
2264 NTSTATUS _lsa_DeleteTrustedDomain(pipes_struct *p, struct lsa_DeleteTrustedDomain *r)
2266 p->rng_fault_state = True;
2267 return NT_STATUS_NOT_IMPLEMENTED;
2270 NTSTATUS _lsa_StorePrivateData(pipes_struct *p, struct lsa_StorePrivateData *r)
2272 p->rng_fault_state = True;
2273 return NT_STATUS_NOT_IMPLEMENTED;
2276 NTSTATUS _lsa_RetrievePrivateData(pipes_struct *p, struct lsa_RetrievePrivateData *r)
2278 p->rng_fault_state = True;
2279 return NT_STATUS_NOT_IMPLEMENTED;
2282 NTSTATUS _lsa_QueryInfoPolicy2(pipes_struct *p, struct lsa_QueryInfoPolicy2 *r)
2284 p->rng_fault_state = True;
2285 return NT_STATUS_NOT_IMPLEMENTED;
2288 NTSTATUS _lsa_SetInfoPolicy2(pipes_struct *p, struct lsa_SetInfoPolicy2 *r)
2290 p->rng_fault_state = True;
2291 return NT_STATUS_NOT_IMPLEMENTED;
2294 NTSTATUS _lsa_QueryTrustedDomainInfoByName(pipes_struct *p, struct lsa_QueryTrustedDomainInfoByName *r)
2296 p->rng_fault_state = True;
2297 return NT_STATUS_NOT_IMPLEMENTED;
2300 NTSTATUS _lsa_SetTrustedDomainInfoByName(pipes_struct *p, struct lsa_SetTrustedDomainInfoByName *r)
2302 p->rng_fault_state = True;
2303 return NT_STATUS_NOT_IMPLEMENTED;
2306 NTSTATUS _lsa_EnumTrustedDomainsEx(pipes_struct *p, struct lsa_EnumTrustedDomainsEx *r)
2308 p->rng_fault_state = True;
2309 return NT_STATUS_NOT_IMPLEMENTED;
2312 NTSTATUS _lsa_CreateTrustedDomainEx(pipes_struct *p, struct lsa_CreateTrustedDomainEx *r)
2314 p->rng_fault_state = True;
2315 return NT_STATUS_NOT_IMPLEMENTED;
2318 NTSTATUS _lsa_CloseTrustedDomainEx(pipes_struct *p, struct lsa_CloseTrustedDomainEx *r)
2320 p->rng_fault_state = True;
2321 return NT_STATUS_NOT_IMPLEMENTED;
2324 NTSTATUS _lsa_QueryDomainInformationPolicy(pipes_struct *p, struct lsa_QueryDomainInformationPolicy *r)
2326 p->rng_fault_state = True;
2327 return NT_STATUS_NOT_IMPLEMENTED;
2330 NTSTATUS _lsa_SetDomainInformationPolicy(pipes_struct *p, struct lsa_SetDomainInformationPolicy *r)
2332 p->rng_fault_state = True;
2333 return NT_STATUS_NOT_IMPLEMENTED;
2336 NTSTATUS _lsa_OpenTrustedDomainByName(pipes_struct *p, struct lsa_OpenTrustedDomainByName *r)
2338 p->rng_fault_state = True;
2339 return NT_STATUS_NOT_IMPLEMENTED;
2342 NTSTATUS _lsa_TestCall(pipes_struct *p, struct lsa_TestCall *r)
2344 p->rng_fault_state = True;
2345 return NT_STATUS_NOT_IMPLEMENTED;
2348 NTSTATUS _lsa_CreateTrustedDomainEx2(pipes_struct *p, struct lsa_CreateTrustedDomainEx2 *r)
2350 p->rng_fault_state = True;
2351 return NT_STATUS_NOT_IMPLEMENTED;
2354 NTSTATUS _lsa_CREDRWRITE(pipes_struct *p, struct lsa_CREDRWRITE *r)
2356 p->rng_fault_state = True;
2357 return NT_STATUS_NOT_IMPLEMENTED;
2360 NTSTATUS _lsa_CREDRREAD(pipes_struct *p, struct lsa_CREDRREAD *r)
2362 p->rng_fault_state = True;
2363 return NT_STATUS_NOT_IMPLEMENTED;
2366 NTSTATUS _lsa_CREDRENUMERATE(pipes_struct *p, struct lsa_CREDRENUMERATE *r)
2368 p->rng_fault_state = True;
2369 return NT_STATUS_NOT_IMPLEMENTED;
2372 NTSTATUS _lsa_CREDRWRITEDOMAINCREDENTIALS(pipes_struct *p, struct lsa_CREDRWRITEDOMAINCREDENTIALS *r)
2374 p->rng_fault_state = True;
2375 return NT_STATUS_NOT_IMPLEMENTED;
2378 NTSTATUS _lsa_CREDRREADDOMAINCREDENTIALS(pipes_struct *p, struct lsa_CREDRREADDOMAINCREDENTIALS *r)
2380 p->rng_fault_state = True;
2381 return NT_STATUS_NOT_IMPLEMENTED;
2384 NTSTATUS _lsa_CREDRDELETE(pipes_struct *p, struct lsa_CREDRDELETE *r)
2386 p->rng_fault_state = True;
2387 return NT_STATUS_NOT_IMPLEMENTED;
2390 NTSTATUS _lsa_CREDRGETTARGETINFO(pipes_struct *p, struct lsa_CREDRGETTARGETINFO *r)
2392 p->rng_fault_state = True;
2393 return NT_STATUS_NOT_IMPLEMENTED;
2396 NTSTATUS _lsa_CREDRPROFILELOADED(pipes_struct *p, struct lsa_CREDRPROFILELOADED *r)
2398 p->rng_fault_state = True;
2399 return NT_STATUS_NOT_IMPLEMENTED;
2402 NTSTATUS _lsa_CREDRGETSESSIONTYPES(pipes_struct *p, struct lsa_CREDRGETSESSIONTYPES *r)
2404 p->rng_fault_state = True;
2405 return NT_STATUS_NOT_IMPLEMENTED;
2408 NTSTATUS _lsa_LSARREGISTERAUDITEVENT(pipes_struct *p, struct lsa_LSARREGISTERAUDITEVENT *r)
2410 p->rng_fault_state = True;
2411 return NT_STATUS_NOT_IMPLEMENTED;
2414 NTSTATUS _lsa_LSARGENAUDITEVENT(pipes_struct *p, struct lsa_LSARGENAUDITEVENT *r)
2416 p->rng_fault_state = True;
2417 return NT_STATUS_NOT_IMPLEMENTED;
2420 NTSTATUS _lsa_LSARUNREGISTERAUDITEVENT(pipes_struct *p, struct lsa_LSARUNREGISTERAUDITEVENT *r)
2422 p->rng_fault_state = True;
2423 return NT_STATUS_NOT_IMPLEMENTED;
2426 NTSTATUS _lsa_lsaRQueryForestTrustInformation(pipes_struct *p, struct lsa_lsaRQueryForestTrustInformation *r)
2428 p->rng_fault_state = True;
2429 return NT_STATUS_NOT_IMPLEMENTED;
2432 NTSTATUS _lsa_LSARSETFORESTTRUSTINFORMATION(pipes_struct *p, struct lsa_LSARSETFORESTTRUSTINFORMATION *r)
2434 p->rng_fault_state = True;
2435 return NT_STATUS_NOT_IMPLEMENTED;
2438 NTSTATUS _lsa_CREDRRENAME(pipes_struct *p, struct lsa_CREDRRENAME *r)
2440 p->rng_fault_state = True;
2441 return NT_STATUS_NOT_IMPLEMENTED;
2444 NTSTATUS _lsa_LSAROPENPOLICYSCE(pipes_struct *p, struct lsa_LSAROPENPOLICYSCE *r)
2446 p->rng_fault_state = True;
2447 return NT_STATUS_NOT_IMPLEMENTED;
2450 NTSTATUS _lsa_LSARADTREGISTERSECURITYEVENTSOURCE(pipes_struct *p, struct lsa_LSARADTREGISTERSECURITYEVENTSOURCE *r)
2452 p->rng_fault_state = True;
2453 return NT_STATUS_NOT_IMPLEMENTED;
2456 NTSTATUS _lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE(pipes_struct *p, struct lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE *r)
2458 p->rng_fault_state = True;
2459 return NT_STATUS_NOT_IMPLEMENTED;
2462 NTSTATUS _lsa_LSARADTREPORTSECURITYEVENT(pipes_struct *p, struct lsa_LSARADTREPORTSECURITYEVENT *r)
2464 p->rng_fault_state = True;
2465 return NT_STATUS_NOT_IMPLEMENTED;