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 (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. 23 * Copyright 2020 Tintri by DDN, Inc. All rights reserved. 24 * Copyright 2020 RackTop Systems, Inc. 25 */ 26 27 #ifndef _SMBSRV_SMBINFO_H 28 #define _SMBSRV_SMBINFO_H 29 30 #include <sys/types.h> 31 #include <sys/uuid.h> 32 #include <smbsrv/netbios.h> 33 #include <netinet/in.h> 34 #include <smbsrv/smb_inet.h> 35 36 #ifdef __cplusplus 37 extern "C" { 38 #endif 39 40 /* 41 * Native OS types used in SmbSessionSetupX. 42 */ 43 #ifndef NATIVE_OS_DEFINED 44 #define NATIVE_OS_DEFINED 45 46 #define NATIVE_OS_UNKNOWN 0x00000000 47 #define NATIVE_OS_WINNT 0x00000001 48 #define NATIVE_OS_WIN95 0x00000002 49 #define NATIVE_OS_MACOS 0x00000003 50 #define NATIVE_OS_WIN2000 0x00000004 51 52 #endif /* NATIVE_OS_DEFINED */ 53 54 55 /* 56 * Native lanman types in SmbSessionSetupX. Note that these values 57 * are not directly related to the negotiated protocol dialect. 58 */ 59 #ifndef NATIVE_LANMAN_DEFINED 60 #define NATIVE_LANMAN_DEFINED 61 62 #define NATIVE_LM_NONE 0x00000000 63 #define NATIVE_LM_NT 0x00000001 64 #define NATIVE_LM_WIN2000 0x00000002 65 66 #endif /* NATIVE_LANMAN_DEFINED */ 67 68 69 /* PDC types to be used in user authentication process */ 70 71 #define PDC_UNKNOWN 0 72 #define PDC_WINNT 1 73 #define PDC_WIN2000 2 74 #define PDC_WINXP 3 75 #define PDC_SAMBA 4 76 77 /* 78 * Please replace the use of MAX_NETWORKS with SMB_PI_MAX_NETWORKS if 79 * you find it used in conjunction with smbparm_info and maybe one day 80 * there will be just a single definition (here) throughout the code. 81 */ 82 #ifndef MAX_NETWORKS 83 #define MAX_NETWORKS 36 84 #endif /* MAX_NETWORKS */ 85 86 #define SMB_PI_MAX_NETWORKS 36 87 #define SMB_PI_MAX_WINS 2 88 89 #define SMB_SECMODE_WORKGRP 1 90 #define SMB_SECMODE_DOMAIN 2 91 92 #define SMB_PI_MAX_HOST 48 93 #define SMB_PI_MAX_DOMAIN 256 94 #define SMB_PI_MAX_SCOPE 16 95 #define SMB_PI_MAX_COMMENT 58 96 #define SMB_PI_MAX_NATIVE_OS 32 97 #define SMB_PI_MAX_LANMAN 32 98 #define SMB_PI_MAX_NEGTOK 256 /* GUID and SMB negotiate token */ 99 100 #define SMB_PI_KEEP_ALIVE_MIN (90 * 60) 101 /* 102 * Some older clients (Windows 98) only handle the low byte 103 * of the max workers value. If the low byte is less than 104 * SMB_PI_MAX_WORKERS_MIN we set it to SMB_PI_MAX_WORKERS_MIN. 105 * SMB_PI_MAX_WORKERS_MIN must therefore be < 256 106 */ 107 #define SMB_PI_MAX_WORKERS_MIN 64 108 #define SMB_PI_MAX_WORKERS_DEF 1024 109 #define SMB_PI_MAX_WORKERS_MAX 16384 110 111 /* 112 * Min/max initial credit grant and credit limit we allow to be 113 * configured via SMB_CI_INITIAL_CREDITS, SMB_CI_MAXIMUM_CREDITS 114 */ 115 #define SMB_PI_INITIAL_CREDITS_MIN 16 116 #define SMB_PI_INITIAL_CREDITS_DEF 20 117 #define SMB_PI_INITIAL_CREDITS_MAX 256 118 119 #define SMB_PI_MAXIMUM_CREDITS_MIN 64 120 #define SMB_PI_MAXIMUM_CREDITS_DEF 1000 121 #define SMB_PI_MAXIMUM_CREDITS_MAX 1024 122 123 #define SMB_PI_NETLOGON_FLAGS_DEFAULT 0x00000000 124 125 /* 126 * sv_size is used by the RPC services and should be set to 127 * sizeof (smb_version_t). 128 */ 129 typedef struct smb_version { 130 uint32_t sv_size; 131 uint32_t sv_major; 132 uint32_t sv_minor; 133 uint32_t sv_build_number; 134 uint32_t sv_platform_id; 135 } smb_version_t; 136 137 typedef enum smb_cfg_val { 138 SMB_CONFIG_DISABLED = 0, 139 SMB_CONFIG_ENABLED = 1, 140 SMB_CONFIG_REQUIRED = 2 141 } smb_cfg_val_t; 142 143 void smb_cfg_set_require(const char *, smb_cfg_val_t *); 144 145 /* See also: smb_ioc_cfg_t */ 146 typedef struct smb_kmod_cfg { 147 uint32_t skc_maxworkers; 148 uint32_t skc_maxconnections; 149 uint32_t skc_keepalive; 150 int32_t skc_restrict_anon; 151 int32_t skc_signing_enable; 152 int32_t skc_signing_required; 153 int32_t skc_oplock_enable; 154 int32_t skc_sync_enable; 155 int32_t skc_secmode; 156 int32_t skc_netbios_enable; 157 int32_t skc_ipv6_enable; 158 int32_t skc_print_enable; 159 int32_t skc_traverse_mounts; 160 uint32_t skc_max_protocol; /* SMB_VERS_... */ 161 uint32_t skc_min_protocol; /* SMB_VERS_... */ 162 smb_cfg_val_t skc_encrypt; /* EncryptData and RejectUnencryptedAccess */ 163 uint16_t skc_encrypt_cipher; /* 3.1.1 encryption cipher */ 164 uint32_t skc_execflags; 165 uint32_t skc_negtok_len; 166 smb_version_t skc_version; 167 uint16_t skc_initial_credits; 168 uint16_t skc_maximum_credits; 169 uuid_t skc_machine_uuid; 170 uchar_t skc_negtok[SMB_PI_MAX_NEGTOK]; 171 char skc_native_os[SMB_PI_MAX_NATIVE_OS]; 172 char skc_native_lm[SMB_PI_MAX_LANMAN]; 173 char skc_nbdomain[NETBIOS_NAME_SZ]; 174 char skc_fqdn[SMB_PI_MAX_DOMAIN]; 175 char skc_hostname[SMB_PI_MAX_HOST]; 176 char skc_system_comment[SMB_PI_MAX_COMMENT]; 177 } smb_kmod_cfg_t; 178 179 #define SMB_EXEC_MAP 0x01 180 #define SMB_EXEC_UNMAP 0x02 181 #define SMB_EXEC_TERM 0x04 182 183 #define SMB_EXEC_DISP_CONTINUE "continue" 184 #define SMB_EXEC_DISP_TERMINATE "terminate" 185 186 /* 187 * Major version numbers 188 */ 189 #define SMB_MAJOR_NT 4 /* Windows 95/98/Me, Windows NT4.0 */ 190 #define SMB_MAJOR_2000 5 191 #define SMB_MAJOR_XP 5 192 #define SMB_MAJOR_2003 5 193 #define SMB_MAJOR_VISTA 6 194 #define SMB_MAJOR_2008 6 195 #define SMB_MAJOR_2008R2 6 196 #define SMB_MAJOR_7 6 197 198 /* 199 * Minor version numbers 200 */ 201 #define SMB_MINOR_NT 0 202 #define SMB_MINOR_2000 0 203 #define SMB_MINOR_XP 1 204 #define SMB_MINOR_2003 2 205 #define SMB_MINOR_VISTA 0 206 #define SMB_MINOR_2008 0 207 #define SMB_MINOR_2008R2 1 208 #define SMB_MINOR_7 1 209 210 /* 211 * Max version length in string format 212 */ 213 #define SMB_VERSTR_LEN 8 214 215 int smbnative_os_value(const char *); 216 int smbnative_lm_value(const char *); 217 int smbnative_pdc_value(const char *); 218 const char *smbnative_os_str(smb_version_t *); 219 const char *smbnative_lm_str(smb_version_t *); 220 221 /* 222 * Support for passthrough authentication. 223 */ 224 #define AUTH_USER_GRANT 0x00000000 225 #define AUTH_GUEST_GRANT 0x00000001 226 #define AUTH_IPC_ONLY_GRANT 0x00000002 227 228 /* 229 * Defined SMB1, SMB2(+) protocol versions, as returned by 230 * smb_config_get_max_protocol() 231 */ 232 #define SMB_VERS_1 1 /* arbitrary value < 0x200 */ 233 #define SMB_VERS_2_BASE 0x200 /* for (SMB2 or higher?) tests */ 234 #define SMB_VERS_2_002 0x202 /* "2.002" */ 235 #define SMB_VERS_2_1 0x210 /* "2.1" */ 236 #define SMB_VERS_3_0 0x300 /* "3.0" */ 237 #define SMB_VERS_3_02 0x302 /* "3.02" */ 238 #define SMB_VERS_3_11 0x311 /* "3.11" */ 239 240 #define SMB3_HASH_SHA512 1 241 242 #define SMB3_CIPHER_NONE 0 243 #define SMB3_CIPHER_AES128_CCM 1 244 #define SMB3_CIPHER_AES128_GCM 2 245 246 #ifdef __cplusplus 247 } 248 #endif 249 250 #endif /* _SMBSRV_SMBINFO_H */ 251