Print this page
1575 untangle libmlrpc ... (smbsrv)
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/lib/smbsrv/libmlsvc/common/libmlsvc.h
+++ new/usr/src/lib/smbsrv/libmlsvc/common/libmlsvc.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
↓ open down ↓ |
18 lines elided |
↑ open up ↑ |
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 22 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
23 23 * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
24 24 */
25 25
26 26 #ifndef _LIBMLSVC_H
27 27 #define _LIBMLSVC_H
28 28
29 -#include <uuid/uuid.h>
30 29 #include <sys/param.h>
31 30 #include <sys/types.h>
32 31 #include <sys/uio.h>
33 32 #include <sys/ksynch.h>
33 +#include <uuid/uuid.h>
34 +
34 35 #include <time.h>
35 36 #include <stdio.h>
36 37 #include <string.h>
38 +#include <syslog.h>
37 39 #include <netdb.h>
38 40 #include <libuutil.h>
39 -#include <smbsrv/wintypes.h>
41 +
42 +#include <smb/wintypes.h>
43 +#include <libmlrpc/libmlrpc.h>
44 +
40 45 #include <smbsrv/hash_table.h>
41 46 #include <smbsrv/smb_token.h>
42 47 #include <smbsrv/smb_privilege.h>
43 48 #include <smbsrv/smb_share.h>
44 49 #include <smbsrv/smb_xdr.h>
45 50 #include <smbsrv/smb_dfs.h>
46 51 #include <smbsrv/libsmb.h>
47 -#include <smbsrv/libmlrpc.h>
48 -#include <smbsrv/ndl/lsarpc.ndl>
49 52
50 53 #ifdef __cplusplus
51 54 extern "C" {
52 55 #endif
53 56
54 57 uint32_t lsa_lookup_name(char *, uint16_t, smb_account_t *);
55 58 uint32_t lsa_lookup_sid(smb_sid_t *, smb_account_t *);
56 59
57 60 /*
58 61 * SMB domain API to discover a domain controller and obtain domain
59 62 * information.
60 63 */
61 64
62 65 extern boolean_t smb_locate_dc(char *, smb_domainex_t *);
63 66 uint32_t smb_ddiscover_dns(char *, smb_domainex_t *);
64 67 extern void smb_ddiscover_bad_dc(char *);
65 68 extern void smb_ddiscover_refresh(void);
66 69 extern int smb_ddiscover_wait(void);
67 70
68 71 extern int dssetup_check_service(void);
69 72 extern void dssetup_clear_domain_info(void);
70 73 extern void mlsvc_disconnect(const char *);
71 74 extern int mlsvc_init(void);
72 75 extern void mlsvc_fini(void);
73 76 extern DWORD mlsvc_netlogon(char *, char *);
74 77 extern void mlsvc_join(smb_joininfo_t *, smb_joinres_t *);
75 78
76 79 extern void smb_logon_domain(smb_logon_t *, smb_token_t *);
77 80 extern uint32_t smb_decode_krb5_pac(smb_token_t *, char *, uint_t);
78 81 extern boolean_t smb_token_setup_common(smb_token_t *);
79 82
80 83
81 84 /*
82 85 * The maximum number of domains (NT limit).
83 86 */
84 87 #define MLSVC_DOMAIN_MAX 32
85 88
86 89 #define MLSVC_ANON_USER "IPC$"
87 90
88 91 char *mlsvc_ipc_name(int ipc_type, char *username);
89 92
90 93 /*
91 94 * Passthrough negotiation and authentication interface.
92 95 *
93 96 * NT supports two forms of password: a Lanman (case-insensitive)
94 97 * password and an NT (case-sensitive) password. If either of the
95 98 * passwords is not available its pointer and length should be set
96 99 * to zero. The session key and vc number are required to validate
97 100 * the encrypted passwords.
98 101 */
99 102
100 103 void mlsvc_nt_password_hash(char *result, char *password);
101 104 int mlsvc_encrypt_nt_password(char *password, char *key, int keylen, char *out,
102 105 int outmax);
103 106
104 107 #define SMB_AUTOHOME_FILE "smbautohome"
105 108 #define SMB_AUTOHOME_PATH "/etc"
106 109
107 110 typedef struct smb_autohome {
108 111 struct smb_autohome *ah_next;
109 112 uint32_t ah_hits;
110 113 time_t ah_timestamp;
111 114 char *ah_name; /* User account name */
112 115 char *ah_path; /* Home directory path */
113 116 char *ah_container; /* ADS container distinguished name */
114 117 } smb_autohome_t;
115 118
116 119 extern void smb_autohome_add(const smb_token_t *);
117 120 extern void smb_autohome_remove(const char *);
118 121
119 122 /*
↓ open down ↓ |
61 lines elided |
↑ open up ↑ |
120 123 * A local unique id (LUID) is an opaque id used by servers to identify
121 124 * local resources, such as privileges. A client will use lookup
122 125 * functions to translate the LUID to a more general, machine independent
123 126 * form; such as a string.
124 127 */
125 128 typedef struct ms_luid {
126 129 uint32_t low_part;
127 130 uint32_t high_part;
128 131 } ms_luid_t;
129 132
130 -int srvsvc_net_remote_tod(char *, char *, struct timeval *, struct tm *);
131 -
132 -
133 133 /*
134 134 * A client_t is created while binding a client connection to hold the
135 135 * context for calls made using that connection.
136 136 *
137 137 * Handles are RPC call specific and we use an inheritance mechanism to
138 138 * ensure that each handle has a pointer to the client_t. When the top
139 139 * level (bind) handle is released, we close the connection.
140 140 */
141 -typedef struct mlsvc_handle {
142 - ndr_hdid_t handle;
143 - ndr_client_t *clnt;
144 -} mlsvc_handle_t;
141 +typedef struct mlrpc_handle mlsvc_handle_t;
145 142
143 +/* mlsvc_client.c */
146 144 void ndr_rpc_init(void);
147 145 void ndr_rpc_fini(void);
148 146 uint32_t ndr_rpc_bind(mlsvc_handle_t *, char *, char *, char *, const char *);
149 147 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 148 void ndr_rpc_status(mlsvc_handle_t *, int, uint32_t);
160 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 +
161 158 /* SVCCTL service */
162 159 /*
163 160 * Calculate the wide-char equivalent string length required to
164 161 * store a string - including the terminating null wide-char.
165 162 */
166 163 #define SVCCTL_WNSTRLEN(S) ((strlen((S)) + 1) * sizeof (smb_wchar_t))
167 164
168 165 /* An AVL-storable node representing each service in the SCM database. */
169 166 typedef struct svcctl_svc_node {
170 167 uu_avl_node_t sn_node;
171 168 char *sn_name; /* Service Name (Key) */
172 169 char *sn_fmri; /* Display Name (FMRI) */
173 170 char *sn_desc; /* Description */
174 171 char *sn_state; /* State */
175 172 } svcctl_svc_node_t;
176 173
177 174 /* This structure provides context for each svcctl_s_OpenManager call. */
178 175 typedef struct svcctl_manager_context {
179 176 scf_handle_t *mc_scf_hdl; /* SCF handle */
180 177 scf_propertygroup_t *mc_scf_gpg; /* Property group */
181 178 scf_property_t *mc_scf_gprop; /* Property */
182 179 scf_value_t *mc_scf_gval; /* Value */
183 180 uint32_t mc_scf_numsvcs; /* Number of SMF services */
184 181 ssize_t mc_scf_max_fmri_len; /* Max FMRI length */
185 182 ssize_t mc_scf_max_value_len; /* Max Value length */
186 183 uint32_t mc_bytes_needed; /* Number of bytes needed */
187 184 uu_avl_pool_t *mc_svcs_pool; /* AVL pool */
188 185 uu_avl_t *mc_svcs; /* AVL tree of SMF services */
189 186 } svcctl_manager_context_t;
190 187
191 188 /* This structure provides context for each svcctl_s_OpenService call. */
192 189 typedef struct svcctl_service_context {
193 190 ndr_hdid_t *sc_mgrid; /* Manager ID */
194 191 char *sc_svcname; /* Service Name */
195 192 } svcctl_service_context_t;
196 193
197 194 typedef enum {
198 195 SVCCTL_MANAGER_CONTEXT = 0,
199 196 SVCCTL_SERVICE_CONTEXT
200 197 } svcctl_context_type_t;
201 198
202 199 /* This structure provides abstraction for service and manager context call. */
203 200 typedef struct svcctl_context {
204 201 svcctl_context_type_t c_type;
205 202 union {
206 203 svcctl_manager_context_t *uc_mgr;
207 204 svcctl_service_context_t *uc_svc;
208 205 void *uc_cp;
209 206 } c_ctx;
210 207 } svcctl_context_t;
211 208
212 209 /* Service Control Manager (SCM) functions */
213 210 void svcctl_init(void);
214 211 void svcctl_fini(void);
215 212 int svcctl_scm_init(svcctl_manager_context_t *);
216 213 void svcctl_scm_fini(svcctl_manager_context_t *);
217 214 int svcctl_scm_scf_handle_init(svcctl_manager_context_t *);
218 215 void svcctl_scm_scf_handle_fini(svcctl_manager_context_t *);
219 216 int svcctl_scm_refresh(svcctl_manager_context_t *);
220 217 uint32_t svcctl_scm_enum_services(svcctl_manager_context_t *, uint8_t *,
221 218 size_t, uint32_t *, boolean_t);
222 219 uint32_t svcctl_scm_validate_service(svcctl_manager_context_t *, char *);
223 220 svcctl_svc_node_t *svcctl_scm_find_service(svcctl_manager_context_t *, char *);
224 221 uint32_t svcctl_scm_map_status(const char *);
225 222
226 223 /* LOGR service */
227 224 #define LOGR_APPLICATION_LOG "Application"
228 225 #define LOGR_SECURITY_LOG "Security"
229 226 #define LOGR_SYSTEM_LOG "System"
230 227 #define LOGR_NMSGMASK 1023
231 228 #define LOGR_MAXMSGLEN 800
232 229
233 230 typedef struct logr_entry {
234 231 struct timeval le_timestamp; /* Time of log entry */
235 232 int le_pri; /* Message priority */
236 233 char le_hostname[MAXHOSTNAMELEN]; /* Log hostname */
237 234 char le_msg[LOGR_MAXMSGLEN]; /* Log message text */
238 235 } logr_entry_t;
239 236
240 237 typedef struct logr_info {
241 238 logr_entry_t li_entry[LOGR_NMSGMASK+1]; /* Array of log entry */
242 239 int li_idx; /* Index */
243 240 } logr_info_t;
244 241
245 242 typedef struct logr_read_data {
246 243 int rd_tot_recnum; /* Total no. of record read */
247 244 int rd_last_sentrec; /* Last sentence read */
248 245 char rd_first_read; /* First sentence read */
249 246 logr_info_t *rd_log; /* Log information read */
250 247 } logr_read_data_t;
251 248
252 249 /* This structure provides the context for eventlog calls from clients. */
253 250 typedef struct logr_context {
254 251 logr_read_data_t *lc_cached_read_data;
255 252 char *lc_source_name;
256 253 } logr_context_t;
257 254
258 255 void logr_init(void);
259 256 void logr_fini(void);
260 257 boolean_t logr_is_supported(char *);
261 258 int logr_get_snapshot(logr_context_t *);
262 259
263 260 /* User and Group quotas */
264 261 uint32_t smb_quota_query(smb_quota_query_t *, smb_quota_response_t *);
265 262 uint32_t smb_quota_set(smb_quota_set_t *);
266 263 void smb_quota_free(smb_quota_response_t *);
267 264
268 265 uint32_t dfs_get_referrals(const char *, dfs_reftype_t, dfs_info_t *);
269 266 void dfs_info_free(dfs_info_t *);
270 267
271 268 /*
272 269 * The spoolss installable copyfile API.
273 270 */
274 271 typedef void (*spoolss_copyfile_t)(smb_inaddr_t *, char *, char *, char *);
275 272 void spoolss_register_copyfile(spoolss_copyfile_t);
276 273
277 274 #ifdef __cplusplus
278 275 }
279 276 #endif
280 277
281 278 #endif /* _LIBMLSVC_H */
↓ open down ↓ |
111 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX