xref: /illumos-gate/usr/src/lib/smbsrv/libmlsvc/common/lsalib.h (revision 47842382d52f28aa3173aa6b511781c322ccb6a2)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef _LSALIB_H
27 #define	_LSALIB_H
28 
29 /*
30  * Prototypes for the LSA library and RPC client side library interface.
31  * There are two levels of interface defined here: lsa_xxx and lsar_xxx.
32  * The lsa_xxx functions provide a high level interface which make
33  * multiple RPC calls and do all the work necessary to obtain and return
34  * the requested information. The lsar_xxx functions provide a low level
35  * interface in which each function maps to a single underlying RPC.
36  */
37 
38 #include <smbsrv/ndl/lsarpc.ndl>
39 #include <smbsrv/libsmb.h>
40 #include <smbsrv/libmlsvc.h>
41 #include <smbsrv/smb_sid.h>
42 
43 
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47 
48 typedef struct lsa_nt_domaininfo {
49 	smb_sid_t	*n_sid;
50 	char		n_domain[NETBIOS_NAME_SZ];
51 } lsa_nt_domaininfo_t;
52 
53 typedef struct lsa_trusted_domainlist {
54 	uint32_t		t_num;
55 	lsa_nt_domaininfo_t	*t_domains;
56 } lsa_trusted_domainlist_t;
57 
58 typedef struct lsa_dns_domaininfo {
59 	smb_sid_t	*d_sid;
60 	char		d_nbdomain[NETBIOS_NAME_SZ];
61 	char		d_fqdomain[MAXHOSTNAMELEN];
62 	char		d_forest[MAXHOSTNAMELEN];
63 	mslsa_guid_t	d_guid;
64 } lsa_dns_domaininfo_t;
65 
66 typedef enum lsa_info_type {
67 	LSA_INFO_NONE,
68 	LSA_INFO_PRIMARY_DOMAIN,
69 	LSA_INFO_ACCOUNT_DOMAIN,
70 	LSA_INFO_DNS_DOMAIN,
71 	LSA_INFO_TRUSTED_DOMAINS
72 } lsa_info_type_t;
73 
74 typedef struct lsa_info {
75 	lsa_info_type_t		i_type;
76 	union {
77 		lsa_nt_domaininfo_t		di_primary;
78 		lsa_nt_domaininfo_t		di_account;
79 		lsa_dns_domaininfo_t		di_dns;
80 		lsa_trusted_domainlist_t	di_trust;
81 	} i_domain;
82 } lsa_info_t;
83 
84 /*
85  * lsalib.c
86  */
87 uint32_t lsa_lookup_name(char *, uint16_t, smb_account_t *);
88 uint32_t lsa_lookup_sid(smb_sid_t *, smb_account_t *);
89 void lsa_free_info(lsa_info_t *);
90 DWORD lsa_query_primary_domain_info(char *, char *, lsa_info_t *);
91 DWORD lsa_query_account_domain_info(char *, char *, lsa_info_t *);
92 DWORD lsa_query_dns_domain_info(char *, char *, lsa_info_t *);
93 DWORD lsa_enum_trusted_domains(char *, char *, lsa_info_t *);
94 
95 
96 /*
97  * lsar_open.c
98  */
99 int lsar_open(char *, char *, char *, mlsvc_handle_t *);
100 int lsar_open_policy2(char *, char *, char *, mlsvc_handle_t *);
101 int lsar_open_account(mlsvc_handle_t *, struct mslsa_sid *, mlsvc_handle_t *);
102 int lsar_close(mlsvc_handle_t *);
103 
104 /*
105  * lsar_lookup.c
106  */
107 int lsar_query_security_desc(mlsvc_handle_t *);
108 DWORD lsar_query_info_policy(mlsvc_handle_t *, WORD, lsa_info_t *);
109 uint32_t lsar_lookup_names(mlsvc_handle_t *, char *, smb_account_t *);
110 uint32_t lsar_lookup_names2(mlsvc_handle_t *, char *, smb_account_t *);
111 uint32_t lsar_lookup_sids(mlsvc_handle_t *, struct mslsa_sid *,
112     smb_account_t *);
113 uint32_t lsar_lookup_sids2(mlsvc_handle_t *, struct mslsa_sid *,
114     smb_account_t *);
115 
116 int lsar_enum_accounts(mlsvc_handle_t *, DWORD *,
117     struct mslsa_EnumAccountBuf *);
118 DWORD lsar_enum_trusted_domains(mlsvc_handle_t *, DWORD *, lsa_info_t *);
119 int lsar_enum_privs_account(mlsvc_handle_t *, smb_account_t *);
120 int lsar_lookup_priv_value(mlsvc_handle_t *, char *, struct  ms_luid *);
121 int lsar_lookup_priv_name(mlsvc_handle_t *, struct  ms_luid *, char *, int);
122 DWORD lsar_lookup_priv_display_name(mlsvc_handle_t *, char *, char *, int);
123 
124 #ifdef __cplusplus
125 }
126 #endif
127 
128 #endif /* _LSALIB_H */
129