1996-05-04 11:50:46 +04:00
/*
2002-01-30 09:08:46 +03:00
Unix SMB / CIFS implementation .
2002-01-14 09:15:07 +03:00
SMB parameters and setup , plus a whole lot more .
2000-03-10 21:10:10 +03:00
Copyright ( C ) Andrew Tridgell 1992 - 2000
2002-09-25 19:19:00 +04:00
Copyright ( C ) John H Terpstra 1996 - 2002
2000-03-10 21:10:10 +03:00
Copyright ( C ) Luke Kenneth Casson Leighton 1996 - 2000
Copyright ( C ) Paul Ashton 1998 - 2000
2002-01-25 03:35:14 +03:00
Copyright ( C ) Simo Sorce 2001 - 2002
2002-01-14 09:15:07 +03:00
Copyright ( C ) Martin Pool 2002
1996-05-04 11:50:46 +04:00
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
1996-05-04 11:50:46 +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/>.
1996-05-04 11:50:46 +04:00
*/
2000-02-03 07:47:50 +03:00
1996-05-04 11:50:46 +04:00
# ifndef _SMB_H
# define _SMB_H
2005-10-07 19:43:32 +04:00
/* logged when starting the various Samba daemons */
2010-01-04 10:42:03 +03:00
# define COPYRIGHT_STARTUP_MESSAGE "Copyright Andrew Tridgell and the Samba Team 1992-2010"
2005-10-07 19:43:32 +04:00
2002-03-20 10:20:38 +03:00
# if defined(LARGE_SMB_OFF_T)
# define BUFFER_SIZE (128*1024)
# else /* no large readwrite possible */
1996-05-04 11:50:46 +04:00
# define BUFFER_SIZE (0xFFFF)
2002-03-20 10:20:38 +03:00
# endif
1996-05-04 11:50:46 +04:00
# define SAFETY_MARGIN 1024
2001-05-24 23:28:22 +04:00
# define LARGE_WRITEX_HDR_SIZE 65
1996-05-04 11:50:46 +04:00
1996-06-04 10:42:03 +04:00
# define NMB_PORT 137
# define DGRAM_PORT 138
2002-08-17 21:00:51 +04:00
# define SMB_PORT1 445
# define SMB_PORT2 139
# define SMB_PORTS "445 139"
1996-06-04 10:42:03 +04:00
2003-07-31 03:49:29 +04:00
# define Undefined (-1)
2007-10-19 04:40:25 +04:00
# define False false
# define True true
2000-05-29 03:34:34 +04:00
# define Auto (2)
2003-07-16 03:05:57 +04:00
# define Required (3)
1996-05-04 11:50:46 +04:00
# define SIZEOFWORD 2
# ifndef DEF_CREATE_MASK
# define DEF_CREATE_MASK (0755)
# endif
2001-03-10 14:35:25 +03:00
/* string manipulation flags - see clistr.c and srvstr.c */
# define STR_TERMINATE 1
2001-07-04 11:15:53 +04:00
# define STR_UPPER 2
# define STR_ASCII 4
# define STR_UNICODE 8
# define STR_NOALIGN 16
2003-06-06 09:15:28 +04:00
# define STR_TERMINATE_ASCII 128
2001-03-10 14:35:25 +03:00
1996-08-21 18:15:09 +04:00
/* how long to wait for secondary SMB packets (milli-seconds) */
# define SMB_SECONDARY_WAIT (60*1000)
1996-06-10 09:16:19 +04:00
2000-02-03 07:47:50 +03:00
/* Debugging stuff */
# include "debug.h"
1998-08-01 00:16:35 +04:00
1996-07-30 19:47:30 +04:00
/* this defines the error codes that receive_smb can put in smb_read_error */
2007-11-04 01:12:42 +03:00
enum smb_read_errors {
SMB_READ_OK = 0 ,
SMB_READ_TIMEOUT ,
SMB_READ_EOF ,
SMB_READ_ERROR ,
SMB_WRITE_ERROR , /* This error code can go into the client smb_rw_error. */
SMB_READ_BAD_SIG ,
2007-11-30 00:24:54 +03:00
SMB_NO_MEMORY ,
2007-12-27 04:12:36 +03:00
SMB_DO_NOT_DO_TDIS , /* cli_close_connection() check for this when smbfs wants to keep tree connected */
SMB_READ_BAD_DECRYPT
2007-11-04 01:12:42 +03:00
} ;
2003-04-21 17:04:39 +04:00
1996-05-04 11:50:46 +04:00
# define DIR_STRUCT_SIZE 43
/* these define the attribute byte as seen by DOS */
2002-03-07 05:16:25 +03:00
# define aRONLY (1L<<0) /* 0x01 */
# define aHIDDEN (1L<<1) /* 0x02 */
# define aSYSTEM (1L<<2) /* 0x04 */
# define aVOLID (1L<<3) /* 0x08 */
# define aDIR (1L<<4) /* 0x10 */
# define aARCH (1L<<5) /* 0x20 */
1996-05-04 11:50:46 +04:00
/* deny modes */
# define DENY_DOS 0
# define DENY_ALL 1
# define DENY_WRITE 2
# define DENY_READ 3
# define DENY_NONE 4
# define DENY_FCB 7
1998-10-23 04:58:28 +04:00
/* open modes */
# define DOS_OPEN_RDONLY 0
# define DOS_OPEN_WRONLY 1
# define DOS_OPEN_RDWR 2
2005-03-31 23:10:59 +04:00
# define DOS_OPEN_EXEC 3
1998-10-23 04:58:28 +04:00
# define DOS_OPEN_FCB 0xF
/* define shifts and masks for share and open modes. */
2005-07-08 08:51:27 +04:00
# define OPENX_MODE_MASK 0xF
# define DENY_MODE_SHIFT 4
# define DENY_MODE_MASK 0x7
# define GET_OPENX_MODE(x) ((x) & OPENX_MODE_MASK)
# define SET_OPENX_MODE(x) ((x) & OPENX_MODE_MASK)
# define GET_DENY_MODE(x) (((x)>>DENY_MODE_SHIFT) & DENY_MODE_MASK)
# define SET_DENY_MODE(x) (((x) & DENY_MODE_MASK) <<DENY_MODE_SHIFT)
1998-10-23 04:58:28 +04:00
1998-10-23 07:34:50 +04:00
/* Sync on open file (not sure if used anymore... ?) */
# define FILE_SYNC_OPENMODE (1<<14)
# define GET_FILE_SYNC_OPENMODE(x) (((x) & FILE_SYNC_OPENMODE) ? True : False)
1998-10-23 04:58:28 +04:00
/* open disposition values */
2005-07-08 08:51:27 +04:00
# define OPENX_FILE_EXISTS_FAIL 0
# define OPENX_FILE_EXISTS_OPEN 1
# define OPENX_FILE_EXISTS_TRUNCATE 2
1998-10-23 04:58:28 +04:00
/* mask for open disposition. */
2005-07-08 08:51:27 +04:00
# define OPENX_FILE_OPEN_MASK 0x3
1998-10-23 04:58:28 +04:00
2005-07-08 08:51:27 +04:00
# define GET_FILE_OPENX_DISPOSITION(x) ((x) & FILE_OPEN_MASK)
# define SET_FILE_OPENX_DISPOSITION(x) ((x) & FILE_OPEN_MASK)
1998-10-23 04:58:28 +04:00
/* The above can be OR'ed with... */
2005-07-08 08:51:27 +04:00
# define OPENX_FILE_CREATE_IF_NOT_EXIST 0x10
# define OPENX_FILE_FAIL_IF_NOT_EXIST 0
1998-10-23 04:58:28 +04:00
2003-05-12 22:12:31 +04:00
typedef union unid_t {
uid_t uid ;
gid_t gid ;
} unid_t ;
1998-11-10 22:05:00 +03:00
/* pipe string names */
1997-10-22 18:28:19 +04:00
# define PIPE_LANMAN "\\PIPE\\LANMAN"
2003-04-09 19:54:17 +04:00
1998-05-08 21:53:17 +04:00
# define MAX_HOURS_LEN 32
2000-08-04 02:38:43 +04:00
# ifndef MAXSUBAUTHS
1998-10-24 01:45:16 +04:00
# define MAXSUBAUTHS 15 /* max sub authorities in a SID */
2000-08-04 02:38:43 +04:00
# endif
1998-10-24 01:45:16 +04:00
2003-04-15 23:51:17 +04:00
# define SID_MAX_SIZE ((size_t)(8+(MAXSUBAUTHS*4)))
2007-11-28 04:15:37 +03:00
# define LOOKUP_NAME_NONE 0x00000000
2007-05-30 23:47:35 +04:00
# define LOOKUP_NAME_ISOLATED 0x00000001 /* Look up unqualified names */
# define LOOKUP_NAME_REMOTE 0x00000002 /* Ask others */
# define LOOKUP_NAME_GROUP 0x00000004 / * (unused) This is a NASTY hack for
valid users = @ foo where foo also
exists in as user . */
2009-08-01 01:17:54 +04:00
# define LOOKUP_NAME_NO_NSS 0x00000008 / * no NSS calls to avoid
winbind recursions */
2007-11-28 04:15:37 +03:00
# define LOOKUP_NAME_BUILTIN 0x00000010 /* builtin names */
# define LOOKUP_NAME_WKN 0x00000020 /* well known names */
# define LOOKUP_NAME_DOMAIN 0x00000040 /* only lookup own domain */
2007-12-17 13:28:56 +03:00
# define LOOKUP_NAME_LOCAL (LOOKUP_NAME_ISOLATED\
| LOOKUP_NAME_BUILTIN \
| LOOKUP_NAME_WKN \
| LOOKUP_NAME_DOMAIN )
2007-11-28 04:15:37 +03:00
# define LOOKUP_NAME_ALL (LOOKUP_NAME_ISOLATED\
| LOOKUP_NAME_REMOTE \
| LOOKUP_NAME_BUILTIN \
| LOOKUP_NAME_WKN \
| LOOKUP_NAME_DOMAIN )
2006-02-04 01:19:41 +03:00
2008-04-25 00:45:28 +04:00
# include "librpc/gen_ndr/epmapper.h"
2009-03-21 02:10:14 +03:00
# include "librpc/gen_ndr/dcerpc.h"
2010-08-26 14:04:11 +04:00
# include "librpc/gen_ndr/security.h"
2008-01-15 17:43:19 +03:00
2006-02-04 01:19:41 +03:00
struct lsa_dom_info {
2007-10-19 04:40:25 +04:00
bool valid ;
2010-05-21 05:25:01 +04:00
struct dom_sid sid ;
2006-02-04 01:19:41 +03:00
const char * name ;
int num_idxs ;
int * idxs ;
} ;
struct lsa_name_info {
uint32 rid ;
2006-09-08 18:28:06 +04:00
enum lsa_SidType type ;
2006-02-04 01:19:41 +03:00
const char * name ;
int dom_idx ;
} ;
2000-08-02 06:11:55 +04:00
/*
* The complete list of SIDS belonging to this user .
* Created when a vuid is registered .
2000-08-23 21:38:52 +04:00
* The definition of the user_sids array is as follows :
*
* token - > user_sids [ 0 ] = primary user SID .
* token - > user_sids [ 1 ] = primary group SID .
2001-11-30 03:24:43 +03:00
* token - > user_sids [ 2. . num_sids ] = supplementary group SIDS .
2000-08-02 06:11:55 +04:00
*/
2001-11-04 02:34:24 +03:00
# define PRIMARY_USER_SID_INDEX 0
# define PRIMARY_GROUP_SID_INDEX 1
2008-06-19 18:54:12 +04:00
typedef struct unix_user_token {
2006-02-02 23:44:50 +03:00
uid_t uid ;
gid_t gid ;
2008-06-19 18:54:12 +04:00
size_t ngroups ;
2006-02-02 23:44:50 +03:00
gid_t * groups ;
} UNIX_USER_TOKEN ;
typedef struct write_cache {
SMB_OFF_T file_size ;
SMB_OFF_T offset ;
size_t alloc_size ;
size_t data_size ;
char * data ;
2000-02-03 07:47:50 +03:00
} write_cache ;
2005-07-08 08:51:27 +04:00
struct fd_handle {
size_t ref_count ;
int fd ;
2008-10-14 03:59:36 +04:00
uint64_t position_information ;
2005-07-08 08:51:27 +04:00
SMB_OFF_T pos ;
uint32 private_options ; /* NT Create options, but we only look at
* NTCREATEX_OPTIONS_PRIVATE_DENY_DOS and
2010-03-06 02:10:30 +03:00
* NTCREATEX_OPTIONS_PRIVATE_DENY_FCB and
* NTCREATEX_OPTIONS_PRIVATE_DELETE_ON_CLOSE
2005-07-08 08:51:27 +04:00
* for print files * only * , where
* DELETE_ON_CLOSE is not stored in the share
* mode database .
*/
2007-05-29 13:30:34 +04:00
unsigned long gen_id ;
2005-07-08 08:51:27 +04:00
} ;
2005-09-30 21:13:37 +04:00
struct idle_event ;
struct share_mode_entry ;
2006-09-04 01:07:16 +04:00
struct uuid ;
2008-03-10 23:08:29 +03:00
struct named_mutex ;
2008-12-27 20:43:03 +03:00
struct wb_context ;
2009-01-30 00:54:55 +03:00
struct rpc_cli_smbd_conn ;
2009-04-25 22:02:24 +04:00
struct fncall_context ;
2005-09-30 21:13:37 +04:00
2006-07-11 22:01:26 +04:00
struct vfs_fsp_data {
struct vfs_fsp_data * next ;
struct vfs_handle_struct * owner ;
2009-02-01 07:51:04 +03:00
void ( * destroy ) ( void * p_data ) ;
void * _dummy_ ;
/* NOTE: This structure contains four pointers so that we can guarantee
2006-07-11 22:01:26 +04:00
* that the end of the structure is always both 4 - byte and 8 - byte aligned .
*/
} ;
2007-01-17 19:23:45 +03:00
/* the basic packet size, assuming no words or bytes */
# define smb_size 39
struct notify_change {
uint32_t action ;
2007-01-31 17:19:09 +03:00
const char * name ;
2007-01-17 19:23:45 +03:00
} ;
2007-01-17 21:23:37 +03:00
struct notify_mid_map ;
2007-02-01 16:36:02 +03:00
struct notify_entry ;
struct notify_event ;
2007-02-02 17:55:21 +03:00
struct notify_change_request ;
2007-01-31 16:47:37 +03:00
struct sys_notify_backend ;
struct sys_notify_context {
struct event_context * ev ;
2007-02-01 16:36:02 +03:00
struct connection_struct * conn ;
void * private_data ; /* For use by the system backend */
2007-01-31 16:47:37 +03:00
} ;
2007-01-17 21:23:37 +03:00
2007-01-17 19:23:45 +03:00
struct notify_change_buf {
/*
* If no requests are pending , changes are queued here . Simple array ,
* we only append .
*/
2007-01-21 14:49:00 +03:00
/*
* num_changes = = - 1 means that we have got a catch - all change , when
* asked we just return NT_STATUS_OK without specific changes .
*/
int num_changes ;
2007-01-17 19:23:45 +03:00
struct notify_change * changes ;
/*
* If no changes are around requests are queued here . Using a linked
* list , because we have to append at the end and delete from the top .
*/
struct notify_change_request * requests ;
} ;
2010-04-24 01:26:33 +04:00
struct print_file_data {
2010-04-29 02:55:20 +04:00
char * svcname ;
char * docname ;
char * filename ;
struct policy_handle handle ;
uint32_t jobid ;
2010-04-24 01:26:33 +04:00
uint16 rap_jobid ;
} ;
2004-10-19 02:01:10 +04:00
typedef struct files_struct {
2000-02-03 07:47:50 +03:00
struct files_struct * next , * prev ;
int fnum ;
struct connection_struct * conn ;
2005-07-08 08:51:27 +04:00
struct fd_handle * fh ;
2005-04-15 03:32:56 +04:00
unsigned int num_smb_operations ;
2007-05-29 13:30:34 +04:00
struct file_id file_id ;
2008-10-14 03:59:36 +04:00
uint64_t initial_allocation_size ; /* Faked up initial allocation on disk. */
2000-02-03 07:47:50 +03:00
mode_t mode ;
2003-08-19 05:53:45 +04:00
uint16 file_pid ;
2000-02-03 07:47:50 +03:00
uint16 vuid ;
2000-04-12 21:59:09 +04:00
write_cache * wcp ;
2000-02-03 07:47:50 +03:00
struct timeval open_time ;
2005-07-08 08:51:27 +04:00
uint32 access_mask ; /* NTCreateX access bits (FILE_READ_DATA etc.) */
uint32 share_access ; /* NTCreateX share constants (FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE). */
2008-03-12 17:39:38 +03:00
2008-09-08 17:12:24 +04:00
bool update_write_time_triggered ;
2008-03-12 17:39:38 +03:00
struct timed_event * update_write_time_event ;
bool update_write_time_on_close ;
struct timespec close_write_time ;
bool write_time_forced ;
2000-04-12 21:59:09 +04:00
int oplock_type ;
int sent_oplock_break ;
2005-09-30 21:13:37 +04:00
struct timed_event * oplock_timeout ;
2006-07-18 01:09:02 +04:00
struct lock_struct last_lock_failure ;
2007-03-07 00:59:51 +03:00
int current_lock_count ; /* Count the number of outstanding locks and pending locks. */
2005-09-30 21:13:37 +04:00
struct share_mode_entry * pending_break_messages ;
int num_pending_break_messages ;
2007-10-19 04:40:25 +04:00
bool can_lock ;
bool can_read ;
bool can_write ;
bool modified ;
bool is_directory ;
bool aio_write_behind ;
bool lockdb_clean ;
bool initial_delete_on_close ; /* Only set at NTCreateX if file was created. */
2010-01-13 03:04:44 +03:00
bool delete_on_close ;
2007-10-19 04:40:25 +04:00
bool posix_open ;
2010-12-21 04:58:33 +03:00
bool is_sparse ;
2009-07-11 01:50:37 +04:00
struct smb_filename * fsp_name ;
2006-07-11 22:01:26 +04:00
struct vfs_fsp_data * vfs_extension ;
2008-03-29 20:19:31 +03:00
struct fake_file_handle * fake_file_handle ;
2007-01-17 19:23:45 +03:00
struct notify_change_buf * notify ;
2008-01-20 01:25:36 +03:00
struct files_struct * base_fsp ; /* placeholder for delete on close */
2009-08-06 14:53:05 +04:00
2009-11-16 11:40:47 +03:00
/*
* Read - only cached brlock record , thrown away when the
* brlock . tdb seqnum changes . This avoids fetching data from
* the brlock . tdb on every read / write call .
*/
int brlock_seqnum ;
struct byte_range_lock * brlock_rec ;
2009-08-06 14:53:05 +04:00
struct dptr_struct * dptr ;
2010-04-24 01:26:33 +04:00
/* if not NULL, means this is a print file */
struct print_file_data * print_file ;
2000-02-03 07:47:50 +03:00
} files_struct ;
2003-04-15 23:51:17 +04:00
# include "ntquotas.h"
2003-05-12 03:34:18 +04:00
# include "sysquotas.h"
2003-04-15 23:51:17 +04:00
2010-08-16 10:30:36 +04:00
struct client_address {
char addr [ INET6_ADDRSTRLEN ] ;
const char * name ;
} ;
2006-02-02 23:44:50 +03:00
struct vuid_cache_entry {
2008-05-08 17:09:02 +04:00
struct auth_serversupplied_info * server_info ;
2008-07-26 18:51:00 +04:00
uint16_t vuid ;
2007-10-19 04:40:25 +04:00
bool read_only ;
2004-02-13 22:05:25 +03:00
} ;
2006-02-02 23:44:50 +03:00
struct vuid_cache {
2008-05-07 17:51:42 +04:00
unsigned int next_entry ;
2004-02-13 22:05:25 +03:00
struct vuid_cache_entry array [ VUID_CACHE_SIZE ] ;
1996-05-04 11:50:46 +04:00
} ;
2006-02-02 23:44:50 +03:00
typedef struct {
2004-02-13 22:05:25 +03:00
char * name ;
2007-10-19 04:40:25 +04:00
bool is_wild ;
1997-07-24 21:25:11 +04:00
} name_compare_entry ;
2006-04-10 19:33:04 +04:00
struct trans_state {
struct trans_state * next , * prev ;
uint16 vuid ;
2010-04-13 08:40:28 +04:00
uint64_t mid ;
2006-04-10 19:33:04 +04:00
uint32 max_param_return ;
uint32 max_data_return ;
uint32 max_setup_return ;
uint8 cmd ; /* SMBtrans or SMBtrans2 */
2007-12-11 02:31:05 +03:00
char * name ; /* for trans requests */
2006-04-10 19:33:04 +04:00
uint16 call ; /* for trans2 and nttrans requests */
2007-10-19 04:40:25 +04:00
bool close_on_completion ;
bool one_way ;
2006-04-10 19:33:04 +04:00
unsigned int setup_count ;
uint16 * setup ;
size_t received_data ;
size_t received_param ;
size_t total_param ;
char * param ;
size_t total_data ;
char * data ;
} ;
2008-01-18 13:08:17 +03:00
/*
* Info about an alternate data stream
*/
struct stream_struct {
SMB_OFF_T size ;
SMB_OFF_T alloc_size ;
char * name ;
} ;
2000-02-03 07:47:50 +03:00
/* Include VFS stuff */
2002-03-12 03:08:08 +03:00
# include "smb_acls.h"
2000-02-03 07:47:50 +03:00
# include "vfs.h"
2005-10-20 00:02:12 +04:00
struct dfree_cached_info {
time_t last_dfree_time ;
2008-10-14 03:59:36 +04:00
uint64_t dfree_ret ;
uint64_t bsize ;
uint64_t dfree ;
uint64_t dsize ;
2005-10-20 00:02:12 +04:00
} ;
2005-02-01 03:28:20 +03:00
struct dptr_struct ;
2006-07-11 22:01:26 +04:00
struct share_params {
int service ;
} ;
2006-07-15 02:06:38 +04:00
struct share_iterator {
int next_id ;
} ;
2006-02-02 23:44:50 +03:00
typedef struct connection_struct {
1998-08-17 10:13:32 +04:00
struct connection_struct * next , * prev ;
2009-08-06 15:22:33 +04:00
struct smbd_server_connection * sconn ; /* can be NULL */
1998-08-14 21:38:29 +04:00
unsigned cnum ; /* an index passed over the wire */
2006-07-11 22:01:26 +04:00
struct share_params * params ;
2007-10-19 04:40:25 +04:00
bool force_user ;
2002-09-25 19:19:00 +04:00
struct vuid_cache vuid_cache ;
2007-10-19 04:40:25 +04:00
bool printer ;
bool ipc ;
bool read_only ; /* Attributes for the current user of the share. */
2009-08-25 07:57:37 +04:00
/* Does this filesystem honor
sub second timestamps on files
and directories when setting time ? */
enum timestamp_set_resolution ts_res ;
1998-08-14 21:38:29 +04:00
char * connectpath ;
char * origpath ;
2000-02-03 07:47:50 +03:00
2003-05-12 03:34:18 +04:00
struct vfs_handle_struct * vfs_handles ; /* for the new plugins */
2000-02-03 07:47:50 +03:00
2008-05-10 13:01:26 +04:00
/*
* This represents the user information on this connection . Depending
* on the vuid using this tid , this might change per SMB request .
*/
2008-05-07 14:20:18 +04:00
struct auth_serversupplied_info * server_info ;
2009-03-04 03:08:56 +03:00
/*
* If the " force group " parameter is set , this is the primary gid that
* may be used in the users token , depending on the vuid using this tid .
*/
gid_t force_group_gid ;
1999-12-09 00:43:03 +03:00
uint16 vuid ; /* vuid of user who *opened* this connection, or UID_FIELD_INVALID */
1998-08-14 21:38:29 +04:00
time_t lastused ;
2006-04-15 08:07:10 +04:00
time_t lastused_count ;
2007-10-19 04:40:25 +04:00
bool used ;
1998-08-14 21:38:29 +04:00
int num_files_open ;
2005-04-15 03:32:56 +04:00
unsigned int num_smb_operations ; /* Count of smb operations on this tree. */
2007-12-28 10:51:03 +03:00
int encrypt_level ;
2008-01-04 23:56:23 +03:00
bool encrypted_tid ;
2004-05-07 22:37:47 +04:00
2007-12-23 01:01:25 +03:00
/* Semantics requested by the client or forced by the server config. */
2007-10-19 04:40:25 +04:00
bool case_sensitive ;
bool case_preserve ;
bool short_case_preserve ;
2004-05-07 22:37:47 +04:00
2007-12-23 01:01:25 +03:00
/* Semantics provided by the underlying filesystem. */
int fs_capabilities ;
2010-05-20 22:36:47 +04:00
/* Device number of the directory of the share mount.
Used to ensure unique FileIndex returns . */
SMB_DEV_T base_share_dev ;
2007-12-23 01:01:25 +03:00
1998-08-14 21:38:29 +04:00
name_compare_entry * hide_list ; /* Per-share list of files to return as hidden. */
name_compare_entry * veto_list ; /* Per-share list of files to veto (never show). */
name_compare_entry * veto_oplock_list ; /* Per-share list of files to refuse oplocks on. */
2007-10-11 00:34:30 +04:00
name_compare_entry * aio_write_behind_list ; /* Per-share list of files to use aio write behind on. */
2005-10-20 00:02:12 +04:00
struct dfree_cached_info * dfree_info ;
2006-04-10 19:33:04 +04:00
struct trans_state * pending_trans ;
2007-01-31 17:42:56 +03:00
struct notify_context * notify_ctx ;
2010-04-28 17:51:12 +04:00
struct rpc_pipe_client * spoolss_pipe ;
1998-08-14 21:38:29 +04:00
} connection_struct ;
1997-10-10 18:48:05 +04:00
2006-02-02 23:44:50 +03:00
struct current_user {
1998-08-14 21:38:29 +04:00
connection_struct * conn ;
1998-09-30 00:24:17 +04:00
uint16 vuid ;
2006-02-02 23:44:50 +03:00
UNIX_USER_TOKEN ut ;
2010-08-26 16:08:22 +04:00
struct security_token * nt_user_token ;
1998-08-14 21:38:29 +04:00
} ;
1997-10-10 18:48:05 +04:00
2010-04-09 09:15:55 +04:00
struct smbd_smb2_request ;
2009-02-09 10:10:34 +03:00
2007-07-05 20:26:27 +04:00
struct smb_request {
2008-11-03 00:33:20 +03:00
uint8_t cmd ;
2007-07-05 20:26:27 +04:00
uint16 flags2 ;
uint16 smbpid ;
2010-04-13 08:40:28 +04:00
uint64_t mid ; /* For compatibility with SMB2. */
2009-03-09 11:47:59 +03:00
uint32_t seqnum ;
2007-07-05 20:26:27 +04:00
uint16 vuid ;
2007-07-23 13:36:09 +04:00
uint16 tid ;
uint8 wct ;
2008-11-02 14:20:47 +03:00
uint16_t * vwv ;
2008-11-01 18:24:42 +03:00
uint16_t buflen ;
2008-11-01 19:35:48 +03:00
const uint8_t * buf ;
2007-07-23 13:36:09 +04:00
const uint8 * inbuf ;
2008-10-14 17:53:35 +04:00
/*
* Async handling in the main smb processing loop is directed by
* outbuf : reply_xxx routines indicate sync behaviour by putting their
* reply into " outbuf " . If they leave it as NULL , they take of it
* themselves , possibly later .
*
* If async handling is wanted , the reply_xxx routine must make sure
* that it talloc_move ( ) s the smb_req somewhere else .
*/
2007-07-23 13:36:09 +04:00
uint8 * outbuf ;
2008-10-14 17:53:35 +04:00
2007-10-31 02:22:24 +03:00
size_t unread_bytes ;
2008-01-04 23:56:23 +03:00
bool encrypted ;
connection_struct * conn ;
2010-06-12 13:01:10 +04:00
struct smbd_server_connection * sconn ;
2009-02-09 10:10:34 +03:00
struct smb_perfcount_data pcd ;
2008-11-10 12:01:26 +03:00
/*
* Chained request handling
*/
2008-10-09 18:55:56 +04:00
struct files_struct * chain_fsp ;
2008-11-10 12:01:26 +03:00
/*
* Here we collect the outbufs from the chain handlers
*/
uint8_t * chain_outbuf ;
2008-10-14 17:53:35 +04:00
/*
* state information for async smb handling
*/
void * async_priv ;
2009-07-27 16:47:41 +04:00
bool done ;
2010-04-09 09:15:55 +04:00
/*
* Back pointer to smb2 request .
*/
struct smbd_smb2_request * smb2req ;
2007-07-05 20:26:27 +04:00
} ;
1999-12-13 16:27:58 +03:00
/* Defines for the sent_oplock_break field above. */
# define NO_BREAK_SENT 0
2005-07-15 23:32:56 +04:00
# define BREAK_TO_NONE_SENT 1
1999-12-13 16:27:58 +03:00
# define LEVEL_II_BREAK_SENT 2
2000-05-02 17:55:42 +04:00
typedef struct {
fstring smb_name ; /* user name from the client */
fstring unix_name ; /* unix user name of a validated user */
fstring domain ; /* domain that the client specified */
} userdom_struct ;
2001-02-23 06:59:37 +03:00
/* Extra fields above "LPQ_PRINTING" are used to map extra NT status codes. */
2010-05-04 10:51:12 +04:00
enum {
LPQ_QUEUED = 0 ,
LPQ_PAUSED ,
LPQ_SPOOLING ,
LPQ_PRINTING ,
LPQ_ERROR ,
LPQ_DELETING ,
LPQ_OFFLINE ,
LPQ_PAPEROUT ,
LPQ_PRINTED ,
LPQ_DELETED ,
LPQ_BLOCKED ,
LPQ_USER_INTERVENTION ,
/* smbd is dooing the file spooling before passing control to spoolss */
PJOB_SMBD_SPOOLING
} ;
1996-05-04 11:50:46 +04:00
2006-02-02 23:44:50 +03:00
typedef struct _print_queue_struct {
int job ; /* normally the UNIX jobid -- see note in
printing . c : traverse_fn_delete ( ) */
int size ;
int page_count ;
int status ;
int priority ;
time_t time ;
fstring fs_user ;
fstring fs_file ;
1996-05-04 11:50:46 +04:00
} print_queue_struct ;
enum { LPSTAT_OK , LPSTAT_STOPPED , LPSTAT_ERROR } ;
2006-02-02 23:44:50 +03:00
typedef struct {
fstring message ;
int qcount ;
int status ;
1996-05-04 11:50:46 +04:00
} print_status_struct ;
1996-06-04 10:42:03 +04:00
/* used for server information: client, nameserv and ipc */
2006-02-02 23:44:50 +03:00
struct server_info_struct {
fstring name ;
uint32 type ;
fstring comment ;
fstring domain ; /* used ONLY in ipc.c NOT namework.c */
2007-10-19 04:40:25 +04:00
bool server_added ; /* used ONLY in ipc.c NOT namework.c */
1996-06-04 10:42:03 +04:00
} ;
1996-06-29 22:49:20 +04:00
/* used for network interfaces */
2006-02-02 23:44:50 +03:00
struct interface {
1999-12-13 16:27:58 +03:00
struct interface * next , * prev ;
2007-10-11 05:25:16 +04:00
char * name ;
int flags ;
struct sockaddr_storage ip ;
struct sockaddr_storage netmask ;
struct sockaddr_storage bcast ;
1996-06-29 22:49:20 +04:00
} ;
2004-06-08 20:14:31 +04:00
/* Internal message queue for deferred opens. */
struct pending_message_list {
struct pending_message_list * next , * prev ;
2005-09-30 21:13:37 +04:00
struct timeval request_time ; /* When was this first issued? */
2009-01-08 17:38:47 +03:00
struct timed_event * te ;
2009-02-09 10:10:34 +03:00
struct smb_perfcount_data pcd ;
2009-03-09 11:47:59 +03:00
uint32_t seqnum ;
2008-01-04 23:56:23 +03:00
bool encrypted ;
2009-10-01 16:32:36 +04:00
bool processed ;
2004-06-08 20:14:31 +04:00
DATA_BLOB buf ;
DATA_BLOB private_data ;
} ;
2007-02-07 00:05:34 +03:00
# define SHARE_MODE_FLAG_POSIX_OPEN 0x1
1997-05-20 04:32:51 +04:00
/* struct returned by get_share_modes */
2005-09-30 21:13:37 +04:00
struct share_mode_entry {
2007-05-07 13:35:35 +04:00
struct server_id pid ;
2010-04-13 08:40:28 +04:00
uint64_t op_mid ; /* For compatibility with SMB2 opens. */
2001-10-21 01:59:34 +04:00
uint16 op_type ;
2005-07-08 08:51:27 +04:00
uint32 access_mask ; /* NTCreateX access bits (FILE_READ_DATA etc.) */
uint32 share_access ; /* NTCreateX share constants (FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE). */
uint32 private_options ; /* NT Create options, but we only look at
* NTCREATEX_OPTIONS_PRIVATE_DENY_DOS and
* NTCREATEX_OPTIONS_PRIVATE_DENY_FCB for
* smbstatus and swat */
2001-10-21 01:59:34 +04:00
struct timeval time ;
2007-05-29 13:30:34 +04:00
struct file_id id ;
2001-10-21 01:59:34 +04:00
unsigned long share_file_id ;
2006-06-21 06:31:12 +04:00
uint32 uid ; /* uid of file opener. */
2007-05-24 01:32:10 +04:00
uint16 flags ; /* See SHARE_MODE_XX above. */
2005-09-30 21:13:37 +04:00
} ;
1) added void* state argument to tdb_traverse. guess what! there were
two places i found where it was appropriate to _use_ that third argument,
in locking.c and brlock.c! there was a static traverse_function and
i removed the static variable, typecast it to a void*, passed it to
tdb_traverse and re-cast it back to the traverse_function inside the
tdb_traverse function. this makes the use of tdb_traverse() reentrant,
which is never going to happen, i know, i just don't like to see
statics lying about when there's no need for them.
as i had to do in samba-tng, all uses of tdb_traverse modified to take
the new void* state argument.
2) disabled rpcclient: referring people to use SAMBA_TNG rpcclient.
i don't know how the other samba team members would react if i deleted
rpcclient from cvs main. damn, that code's so old, it's unreal.
20 rpcclient commands, instead of about 70 in SAMBA_TNG.
(This used to be commit 49d7f0afbc1c5425d53019e234d54ddf205c8e9a)
2000-02-04 07:59:31 +03:00
2006-01-13 01:17:54 +03:00
/* oplock break message definition - linearization of share_mode_entry.
Offset Data length .
2007-05-07 13:35:35 +04:00
0 struct server_id pid 4
2010-04-13 08:40:28 +04:00
4 uint16 op_mid 8
12 uint16 op_type 2
14 uint32 access_mask 4
18 uint32 share_access 4
22 uint32 private_options 4
26 uint32 time sec 4
30 uint32 time usec 4
34 uint64 dev 8 bytes
42 uint64 inode 8 bytes
50 uint64 extid 8 bytes
58 unsigned long file_id 4 bytes
62 uint32 uid 4 bytes
66 uint16 flags 2 bytes
68
2006-01-13 01:17:54 +03:00
*/
2010-04-13 08:40:28 +04:00
# define OP_BREAK_MSG_PID_OFFSET 0
# define OP_BREAK_MSG_MID_OFFSET 4
# define OP_BREAK_MSG_OP_TYPE_OFFSET 12
# define OP_BREAK_MSG_ACCESS_MASK_OFFSET 14
# define OP_BREAK_MSG_SHARE_ACCESS_OFFSET 18
# define OP_BREAK_MSG_PRIV_OFFSET 22
# define OP_BREAK_MSG_TIME_SEC_OFFSET 26
# define OP_BREAK_MSG_TIME_USEC_OFFSET 30
# define OP_BREAK_MSG_DEV_OFFSET 34
# define OP_BREAK_MSG_INO_OFFSET 42
# define OP_BREAK_MSG_EXTID_OFFSET 50
# define OP_BREAK_MSG_FILE_ID_OFFSET 58
# define OP_BREAK_MSG_UID_OFFSET 62
# define OP_BREAK_MSG_FLAGS_OFFSET 66
2007-06-10 21:02:09 +04:00
# ifdef CLUSTER_SUPPORT
2010-04-13 08:40:28 +04:00
# define OP_BREAK_MSG_VNN_OFFSET 68
# define MSG_SMB_SHARE_MODE_ENTRY_SIZE 72
2007-06-10 21:02:09 +04:00
# else
2010-04-13 08:40:28 +04:00
# define MSG_SMB_SHARE_MODE_ENTRY_SIZE 68
2007-06-10 21:02:09 +04:00
# endif
2006-01-13 01:17:54 +03:00
2005-09-30 21:13:37 +04:00
struct share_mode_lock {
2005-12-13 01:07:36 +03:00
const char * servicepath ; /* canonicalized. */
2009-07-09 03:22:44 +04:00
const char * base_name ;
const char * stream_name ;
2007-05-29 13:30:34 +04:00
struct file_id id ;
2005-09-30 21:13:37 +04:00
int num_share_modes ;
struct share_mode_entry * share_modes ;
2006-02-02 23:44:50 +03:00
UNIX_USER_TOKEN * delete_token ;
2007-10-19 04:40:25 +04:00
bool delete_on_close ;
2008-03-12 17:32:47 +03:00
struct timespec old_write_time ;
struct timespec changed_write_time ;
2007-10-19 04:40:25 +04:00
bool fresh ;
bool modified ;
2007-05-27 13:57:05 +04:00
struct db_record * record ;
2005-09-30 21:13:37 +04:00
} ;
1) added void* state argument to tdb_traverse. guess what! there were
two places i found where it was appropriate to _use_ that third argument,
in locking.c and brlock.c! there was a static traverse_function and
i removed the static variable, typecast it to a void*, passed it to
tdb_traverse and re-cast it back to the traverse_function inside the
tdb_traverse function. this makes the use of tdb_traverse() reentrant,
which is never going to happen, i know, i just don't like to see
statics lying about when there's no need for them.
as i had to do in samba-tng, all uses of tdb_traverse modified to take
the new void* state argument.
2) disabled rpcclient: referring people to use SAMBA_TNG rpcclient.
i don't know how the other samba team members would react if i deleted
rpcclient from cvs main. damn, that code's so old, it's unreal.
20 rpcclient commands, instead of about 70 in SAMBA_TNG.
(This used to be commit 49d7f0afbc1c5425d53019e234d54ddf205c8e9a)
2000-02-04 07:59:31 +03:00
2006-02-04 09:31:04 +03:00
/*
* Internal structure of locking . tdb share mode db .
* Used by locking . c and libsmbsharemodes . c
*/
struct locking_data {
union {
struct {
int num_share_mode_entries ;
2007-10-19 04:40:25 +04:00
bool delete_on_close ;
2008-03-12 17:32:47 +03:00
struct timespec old_write_time ;
struct timespec changed_write_time ;
2006-02-04 09:31:04 +03:00
uint32 delete_token_size ; /* Only valid if either of
the two previous fields
are True . */
} s ;
struct share_mode_entry dummy ; /* Needed for alignment. */
} u ;
/* The following four entries are implicit
struct share_mode_entry modes [ num_share_mode_entries ] ;
char unix_token [ delete_token_size ] ( divisible by 4 ) .
char share_name [ ] ;
char file_name [ ] ;
*/
} ;
2006-07-11 22:01:26 +04:00
/* Used to store pipe open records for NetFileEnum() */
struct pipe_open_rec {
2007-05-07 13:35:35 +04:00
struct server_id pid ;
2006-07-11 22:01:26 +04:00
uid_t uid ;
int pnum ;
fstring name ;
} ;
2002-01-02 10:41:54 +03:00
# define NT_HASH_LEN 16
# define LM_HASH_LEN 16
2004-08-05 23:57:41 +04:00
/* Password history contants. */
# define PW_HISTORY_SALT_LEN 16
# define SALTED_MD5_HASH_LEN 16
# define PW_HISTORY_ENTRY_LEN (PW_HISTORY_SALT_LEN+SALTED_MD5_HASH_LEN)
2006-05-17 02:03:05 +04:00
# define MAX_PW_HISTORY_LEN 24
2004-08-05 23:57:41 +04:00
2000-02-26 01:25:25 +03:00
/*
* Flags for local user manipulation .
*/
# define LOCAL_ADD_USER 0x1
# define LOCAL_DELETE_USER 0x2
# define LOCAL_DISABLE_USER 0x4
# define LOCAL_ENABLE_USER 0x8
# define LOCAL_TRUST_ACCOUNT 0x10
# define LOCAL_SET_NO_PASSWORD 0x20
2001-10-30 08:21:16 +03:00
# define LOCAL_SET_PASSWORD 0x40
2001-12-13 21:09:29 +03:00
# define LOCAL_SET_LDAP_ADMIN_PW 0x80
2001-12-14 17:35:38 +03:00
# define LOCAL_INTERDOM_ACCOUNT 0x100
2002-07-15 14:35:28 +04:00
# define LOCAL_AM_ROOT 0x200 /* Act as root */
2000-02-26 01:25:25 +03:00
1999-12-21 07:54:30 +03:00
/* key and data in the connections database - used in smbstatus and smbd */
struct connections_key {
2007-05-07 13:35:35 +04:00
struct server_id pid ;
1999-12-21 07:54:30 +03:00
int cnum ;
fstring name ;
} ;
1998-05-19 03:57:28 +04:00
1999-12-21 07:54:30 +03:00
struct connections_data {
int magic ;
2007-05-07 13:35:35 +04:00
struct server_id pid ;
1999-12-21 07:54:30 +03:00
int cnum ;
uid_t uid ;
gid_t gid ;
2007-04-16 23:10:16 +04:00
char servicename [ FSTRING_LEN ] ;
1999-12-21 07:54:30 +03:00
char addr [ 24 ] ;
2001-03-11 04:08:10 +03:00
char machine [ FSTRING_LEN ] ;
1999-12-21 07:54:30 +03:00
time_t start ;
2010-07-05 12:05:27 +04:00
/*
* This field used to hold the msg_flags . For compatibility reasons ,
* keep the data structure in the tdb file the same .
*/
uint32 unused_compatitibility_field ;
1996-05-04 11:50:46 +04:00
} ;
1999-12-21 12:25:59 +03:00
1998-03-08 17:14:49 +03:00
/* the following are used by loadparm for option lists */
2004-06-08 20:14:31 +04:00
typedef enum {
P_BOOL , P_BOOLREV , P_CHAR , P_INTEGER , P_OCTAL , P_LIST ,
2007-12-07 23:43:10 +03:00
P_STRING , P_USTRING , P_ENUM , P_SEP
1998-03-08 17:14:49 +03:00
} parm_type ;
2004-06-08 20:14:31 +04:00
typedef enum {
P_LOCAL , P_GLOBAL , P_SEPARATOR , P_NONE
1998-03-08 17:14:49 +03:00
} parm_class ;
struct enum_list {
int value ;
2003-01-03 11:28:12 +03:00
const char * name ;
1998-03-08 17:14:49 +03:00
} ;
2006-02-02 23:44:50 +03:00
struct parm_struct {
2003-01-03 11:28:12 +03:00
const char * label ;
1998-03-08 17:14:49 +03:00
parm_type type ;
2005-06-25 00:25:18 +04:00
parm_class p_class ;
1998-03-08 17:14:49 +03:00
void * ptr ;
2007-10-19 04:40:25 +04:00
bool ( * special ) ( int snum , const char * , char * * ) ;
2003-01-03 11:28:12 +03:00
const struct enum_list * enum_list ;
1998-03-08 17:14:49 +03:00
unsigned flags ;
1998-03-14 11:27:41 +03:00
union {
2007-10-19 04:40:25 +04:00
bool bvalue ;
1998-03-14 11:27:41 +03:00
int ivalue ;
char * svalue ;
char cvalue ;
2001-06-20 20:54:32 +04:00
char * * lvalue ;
1998-03-14 11:27:41 +03:00
} def ;
1998-03-08 17:14:49 +03:00
} ;
2003-07-28 09:49:51 +04:00
/* The following flags are used in SWAT */
# define FLAG_BASIC 0x0001 /* Display only in BASIC view */
2002-09-25 19:19:00 +04:00
# define FLAG_SHARE 0x0002 /* file sharing options */
# define FLAG_PRINT 0x0004 /* printing options */
# define FLAG_GLOBAL 0x0008 /* local options that should be globally settable in SWAT */
# define FLAG_WIZARD 0x0010 /* Parameters that the wizard will operate on */
2003-07-28 09:49:51 +04:00
# define FLAG_ADVANCED 0x0020 /* Parameters that will be visible in advanced view */
# define FLAG_DEVELOPER 0x0040 /* No longer used */
2002-09-25 19:19:00 +04:00
# define FLAG_DEPRECATED 0x1000 /* options that should no longer be used */
# define FLAG_HIDE 0x2000 /* options that should be hidden in SWAT */
# define FLAG_DOS_STRING 0x4000 /* convert from UNIX to DOS codepage when reading this string. */
2009-05-15 03:46:09 +04:00
# define FLAG_META 0x8000 /* A meta directive - not a real parameter */
2010-08-11 07:35:14 +04:00
# define FLAG_CMDLINE 0x10000 /* option has been overridden */
1998-03-08 17:14:49 +03:00
2006-02-28 02:45:49 +03:00
struct bitmap {
uint32 * b ;
unsigned int n ;
} ;
1996-05-04 11:50:46 +04:00
/* offsets into message for common items */
# define smb_com 8
# define smb_rcls 9
# define smb_reh 10
# define smb_err 11
# define smb_flg 13
# define smb_flg2 14
2002-07-15 14:35:28 +04:00
# define smb_pidhigh 16
# define smb_ss_field 18
1996-05-04 11:50:46 +04:00
# define smb_tid 28
# define smb_pid 30
# define smb_uid 32
# define smb_mid 34
# define smb_wct 36
# define smb_vwv 37
# define smb_vwv0 37
# define smb_vwv1 39
# define smb_vwv2 41
# define smb_vwv3 43
# define smb_vwv4 45
# define smb_vwv5 47
# define smb_vwv6 49
# define smb_vwv7 51
# define smb_vwv8 53
# define smb_vwv9 55
# define smb_vwv10 57
# define smb_vwv11 59
# define smb_vwv12 61
# define smb_vwv13 63
# define smb_vwv14 65
# define smb_vwv15 67
# define smb_vwv16 69
# define smb_vwv17 71
1998-09-18 03:06:57 +04:00
/* flag defines. CIFS spec 3.1.1 */
# define FLAG_SUPPORT_LOCKREAD 0x01
# define FLAG_CLIENT_BUF_AVAIL 0x02
# define FLAG_RESERVED 0x04
# define FLAG_CASELESS_PATHNAMES 0x08
# define FLAG_CANONICAL_PATHNAMES 0x10
# define FLAG_REQUEST_OPLOCK 0x20
# define FLAG_REQUEST_BATCH_OPLOCK 0x40
# define FLAG_REPLY 0x80
1996-05-04 11:50:46 +04:00
/* the complete */
# define SMBmkdir 0x00 /* create directory */
# define SMBrmdir 0x01 /* delete directory */
# define SMBopen 0x02 /* open file */
# define SMBcreate 0x03 /* create file */
# define SMBclose 0x04 /* close file */
# define SMBflush 0x05 /* flush file */
# define SMBunlink 0x06 /* delete file */
# define SMBmv 0x07 /* rename file */
# define SMBgetatr 0x08 /* get file attributes */
# define SMBsetatr 0x09 /* set file attributes */
# define SMBread 0x0A /* read from file */
# define SMBwrite 0x0B /* write to file */
# define SMBlock 0x0C /* lock byte range */
# define SMBunlock 0x0D /* unlock byte range */
# define SMBctemp 0x0E /* create temporary file */
# define SMBmknew 0x0F /* make new file */
2007-01-14 01:10:18 +03:00
# define SMBcheckpath 0x10 /* check directory path */
1996-05-04 11:50:46 +04:00
# define SMBexit 0x11 /* process exit */
# define SMBlseek 0x12 /* seek */
# define SMBtcon 0x70 /* tree connect */
# define SMBtconX 0x75 /* tree connect and X*/
# define SMBtdis 0x71 /* tree disconnect */
# define SMBnegprot 0x72 /* negotiate protocol */
# define SMBdskattr 0x80 /* get disk attributes */
# define SMBsearch 0x81 /* search directory */
# define SMBsplopen 0xC0 /* open print spool file */
# define SMBsplwr 0xC1 /* write to print spool file */
# define SMBsplclose 0xC2 /* close print spool file */
# define SMBsplretq 0xC3 /* return print queue */
# define SMBsends 0xD0 /* send single block message */
# define SMBsendb 0xD1 /* send broadcast message */
# define SMBfwdname 0xD2 /* forward user name */
# define SMBcancelf 0xD3 /* cancel forward */
# define SMBgetmac 0xD4 /* get machine name */
# define SMBsendstrt 0xD5 /* send start of multi-block message */
# define SMBsendend 0xD6 /* send end of multi-block message */
# define SMBsendtxt 0xD7 /* send text of multi-block message */
/* Core+ protocol */
# define SMBlockread 0x13 /* Lock a range and read */
# define SMBwriteunlock 0x14 /* Unlock a range then write */
# define SMBreadbraw 0x1a /* read a block of data with no smb header */
# define SMBwritebraw 0x1d /* write a block of data with no smb header */
# define SMBwritec 0x20 /* secondary write request */
# define SMBwriteclose 0x2c /* write a file then close it */
/* dos extended protocol */
# define SMBreadBraw 0x1A /* read block raw */
# define SMBreadBmpx 0x1B /* read block multiplexed */
# define SMBreadBs 0x1C /* read block (secondary response) */
# define SMBwriteBraw 0x1D /* write block raw */
# define SMBwriteBmpx 0x1E /* write block multiplexed */
# define SMBwriteBs 0x1F /* write block (secondary request) */
# define SMBwriteC 0x20 /* write complete response */
# define SMBsetattrE 0x22 /* set file attributes expanded */
# define SMBgetattrE 0x23 /* get file attributes expanded */
# define SMBlockingX 0x24 /* lock/unlock byte ranges and X */
# define SMBtrans 0x25 /* transaction - name, bytes in/out */
# define SMBtranss 0x26 /* transaction (secondary request/response) */
# define SMBioctl 0x27 /* IOCTL */
# define SMBioctls 0x28 /* IOCTL (secondary request/response) */
# define SMBcopy 0x29 /* copy */
# define SMBmove 0x2A /* move */
# define SMBecho 0x2B /* echo */
# define SMBopenX 0x2D /* open and X */
# define SMBreadX 0x2E /* read and X */
# define SMBwriteX 0x2F /* write and X */
# define SMBsesssetupX 0x73 /* Session Set Up & X (including User Logon) */
# define SMBffirst 0x82 /* find first */
# define SMBfunique 0x83 /* find unique */
# define SMBfclose 0x84 /* find close */
2001-10-21 03:34:40 +04:00
# define SMBkeepalive 0x85 /* keepalive */
1996-05-04 11:50:46 +04:00
# define SMBinvalid 0xFE /* invalid command */
/* Extended 2.0 protocol */
# define SMBtrans2 0x32 /* TRANS2 protocol set */
# define SMBtranss2 0x33 /* TRANS2 protocol set, secondary command */
# define SMBfindclose 0x34 /* Terminate a TRANSACT2_FINDFIRST */
# define SMBfindnclose 0x35 /* Terminate a TRANSACT2_FINDNOTIFYFIRST */
# define SMBulogoffX 0x74 /* user logoff */
1997-10-10 05:32:26 +04:00
/* NT SMB extensions. */
# define SMBnttrans 0xA0 /* NT transact */
# define SMBnttranss 0xA1 /* NT transact secondary */
# define SMBntcreateX 0xA2 /* NT create and X */
# define SMBntcancel 0xA4 /* NT cancel */
2004-02-24 03:06:08 +03:00
# define SMBntrename 0xA5 /* NT rename */
1997-10-10 05:32:26 +04:00
2002-11-07 17:45:46 +03:00
/* These are the trans subcommands */
2002-11-29 05:58:59 +03:00
# define TRANSACT_SETNAMEDPIPEHANDLESTATE 0x01
2002-11-07 17:45:46 +03:00
# define TRANSACT_DCERPCCMD 0x26
# define TRANSACT_WAITNAMEDPIPEHANDLESTATE 0x53
1997-10-10 05:32:26 +04:00
/* These are the TRANS2 sub commands */
2003-04-15 23:51:17 +04:00
# define TRANSACT2_OPEN 0x00
# define TRANSACT2_FINDFIRST 0x01
# define TRANSACT2_FINDNEXT 0x02
# define TRANSACT2_QFSINFO 0x03
# define TRANSACT2_SETFSINFO 0x04
# define TRANSACT2_QPATHINFO 0x05
# define TRANSACT2_SETPATHINFO 0x06
# define TRANSACT2_QFILEINFO 0x07
# define TRANSACT2_SETFILEINFO 0x08
# define TRANSACT2_FSCTL 0x09
# define TRANSACT2_IOCTL 0x0A
# define TRANSACT2_FINDNOTIFYFIRST 0x0B
# define TRANSACT2_FINDNOTIFYNEXT 0x0C
# define TRANSACT2_MKDIR 0x0D
# define TRANSACT2_SESSION_SETUP 0x0E
2003-04-28 09:47:07 +04:00
# define TRANSACT2_GET_DFS_REFERRAL 0x10
# define TRANSACT2_REPORT_DFS_INCONSISTANCY 0x11
1997-10-10 05:32:26 +04:00
/* These are the NT transact sub commands. */
1999-12-13 16:27:58 +03:00
# define NT_TRANSACT_CREATE 1
# define NT_TRANSACT_IOCTL 2
# define NT_TRANSACT_SET_SECURITY_DESC 3
# define NT_TRANSACT_NOTIFY_CHANGE 4
# define NT_TRANSACT_RENAME 5
# define NT_TRANSACT_QUERY_SECURITY_DESC 6
2003-04-15 23:51:17 +04:00
# define NT_TRANSACT_GET_USER_QUOTA 7
# define NT_TRANSACT_SET_USER_QUOTA 8
/* These are the NT transact_get_user_quota sub commands */
# define TRANSACT_GET_USER_QUOTA_LIST_CONTINUE 0x0000
# define TRANSACT_GET_USER_QUOTA_LIST_START 0x0100
# define TRANSACT_GET_USER_QUOTA_FOR_SID 0x0101
1999-12-13 16:27:58 +03:00
/* Relevant IOCTL codes */
# define IOCTL_QUERY_JOB_INFO 0x530060
1996-05-04 11:50:46 +04:00
/* these are the trans2 sub fields for primary requests */
# define smb_tpscnt smb_vwv0
# define smb_tdscnt smb_vwv1
# define smb_mprcnt smb_vwv2
# define smb_mdrcnt smb_vwv3
# define smb_msrcnt smb_vwv4
# define smb_flags smb_vwv5
# define smb_timeout smb_vwv6
# define smb_pscnt smb_vwv9
# define smb_psoff smb_vwv10
# define smb_dscnt smb_vwv11
# define smb_dsoff smb_vwv12
# define smb_suwcnt smb_vwv13
# define smb_setup smb_vwv14
# define smb_setup0 smb_setup
# define smb_setup1 (smb_setup+2)
# define smb_setup2 (smb_setup+4)
/* these are for the secondary requests */
# define smb_spscnt smb_vwv2
# define smb_spsoff smb_vwv3
# define smb_spsdisp smb_vwv4
# define smb_sdscnt smb_vwv5
# define smb_sdsoff smb_vwv6
# define smb_sdsdisp smb_vwv7
# define smb_sfid smb_vwv8
/* and these for responses */
# define smb_tprcnt smb_vwv0
# define smb_tdrcnt smb_vwv1
# define smb_prcnt smb_vwv3
# define smb_proff smb_vwv4
# define smb_prdisp smb_vwv5
# define smb_drcnt smb_vwv6
# define smb_droff smb_vwv7
# define smb_drdisp smb_vwv8
1998-05-08 05:23:11 +04:00
/* these are for the NT trans primary request. */
# define smb_nt_MaxSetupCount smb_vwv0
# define smb_nt_Flags (smb_vwv0 + 1)
# define smb_nt_TotalParameterCount (smb_vwv0 + 3)
# define smb_nt_TotalDataCount (smb_vwv0 + 7)
# define smb_nt_MaxParameterCount (smb_vwv0 + 11)
# define smb_nt_MaxDataCount (smb_vwv0 + 15)
# define smb_nt_ParameterCount (smb_vwv0 + 19)
# define smb_nt_ParameterOffset (smb_vwv0 + 23)
# define smb_nt_DataCount (smb_vwv0 + 27)
# define smb_nt_DataOffset (smb_vwv0 + 31)
# define smb_nt_SetupCount (smb_vwv0 + 35)
# define smb_nt_Function (smb_vwv0 + 36)
1998-08-03 23:07:55 +04:00
# define smb_nt_SetupStart (smb_vwv0 + 38)
1998-05-08 05:23:11 +04:00
/* these are for the NT trans secondary request. */
# define smb_nts_TotalParameterCount (smb_vwv0 + 3)
# define smb_nts_TotalDataCount (smb_vwv0 + 7)
# define smb_nts_ParameterCount (smb_vwv0 + 11)
# define smb_nts_ParameterOffset (smb_vwv0 + 15)
# define smb_nts_ParameterDisplacement (smb_vwv0 + 19)
# define smb_nts_DataCount (smb_vwv0 + 23)
# define smb_nts_DataOffset (smb_vwv0 + 27)
# define smb_nts_DataDisplacement (smb_vwv0 + 31)
1998-07-09 04:41:32 +04:00
/* these are for the NT trans reply. */
# define smb_ntr_TotalParameterCount (smb_vwv0 + 3)
# define smb_ntr_TotalDataCount (smb_vwv0 + 7)
# define smb_ntr_ParameterCount (smb_vwv0 + 11)
# define smb_ntr_ParameterOffset (smb_vwv0 + 15)
# define smb_ntr_ParameterDisplacement (smb_vwv0 + 19)
# define smb_ntr_DataCount (smb_vwv0 + 23)
# define smb_ntr_DataOffset (smb_vwv0 + 27)
# define smb_ntr_DataDisplacement (smb_vwv0 + 31)
1998-05-23 06:00:21 +04:00
/* these are for the NT create_and_X */
# define smb_ntcreate_NameLength (smb_vwv0 + 5)
# define smb_ntcreate_Flags (smb_vwv0 + 7)
1998-09-18 03:06:57 +04:00
# define smb_ntcreate_RootDirectoryFid (smb_vwv0 + 11)
1998-05-23 06:00:21 +04:00
# define smb_ntcreate_DesiredAccess (smb_vwv0 + 15)
# define smb_ntcreate_AllocationSize (smb_vwv0 + 19)
# define smb_ntcreate_FileAttributes (smb_vwv0 + 27)
# define smb_ntcreate_ShareAccess (smb_vwv0 + 31)
# define smb_ntcreate_CreateDisposition (smb_vwv0 + 35)
# define smb_ntcreate_CreateOptions (smb_vwv0 + 39)
# define smb_ntcreate_ImpersonationLevel (smb_vwv0 + 43)
# define smb_ntcreate_SecurityFlags (smb_vwv0 + 47)
1998-09-20 19:39:12 +04:00
/* this is used on a TConX. I'm not sure the name is very helpful though */
# define SMB_SUPPORT_SEARCH_BITS 0x0001
2000-03-09 01:14:30 +03:00
# define SMB_SHARE_IN_DFS 0x0002
1998-09-20 19:39:12 +04:00
2000-03-10 00:45:16 +03:00
/* Named pipe write mode flags. Used in writeX calls. */
# define PIPE_RAW_MODE 0x4
# define PIPE_START_MESSAGE 0x8
2000-12-04 10:26:56 +03:00
/* the desired access to use when opening a pipe */
# define DESIRED_ACCESS_PIPE 0x2019f
1998-07-01 01:19:40 +04:00
1999-12-13 16:27:58 +03:00
/* Mapping of access rights to UNIX perms. */
2001-05-19 00:16:55 +04:00
# define UNIX_ACCESS_RWX FILE_GENERIC_ALL
# define UNIX_ACCESS_R FILE_GENERIC_READ
# define UNIX_ACCESS_W FILE_GENERIC_WRITE
# define UNIX_ACCESS_X FILE_GENERIC_EXECUTE
2005-05-24 00:47:43 +04:00
/* Mapping of access rights to UNIX perms. for a UNIX directory. */
# define UNIX_DIRECTORY_ACCESS_RWX FILE_GENERIC_ALL
# define UNIX_DIRECTORY_ACCESS_R FILE_GENERIC_READ
2009-02-03 04:10:27 +03:00
# define UNIX_DIRECTORY_ACCESS_W (FILE_GENERIC_WRITE|FILE_DELETE_CHILD)
2005-05-24 00:47:43 +04:00
# define UNIX_DIRECTORY_ACCESS_X FILE_GENERIC_EXECUTE
2001-05-19 00:16:55 +04:00
#if 0
/*
* This is the old mapping we used to use . To get W2KSP2 profiles
* working we need to map to the canonical file perms .
*/
1999-12-13 16:27:58 +03:00
# define UNIX_ACCESS_RWX (UNIX_ACCESS_R|UNIX_ACCESS_W|UNIX_ACCESS_X)
# define UNIX_ACCESS_R (READ_CONTROL_ACCESS|SYNCHRONIZE_ACCESS|\
FILE_READ_ATTRIBUTES | FILE_READ_EA | FILE_READ_DATA )
# define UNIX_ACCESS_W (READ_CONTROL_ACCESS|SYNCHRONIZE_ACCESS|\
FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | \
FILE_APPEND_DATA | FILE_WRITE_DATA )
# define UNIX_ACCESS_X (READ_CONTROL_ACCESS|SYNCHRONIZE_ACCESS|\
FILE_EXECUTE | FILE_READ_ATTRIBUTES )
2001-05-19 00:16:55 +04:00
# endif
1999-12-13 16:27:58 +03:00
# define UNIX_ACCESS_NONE (WRITE_OWNER_ACCESS)
1998-05-26 23:37:31 +04:00
1998-05-23 06:00:21 +04:00
/* Flags field. */
# define REQUEST_OPLOCK 2
# define REQUEST_BATCH_OPLOCK 4
# define OPEN_DIRECTORY 8
2004-02-25 05:15:34 +03:00
# define EXTENDED_RESPONSE_REQUIRED 0x10
1998-05-23 06:00:21 +04:00
/* ShareAccess field. */
# define FILE_SHARE_NONE 0 /* Cannot be used in bitmask. */
# define FILE_SHARE_READ 1
# define FILE_SHARE_WRITE 2
# define FILE_SHARE_DELETE 4
/* FileAttributesField */
2002-09-25 19:19:00 +04:00
# define FILE_ATTRIBUTE_READONLY 0x001L
# define FILE_ATTRIBUTE_HIDDEN 0x002L
# define FILE_ATTRIBUTE_SYSTEM 0x004L
# define FILE_ATTRIBUTE_DIRECTORY 0x010L
# define FILE_ATTRIBUTE_ARCHIVE 0x020L
# define FILE_ATTRIBUTE_NORMAL 0x080L
# define FILE_ATTRIBUTE_TEMPORARY 0x100L
# define FILE_ATTRIBUTE_SPARSE 0x200L
2005-03-03 07:05:33 +03:00
# define FILE_ATTRIBUTE_REPARSE_POINT 0x400L
2002-09-25 19:19:00 +04:00
# define FILE_ATTRIBUTE_COMPRESSED 0x800L
2005-03-03 07:05:33 +03:00
# define FILE_ATTRIBUTE_OFFLINE 0x1000L
2002-09-25 19:19:00 +04:00
# define FILE_ATTRIBUTE_NONINDEXED 0x2000L
2005-03-03 07:05:33 +03:00
# define FILE_ATTRIBUTE_ENCRYPTED 0x4000L
2010-12-17 21:22:58 +03:00
# define SAMBA_ATTRIBUTES_MASK (FILE_ATTRIBUTE_READONLY|\
FILE_ATTRIBUTE_HIDDEN | \
FILE_ATTRIBUTE_SYSTEM | \
FILE_ATTRIBUTE_DIRECTORY | \
2010-12-20 21:23:27 +03:00
FILE_ATTRIBUTE_ARCHIVE )
1998-07-02 01:49:49 +04:00
1998-05-23 06:00:21 +04:00
/* Flags - combined with attributes. */
# define FILE_FLAG_WRITE_THROUGH 0x80000000L
# define FILE_FLAG_NO_BUFFERING 0x20000000L
# define FILE_FLAG_RANDOM_ACCESS 0x10000000L
# define FILE_FLAG_SEQUENTIAL_SCAN 0x08000000L
# define FILE_FLAG_DELETE_ON_CLOSE 0x04000000L
# define FILE_FLAG_BACKUP_SEMANTICS 0x02000000L
# define FILE_FLAG_POSIX_SEMANTICS 0x01000000L
/* CreateDisposition field. */
2005-07-08 08:51:27 +04:00
# define FILE_SUPERSEDE 0 /* File exists overwrite/supersede. File not exist create. */
# define FILE_OPEN 1 /* File exists open. File not exist fail. */
# define FILE_CREATE 2 /* File exists fail. File not exist create. */
# define FILE_OPEN_IF 3 /* File exists open. File not exist create. */
# define FILE_OVERWRITE 4 /* File exists overwrite. File not exist fail. */
# define FILE_OVERWRITE_IF 5 /* File exists overwrite. File not exist create. */
1998-07-17 02:46:06 +04:00
1998-09-14 23:49:55 +04:00
/* CreateOptions field. */
# define FILE_DIRECTORY_FILE 0x0001
# define FILE_WRITE_THROUGH 0x0002
# define FILE_SEQUENTIAL_ONLY 0x0004
2009-08-21 16:56:32 +04:00
# define FILE_NO_INTERMEDIATE_BUFFERING 0x0008
# define FILE_SYNCHRONOUS_IO_ALERT 0x0010 /* may be ignored */
# define FILE_SYNCHRONOUS_IO_NONALERT 0x0020 /* may be ignored */
1998-09-14 23:49:55 +04:00
# define FILE_NON_DIRECTORY_FILE 0x0040
2009-08-21 16:56:32 +04:00
# define FILE_CREATE_TREE_CONNECTION 0x0080 /* ignore, should be zero */
# define FILE_COMPLETE_IF_OPLOCKED 0x0100 /* ignore, should be zero */
1998-09-14 23:49:55 +04:00
# define FILE_NO_EA_KNOWLEDGE 0x0200
2009-08-21 16:56:32 +04:00
# define FILE_EIGHT_DOT_THREE_ONLY 0x0400 /* aka OPEN_FOR_RECOVERY: ignore, should be zero */
1998-09-14 23:49:55 +04:00
# define FILE_RANDOM_ACCESS 0x0800
# define FILE_DELETE_ON_CLOSE 0x1000
2002-09-25 19:19:00 +04:00
# define FILE_OPEN_BY_FILE_ID 0x2000
2009-08-21 16:56:32 +04:00
# define FILE_OPEN_FOR_BACKUP_INTENT 0x4000
# define FILE_NO_COMPRESSION 0x8000
# define FILE_RESERVER_OPFILTER 0x00100000 /* ignore, should be zero */
# define FILE_OPEN_REPARSE_POINT 0x00200000
# define FILE_OPEN_NO_RECALL 0x00400000
# define FILE_OPEN_FOR_FREE_SPACE_QUERY 0x00800000 /* ignore should be zero */
1998-09-14 23:49:55 +04:00
2008-08-19 18:34:50 +04:00
# define NTCREATEX_OPTIONS_MUST_IGNORE_MASK (0x008F0480)
# define NTCREATEX_OPTIONS_INVALID_PARAM_MASK (0xFF100030)
/*
* Private create options used by the ntcreatex processing code . From Samba4 .
2010-03-06 02:10:30 +03:00
* We reuse some ignored flags for private use . Passed in the private_flags
* argument .
2008-08-19 18:34:50 +04:00
*/
2010-03-06 02:10:30 +03:00
# define NTCREATEX_OPTIONS_PRIVATE_DENY_DOS 0x0001
# define NTCREATEX_OPTIONS_PRIVATE_DENY_FCB 0x0002
2005-07-08 08:51:27 +04:00
2008-01-20 01:25:36 +03:00
/* Private options for streams support */
2010-03-06 02:10:30 +03:00
# define NTCREATEX_OPTIONS_PRIVATE_STREAM_DELETE 0x0004
/* Private options for printer support */
# define NTCREATEX_OPTIONS_PRIVATE_DELETE_ON_CLOSE 0x0008
2008-01-20 01:25:36 +03:00
1998-07-17 02:46:06 +04:00
/* Responses when opening a file. */
2002-09-25 19:19:00 +04:00
# define FILE_WAS_SUPERSEDED 0
1998-07-17 02:46:06 +04:00
# define FILE_WAS_OPENED 1
# define FILE_WAS_CREATED 2
# define FILE_WAS_OVERWRITTEN 3
/* File type flags */
# define FILE_TYPE_DISK 0
# define FILE_TYPE_BYTE_MODE_PIPE 1
# define FILE_TYPE_MESSAGE_MODE_PIPE 2
# define FILE_TYPE_PRINTER 3
# define FILE_TYPE_COMM_DEVICE 4
# define FILE_TYPE_UNKNOWN 0xFFFF
1998-05-23 06:00:21 +04:00
1998-07-11 05:25:02 +04:00
/* Flag for NT transact rename call. */
# define RENAME_REPLACE_IF_EXISTS 1
2004-03-03 23:55:59 +03:00
/* flags for SMBntrename call (from Samba4) */
# define RENAME_FLAG_MOVE_CLUSTER_INFORMATION 0x102 /* ???? */
# define RENAME_FLAG_HARD_LINK 0x103
# define RENAME_FLAG_RENAME 0x104
# define RENAME_FLAG_COPY 0x105
1998-07-02 01:49:49 +04:00
/* Filesystem Attributes. */
2003-04-15 23:51:17 +04:00
# define FILE_CASE_SENSITIVE_SEARCH 0x00000001
# define FILE_CASE_PRESERVED_NAMES 0x00000002
# define FILE_UNICODE_ON_DISK 0x00000004
2000-02-18 06:54:26 +03:00
/* According to cifs9f, this is 4, not 8 */
/* Acconding to testing, this actually sets the security attribute! */
2003-04-15 23:51:17 +04:00
# define FILE_PERSISTENT_ACLS 0x00000008
# define FILE_FILE_COMPRESSION 0x00000010
# define FILE_VOLUME_QUOTAS 0x00000020
# define FILE_SUPPORTS_SPARSE_FILES 0x00000040
# define FILE_SUPPORTS_REPARSE_POINTS 0x00000080
# define FILE_SUPPORTS_REMOTE_STORAGE 0x00000100
# define FS_LFN_APIS 0x00004000
# define FILE_VOLUME_IS_COMPRESSED 0x00008000
# define FILE_SUPPORTS_OBJECT_IDS 0x00010000
# define FILE_SUPPORTS_ENCRYPTION 0x00020000
# define FILE_NAMED_STREAMS 0x00040000
# define FILE_READ_ONLY_VOLUME 0x00080000
1998-07-02 01:49:49 +04:00
1998-08-03 23:07:55 +04:00
/* ChangeNotify flags. */
2007-01-31 15:42:24 +03:00
# define FILE_NOTIFY_CHANGE_FILE_NAME 0x001
1998-08-03 23:07:55 +04:00
# define FILE_NOTIFY_CHANGE_DIR_NAME 0x002
# define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x004
# define FILE_NOTIFY_CHANGE_SIZE 0x008
# define FILE_NOTIFY_CHANGE_LAST_WRITE 0x010
# define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x020
# define FILE_NOTIFY_CHANGE_CREATION 0x040
# define FILE_NOTIFY_CHANGE_EA 0x080
# define FILE_NOTIFY_CHANGE_SECURITY 0x100
2007-01-31 15:42:24 +03:00
# define FILE_NOTIFY_CHANGE_STREAM_NAME 0x00000200
# define FILE_NOTIFY_CHANGE_STREAM_SIZE 0x00000400
# define FILE_NOTIFY_CHANGE_STREAM_WRITE 0x00000800
1998-08-03 23:07:55 +04:00
2007-01-17 19:23:45 +03:00
# define FILE_NOTIFY_CHANGE_NAME \
( FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_DIR_NAME )
/* change notify action results */
# define NOTIFY_ACTION_ADDED 1
# define NOTIFY_ACTION_REMOVED 2
# define NOTIFY_ACTION_MODIFIED 3
# define NOTIFY_ACTION_OLD_NAME 4
# define NOTIFY_ACTION_NEW_NAME 5
# define NOTIFY_ACTION_ADDED_STREAM 6
# define NOTIFY_ACTION_REMOVED_STREAM 7
# define NOTIFY_ACTION_MODIFIED_STREAM 8
2006-12-29 00:50:31 +03:00
1996-05-04 11:50:46 +04:00
/* where to find the base of the SMB packet proper */
# define smb_base(buf) (((char *)(buf))+4)
1999-12-13 16:27:58 +03:00
/* we don't allow server strings to be longer than 48 characters as
otherwise NT will not honour the announce packets */
# define MAX_SERVER_STRING_LENGTH 48
1998-04-10 00:48:48 +04:00
# define SMB_SUCCESS 0 /* The request was successful. */
1996-05-04 11:50:46 +04:00
1998-07-29 07:08:05 +04:00
# ifdef WITH_DFS
1996-05-04 11:50:46 +04:00
void dfs_unlogin ( void ) ;
extern int dcelogin_atmost_once ;
# endif
1996-06-04 10:42:03 +04:00
1996-05-04 11:50:46 +04:00
# ifdef NOSTRDUP
char * strdup ( char * s ) ;
# endif
1996-06-04 10:42:03 +04:00
1996-05-04 11:50:46 +04:00
# ifndef SELECT_CAST
# define SELECT_CAST
# endif
2001-04-13 06:51:58 +04:00
/* This was set by JHT in liaison with Jeremy Allison early 1997
* History :
* Version 4.0 - never made public
* Version 4.10 - New to 1.9 .16 p2 , lost in space 1.9 .16 p3 to 1.9 .16 p9
* - Reappeared in 1.9 .16 p11 with fixed smbd services
* Version 4.20 - To indicate that nmbd and browsing now works better
* Version 4.50 - Set at release of samba - 2.2 .0 by JHT
*
* Note : In the presence of NT4 . X do not set above 4.9
* Setting this above 4.9 can have undesired side - effects .
* This may change again in Samba - 3.0 after further testing . JHT
*/
1997-07-30 23:17:51 +04:00
# define DEFAULT_MAJOR_VERSION 0x04
2002-09-25 19:19:00 +04:00
# define DEFAULT_MINOR_VERSION 0x09
1997-03-15 17:47:00 +03:00
/* Browser Election Values */
1997-03-15 17:58:30 +03:00
# define BROWSER_ELECTION_VERSION 0x010f
1997-03-15 17:47:00 +03:00
# define BROWSER_CONSTANT 0xaa55
1996-05-04 11:50:46 +04:00
2002-07-15 14:35:28 +04:00
/* Sercurity mode bits. */
# define NEGOTIATE_SECURITY_USER_LEVEL 0x01
# define NEGOTIATE_SECURITY_CHALLENGE_RESPONSE 0x02
# define NEGOTIATE_SECURITY_SIGNATURES_ENABLED 0x04
# define NEGOTIATE_SECURITY_SIGNATURES_REQUIRED 0x08
1998-03-12 00:11:04 +03:00
/* NT Flags2 bits - cifs6.txt section 3.1.2 */
2002-07-15 14:35:28 +04:00
# define FLAGS2_LONG_PATH_COMPONENTS 0x0001
# define FLAGS2_EXTENDED_ATTRIBUTES 0x0002
# define FLAGS2_SMB_SECURITY_SIGNATURES 0x0004
2007-02-09 00:48:09 +03:00
# define FLAGS2_UNKNOWN_BIT4 0x0010
2002-07-15 14:35:28 +04:00
# define FLAGS2_IS_LONG_NAME 0x0040
# define FLAGS2_EXTENDED_SECURITY 0x0800
# define FLAGS2_DFS_PATHNAMES 0x1000
2005-07-08 08:51:27 +04:00
# define FLAGS2_READ_PERMIT_EXECUTE 0x2000
2002-07-15 14:35:28 +04:00
# define FLAGS2_32_BIT_ERROR_CODES 0x4000
# define FLAGS2_UNICODE_STRINGS 0x8000
# define FLAGS2_WIN2K_SIGNATURE 0xC852 /* Hack alert ! For now... JRA. */
2000-03-13 23:05:18 +03:00
2007-04-07 09:49:24 +04:00
/* TCONX Flag (smb_vwv2). */
# define TCONX_FLAG_EXTENDED_RESPONSE 0x8
2009-09-15 02:30:05 +04:00
/* File Status Flags. See:
http : //msdn.microsoft.com/en-us/library/cc246334(PROT.13).aspx
*/
# define NO_EAS 0x1
# define NO_SUBSTREAMS 0x2
# define NO_REPARSETAG 0x4
1997-03-09 17:58:22 +03:00
/* Capabilities. see ftp.microsoft.com/developr/drg/cifs/cifs/cifs4.txt */
1999-12-13 16:27:58 +03:00
# define CAP_RAW_MODE 0x0001
# define CAP_MPX_MODE 0x0002
# define CAP_UNICODE 0x0004
# define CAP_LARGE_FILES 0x0008
# define CAP_NT_SMBS 0x0010
# define CAP_RPC_REMOTE_APIS 0x0020
# define CAP_STATUS32 0x0040
# define CAP_LEVEL_II_OPLOCKS 0x0080
# define CAP_LOCK_AND_READ 0x0100
# define CAP_NT_FIND 0x0200
# define CAP_DFS 0x1000
2001-06-08 07:02:34 +04:00
# define CAP_W2K_SMBS 0x2000
1999-12-13 16:27:58 +03:00
# define CAP_LARGE_READX 0x4000
2001-06-08 07:02:34 +04:00
# define CAP_LARGE_WRITEX 0x8000
2002-07-15 14:35:28 +04:00
# define CAP_UNIX 0x800000 /* Capabilities for UNIX extensions. Created by HP. */
2000-03-13 23:05:18 +03:00
# define CAP_EXTENDED_SECURITY 0x80000000
1997-03-09 17:58:22 +03:00
1996-05-04 11:50:46 +04:00
/* protocol types. It assumes that higher protocols include lower protocols
as subsets */
2009-05-19 12:45:38 +04:00
enum protocol_types {
PROTOCOL_NONE ,
PROTOCOL_CORE ,
PROTOCOL_COREPLUS ,
PROTOCOL_LANMAN1 ,
PROTOCOL_LANMAN2 ,
PROTOCOL_NT1 ,
PROTOCOL_SMB2
} ;
1996-05-04 11:50:46 +04:00
/* security levels */
2001-11-26 02:05:13 +03:00
enum security_types { SEC_SHARE , SEC_USER , SEC_SERVER , SEC_DOMAIN , SEC_ADS } ;
1996-05-04 11:50:46 +04:00
2000-05-29 03:34:34 +04:00
/* server roles */
2006-02-02 23:44:50 +03:00
enum server_types {
2000-05-29 03:34:34 +04:00
ROLE_STANDALONE ,
ROLE_DOMAIN_MEMBER ,
ROLE_DOMAIN_BDC ,
ROLE_DOMAIN_PDC
} ;
1996-05-04 11:50:46 +04:00
/* printing types */
1997-11-10 22:23:17 +03:00
enum printing_types { PRINT_BSD , PRINT_SYSV , PRINT_AIX , PRINT_HPUX ,
2000-11-14 18:26:53 +03:00
PRINT_QNX , PRINT_PLP , PRINT_LPRNG , PRINT_SOFTQ ,
2005-09-21 03:28:22 +04:00
PRINT_CUPS , PRINT_LPRNT , PRINT_LPROS2 , PRINT_IPRINT
2006-08-20 21:46:20 +04:00
# if defined(DEVELOPER) || defined(ENABLE_BUILD_FARM_HACKS)
2000-11-14 18:26:53 +03:00
, PRINT_TEST , PRINT_VLP
# endif /* DEVELOPER */
} ;
1996-05-04 11:50:46 +04:00
2001-12-13 21:09:29 +03:00
/* LDAP schema types */
enum schema_types { SCHEMA_COMPAT , SCHEMA_AD , SCHEMA_SAMBA } ;
/* LDAP SSL options */
2008-12-17 18:26:43 +03:00
enum ldap_ssl_types { LDAP_SSL_OFF , LDAP_SSL_START_TLS } ;
2001-12-13 21:09:29 +03:00
2002-09-25 19:19:00 +04:00
/* LDAP PASSWD SYNC methods */
enum ldap_passwd_sync_types { LDAP_PASSWD_SYNC_ON , LDAP_PASSWD_SYNC_OFF , LDAP_PASSWD_SYNC_ONLY } ;
2010-07-01 01:20:22 +04:00
/*
* This should be under the HAVE_KRB5 flag but since they ' re used
* in lp_kerberos_method ( ) , they ned to be always available
* If you add any entries to KERBEROS_VERIFY defines , please modify USE . * KEYTAB macros
* so they remain accurate .
*/
# define KERBEROS_VERIFY_SECRETS 0
# define KERBEROS_VERIFY_SYSTEM_KEYTAB 1
# define KERBEROS_VERIFY_DEDICATED_KEYTAB 2
# define KERBEROS_VERIFY_SECRETS_AND_KEYTAB 3
1997-09-05 00:26:07 +04:00
/* Remote architectures we know about. */
2004-06-15 22:36:45 +04:00
enum remote_arch_types { RA_UNKNOWN , RA_WFWG , RA_OS2 , RA_WIN95 , RA_WINNT ,
2007-02-09 00:48:09 +03:00
RA_WIN2K , RA_WINXP , RA_WIN2K3 , RA_VISTA ,
2008-03-31 23:33:53 +04:00
RA_SAMBA , RA_CIFSFS , RA_WINXP64 } ;
1996-05-04 11:50:46 +04:00
/* case handling */
enum case_handling { CASE_LOWER , CASE_UPPER } ;
2006-03-11 13:59:03 +03:00
/* ACL compatibility */
enum acl_compatibility { ACL_COMPAT_AUTO , ACL_COMPAT_WINNT , ACL_COMPAT_WIN2K } ;
1996-10-26 00:48:25 +04:00
/*
* Global value meaing that the smb_uid field should be
* ingored ( in share level security and protocol level = = CORE )
*/
# define UID_FIELD_INVALID 0
# define VUID_OFFSET 100 /* Amount to bias returned vuid numbers */
1997-09-26 23:26:56 +04:00
/*
* Size of buffer to use when moving files across filesystems .
*/
1997-07-01 05:19:13 +04:00
# define COPYBUF_SIZE (8*1024)
1997-09-26 23:26:56 +04:00
/*
* Map the Core and Extended Oplock requesst bits down
* to common bits ( EXCLUSIVE_OPLOCK & BATCH_OPLOCK ) .
*/
/*
* Core protocol .
*/
1998-09-18 03:06:57 +04:00
# define CORE_OPLOCK_REQUEST(inbuf) \
( ( CVAL ( inbuf , smb_flg ) & ( FLAG_REQUEST_OPLOCK | FLAG_REQUEST_BATCH_OPLOCK ) ) > > 5 )
1997-09-26 23:26:56 +04:00
/*
* Extended protocol .
*/
1997-10-27 15:02:34 +03:00
# define EXTENDED_OPLOCK_REQUEST(inbuf) ((SVAL(inbuf,smb_vwv2)&((1<<1)|(1<<2)))>>1)
1997-09-26 23:26:56 +04:00
1997-09-30 06:38:19 +04:00
/* Lock types. */
# define LOCKING_ANDX_SHARED_LOCK 0x1
# define LOCKING_ANDX_OPLOCK_RELEASE 0x2
# define LOCKING_ANDX_CHANGE_LOCKTYPE 0x4
# define LOCKING_ANDX_CANCEL_LOCK 0x8
# define LOCKING_ANDX_LARGE_FILES 0x10
1997-09-26 23:26:56 +04:00
/*
* Bits we test with .
2006-05-30 22:17:37 +04:00
* Note these must fit into 16 - bits .
1997-09-26 23:26:56 +04:00
*/
2006-05-30 22:17:37 +04:00
2007-02-07 00:05:34 +03:00
# define NO_OPLOCK 0x0
# define EXCLUSIVE_OPLOCK 0x1
# define BATCH_OPLOCK 0x2
# define LEVEL_II_OPLOCK 0x4
2006-05-30 22:17:37 +04:00
/* The following are Samba-private. */
2007-02-07 00:05:34 +03:00
# define INTERNAL_OPEN_ONLY 0x8
# define FAKE_LEVEL_II_OPLOCK 0x10 / * Client requested no_oplock, but we have to
2005-09-30 21:13:37 +04:00
* inform potential level2 holders on
* write . */
2007-02-07 00:05:34 +03:00
# define DEFERRED_OPEN_ENTRY 0x20
# define UNUSED_SHARE_MODE_ENTRY 0x40
# define FORCE_OPLOCK_BREAK_TO_NONE 0x80
2006-05-30 22:17:37 +04:00
/* None of the following should ever appear in fsp->oplock_request. */
# define SAMBA_PRIVATE_OPLOCK_MASK (INTERNAL_OPEN_ONLY|DEFERRED_OPEN_ENTRY|UNUSED_SHARE_MODE_ENTRY|FORCE_OPLOCK_BREAK_TO_NONE)
1999-12-13 16:27:58 +03:00
2005-07-08 08:51:27 +04:00
# define EXCLUSIVE_OPLOCK_TYPE(lck) ((lck) & ((unsigned int)EXCLUSIVE_OPLOCK|(unsigned int)BATCH_OPLOCK))
# define BATCH_OPLOCK_TYPE(lck) ((lck) & (unsigned int)BATCH_OPLOCK)
2005-09-30 21:13:37 +04:00
# define LEVEL_II_OPLOCK_TYPE(lck) ((lck) & ((unsigned int)LEVEL_II_OPLOCK|(unsigned int)FAKE_LEVEL_II_OPLOCK))
2006-01-13 01:17:54 +03:00
/* kernel_oplock_message definition.
2005-09-30 21:13:37 +04:00
struct kernel_oplock_message {
2009-02-16 10:45:28 +03:00
uint64_t dev ;
uint64_t inode ;
unit64_t extid ;
2005-09-30 21:13:37 +04:00
unsigned long file_id ;
} ;
1997-09-26 23:26:56 +04:00
2006-01-13 01:17:54 +03:00
Offset Data length .
2009-02-16 10:45:28 +03:00
0 uint64_t dev 8 bytes
8 uint64_t inode 8 bytes
16 uint64_t extid 8 bytes
24 unsigned long file_id 4 bytes
28
2006-01-13 01:17:54 +03:00
*/
2009-02-16 10:45:28 +03:00
# define MSG_SMB_KERNEL_BREAK_SIZE 28
2006-01-13 01:17:54 +03:00
/* file_renamed_message definition.
2005-12-13 21:11:50 +03:00
struct file_renamed_message {
2009-02-16 10:45:28 +03:00
uint64_t dev ;
uint64_t inode ;
2006-01-13 01:17:54 +03:00
char names [ 1 ] ; A variable area containing sharepath and filename .
2005-12-13 21:11:50 +03:00
} ;
2006-01-13 01:17:54 +03:00
Offset Data length .
2009-02-16 10:45:28 +03:00
0 uint64_t dev 8 bytes
8 uint64_t inode 8 bytes
16 unit64_t extid 8 bytes
24 char [ ] name zero terminated namelen bytes
minimum length = = 24.
2006-01-13 01:17:54 +03:00
*/
2009-02-16 10:45:28 +03:00
# define MSG_FILE_RENAMED_MIN_SIZE 24
2006-01-13 01:17:54 +03:00
1999-12-13 16:27:58 +03:00
/*
2005-07-08 08:51:27 +04:00
* On the wire return values for oplock types .
1999-12-13 16:27:58 +03:00
*/
2005-07-08 08:51:27 +04:00
# define CORE_OPLOCK_GRANTED (1<<5)
# define EXTENDED_OPLOCK_GRANTED (1<<15)
1999-12-13 16:27:58 +03:00
# define NO_OPLOCK_RETURN 0
# define EXCLUSIVE_OPLOCK_RETURN 1
# define BATCH_OPLOCK_RETURN 2
# define LEVEL_II_OPLOCK_RETURN 3
2005-07-08 08:51:27 +04:00
/* Oplock levels */
# define OPLOCKLEVEL_NONE 0
# define OPLOCKLEVEL_II 1
1998-09-26 03:40:49 +04:00
/*
* Capabilities abstracted for different systems .
*/
2006-03-21 05:56:49 +03:00
enum smbd_capability {
2006-03-23 02:49:09 +03:00
KERNEL_OPLOCK_CAPABILITY ,
2008-05-28 15:20:16 +04:00
DMAPI_ACCESS_CAPABILITY ,
2010-03-08 22:34:39 +03:00
LEASE_CAPABILITY
2006-03-21 05:56:49 +03:00
} ;
1998-09-26 03:40:49 +04:00
2009-02-04 02:40:23 +03:00
/*
* Kernel oplocks capability flags .
*/
/* Level 2 oplocks are supported natively by kernel oplocks. */
# define KOPLOCKS_LEVEL2_SUPPORTED 0x1
/* The kernel notifies deferred openers when they can retry the open. */
# define KOPLOCKS_DEFERRED_OPEN_NOTIFICATION 0x2
/* The kernel notifies smbds when an oplock break times out. */
# define KOPLOCKS_TIMEOUT_NOTIFICATION 0x4
/* The kernel notifies smbds when an oplock is broken. */
# define KOPLOCKS_OPLOCK_BROKEN_NOTIFICATION 0x8
2009-01-09 16:02:18 +03:00
struct kernel_oplocks_ops ;
struct kernel_oplocks {
const struct kernel_oplocks_ops * ops ;
2009-02-04 02:40:23 +03:00
uint32_t flags ;
2009-01-09 16:02:18 +03:00
void * private_data ;
} ;
2009-02-03 22:56:35 +03:00
enum level2_contention_type {
LEVEL2_CONTEND_ALLOC_SHRINK ,
LEVEL2_CONTEND_ALLOC_GROW ,
LEVEL2_CONTEND_SET_FILE_LEN ,
LEVEL2_CONTEND_FILL_SPARSE ,
LEVEL2_CONTEND_WRITE ,
LEVEL2_CONTEND_WINDOWS_BRL ,
LEVEL2_CONTEND_POSIX_BRL
} ;
2000-06-10 17:38:07 +04:00
/* if a kernel does support oplocks then a structure of the following
typee is used to describe how to interact with the kernel */
2009-01-09 16:02:18 +03:00
struct kernel_oplocks_ops {
bool ( * set_oplock ) ( struct kernel_oplocks * ctx ,
files_struct * fsp , int oplock_type ) ;
void ( * release_oplock ) ( struct kernel_oplocks * ctx ,
2009-01-10 00:07:58 +03:00
files_struct * fsp , int oplock_type ) ;
2009-02-03 22:56:35 +03:00
void ( * contend_level2_oplocks_begin ) ( files_struct * fsp ,
enum level2_contention_type type ) ;
void ( * contend_level2_oplocks_end ) ( files_struct * fsp ,
enum level2_contention_type type ) ;
2000-06-10 17:38:07 +04:00
} ;
2000-02-03 07:47:50 +03:00
# include "smb_macros.h"
1998-08-21 13:43:21 +04:00
2004-03-13 03:28:53 +03:00
# define MAX_NETBIOSNAME_LEN 16
2004-03-16 00:45:45 +03:00
/* DOS character, NetBIOS namestring. Type used on the wire. */
2004-03-13 03:28:53 +03:00
typedef char nstring [ MAX_NETBIOSNAME_LEN ] ;
2004-03-16 00:45:45 +03:00
/* Unix character, NetBIOS namestring. Type used to manipulate name in nmbd. */
typedef char unstring [ MAX_NETBIOSNAME_LEN * 4 ] ;
2003-08-23 05:59:14 +04:00
1998-09-26 01:01:52 +04:00
/* A netbios name structure. */
struct nmb_name {
2003-08-23 05:59:14 +04:00
nstring name ;
2003-08-23 02:45:34 +04:00
char scope [ 64 ] ;
unsigned int name_type ;
1998-09-26 01:01:52 +04:00
} ;
2000-12-20 06:22:51 +03:00
/* A netbios node status array element. */
2005-06-25 00:25:18 +04:00
typedef struct node_status_ {
2003-08-23 05:59:14 +04:00
nstring name ;
2000-12-20 06:22:51 +03:00
unsigned char type ;
unsigned char flags ;
2005-06-25 00:25:18 +04:00
} NODE_STATUS_STRUCT ;
2000-12-20 06:22:51 +03:00
2004-04-16 07:57:30 +04:00
/* The extra info from a NetBIOS node status query */
struct node_status_extra {
unsigned char mac_addr [ 6 ] ;
/* There really is more here ... */
} ;
2005-12-07 02:06:38 +03:00
typedef struct user_struct {
2000-11-29 01:17:44 +03:00
struct user_struct * next , * prev ;
uint16 vuid ; /* Tag for this entry. */
2000-06-08 17:56:07 +04:00
2002-08-17 21:00:51 +04:00
char * session_keystr ; /* used by utmp and pam session code.
TDB key string */
2002-07-15 14:35:28 +04:00
int homes_snum ;
2003-02-24 05:35:54 +03:00
struct auth_serversupplied_info * server_info ;
2005-07-14 18:39:27 +04:00
struct auth_ntlmssp_state * auth_ntlmssp_state ;
2000-06-08 17:56:07 +04:00
} user_struct ;
2002-01-17 00:27:57 +03:00
struct unix_error_map {
int unix_error ;
int dos_class ;
int dos_code ;
NTSTATUS nt_error ;
} ;
1998-09-25 02:33:13 +04:00
/*
2001-09-06 12:56:30 +04:00
* Size of new password account encoding string . This is enough space to
* hold 11 ACB characters , plus the surrounding [ ] and a terminating null .
* Do not change unless you are adding new ACB bits !
1998-09-25 02:33:13 +04:00
*/
# define NEW_PW_FORMAT_SPACE_PADDED_LEN 14
1998-11-10 23:51:25 +03:00
/*
Do you want session setups at user level security with a invalid
password to be rejected or allowed in as guest ? WinNT rejects them
but it can be a pain as it means " net view " needs to use a password
You have 3 choices in the setting of map_to_guest :
" NEVER_MAP_TO_GUEST " means session setups with an invalid password
are rejected . This is the default .
" MAP_TO_GUEST_ON_BAD_USER " means session setups with an invalid password
are rejected , unless the username does not exist , in which case it
is treated as a guest login
" MAP_TO_GUEST_ON_BAD_PASSWORD " means session setups with an invalid password
are treated as a guest login
Note that map_to_guest only has an effect in user or server
level security .
*/
2005-06-08 18:23:49 +04:00
# define NEVER_MAP_TO_GUEST 0
# define MAP_TO_GUEST_ON_BAD_USER 1
# define MAP_TO_GUEST_ON_BAD_PASSWORD 2
# define MAP_TO_GUEST_ON_BAD_UID 3
1998-11-10 23:51:25 +03:00
2001-06-23 11:22:16 +04:00
# define SAFE_NETBIOS_CHARS ". -_"
2001-12-05 14:00:26 +03:00
/* The maximum length of a trust account password.
Used when we randomly create it , 15 char passwords
exceed NT4 ' s max password length */
# define DEFAULT_TRUST_ACCOUNT_PASSWORD_LENGTH 14
2003-06-25 21:41:05 +04:00
# define PORT_NONE 0
2003-06-25 23:39:16 +04:00
# ifndef LDAP_PORT
# define LDAP_PORT 389
# endif
2008-06-27 18:22:39 +04:00
# define LDAP_GC_PORT 3268
2003-06-25 21:41:05 +04:00
/* used by the IP comparison function */
struct ip_service {
2007-10-25 01:16:54 +04:00
struct sockaddr_storage ss ;
2003-06-25 21:41:05 +04:00
unsigned port ;
} ;
2006-09-02 23:27:44 +04:00
/* Special name type used to cause a _kerberos DNS lookup. */
# define KDC_NAME_TYPE 0xDCDC
2004-03-27 05:13:58 +03:00
struct ea_struct {
uint8 flags ;
char * name ;
DATA_BLOB value ;
} ;
2005-03-31 04:36:22 +04:00
struct ea_list {
struct ea_list * next , * prev ;
struct ea_struct ea ;
} ;
2004-03-31 06:20:16 +04:00
/* EA names used internally in Samba. KEEP UP TO DATE with prohibited_ea_names in trans2.c !. */
# define SAMBA_POSIX_INHERITANCE_EA_NAME "user.SAMBA_PAI"
2004-04-02 22:46:19 +04:00
/* EA to use for DOS attributes */
# define SAMBA_XATTR_DOS_ATTRIB "user.DOSATTRIB"
2008-01-21 22:24:23 +03:00
/* Prefix for DosStreams in the vfs_streams_xattr module */
# define SAMBA_XATTR_DOSSTREAM_PREFIX "user.DosStream."
2009-10-30 02:14:12 +03:00
/* Prefix for xattrs storing streams. */
# define SAMBA_XATTR_MARKER "user.SAMBA_STREAMS"
2004-04-02 22:46:19 +04:00
2005-09-30 21:13:37 +04:00
# define UUID_SIZE 16
# define UUID_FLAT_SIZE 16
typedef struct uuid_flat {
uint8 info [ UUID_FLAT_SIZE ] ;
} UUID_FLAT ;
2005-10-14 05:09:37 +04:00
/* map readonly options */
enum mapreadonly_options { MAP_READONLY_NO , MAP_READONLY_YES , MAP_READONLY_PERMISSIONS } ;
2006-02-04 01:19:41 +03:00
/* usershare error codes. */
enum usershare_err {
USERSHARE_OK = 0 ,
USERSHARE_MALFORMED_FILE ,
USERSHARE_BAD_VERSION ,
USERSHARE_MALFORMED_PATH ,
USERSHARE_MALFORMED_COMMENT_DEF ,
USERSHARE_MALFORMED_ACL_DEF ,
USERSHARE_ACL_ERR ,
USERSHARE_PATH_NOT_ABSOLUTE ,
USERSHARE_PATH_IS_DENIED ,
USERSHARE_PATH_NOT_ALLOWED ,
USERSHARE_PATH_NOT_DIRECTORY ,
2010-03-27 03:09:58 +03:00
USERSHARE_POSIX_ERR ,
USERSHARE_MALFORMED_SHARENAME_DEF ,
USERSHARE_BAD_SHARENAME
2006-02-04 01:19:41 +03:00
} ;
2006-02-02 23:44:50 +03:00
/* Different reasons for closing a file. */
enum file_close_type { NORMAL_CLOSE = 0 , SHUTDOWN_CLOSE , ERROR_CLOSE } ;
2008-01-22 13:33:17 +03:00
/* Used in SMB_FS_OBJECTID_INFORMATION requests. Must be exactly 48 bytes. */
# define SAMBA_EXTENDED_INFO_MAGIC 0x536d4261 /* "SmBa" */
# define SAMBA_EXTENDED_INFO_VERSION_STRING_LENGTH 28
struct smb_extended_info {
uint32 samba_magic ; /* Always SAMBA_EXTRA_INFO_MAGIC */
uint32 samba_version ; /* Major/Minor/Release/Revision */
uint32 samba_subversion ; /* Prerelease/RC/Vendor patch */
NTTIME samba_gitcommitdate ;
char samba_version_string [ SAMBA_EXTENDED_INFO_VERSION_STRING_LENGTH ] ;
} ;
2009-01-24 01:40:19 +03:00
/* time info */
struct smb_file_time {
struct timespec mtime ;
struct timespec atime ;
2009-07-31 00:16:40 +04:00
struct timespec ctime ;
2009-01-24 01:40:19 +03:00
struct timespec create_time ;
} ;
s3: Change unix_convert (and its callers) to use struct smb_filename
This is the first of a series of patches that change path based
operations to operate on a struct smb_filename instead of a char *.
This same concept already exists in source4.
My goals for this series of patches are to eventually:
1) Solve the stream vs. posix filename that contains a colon ambiguity
that currently exists.
2) Make unix_convert the only function that parses the stream name.
3) Clean up the unix_convert API.
4) Change all path based vfs operation to take a struct smb_filename.
5) Make is_ntfs_stream_name() a constant operation that can simply
check the state of struct smb_filename rather than re-parse the
filename.
6) Eliminate the need for split_ntfs_stream_name() to exist.
My strategy is to start from the inside at unix_convert() and work my
way out through the vfs layer, call by call. This first patch does
just that, by changing unix_convert and all of its callers to operate
on struct smb_filename. Since this is such a large change, I plan on
pushing the patches in phases, where each phase keeps full
compatibility and passes make test.
The API of unix_convert has been simplified from:
NTSTATUS unix_convert(TALLOC_CTX *ctx,
connection_struct *conn,
const char *orig_path,
bool allow_wcard_last_component,
char **pp_conv_path,
char **pp_saved_last_component,
SMB_STRUCT_STAT *pst)
to:
NTSTATUS unix_convert(TALLOC_CTX *ctx,
connection_struct *conn,
const char *orig_path,
struct smb_filename *smb_fname,
uint32_t ucf_flags)
Currently the smb_filename struct looks like:
struct smb_filename {
char *base_name;
char *stream_name;
char *original_lcomp;
SMB_STRUCT_STAT st;
};
One key point here is the decision to break up the base_name and
stream_name. I have introduced a helper function called
get_full_smb_filename() that takes an smb_filename struct and
allocates the full_name. I changed the callers of unix_convert() to
subsequently call get_full_smb_filename() for the time being, but I
plan to eventually eliminate get_full_smb_filename().
2009-04-08 00:39:57 +04:00
/*
* unix_convert_flags
*/
# define UCF_SAVE_LCOMP 0x00000001
2009-07-25 05:38:40 +04:00
# define UCF_ALWAYS_ALLOW_WCARD_LCOMP 0x00000002
# define UCF_COND_ALLOW_WCARD_LCOMP 0x00000004
2009-11-24 02:01:34 +03:00
# define UCF_POSIX_PATHNAMES 0x00000008
s3: Change unix_convert (and its callers) to use struct smb_filename
This is the first of a series of patches that change path based
operations to operate on a struct smb_filename instead of a char *.
This same concept already exists in source4.
My goals for this series of patches are to eventually:
1) Solve the stream vs. posix filename that contains a colon ambiguity
that currently exists.
2) Make unix_convert the only function that parses the stream name.
3) Clean up the unix_convert API.
4) Change all path based vfs operation to take a struct smb_filename.
5) Make is_ntfs_stream_name() a constant operation that can simply
check the state of struct smb_filename rather than re-parse the
filename.
6) Eliminate the need for split_ntfs_stream_name() to exist.
My strategy is to start from the inside at unix_convert() and work my
way out through the vfs layer, call by call. This first patch does
just that, by changing unix_convert and all of its callers to operate
on struct smb_filename. Since this is such a large change, I plan on
pushing the patches in phases, where each phase keeps full
compatibility and passes make test.
The API of unix_convert has been simplified from:
NTSTATUS unix_convert(TALLOC_CTX *ctx,
connection_struct *conn,
const char *orig_path,
bool allow_wcard_last_component,
char **pp_conv_path,
char **pp_saved_last_component,
SMB_STRUCT_STAT *pst)
to:
NTSTATUS unix_convert(TALLOC_CTX *ctx,
connection_struct *conn,
const char *orig_path,
struct smb_filename *smb_fname,
uint32_t ucf_flags)
Currently the smb_filename struct looks like:
struct smb_filename {
char *base_name;
char *stream_name;
char *original_lcomp;
SMB_STRUCT_STAT st;
};
One key point here is the decision to break up the base_name and
stream_name. I have introduced a helper function called
get_full_smb_filename() that takes an smb_filename struct and
allocates the full_name. I changed the callers of unix_convert() to
subsequently call get_full_smb_filename() for the time being, but I
plan to eventually eliminate get_full_smb_filename().
2009-04-08 00:39:57 +04:00
/*
* smb_filename
*/
struct smb_filename {
char * base_name ;
char * stream_name ;
char * original_lcomp ;
SMB_STRUCT_STAT st ;
} ;
2009-06-17 02:11:32 +04:00
/* struct for maintaining the child processes that get spawned from smbd */
struct child_pid {
struct child_pid * prev , * next ;
pid_t pid ;
} ;
2010-04-10 06:26:34 +04:00
/* Used to keep track of deferred opens. */
struct deferred_open_record ;
2010-05-22 03:56:10 +04:00
/* Client-side offline caching policy types */
# define CSC_POLICY_MANUAL 0
# define CSC_POLICY_DOCUMENTS 1
# define CSC_POLICY_PROGRAMS 2
# define CSC_POLICY_DISABLE 3
2010-06-04 22:30:46 +04:00
/* Used inside aio code. */
struct aio_extra ;
1998-03-12 00:11:04 +03:00
# endif /* _SMB_H */