1998-09-26 02:34:40 +04:00
/*
2002-01-30 09:08:46 +03:00
Unix SMB / CIFS implementation .
1998-09-26 02:34:40 +04:00
SMB parameters and setup
Copyright ( C ) Andrew Tridgell 1992 - 1998
Copyright ( C ) Luke Kenneth Casson Leighton 1996 - 1998
Copyright ( C ) Jeremy Allison 1998
This program is free software ; you can redistribute it and / or modify
it under the terms of the GNU General Public License as published by
2007-07-09 23:25:36 +04:00
the Free Software Foundation ; either version 3 of the License , or
1998-09-26 02:34:40 +04:00
( at your option ) any later version .
This program is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
GNU General Public License for more details .
You should have received a copy of the GNU General Public License
2007-07-10 04:52:41 +04:00
along with this program . If not , see < http : //www.gnu.org/licenses/>.
1998-09-26 02:34:40 +04:00
*/
# ifndef _CLIENT_H
# define _CLIENT_H
2013-12-06 16:57:15 +04:00
# define CLI_BUFFER_SIZE SMB_BUFFER_SIZE_MAX
2001-02-20 11:09:06 +03:00
2012-12-04 18:15:38 +04:00
/* default client timeout to 20 seconds on most commands */
# define CLIENT_TIMEOUT (20 * 1000)
1998-09-26 02:34:40 +04:00
/*
* These definitions depend on smb . h
*/
2007-03-19 23:39:58 +03:00
struct print_job_info {
2015-05-10 05:49:09 +03:00
uint16_t id ;
uint16_t priority ;
1998-10-04 13:42:51 +04:00
size_t size ;
fstring user ;
fstring name ;
time_t t ;
} ;
2011-09-15 14:46:59 +04:00
struct smbXcli_conn ;
2011-09-03 12:18:17 +04:00
struct smbXcli_session ;
2011-09-15 14:46:59 +04:00
1999-12-13 16:27:58 +03:00
struct cli_state {
2009-03-13 03:59:24 +03:00
/**
* A list of subsidiary connections for DFS .
*/
struct cli_state * prev , * next ;
1998-10-09 03:57:46 +04:00
int rap_error ;
2011-07-08 12:52:22 +04:00
NTSTATUS raw_status ; /* maybe via NT_STATUS_DOS() */
2011-11-16 17:45:01 +04:00
bool map_dos_errors ;
1999-11-25 01:45:09 +03:00
1998-11-13 01:17:51 +03:00
/*
* The following strings are the
* ones returned by the server if
* the protocol > NT1 .
*/
2011-04-27 23:06:25 +04:00
char * server_type ;
char * server_os ;
char * server_domain ;
1998-11-13 01:17:51 +03:00
2011-04-27 23:06:25 +04:00
char * share ;
char * dev ;
1998-10-09 03:57:46 +04:00
1999-12-13 16:27:58 +03:00
int timeout ; /* in milliseconds. */
1998-10-09 03:57:46 +04:00
int initialised ;
int win95 ;
2010-04-14 05:41:14 +04:00
/* What the server offered. */
uint32_t server_posix_capabilities ;
/* What the client requested. */
uint32_t requested_posix_capabilities ;
2011-12-02 01:24:22 +04:00
bool backup_intent ;
1998-10-09 03:57:46 +04:00
2005-09-30 21:13:37 +04:00
/* The list of pipes currently open on this connection. */
struct rpc_pipe_client * pipe_list ;
Jeremy requested that I get my NTLMSSP patch into CVS. He didn't request
the schannel code, but I've included that anyway. :-)
This patch revives the client-side NTLMSSP support for RPC named pipes
in Samba, and cleans up the client and server schannel code. The use of the
new code is enabled by the 'sign', 'seal' and 'schannel' commands in
rpcclient.
The aim was to prove that our separate NTLMSSP client library actually
implements NTLMSSP signing and sealing as per Microsoft's NTLMv1 implementation,
in the hope that knowing this will assist us in correctly implementing
NTLMSSP signing for SMB packets. (Still not yet functional)
This patch replaces the NTLMSSP implementation in rpc_client/cli_pipe.c with
calls to libsmb/ntlmssp.c. In the process, we have gained the ability to
use the more secure NT password, and the ability to sign-only, instead of
having to seal the pipe connection. (Previously we were limited to sealing,
and could only use the LM-password derived key).
Our new client-side NTLMSSP code also needed alteration to cope with our
comparatively simple server-side implementation. A future step is to replace
it with calls to the same NTLMSSP library.
Also included in this patch is the schannel 'sign only' patch I submitted to
the team earlier. While not enabled (and not functional, at this stage) the
work in this patch makes the code paths *much* easier to follow. I have also
included similar hooks in rpccleint to allow the use of schannel on *any* pipe.
rpcclient now defaults to not using schannel (or any other extra per-pipe
authenticiation) for any connection. The 'schannel' command enables schannel
for all pipes until disabled.
This code is also much more secure than the previous code, as changes to our
cli_pipe routines ensure that the authentication footer cannot be removed
by an attacker, and more error states are correctly handled.
(The same needs to be done to our server)
Andrew Bartlett
(This used to be commit 5472ddc9eaf4e79c5b2e1c8ee8c7f190dc285f19)
2003-07-14 12:46:32 +04:00
2007-10-19 04:40:25 +04:00
bool use_kerberos ;
bool fallback_after_kerberos ;
2010-01-24 18:50:46 +03:00
bool use_ccache ;
2012-06-11 16:02:03 +04:00
bool pw_nt_hash ;
1998-09-26 02:34:40 +04:00
2007-10-19 04:40:25 +04:00
bool use_oplocks ; /* should we use oplocks? */
2001-06-18 12:26:15 +04:00
2009-03-13 03:59:24 +03:00
/* Where (if anywhere) this is mounted under DFS. */
char * dfs_mountpoint ;
2009-04-05 22:18:45 +04:00
2011-09-22 23:09:00 +04:00
struct smbXcli_conn * conn ;
2011-05-05 20:12:07 +04:00
2011-07-19 13:34:35 +04:00
struct {
2016-06-11 02:51:11 +03:00
uint32_t pid ;
2011-07-19 14:52:10 +04:00
uint16_t vc_num ;
2012-06-02 14:45:40 +04:00
struct smbXcli_session * session ;
2012-07-23 22:27:58 +04:00
struct smbXcli_tcon * tcon ;
2011-07-19 13:34:35 +04:00
} smb1 ;
2011-05-05 20:12:07 +04:00
struct {
2011-09-03 12:18:17 +04:00
struct smbXcli_session * session ;
2012-07-24 00:22:02 +04:00
struct smbXcli_tcon * tcon ;
2013-08-08 02:54:05 +04:00
struct idr_context * open_handles ;
2011-05-05 20:12:07 +04:00
} smb2 ;
2008-02-28 16:41:25 +03:00
} ;
2010-07-27 12:59:55 +04:00
struct file_info {
2008-10-14 03:59:36 +04:00
uint64_t size ;
2019-01-18 03:59:08 +03:00
uint64_t allocated_size ;
2015-05-10 05:49:09 +03:00
uint16_t mode ;
2007-03-09 02:54:57 +03:00
uid_t uid ;
gid_t gid ;
2019-01-18 03:13:23 +03:00
uint64_t ino ;
2007-03-09 02:54:57 +03:00
/* these times are normally kept in GMT */
2018-04-06 23:35:05 +03:00
struct timespec btime_ts ; /* Birth-time if supported by system */
2007-03-09 02:54:57 +03:00
struct timespec mtime_ts ;
struct timespec atime_ts ;
struct timespec ctime_ts ;
2007-12-07 04:16:33 +03:00
char * name ;
2011-07-06 20:57:27 +04:00
char * short_name ;
2010-07-27 12:59:55 +04:00
} ;
2007-03-09 02:54:57 +03:00
2002-07-15 14:35:28 +04:00
# define CLI_FULL_CONNECTION_DONT_SPNEGO 0x0001
# define CLI_FULL_CONNECTION_USE_KERBEROS 0x0002
2006-09-28 07:21:49 +04:00
# define CLI_FULL_CONNECTION_ANONYMOUS_FALLBACK 0x0004
2008-04-08 16:10:48 +04:00
# define CLI_FULL_CONNECTION_FALLBACK_AFTER_KERBEROS 0x0008
2009-04-06 22:45:08 +04:00
# define CLI_FULL_CONNECTION_OPLOCKS 0x0010
# define CLI_FULL_CONNECTION_LEVEL_II_OPLOCKS 0x0020
2010-01-24 19:34:13 +03:00
# define CLI_FULL_CONNECTION_USE_CCACHE 0x0040
2011-09-08 11:18:45 +04:00
# define CLI_FULL_CONNECTION_FORCE_DOS_ERRORS 0x0080
2011-09-08 11:49:26 +04:00
# define CLI_FULL_CONNECTION_FORCE_ASCII 0x0100
2012-06-11 15:32:07 +04:00
# define CLI_FULL_CONNECTION_USE_NT_HASH 0x0200
2017-06-19 09:16:57 +03:00
# define CLI_FULL_CONNECTION_FORCE_SMB1 0x0400
2017-06-19 10:57:28 +03:00
# define CLI_FULL_CONNECTION_DISABLE_SMB1 0x0800
2002-07-15 14:35:28 +04:00
1998-09-26 02:34:40 +04:00
# endif /* _CLIENT_H */