2 * Unix SMB/CIFS implementation.
4 * Winbind rpc backend functions
6 * Copyright (c) 2000-2003 Tim Potter
7 * Copyright (c) 2001 Andrew Tridgell
8 * Copyright (c) 2005 Volker Lendecke
9 * Copyright (c) 2008 Guenther Deschner (pidl conversion)
10 * Copyright (c) 2010 Andreas Schneider <asn@samba.org>
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 3 of the License, or
15 * (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program. If not, see <http://www.gnu.org/licenses/>.
28 #include "winbindd_rpc.h"
30 #include "../librpc/gen_ndr/cli_samr.h"
31 #include "rpc_client/cli_samr.h"
32 #include "../librpc/gen_ndr/srv_samr.h"
33 #include "../librpc/gen_ndr/cli_lsa.h"
34 #include "rpc_client/cli_lsarpc.h"
35 #include "../librpc/gen_ndr/srv_lsa.h"
38 #define DBGC_CLASS DBGC_WINBIND
40 static NTSTATUS
open_internal_samr_pipe(TALLOC_CTX
*mem_ctx
,
41 struct rpc_pipe_client
**samr_pipe
)
43 struct rpc_pipe_client
*cli
= NULL
;
44 struct auth_serversupplied_info
*server_info
= NULL
;
51 if (server_info
== NULL
) {
52 status
= make_server_info_system(mem_ctx
, &server_info
);
53 if (!NT_STATUS_IS_OK(status
)) {
54 DEBUG(0, ("open_samr_pipe: Could not create auth_serversupplied_info: %s\n",
60 /* create a samr connection */
61 status
= rpc_pipe_open_internal(mem_ctx
,
62 &ndr_table_samr
.syntax_id
,
65 winbind_messaging_context(),
67 if (!NT_STATUS_IS_OK(status
)) {
68 DEBUG(0, ("open_samr_pipe: Could not connect to samr_pipe: %s\n",
81 NTSTATUS
open_internal_samr_conn(TALLOC_CTX
*mem_ctx
,
82 struct winbindd_domain
*domain
,
83 struct rpc_pipe_client
**samr_pipe
,
84 struct policy_handle
*samr_domain_hnd
)
87 struct policy_handle samr_connect_hnd
;
89 status
= open_internal_samr_pipe(mem_ctx
, samr_pipe
);
90 if (!NT_STATUS_IS_OK(status
)) {
94 status
= rpccli_samr_Connect2((*samr_pipe
),
96 (*samr_pipe
)->desthost
,
97 SEC_FLAG_MAXIMUM_ALLOWED
,
99 if (!NT_STATUS_IS_OK(status
)) {
103 status
= rpccli_samr_OpenDomain((*samr_pipe
),
106 SEC_FLAG_MAXIMUM_ALLOWED
,
113 static NTSTATUS
open_internal_lsa_pipe(TALLOC_CTX
*mem_ctx
,
114 struct rpc_pipe_client
**lsa_pipe
)
116 struct rpc_pipe_client
*cli
= NULL
;
117 struct auth_serversupplied_info
*server_info
= NULL
;
124 if (server_info
== NULL
) {
125 status
= make_server_info_system(mem_ctx
, &server_info
);
126 if (!NT_STATUS_IS_OK(status
)) {
127 DEBUG(0, ("open_lsa_pipe: Could not create auth_serversupplied_info: %s\n",
133 /* create a samr connection */
134 status
= rpc_pipe_open_internal(mem_ctx
,
135 &ndr_table_lsarpc
.syntax_id
,
138 winbind_messaging_context(),
140 if (!NT_STATUS_IS_OK(status
)) {
141 DEBUG(0, ("open_lsa_pipe: Could not connect to lsa_pipe: %s\n",
154 static NTSTATUS
open_internal_lsa_conn(TALLOC_CTX
*mem_ctx
,
155 struct rpc_pipe_client
**lsa_pipe
,
156 struct policy_handle
*lsa_hnd
)
160 status
= open_internal_lsa_pipe(mem_ctx
, lsa_pipe
);
161 if (!NT_STATUS_IS_OK(status
)) {
165 status
= rpccli_lsa_open_policy((*lsa_pipe
),
168 SEC_FLAG_MAXIMUM_ALLOWED
,
174 /*********************************************************************
175 SAM specific functions.
176 *********************************************************************/
178 /* List all domain groups */
179 static NTSTATUS
sam_enum_dom_groups(struct winbindd_domain
*domain
,
182 struct acct_info
**pinfo
)
184 struct rpc_pipe_client
*samr_pipe
;
185 struct policy_handle dom_pol
;
186 struct acct_info
*info
= NULL
;
187 uint32_t num_info
= 0;
191 DEBUG(3,("sam_enum_dom_groups\n"));
193 ZERO_STRUCT(dom_pol
);
199 tmp_ctx
= talloc_stackframe();
200 if (tmp_ctx
== NULL
) {
201 return NT_STATUS_NO_MEMORY
;
204 status
= open_internal_samr_conn(tmp_ctx
, domain
, &samr_pipe
, &dom_pol
);
205 if (!NT_STATUS_IS_OK(status
)) {
209 status
= rpc_enum_dom_groups(tmp_ctx
,
214 if (!NT_STATUS_IS_OK(status
)) {
219 *pnum_info
= num_info
;
223 *pinfo
= talloc_move(mem_ctx
, &info
);
227 if (is_valid_policy_hnd(&dom_pol
)) {
228 rpccli_samr_Close(samr_pipe
, mem_ctx
, &dom_pol
);
230 TALLOC_FREE(tmp_ctx
);
234 /* Query display info for a domain */
235 static NTSTATUS
sam_query_user_list(struct winbindd_domain
*domain
,
238 struct wbint_userinfo
**pinfo
)
240 struct rpc_pipe_client
*samr_pipe
= NULL
;
241 struct policy_handle dom_pol
;
242 struct wbint_userinfo
*info
= NULL
;
243 uint32_t num_info
= 0;
247 DEBUG(3,("samr_query_user_list\n"));
249 ZERO_STRUCT(dom_pol
);
255 tmp_ctx
= talloc_stackframe();
256 if (tmp_ctx
== NULL
) {
257 return NT_STATUS_NO_MEMORY
;
260 status
= open_internal_samr_conn(tmp_ctx
, domain
, &samr_pipe
, &dom_pol
);
261 if (!NT_STATUS_IS_OK(status
)) {
265 status
= rpc_query_user_list(tmp_ctx
,
271 if (!NT_STATUS_IS_OK(status
)) {
276 *pnum_info
= num_info
;
280 *pinfo
= talloc_move(mem_ctx
, &info
);
284 if (is_valid_policy_hnd(&dom_pol
)) {
285 rpccli_samr_Close(samr_pipe
, mem_ctx
, &dom_pol
);
288 TALLOC_FREE(tmp_ctx
);
292 /* Lookup user information from a rid or username. */
293 static NTSTATUS
sam_query_user(struct winbindd_domain
*domain
,
295 const struct dom_sid
*user_sid
,
296 struct wbint_userinfo
*user_info
)
298 struct rpc_pipe_client
*samr_pipe
;
299 struct policy_handle dom_pol
;
303 DEBUG(3,("sam_query_user\n"));
305 ZERO_STRUCT(dom_pol
);
308 if (!sid_check_is_in_our_domain(user_sid
)) {
309 return NT_STATUS_NO_SUCH_USER
;
313 user_info
->homedir
= NULL
;
314 user_info
->shell
= NULL
;
315 user_info
->primary_gid
= (gid_t
) -1;
318 tmp_ctx
= talloc_stackframe();
319 if (tmp_ctx
== NULL
) {
320 return NT_STATUS_NO_MEMORY
;
323 status
= open_internal_samr_conn(tmp_ctx
, domain
, &samr_pipe
, &dom_pol
);
324 if (!NT_STATUS_IS_OK(status
)) {
328 status
= rpc_query_user(tmp_ctx
,
336 if (is_valid_policy_hnd(&dom_pol
)) {
337 rpccli_samr_Close(samr_pipe
, mem_ctx
, &dom_pol
);
340 TALLOC_FREE(tmp_ctx
);
344 /* get a list of trusted domains - builtin domain */
345 static NTSTATUS
sam_trusted_domains(struct winbindd_domain
*domain
,
347 struct netr_DomainTrustList
*ptrust_list
)
349 struct rpc_pipe_client
*lsa_pipe
;
350 struct policy_handle lsa_policy
;
351 struct netr_DomainTrust
*trusts
= NULL
;
352 uint32_t num_trusts
= 0;
356 DEBUG(3,("samr: trusted domains\n"));
358 ZERO_STRUCT(lsa_policy
);
361 ZERO_STRUCTP(ptrust_list
);
364 tmp_ctx
= talloc_stackframe();
365 if (tmp_ctx
== NULL
) {
366 return NT_STATUS_NO_MEMORY
;
369 status
= open_internal_lsa_conn(tmp_ctx
, &lsa_pipe
, &lsa_policy
);
370 if (!NT_STATUS_IS_OK(status
)) {
374 status
= rpc_trusted_domains(tmp_ctx
,
379 if (!NT_STATUS_IS_OK(status
)) {
384 ptrust_list
->count
= num_trusts
;
385 ptrust_list
->array
= talloc_move(mem_ctx
, &trusts
);
389 if (is_valid_policy_hnd(&lsa_policy
)) {
390 rpccli_lsa_Close(lsa_pipe
, mem_ctx
, &lsa_policy
);
393 TALLOC_FREE(tmp_ctx
);
397 /* Lookup group membership given a rid. */
398 static NTSTATUS
sam_lookup_groupmem(struct winbindd_domain
*domain
,
400 const struct dom_sid
*group_sid
,
401 enum lsa_SidType type
,
402 uint32_t *pnum_names
,
403 struct dom_sid
**psid_mem
,
405 uint32_t **pname_types
)
407 struct rpc_pipe_client
*samr_pipe
;
408 struct policy_handle dom_pol
;
410 uint32_t num_names
= 0;
411 struct dom_sid
*sid_mem
= NULL
;
413 uint32_t *name_types
= NULL
;
418 DEBUG(3,("sam_lookup_groupmem\n"));
420 ZERO_STRUCT(dom_pol
);
423 if (sid_check_is_in_builtin(group_sid
) && (type
!= SID_NAME_ALIAS
)) {
424 /* There's no groups, only aliases in BUILTIN */
425 return NT_STATUS_NO_SUCH_GROUP
;
432 tmp_ctx
= talloc_stackframe();
433 if (tmp_ctx
== NULL
) {
434 return NT_STATUS_NO_MEMORY
;
437 status
= open_internal_samr_conn(tmp_ctx
, domain
, &samr_pipe
, &dom_pol
);
438 if (!NT_STATUS_IS_OK(status
)) {
442 status
= rpc_lookup_groupmem(tmp_ctx
,
455 *pnum_names
= num_names
;
459 *pnames
= talloc_move(mem_ctx
, &names
);
463 *pname_types
= talloc_move(mem_ctx
, &name_types
);
467 *psid_mem
= talloc_move(mem_ctx
, &sid_mem
);
471 if (is_valid_policy_hnd(&dom_pol
)) {
472 rpccli_samr_Close(samr_pipe
, mem_ctx
, &dom_pol
);
475 TALLOC_FREE(tmp_ctx
);
479 /*********************************************************************
480 BUILTIN specific functions.
481 *********************************************************************/
483 /* List all domain groups */
484 static NTSTATUS
builtin_enum_dom_groups(struct winbindd_domain
*domain
,
487 struct acct_info
**info
)
489 /* BUILTIN doesn't have domain groups */
495 /* Query display info for a domain */
496 static NTSTATUS
builtin_query_user_list(struct winbindd_domain
*domain
,
499 struct wbint_userinfo
**info
)
501 /* We don't have users */
507 /* Lookup user information from a rid or username. */
508 static NTSTATUS
builtin_query_user(struct winbindd_domain
*domain
,
510 const struct dom_sid
*user_sid
,
511 struct wbint_userinfo
*user_info
)
513 return NT_STATUS_NO_SUCH_USER
;
516 /* get a list of trusted domains - builtin domain */
517 static NTSTATUS
builtin_trusted_domains(struct winbindd_domain
*domain
,
519 struct netr_DomainTrustList
*trusts
)
521 ZERO_STRUCTP(trusts
);
525 /*********************************************************************
527 *********************************************************************/
529 /* List all local groups (aliases) */
530 static NTSTATUS
sam_enum_local_groups(struct winbindd_domain
*domain
,
533 struct acct_info
**pinfo
)
535 struct rpc_pipe_client
*samr_pipe
;
536 struct policy_handle dom_pol
;
537 struct acct_info
*info
= NULL
;
538 uint32_t num_info
= 0;
542 DEBUG(3,("samr: enum local groups\n"));
544 ZERO_STRUCT(dom_pol
);
550 tmp_ctx
= talloc_stackframe();
551 if (tmp_ctx
== NULL
) {
552 return NT_STATUS_NO_MEMORY
;
555 status
= open_internal_samr_conn(tmp_ctx
, domain
, &samr_pipe
, &dom_pol
);
556 if (!NT_STATUS_IS_OK(status
)) {
560 status
= rpc_enum_local_groups(mem_ctx
,
565 if (!NT_STATUS_IS_OK(status
)) {
570 *pnum_info
= num_info
;
574 *pinfo
= talloc_move(mem_ctx
, &info
);
578 if (is_valid_policy_hnd(&dom_pol
)) {
579 rpccli_samr_Close(samr_pipe
, mem_ctx
, &dom_pol
);
582 TALLOC_FREE(tmp_ctx
);
586 /* convert a single name to a sid in a domain */
587 static NTSTATUS
sam_name_to_sid(struct winbindd_domain
*domain
,
589 const char *domain_name
,
592 struct dom_sid
*psid
,
593 enum lsa_SidType
*ptype
)
595 struct rpc_pipe_client
*lsa_pipe
;
596 struct policy_handle lsa_policy
;
598 enum lsa_SidType type
;
602 DEBUG(3,("sam_name_to_sid\n"));
604 ZERO_STRUCT(lsa_policy
);
606 tmp_ctx
= talloc_stackframe();
607 if (tmp_ctx
== NULL
) {
608 return NT_STATUS_NO_MEMORY
;
611 status
= open_internal_lsa_conn(tmp_ctx
, &lsa_pipe
, &lsa_policy
);
612 if (!NT_STATUS_IS_OK(status
)) {
616 status
= rpc_name_to_sid(tmp_ctx
,
624 if (!NT_STATUS_IS_OK(status
)) {
629 sid_copy(psid
, &sid
);
636 if (is_valid_policy_hnd(&lsa_policy
)) {
637 rpccli_lsa_Close(lsa_pipe
, mem_ctx
, &lsa_policy
);
640 TALLOC_FREE(tmp_ctx
);
644 /* convert a domain SID to a user or group name */
645 static NTSTATUS
sam_sid_to_name(struct winbindd_domain
*domain
,
647 const struct dom_sid
*sid
,
650 enum lsa_SidType
*ptype
)
652 struct rpc_pipe_client
*lsa_pipe
;
653 struct policy_handle lsa_policy
;
654 char *domain_name
= NULL
;
656 enum lsa_SidType type
;
660 DEBUG(3,("sam_sid_to_name\n"));
662 ZERO_STRUCT(lsa_policy
);
665 if (!sid_check_is_in_builtin(sid
) &&
666 !sid_check_is_in_our_domain(sid
) &&
667 !sid_check_is_in_unix_users(sid
) &&
668 !sid_check_is_unix_users(sid
) &&
669 !sid_check_is_in_unix_groups(sid
) &&
670 !sid_check_is_unix_groups(sid
) &&
671 !sid_check_is_in_wellknown_domain(sid
)) {
672 DEBUG(0, ("sam_sid_to_name: possible deadlock - trying to "
673 "lookup SID %s\n", sid_string_dbg(sid
)));
674 return NT_STATUS_NONE_MAPPED
;
677 tmp_ctx
= talloc_stackframe();
678 if (tmp_ctx
== NULL
) {
679 return NT_STATUS_NO_MEMORY
;
682 status
= open_internal_lsa_conn(tmp_ctx
, &lsa_pipe
, &lsa_policy
);
683 if (!NT_STATUS_IS_OK(status
)) {
687 status
= rpc_sid_to_name(tmp_ctx
,
701 *pname
= talloc_move(mem_ctx
, &name
);
705 *pdomain_name
= talloc_move(mem_ctx
, &domain_name
);
709 if (is_valid_policy_hnd(&lsa_policy
)) {
710 rpccli_lsa_Close(lsa_pipe
, mem_ctx
, &lsa_policy
);
713 TALLOC_FREE(tmp_ctx
);
717 static NTSTATUS
sam_rids_to_names(struct winbindd_domain
*domain
,
719 const struct dom_sid
*sid
,
724 enum lsa_SidType
**ptypes
)
726 struct rpc_pipe_client
*lsa_pipe
;
727 struct policy_handle lsa_policy
;
728 enum lsa_SidType
*types
= NULL
;
729 char *domain_name
= NULL
;
734 DEBUG(3,("sam_rids_to_names for %s\n", domain
->name
));
736 ZERO_STRUCT(lsa_policy
);
739 if (!sid_check_is_in_builtin(sid
) &&
740 !sid_check_is_in_our_domain(sid
) &&
741 !sid_check_is_in_unix_users(sid
) &&
742 !sid_check_is_unix_users(sid
) &&
743 !sid_check_is_in_unix_groups(sid
) &&
744 !sid_check_is_unix_groups(sid
) &&
745 !sid_check_is_in_wellknown_domain(sid
)) {
746 DEBUG(0, ("sam_rids_to_names: possible deadlock - trying to "
747 "lookup SID %s\n", sid_string_dbg(sid
)));
748 return NT_STATUS_NONE_MAPPED
;
751 tmp_ctx
= talloc_stackframe();
752 if (tmp_ctx
== NULL
) {
753 return NT_STATUS_NO_MEMORY
;
756 status
= open_internal_lsa_conn(tmp_ctx
, &lsa_pipe
, &lsa_policy
);
757 if (!NT_STATUS_IS_OK(status
)) {
761 status
= rpc_rids_to_names(tmp_ctx
,
771 if (!NT_STATUS_IS_OK(status
)) {
776 *pdomain_name
= talloc_move(mem_ctx
, &domain_name
);
780 *ptypes
= talloc_move(mem_ctx
, &types
);
784 *pnames
= talloc_move(mem_ctx
, &names
);
788 if (is_valid_policy_hnd(&lsa_policy
)) {
789 rpccli_lsa_Close(lsa_pipe
, mem_ctx
, &lsa_policy
);
792 TALLOC_FREE(tmp_ctx
);
796 static NTSTATUS
sam_lockout_policy(struct winbindd_domain
*domain
,
798 struct samr_DomInfo12
*lockout_policy
)
800 struct rpc_pipe_client
*samr_pipe
;
801 struct policy_handle dom_pol
;
802 union samr_DomainInfo
*info
= NULL
;
806 DEBUG(3,("sam_lockout_policy\n"));
808 ZERO_STRUCT(dom_pol
);
810 tmp_ctx
= talloc_stackframe();
811 if (tmp_ctx
== NULL
) {
812 return NT_STATUS_NO_MEMORY
;
815 status
= open_internal_samr_conn(tmp_ctx
, domain
, &samr_pipe
, &dom_pol
);
816 if (!NT_STATUS_IS_OK(status
)) {
820 status
= rpccli_samr_QueryDomainInfo(samr_pipe
,
825 if (!NT_STATUS_IS_OK(status
)) {
829 *lockout_policy
= info
->info12
;
832 if (is_valid_policy_hnd(&dom_pol
)) {
833 rpccli_samr_Close(samr_pipe
, mem_ctx
, &dom_pol
);
836 TALLOC_FREE(tmp_ctx
);
840 static NTSTATUS
sam_password_policy(struct winbindd_domain
*domain
,
842 struct samr_DomInfo1
*passwd_policy
)
844 struct rpc_pipe_client
*samr_pipe
;
845 struct policy_handle dom_pol
;
846 union samr_DomainInfo
*info
= NULL
;
850 DEBUG(3,("sam_password_policy\n"));
852 ZERO_STRUCT(dom_pol
);
854 tmp_ctx
= talloc_stackframe();
855 if (tmp_ctx
== NULL
) {
856 return NT_STATUS_NO_MEMORY
;
859 status
= open_internal_samr_conn(tmp_ctx
, domain
, &samr_pipe
, &dom_pol
);
860 if (!NT_STATUS_IS_OK(status
)) {
864 status
= rpccli_samr_QueryDomainInfo(samr_pipe
,
869 if (!NT_STATUS_IS_OK(status
)) {
873 *passwd_policy
= info
->info1
;
876 if (is_valid_policy_hnd(&dom_pol
)) {
877 rpccli_samr_Close(samr_pipe
, mem_ctx
, &dom_pol
);
880 TALLOC_FREE(tmp_ctx
);
884 /* Lookup groups a user is a member of. */
885 static NTSTATUS
sam_lookup_usergroups(struct winbindd_domain
*domain
,
887 const struct dom_sid
*user_sid
,
888 uint32_t *pnum_groups
,
889 struct dom_sid
**puser_grpsids
)
891 struct rpc_pipe_client
*samr_pipe
;
892 struct policy_handle dom_pol
;
893 struct dom_sid
*user_grpsids
= NULL
;
894 uint32_t num_groups
= 0;
898 DEBUG(3,("sam_lookup_usergroups\n"));
900 ZERO_STRUCT(dom_pol
);
906 tmp_ctx
= talloc_stackframe();
907 if (tmp_ctx
== NULL
) {
908 return NT_STATUS_NO_MEMORY
;
911 status
= open_internal_samr_conn(tmp_ctx
, domain
, &samr_pipe
, &dom_pol
);
912 if (!NT_STATUS_IS_OK(status
)) {
916 status
= rpc_lookup_usergroups(tmp_ctx
,
923 if (!NT_STATUS_IS_OK(status
)) {
928 *pnum_groups
= num_groups
;
932 *puser_grpsids
= talloc_move(mem_ctx
, &user_grpsids
);
936 if (is_valid_policy_hnd(&dom_pol
)) {
937 rpccli_samr_Close(samr_pipe
, mem_ctx
, &dom_pol
);
940 TALLOC_FREE(tmp_ctx
);
944 static NTSTATUS
sam_lookup_useraliases(struct winbindd_domain
*domain
,
947 const struct dom_sid
*sids
,
948 uint32_t *pnum_aliases
,
949 uint32_t **palias_rids
)
951 struct rpc_pipe_client
*samr_pipe
;
952 struct policy_handle dom_pol
;
953 uint32_t num_aliases
= 0;
954 uint32_t *alias_rids
= NULL
;
958 DEBUG(3,("sam_lookup_useraliases\n"));
960 ZERO_STRUCT(dom_pol
);
966 tmp_ctx
= talloc_stackframe();
967 if (tmp_ctx
== NULL
) {
968 return NT_STATUS_NO_MEMORY
;
971 status
= open_internal_samr_conn(tmp_ctx
, domain
, &samr_pipe
, &dom_pol
);
972 if (!NT_STATUS_IS_OK(status
)) {
976 status
= rpc_lookup_useraliases(tmp_ctx
,
983 if (!NT_STATUS_IS_OK(status
)) {
988 *pnum_aliases
= num_aliases
;
992 *palias_rids
= talloc_move(mem_ctx
, &alias_rids
);
996 if (is_valid_policy_hnd(&dom_pol
)) {
997 rpccli_samr_Close(samr_pipe
, mem_ctx
, &dom_pol
);
1000 TALLOC_FREE(tmp_ctx
);
1004 /* find the sequence number for a domain */
1005 static NTSTATUS
sam_sequence_number(struct winbindd_domain
*domain
,
1008 struct rpc_pipe_client
*samr_pipe
;
1009 struct policy_handle dom_pol
;
1011 TALLOC_CTX
*tmp_ctx
;
1014 DEBUG(3,("samr: sequence number\n"));
1016 ZERO_STRUCT(dom_pol
);
1019 *pseq
= DOM_SEQUENCE_NONE
;
1022 tmp_ctx
= talloc_stackframe();
1023 if (tmp_ctx
== NULL
) {
1024 return NT_STATUS_NO_MEMORY
;
1027 status
= open_internal_samr_conn(tmp_ctx
, domain
, &samr_pipe
, &dom_pol
);
1028 if (!NT_STATUS_IS_OK(status
)) {
1032 status
= rpc_sequence_number(tmp_ctx
,
1037 if (!NT_STATUS_IS_OK(status
)) {
1045 if (is_valid_policy_hnd(&dom_pol
)) {
1046 rpccli_samr_Close(samr_pipe
, tmp_ctx
, &dom_pol
);
1049 TALLOC_FREE(tmp_ctx
);
1053 /* the rpc backend methods are exposed via this structure */
1054 struct winbindd_methods builtin_passdb_methods
= {
1055 .consistent
= false,
1057 .query_user_list
= builtin_query_user_list
,
1058 .enum_dom_groups
= builtin_enum_dom_groups
,
1059 .enum_local_groups
= sam_enum_local_groups
,
1060 .name_to_sid
= sam_name_to_sid
,
1061 .sid_to_name
= sam_sid_to_name
,
1062 .rids_to_names
= sam_rids_to_names
,
1063 .query_user
= builtin_query_user
,
1064 .lookup_usergroups
= sam_lookup_usergroups
,
1065 .lookup_useraliases
= sam_lookup_useraliases
,
1066 .lookup_groupmem
= sam_lookup_groupmem
,
1067 .sequence_number
= sam_sequence_number
,
1068 .lockout_policy
= sam_lockout_policy
,
1069 .password_policy
= sam_password_policy
,
1070 .trusted_domains
= builtin_trusted_domains
1073 /* the rpc backend methods are exposed via this structure */
1074 struct winbindd_methods sam_passdb_methods
= {
1075 .consistent
= false,
1077 .query_user_list
= sam_query_user_list
,
1078 .enum_dom_groups
= sam_enum_dom_groups
,
1079 .enum_local_groups
= sam_enum_local_groups
,
1080 .name_to_sid
= sam_name_to_sid
,
1081 .sid_to_name
= sam_sid_to_name
,
1082 .rids_to_names
= sam_rids_to_names
,
1083 .query_user
= sam_query_user
,
1084 .lookup_usergroups
= sam_lookup_usergroups
,
1085 .lookup_useraliases
= sam_lookup_useraliases
,
1086 .lookup_groupmem
= sam_lookup_groupmem
,
1087 .sequence_number
= sam_sequence_number
,
1088 .lockout_policy
= sam_lockout_policy
,
1089 .password_policy
= sam_password_policy
,
1090 .trusted_domains
= sam_trusted_domains