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 /*
23 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Copyright 2019 Nexenta Systems, Inc. All rights reserved.
25 */
26
27 #ifndef _LIBSMB_H
28 #define _LIBSMB_H
29
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33
34 #include <sys/types.h>
35 #include <sys/inttypes.h>
36 #include <sys/list.h>
37 #include <sys/avl.h>
38 #include <arpa/inet.h>
39 #include <net/if.h> /* LIFNAMSIZ */
40 #include <netdb.h>
41 #include <stdlib.h>
42 #include <libscf.h>
43 #include <libshare.h>
44 #include <uuid/uuid.h>
143 SMB_CI_MACHINE_PASSWD,
144 SMB_CI_MACHINE_UUID,
145 SMB_CI_KPASSWD_SRV,
146 SMB_CI_KPASSWD_DOMAIN,
147 SMB_CI_KPASSWD_SEQNUM,
148 SMB_CI_NETLOGON_SEQNUM,
149 SMB_CI_IPV6_ENABLE,
150 SMB_CI_PRINT_ENABLE,
151 SMB_CI_MAP,
152 SMB_CI_UNMAP,
153 SMB_CI_DISPOSITION,
154 SMB_CI_DFS_STDROOT_NUM,
155 SMB_CI_TRAVERSE_MOUNTS,
156 SMB_CI_SMB2_ENABLE_OLD, /* obsolete */
157 SMB_CI_INITIAL_CREDITS,
158 SMB_CI_MAXIMUM_CREDITS,
159 SMB_CI_MAX_PROTOCOL,
160 SMB_CI_ENCRYPT,
161 SMB_CI_MIN_PROTOCOL,
162 SMB_CI_BYPASS_TRAVERSE_CHECKING,
163
164 SMB_CI_MAX
165 } smb_cfg_id_t;
166
167 /* SMF helper functions */
168 extern smb_scfhandle_t *smb_smf_scf_init(char *);
169 extern void smb_smf_scf_fini(smb_scfhandle_t *);
170 extern int smb_smf_start_transaction(smb_scfhandle_t *);
171 extern int smb_smf_end_transaction(smb_scfhandle_t *);
172 extern int smb_smf_set_string_property(smb_scfhandle_t *, char *, char *);
173 extern int smb_smf_get_string_property(smb_scfhandle_t *, char *,
174 char *, size_t);
175 extern int smb_smf_set_integer_property(smb_scfhandle_t *, char *, int64_t);
176 extern int smb_smf_get_integer_property(smb_scfhandle_t *, char *, int64_t *);
177 extern int smb_smf_set_boolean_property(smb_scfhandle_t *, char *, uint8_t);
178 extern int smb_smf_get_boolean_property(smb_scfhandle_t *, char *, uint8_t *);
179 extern int smb_smf_set_opaque_property(smb_scfhandle_t *, char *,
180 void *, size_t);
181 extern int smb_smf_get_opaque_property(smb_scfhandle_t *, char *,
182 void *, size_t);
204 extern boolean_t smb_config_get_ads_enable(void);
205 extern int smb_config_get_debug(void);
206 extern uint8_t smb_config_get_fg_flag(void);
207 extern char *smb_config_get_localsid(void);
208 extern int smb_config_get_localuuid(uuid_t);
209 extern int smb_config_secmode_fromstr(char *);
210 extern char *smb_config_secmode_tostr(int);
211 extern int smb_config_get_secmode(void);
212 extern int smb_config_set_secmode(int);
213 extern int smb_config_set_idmap_domain(char *);
214 extern int smb_config_refresh_idmap(void);
215 extern int smb_config_getip(smb_cfg_id_t, smb_inaddr_t *);
216 extern void smb_config_get_version(smb_version_t *);
217 uint32_t smb_config_get_execinfo(char *, char *, size_t);
218 extern void smb_config_get_negtok(uchar_t *, uint32_t *);
219
220 extern int smb_config_check_protocol(char *);
221 extern uint32_t smb_config_get_max_protocol(void);
222 extern uint32_t smb_config_get_min_protocol(void);
223 extern void smb_config_upgrade(void);
224
225 extern smb_cfg_val_t smb_config_get_require(smb_cfg_id_t);
226
227 extern void smb_load_kconfig(smb_kmod_cfg_t *kcfg);
228 extern uint32_t smb_crc_gen(uint8_t *, size_t);
229
230 extern boolean_t smb_match_netlogon_seqnum(void);
231 extern int smb_setdomainprops(char *, char *, char *);
232 extern void smb_update_netlogon_seqnum(void);
233
234 /* maximum password length on Windows 2000 and above */
235 #define SMB_PASSWD_MAXLEN 127
236 #define SMB_USERNAME_MAXLEN 40
237
238 /* See also: smb_joininfo_xdr() */
239 typedef struct smb_joininfo {
240 char domain_name[MAXHOSTNAMELEN];
241 char domain_username[SMB_USERNAME_MAXLEN + 1];
242 char domain_passwd[SMB_PASSWD_MAXLEN + 1];
243 uint32_t mode;
|
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 /*
23 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Copyright 2019 Nexenta Systems, Inc. All rights reserved.
25 * Copyright 2020 RackTop Systems, Inc.
26 */
27
28 #ifndef _LIBSMB_H
29 #define _LIBSMB_H
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34
35 #include <sys/types.h>
36 #include <sys/inttypes.h>
37 #include <sys/list.h>
38 #include <sys/avl.h>
39 #include <arpa/inet.h>
40 #include <net/if.h> /* LIFNAMSIZ */
41 #include <netdb.h>
42 #include <stdlib.h>
43 #include <libscf.h>
44 #include <libshare.h>
45 #include <uuid/uuid.h>
144 SMB_CI_MACHINE_PASSWD,
145 SMB_CI_MACHINE_UUID,
146 SMB_CI_KPASSWD_SRV,
147 SMB_CI_KPASSWD_DOMAIN,
148 SMB_CI_KPASSWD_SEQNUM,
149 SMB_CI_NETLOGON_SEQNUM,
150 SMB_CI_IPV6_ENABLE,
151 SMB_CI_PRINT_ENABLE,
152 SMB_CI_MAP,
153 SMB_CI_UNMAP,
154 SMB_CI_DISPOSITION,
155 SMB_CI_DFS_STDROOT_NUM,
156 SMB_CI_TRAVERSE_MOUNTS,
157 SMB_CI_SMB2_ENABLE_OLD, /* obsolete */
158 SMB_CI_INITIAL_CREDITS,
159 SMB_CI_MAXIMUM_CREDITS,
160 SMB_CI_MAX_PROTOCOL,
161 SMB_CI_ENCRYPT,
162 SMB_CI_MIN_PROTOCOL,
163 SMB_CI_BYPASS_TRAVERSE_CHECKING,
164 SMB_CI_ENCRYPT_CIPHER,
165
166 SMB_CI_MAX
167 } smb_cfg_id_t;
168
169 /* SMF helper functions */
170 extern smb_scfhandle_t *smb_smf_scf_init(char *);
171 extern void smb_smf_scf_fini(smb_scfhandle_t *);
172 extern int smb_smf_start_transaction(smb_scfhandle_t *);
173 extern int smb_smf_end_transaction(smb_scfhandle_t *);
174 extern int smb_smf_set_string_property(smb_scfhandle_t *, char *, char *);
175 extern int smb_smf_get_string_property(smb_scfhandle_t *, char *,
176 char *, size_t);
177 extern int smb_smf_set_integer_property(smb_scfhandle_t *, char *, int64_t);
178 extern int smb_smf_get_integer_property(smb_scfhandle_t *, char *, int64_t *);
179 extern int smb_smf_set_boolean_property(smb_scfhandle_t *, char *, uint8_t);
180 extern int smb_smf_get_boolean_property(smb_scfhandle_t *, char *, uint8_t *);
181 extern int smb_smf_set_opaque_property(smb_scfhandle_t *, char *,
182 void *, size_t);
183 extern int smb_smf_get_opaque_property(smb_scfhandle_t *, char *,
184 void *, size_t);
206 extern boolean_t smb_config_get_ads_enable(void);
207 extern int smb_config_get_debug(void);
208 extern uint8_t smb_config_get_fg_flag(void);
209 extern char *smb_config_get_localsid(void);
210 extern int smb_config_get_localuuid(uuid_t);
211 extern int smb_config_secmode_fromstr(char *);
212 extern char *smb_config_secmode_tostr(int);
213 extern int smb_config_get_secmode(void);
214 extern int smb_config_set_secmode(int);
215 extern int smb_config_set_idmap_domain(char *);
216 extern int smb_config_refresh_idmap(void);
217 extern int smb_config_getip(smb_cfg_id_t, smb_inaddr_t *);
218 extern void smb_config_get_version(smb_version_t *);
219 uint32_t smb_config_get_execinfo(char *, char *, size_t);
220 extern void smb_config_get_negtok(uchar_t *, uint32_t *);
221
222 extern int smb_config_check_protocol(char *);
223 extern uint32_t smb_config_get_max_protocol(void);
224 extern uint32_t smb_config_get_min_protocol(void);
225 extern void smb_config_upgrade(void);
226 extern uint16_t smb31_config_get_encrypt_cipher(void);
227
228 extern smb_cfg_val_t smb_config_get_require(smb_cfg_id_t);
229
230 extern void smb_load_kconfig(smb_kmod_cfg_t *kcfg);
231 extern uint32_t smb_crc_gen(uint8_t *, size_t);
232
233 extern boolean_t smb_match_netlogon_seqnum(void);
234 extern int smb_setdomainprops(char *, char *, char *);
235 extern void smb_update_netlogon_seqnum(void);
236
237 /* maximum password length on Windows 2000 and above */
238 #define SMB_PASSWD_MAXLEN 127
239 #define SMB_USERNAME_MAXLEN 40
240
241 /* See also: smb_joininfo_xdr() */
242 typedef struct smb_joininfo {
243 char domain_name[MAXHOSTNAMELEN];
244 char domain_username[SMB_USERNAME_MAXLEN + 1];
245 char domain_passwd[SMB_PASSWD_MAXLEN + 1];
246 uint32_t mode;
|