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 (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
24 */
25
26 #ifndef _LIBMLSVC_H
27 #define _LIBMLSVC_H
28
29 #include <uuid/uuid.h>
30 #include <sys/param.h>
31 #include <sys/types.h>
32 #include <sys/uio.h>
33 #include <sys/ksynch.h>
34 #include <time.h>
35 #include <stdio.h>
36 #include <string.h>
37 #include <netdb.h>
38 #include <libuutil.h>
39 #include <smbsrv/wintypes.h>
40 #include <smbsrv/hash_table.h>
41 #include <smbsrv/smb_token.h>
42 #include <smbsrv/smb_privilege.h>
43 #include <smbsrv/smb_share.h>
44 #include <smbsrv/smb_xdr.h>
45 #include <smbsrv/smb_dfs.h>
46 #include <smbsrv/libsmb.h>
47 #include <smbsrv/libmlrpc.h>
48 #include <smbsrv/ndl/lsarpc.ndl>
49
50 #ifdef __cplusplus
51 extern "C" {
52 #endif
53
54 uint32_t lsa_lookup_name(char *, uint16_t, smb_account_t *);
55 uint32_t lsa_lookup_sid(smb_sid_t *, smb_account_t *);
56
57 /*
58 * SMB domain API to discover a domain controller and obtain domain
59 * information.
60 */
61
62 extern boolean_t smb_locate_dc(char *, smb_domainex_t *);
63 uint32_t smb_ddiscover_dns(char *, smb_domainex_t *);
64 extern void smb_ddiscover_bad_dc(char *);
65 extern void smb_ddiscover_refresh(void);
66 extern int smb_ddiscover_wait(void);
67
68 extern int dssetup_check_service(void);
110 time_t ah_timestamp;
111 char *ah_name; /* User account name */
112 char *ah_path; /* Home directory path */
113 char *ah_container; /* ADS container distinguished name */
114 } smb_autohome_t;
115
116 extern void smb_autohome_add(const smb_token_t *);
117 extern void smb_autohome_remove(const char *);
118
119 /*
120 * A local unique id (LUID) is an opaque id used by servers to identify
121 * local resources, such as privileges. A client will use lookup
122 * functions to translate the LUID to a more general, machine independent
123 * form; such as a string.
124 */
125 typedef struct ms_luid {
126 uint32_t low_part;
127 uint32_t high_part;
128 } ms_luid_t;
129
130 int srvsvc_net_remote_tod(char *, char *, struct timeval *, struct tm *);
131
132
133 /*
134 * A client_t is created while binding a client connection to hold the
135 * context for calls made using that connection.
136 *
137 * Handles are RPC call specific and we use an inheritance mechanism to
138 * ensure that each handle has a pointer to the client_t. When the top
139 * level (bind) handle is released, we close the connection.
140 */
141 typedef struct mlsvc_handle {
142 ndr_hdid_t handle;
143 ndr_client_t *clnt;
144 } mlsvc_handle_t;
145
146 void ndr_rpc_init(void);
147 void ndr_rpc_fini(void);
148 uint32_t ndr_rpc_bind(mlsvc_handle_t *, char *, char *, char *, const char *);
149 void ndr_rpc_unbind(mlsvc_handle_t *);
150 int ndr_rpc_call(mlsvc_handle_t *, int, void *);
151 void ndr_rpc_set_nonull(mlsvc_handle_t *);
152 int ndr_rpc_get_ssnkey(mlsvc_handle_t *, unsigned char *, size_t);
153 void *ndr_rpc_malloc(mlsvc_handle_t *, size_t);
154 ndr_heap_t *ndr_rpc_get_heap(mlsvc_handle_t *);
155 void ndr_rpc_release(mlsvc_handle_t *);
156 boolean_t ndr_is_null_handle(mlsvc_handle_t *);
157 boolean_t ndr_is_bind_handle(mlsvc_handle_t *);
158 void ndr_inherit_handle(mlsvc_handle_t *, mlsvc_handle_t *);
159 void ndr_rpc_status(mlsvc_handle_t *, int, uint32_t);
160
161 /* SVCCTL service */
162 /*
163 * Calculate the wide-char equivalent string length required to
164 * store a string - including the terminating null wide-char.
165 */
166 #define SVCCTL_WNSTRLEN(S) ((strlen((S)) + 1) * sizeof (smb_wchar_t))
167
168 /* An AVL-storable node representing each service in the SCM database. */
169 typedef struct svcctl_svc_node {
170 uu_avl_node_t sn_node;
171 char *sn_name; /* Service Name (Key) */
172 char *sn_fmri; /* Display Name (FMRI) */
173 char *sn_desc; /* Description */
174 char *sn_state; /* State */
175 } svcctl_svc_node_t;
176
177 /* This structure provides context for each svcctl_s_OpenManager call. */
178 typedef struct svcctl_manager_context {
179 scf_handle_t *mc_scf_hdl; /* SCF handle */
180 scf_propertygroup_t *mc_scf_gpg; /* Property group */
|
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 (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
24 */
25
26 #ifndef _LIBMLSVC_H
27 #define _LIBMLSVC_H
28
29 #include <sys/param.h>
30 #include <sys/types.h>
31 #include <sys/uio.h>
32 #include <sys/ksynch.h>
33 #include <uuid/uuid.h>
34
35 #include <time.h>
36 #include <stdio.h>
37 #include <string.h>
38 #include <syslog.h>
39 #include <netdb.h>
40 #include <libuutil.h>
41
42 #include <smb/wintypes.h>
43 #include <libmlrpc/libmlrpc.h>
44
45 #include <smbsrv/hash_table.h>
46 #include <smbsrv/smb_token.h>
47 #include <smbsrv/smb_privilege.h>
48 #include <smbsrv/smb_share.h>
49 #include <smbsrv/smb_xdr.h>
50 #include <smbsrv/smb_dfs.h>
51 #include <smbsrv/libsmb.h>
52
53 #ifdef __cplusplus
54 extern "C" {
55 #endif
56
57 uint32_t lsa_lookup_name(char *, uint16_t, smb_account_t *);
58 uint32_t lsa_lookup_sid(smb_sid_t *, smb_account_t *);
59
60 /*
61 * SMB domain API to discover a domain controller and obtain domain
62 * information.
63 */
64
65 extern boolean_t smb_locate_dc(char *, smb_domainex_t *);
66 uint32_t smb_ddiscover_dns(char *, smb_domainex_t *);
67 extern void smb_ddiscover_bad_dc(char *);
68 extern void smb_ddiscover_refresh(void);
69 extern int smb_ddiscover_wait(void);
70
71 extern int dssetup_check_service(void);
113 time_t ah_timestamp;
114 char *ah_name; /* User account name */
115 char *ah_path; /* Home directory path */
116 char *ah_container; /* ADS container distinguished name */
117 } smb_autohome_t;
118
119 extern void smb_autohome_add(const smb_token_t *);
120 extern void smb_autohome_remove(const char *);
121
122 /*
123 * A local unique id (LUID) is an opaque id used by servers to identify
124 * local resources, such as privileges. A client will use lookup
125 * functions to translate the LUID to a more general, machine independent
126 * form; such as a string.
127 */
128 typedef struct ms_luid {
129 uint32_t low_part;
130 uint32_t high_part;
131 } ms_luid_t;
132
133 /*
134 * A client_t is created while binding a client connection to hold the
135 * context for calls made using that connection.
136 *
137 * Handles are RPC call specific and we use an inheritance mechanism to
138 * ensure that each handle has a pointer to the client_t. When the top
139 * level (bind) handle is released, we close the connection.
140 */
141 typedef struct mlrpc_handle mlsvc_handle_t;
142
143 /* mlsvc_client.c */
144 void ndr_rpc_init(void);
145 void ndr_rpc_fini(void);
146 uint32_t ndr_rpc_bind(mlsvc_handle_t *, char *, char *, char *, const char *);
147 void ndr_rpc_unbind(mlsvc_handle_t *);
148 void ndr_rpc_status(mlsvc_handle_t *, int, uint32_t);
149
150 /* These three get info about the connected client. */
151 boolean_t ndr_is_admin(ndr_xa_t *);
152 boolean_t ndr_is_poweruser(ndr_xa_t *);
153 int32_t ndr_native_os(ndr_xa_t *);
154
155 /* SRVSVC */
156 int srvsvc_net_remote_tod(char *, char *, struct timeval *, struct tm *);
157
158 /* SVCCTL service */
159 /*
160 * Calculate the wide-char equivalent string length required to
161 * store a string - including the terminating null wide-char.
162 */
163 #define SVCCTL_WNSTRLEN(S) ((strlen((S)) + 1) * sizeof (smb_wchar_t))
164
165 /* An AVL-storable node representing each service in the SCM database. */
166 typedef struct svcctl_svc_node {
167 uu_avl_node_t sn_node;
168 char *sn_name; /* Service Name (Key) */
169 char *sn_fmri; /* Display Name (FMRI) */
170 char *sn_desc; /* Description */
171 char *sn_state; /* State */
172 } svcctl_svc_node_t;
173
174 /* This structure provides context for each svcctl_s_OpenManager call. */
175 typedef struct svcctl_manager_context {
176 scf_handle_t *mc_scf_hdl; /* SCF handle */
177 scf_propertygroup_t *mc_scf_gpg; /* Property group */
|