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 2013 Nexenta Systems, Inc. All rights reserved. 24 */ 25 26 #ifndef _SMBSRV_SMBINFO_H 27 #define _SMBSRV_SMBINFO_H 28 29 #include <sys/types.h> 30 #include <sys/uuid.h> 31 #include <smbsrv/netbios.h> 32 #include <netinet/in.h> 33 #include <smbsrv/smb_inet.h> 34 35 #ifdef __cplusplus 36 extern "C" { 37 #endif 38 39 /* 40 * Native OS types used in SmbSessionSetupX. 41 */ 42 #ifndef NATIVE_OS_DEFINED 43 #define NATIVE_OS_DEFINED 44 45 #define NATIVE_OS_UNKNOWN 0x00000000 46 #define NATIVE_OS_WINNT 0x00000001 47 #define NATIVE_OS_WIN95 0x00000002 48 #define NATIVE_OS_MACOS 0x00000003 49 #define NATIVE_OS_WIN2000 0x00000004 50 51 #endif /* NATIVE_OS_DEFINED */ 52 53 54 /* 55 * Native lanman types in SmbSessionSetupX. Note that these values 56 * are not directly related to the negotiated protocol dialect. 57 */ 58 #ifndef NATIVE_LANMAN_DEFINED 59 #define NATIVE_LANMAN_DEFINED 60 61 #define NATIVE_LM_NONE 0x00000000 62 #define NATIVE_LM_NT 0x00000001 63 #define NATIVE_LM_WIN2000 0x00000002 64 65 #endif /* NATIVE_LANMAN_DEFINED */ 66 67 68 /* PDC types to be used in user authentication process */ 69 70 #define PDC_UNKNOWN 0 71 #define PDC_WINNT 1 72 #define PDC_WIN2000 2 73 #define PDC_WINXP 3 74 #define PDC_SAMBA 4 75 76 /* 77 * Please replace the use of MAX_NETWORKS with SMB_PI_MAX_NETWORKS if 78 * you find it used in conjunction with smbparm_info and maybe one day 79 * there will be just a single definition (here) throughout the code. 80 */ 81 #ifndef MAX_NETWORKS 82 #define MAX_NETWORKS 36 83 #endif /* MAX_NETWORKS */ 84 85 #define SMB_PI_MAX_NETWORKS 36 86 #define SMB_PI_MAX_WINS 2 87 88 #define SMB_SECMODE_WORKGRP 1 89 #define SMB_SECMODE_DOMAIN 2 90 91 #define SMB_PI_MAX_HOST 48 92 #define SMB_PI_MAX_DOMAIN 256 93 #define SMB_PI_MAX_SCOPE 16 94 #define SMB_PI_MAX_COMMENT 58 95 #define SMB_PI_MAX_NATIVE_OS 32 96 #define SMB_PI_MAX_LANMAN 32 97 #define SMB_PI_MAX_NEGTOK 256 /* GUID and SMB negotiate token */ 98 99 #define SMB_PI_KEEP_ALIVE_MIN (90 * 60) 100 /* 101 * Some older clients (Windows 98) only handle the low byte 102 * of the max workers value. If the low byte is less than 103 * SMB_PI_MAX_WORKERS_MIN we set it to SMB_PI_MAX_WORKERS_MIN. 104 * SMB_PI_MAX_WORKERS_MIN must therefore be < 256 105 */ 106 #define SMB_PI_MAX_WORKERS_MIN 64 107 108 /* 109 * sv_size is used by the RPC services and should be set to 110 * sizeof (smb_version_t). 111 */ 112 typedef struct smb_version { 113 uint32_t sv_size; 114 uint32_t sv_major; 115 uint32_t sv_minor; 116 uint32_t sv_build_number; 117 uint32_t sv_platform_id; 118 } smb_version_t; 119 120 /* See also: smb_ioc_cfg_t */ 121 typedef struct smb_kmod_cfg { 122 uint32_t skc_maxworkers; 123 uint32_t skc_maxconnections; 124 uint32_t skc_keepalive; 125 int32_t skc_restrict_anon; 126 int32_t skc_signing_enable; 127 int32_t skc_signing_required; 128 int32_t skc_oplock_enable; 129 int32_t skc_sync_enable; 130 int32_t skc_secmode; 131 int32_t skc_netbios_enable; 132 int32_t skc_ipv6_enable; 133 int32_t skc_print_enable; 134 int32_t skc_traverse_mounts; 135 uint32_t skc_execflags; 136 uint32_t skc_negtok_len; 137 smb_version_t skc_version; 138 /* SMB negotiate protocol response. */ 139 uuid_t skc_machine_uuid; 140 uchar_t skc_negtok[SMB_PI_MAX_NEGTOK]; 141 char skc_native_os[SMB_PI_MAX_NATIVE_OS]; 142 char skc_native_lm[SMB_PI_MAX_LANMAN]; 143 char skc_nbdomain[NETBIOS_NAME_SZ]; 144 char skc_fqdn[SMB_PI_MAX_DOMAIN]; 145 char skc_hostname[SMB_PI_MAX_HOST]; 146 char skc_system_comment[SMB_PI_MAX_COMMENT]; 147 } smb_kmod_cfg_t; 148 149 #define SMB_EXEC_MAP 0x01 150 #define SMB_EXEC_UNMAP 0x02 151 #define SMB_EXEC_TERM 0x04 152 153 #define SMB_EXEC_DISP_CONTINUE "continue" 154 #define SMB_EXEC_DISP_TERMINATE "terminate" 155 156 /* 157 * Major version numbers 158 */ 159 #define SMB_MAJOR_NT 4 /* Windows 95/98/Me, Windows NT4.0 */ 160 #define SMB_MAJOR_2000 5 161 #define SMB_MAJOR_XP 5 162 #define SMB_MAJOR_2003 5 163 #define SMB_MAJOR_VISTA 6 164 #define SMB_MAJOR_2008 6 165 #define SMB_MAJOR_2008R2 6 166 #define SMB_MAJOR_7 6 167 168 /* 169 * Minor version numbers 170 */ 171 #define SMB_MINOR_NT 0 172 #define SMB_MINOR_2000 0 173 #define SMB_MINOR_XP 1 174 #define SMB_MINOR_2003 2 175 #define SMB_MINOR_VISTA 0 176 #define SMB_MINOR_2008 0 177 #define SMB_MINOR_2008R2 1 178 #define SMB_MINOR_7 1 179 180 /* 181 * Max version length in string format 182 */ 183 #define SMB_VERSTR_LEN 8 184 185 int smbnative_os_value(const char *); 186 int smbnative_lm_value(const char *); 187 int smbnative_pdc_value(const char *); 188 const char *smbnative_os_str(smb_version_t *); 189 const char *smbnative_lm_str(smb_version_t *); 190 191 /* 192 * Support for passthrough authentication. 193 */ 194 #define AUTH_USER_GRANT 0x00000000 195 #define AUTH_GUEST_GRANT 0x00000001 196 #define AUTH_IPC_ONLY_GRANT 0x00000002 197 198 #ifdef __cplusplus 199 } 200 #endif 201 202 #endif /* _SMBSRV_SMBINFO_H */ 203