00001 /* 00002 Unix SMB/CIFS implementation. 00003 SMB parameters and setup 00004 Copyright (C) Andrew Tridgell 1992-1998 00005 Copyright (C) Luke Kenneth Casson Leighton 1996-1998 00006 Copyright (C) Jeremy Allison 1998 00007 00008 This program is free software; you can redistribute it and/or modify 00009 it under the terms of the GNU General Public License as published by 00010 the Free Software Foundation; either version 2 of the License, or 00011 (at your option) any later version. 00012 00013 This program is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 GNU General Public License for more details. 00017 00018 You should have received a copy of the GNU General Public License 00019 along with this program; if not, write to the Free Software 00020 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00021 */ 00022 00023 #ifndef _CLIENT_H 00024 #define _CLIENT_H 00025 00026 /* the client asks for a smaller buffer to save ram and also to get more 00027 overlap on the wire. This size gives us a nice read/write size, which 00028 will be a multiple of the page size on almost any system */ 00029 #define CLI_BUFFER_SIZE (0xFFFF) 00030 #define CLI_SAMBA_MAX_LARGE_READX_SIZE (127*1024) /* Works for Samba servers */ 00031 #define CLI_WINDOWS_MAX_LARGE_READX_SIZE ((64*1024)-2) /* Windows servers are broken.... */ 00032 00033 /* 00034 * These definitions depend on smb.h 00035 */ 00036 00037 struct print_job_info 00038 { 00039 uint16 id; 00040 uint16 priority; 00041 size_t size; 00042 fstring user; 00043 fstring name; 00044 time_t t; 00045 }; 00046 00047 struct cli_pipe_auth_data { 00048 enum pipe_auth_type auth_type; /* switch for the union below. Defined in ntdomain.h */ 00049 enum pipe_auth_level auth_level; /* defined in ntdomain.h */ 00050 union { 00051 struct schannel_auth_struct *schannel_auth; 00052 NTLMSSP_STATE *ntlmssp_state; 00053 struct kerberos_auth_struct *kerberos_auth; 00054 } a_u; 00055 void (*cli_auth_data_free_func)(struct cli_pipe_auth_data *); 00056 }; 00057 00058 struct rpc_pipe_client { 00059 struct rpc_pipe_client *prev, *next; 00060 00061 TALLOC_CTX *mem_ctx; 00062 00063 struct cli_state *cli; 00064 00065 int pipe_idx; 00066 const char *pipe_name; 00067 uint16 fnum; 00068 00069 const char *domain; 00070 const char *user_name; 00071 struct pwd_info pwd; 00072 00073 uint16 max_xmit_frag; 00074 uint16 max_recv_frag; 00075 00076 struct cli_pipe_auth_data auth; 00077 00078 /* The following is only non-null on a netlogon pipe. */ 00079 struct dcinfo *dc; 00080 }; 00081 00082 struct cli_state { 00083 int port; 00084 int fd; 00085 int smb_rw_error; /* Copy of last read or write error. */ 00086 uint16 cnum; 00087 uint16 pid; 00088 uint16 mid; 00089 uint16 vuid; 00090 int protocol; 00091 int sec_mode; 00092 int rap_error; 00093 int privileges; 00094 00095 fstring desthost; 00096 00097 /* The credentials used to open the cli_state connection. */ 00098 fstring domain; 00099 fstring user_name; 00100 struct pwd_info pwd; 00101 00102 /* 00103 * The following strings are the 00104 * ones returned by the server if 00105 * the protocol > NT1. 00106 */ 00107 fstring server_type; 00108 fstring server_os; 00109 fstring server_domain; 00110 00111 fstring share; 00112 fstring dev; 00113 struct nmb_name called; 00114 struct nmb_name calling; 00115 fstring full_dest_host_name; 00116 struct in_addr dest_ip; 00117 00118 DATA_BLOB secblob; /* cryptkey or negTokenInit */ 00119 uint32 sesskey; 00120 int serverzone; 00121 uint32 servertime; 00122 int readbraw_supported; 00123 int writebraw_supported; 00124 int timeout; /* in milliseconds. */ 00125 size_t max_xmit; 00126 size_t max_mux; 00127 char *outbuf; 00128 char *inbuf; 00129 unsigned int bufsize; 00130 int initialised; 00131 int win95; 00132 BOOL is_samba; 00133 uint32 capabilities; 00134 BOOL dfsroot; 00135 00136 TALLOC_CTX *mem_ctx; 00137 00138 smb_sign_info sign_info; 00139 00140 /* the session key for this CLI, outside 00141 any per-pipe authenticaion */ 00142 DATA_BLOB user_session_key; 00143 00144 /* The list of pipes currently open on this connection. */ 00145 struct rpc_pipe_client *pipe_list; 00146 00147 BOOL use_kerberos; 00148 BOOL fallback_after_kerberos; 00149 BOOL use_spnego; 00150 00151 BOOL use_oplocks; /* should we use oplocks? */ 00152 BOOL use_level_II_oplocks; /* should we use level II oplocks? */ 00153 00154 /* a oplock break request handler */ 00155 BOOL (*oplock_handler)(struct cli_state *cli, int fnum, unsigned char level); 00156 00157 BOOL force_dos_errors; 00158 BOOL case_sensitive; /* False by default. */ 00159 }; 00160 00161 typedef struct file_info { 00162 struct cli_state *cli; 00163 SMB_BIG_UINT size; 00164 uint16 mode; 00165 uid_t uid; 00166 gid_t gid; 00167 /* these times are normally kept in GMT */ 00168 struct timespec mtime_ts; 00169 struct timespec atime_ts; 00170 struct timespec ctime_ts; 00171 pstring name; 00172 pstring dir; 00173 char short_name[13*3]; /* the *3 is to cope with multi-byte */ 00174 } file_info; 00175 00176 #define CLI_FULL_CONNECTION_DONT_SPNEGO 0x0001 00177 #define CLI_FULL_CONNECTION_USE_KERBEROS 0x0002 00178 #define CLI_FULL_CONNECTION_ANONYMOUS_FALLBACK 0x0004 00179 00180 #endif /* _CLIENT_H */