X-Git-Url: http://git.samba.org/?a=blobdiff_plain;f=source%2Finclude%2Fsmb.h;h=a98d151e5f363214321d5583a667613cb2343d3e;hb=c5462c8b43435763783185a03029903efe3b0c11;hp=a725ae13929ca80ece703bb3c265d1919aba11e0;hpb=45636efa39cbcc2ecf7af4dfd1ac6a90f197ba01;p=samba.git diff --git a/source/include/smb.h b/source/include/smb.h index a725ae13929..a98d151e5f3 100644 --- a/source/include/smb.h +++ b/source/include/smb.h @@ -27,7 +27,7 @@ #define _SMB_H /* logged when starting the various Samba daemons */ -#define COPYRIGHT_STARTUP_MESSAGE "Copyright Andrew Tridgell and the Samba Team 1992-2007" +#define COPYRIGHT_STARTUP_MESSAGE "Copyright Andrew Tridgell and the Samba Team 1992-2009" #if defined(LARGE_SMB_OFF_T) @@ -80,7 +80,8 @@ enum smb_read_errors { SMB_WRITE_ERROR, /* This error code can go into the client smb_rw_error. */ SMB_READ_BAD_SIG, SMB_NO_MEMORY, - SMB_DO_NOT_DO_TDIS /* cli_close_connection() check for this when smbfs wants to keep tree connected */ + SMB_DO_NOT_DO_TDIS, /* cli_close_connection() check for this when smbfs wants to keep tree connected */ + SMB_READ_BAD_DECRYPT }; #define DIR_STRUCT_SIZE 43 @@ -172,68 +173,10 @@ typedef uint32 codepoint_t; /* pipe string names */ #define PIPE_LANMAN "\\PIPE\\LANMAN" -#define PIPE_SRVSVC "\\PIPE\\srvsvc" -#define PIPE_SAMR "\\PIPE\\samr" -#define PIPE_WINREG "\\PIPE\\winreg" -#define PIPE_WKSSVC "\\PIPE\\wkssvc" -#define PIPE_NETLOGON "\\PIPE\\NETLOGON" -#define PIPE_NTLSA "\\PIPE\\ntlsa" -#define PIPE_NTSVCS "\\PIPE\\ntsvcs" -#define PIPE_LSASS "\\PIPE\\lsass" -#define PIPE_LSARPC "\\PIPE\\lsarpc" -#define PIPE_SPOOLSS "\\PIPE\\spoolss" -#define PIPE_NETDFS "\\PIPE\\netdfs" -#define PIPE_ECHO "\\PIPE\\rpcecho" -#define PIPE_SHUTDOWN "\\PIPE\\initshutdown" -#define PIPE_EPM "\\PIPE\\epmapper" -#define PIPE_SVCCTL "\\PIPE\\svcctl" -#define PIPE_EVENTLOG "\\PIPE\\eventlog" - -#define PIPE_NETLOGON_PLAIN "\\NETLOGON" - -#define PI_LSARPC 0 -#define PI_LSARPC_DS 1 -#define PI_SAMR 2 -#define PI_NETLOGON 3 -#define PI_SRVSVC 4 -#define PI_WKSSVC 5 -#define PI_WINREG 6 -#define PI_SPOOLSS 7 -#define PI_NETDFS 8 -#define PI_RPCECHO 9 -#define PI_INITSHUTDOWN 10 -#define PI_SVCCTL 11 -#define PI_EVENTLOG 12 -#define PI_NTSVCS 13 -#define PI_MAX_PIPES 14 /* 64 bit time (100usec) since ????? - cifs6.txt, section 3.5, page 30 */ typedef uint64_t NTTIME; - -/* Allowable account control bits */ -#define ACB_DISABLED 0x00000001 /* 1 = User account disabled */ -#define ACB_HOMDIRREQ 0x00000002 /* 1 = Home directory required */ -#define ACB_PWNOTREQ 0x00000004 /* 1 = User password not required */ -#define ACB_TEMPDUP 0x00000008 /* 1 = Temporary duplicate account */ -#define ACB_NORMAL 0x00000010 /* 1 = Normal user account */ -#define ACB_MNS 0x00000020 /* 1 = MNS logon user account */ -#define ACB_DOMTRUST 0x00000040 /* 1 = Interdomain trust account */ -#define ACB_WSTRUST 0x00000080 /* 1 = Workstation trust account */ -#define ACB_SVRTRUST 0x00000100 /* 1 = Server trust account (BDC) */ -#define ACB_PWNOEXP 0x00000200 /* 1 = User password does not expire */ -#define ACB_AUTOLOCK 0x00000400 /* 1 = Account auto locked */ - -/* only valid for > Windows 2000 */ -#define ACB_ENC_TXT_PWD_ALLOWED 0x00000800 /* 1 = Text password encryped */ -#define ACB_SMARTCARD_REQUIRED 0x00001000 /* 1 = Smart Card required */ -#define ACB_TRUSTED_FOR_DELEGATION 0x00002000 /* 1 = Trusted for Delegation */ -#define ACB_NOT_DELEGATED 0x00004000 /* 1 = Not delegated */ -#define ACB_USE_DES_KEY_ONLY 0x00008000 /* 1 = Use DES key only */ -#define ACB_DONT_REQUIRE_PREAUTH 0x00010000 /* 1 = Preauth not required */ -#define ACB_PWEXPIRED 0x00020000 /* 1 = Password is expired */ -#define ACB_NO_AUTH_DATA_REQD 0x00080000 /* 1 = No authorization data required */ - #define MAX_HOURS_LEN 32 #ifndef MAXSUBAUTHS @@ -254,6 +197,10 @@ typedef uint64_t NTTIME; #define LOOKUP_NAME_BUILTIN 0x00000010 /* builtin names */ #define LOOKUP_NAME_WKN 0x00000020 /* well known names */ #define LOOKUP_NAME_DOMAIN 0x00000040 /* only lookup own domain */ +#define LOOKUP_NAME_LOCAL (LOOKUP_NAME_ISOLATED\ + |LOOKUP_NAME_BUILTIN\ + |LOOKUP_NAME_WKN\ + |LOOKUP_NAME_DOMAIN) #define LOOKUP_NAME_ALL (LOOKUP_NAME_ISOLATED\ |LOOKUP_NAME_REMOTE\ |LOOKUP_NAME_BUILTIN\ @@ -278,9 +225,6 @@ typedef struct dom_sid { uint32 sub_auths[MAXSUBAUTHS]; } DOM_SID; -#define dom_sid2 dom_sid -#define dom_sid28 dom_sid - enum id_mapping { ID_UNKNOWN = 0, ID_MAPPED, @@ -305,8 +249,17 @@ struct id_map { enum id_mapping status; }; -#include "librpc/ndr/misc.h" -#include "librpc/ndr/security.h" +/* used to hold an arbitrary blob of data */ +typedef struct data_blob { + uint8 *data; + size_t length; + void (*free)(struct data_blob *data_blob); +} DATA_BLOB; + +extern const DATA_BLOB data_blob_null; + +#include "librpc/gen_ndr/misc.h" +#include "librpc/gen_ndr/security.h" #include "librpc/ndr/libndr.h" #include "librpc/gen_ndr/lsa.h" #include "librpc/gen_ndr/dfs.h" @@ -317,6 +270,16 @@ struct id_map { #include "librpc/gen_ndr/wkssvc.h" #include "librpc/gen_ndr/echo.h" #include "librpc/gen_ndr/svcctl.h" +#include "librpc/gen_ndr/netlogon.h" +#include "librpc/gen_ndr/samr.h" +#include "librpc/gen_ndr/dssetup.h" +#include "librpc/gen_ndr/epmapper.h" +#include "librpc/gen_ndr/libnet_join.h" +#include "librpc/gen_ndr/krb5pac.h" +#include "librpc/gen_ndr/ntsvcs.h" +#include "librpc/gen_ndr/nbt.h" +#include "librpc/gen_ndr/drsuapi.h" +#include "librpc/gen_ndr/drsblobs.h" struct lsa_dom_info { bool valid; @@ -378,10 +341,10 @@ typedef struct nt_user_token { SE_PRIV privileges; } NT_USER_TOKEN; -typedef struct _unix_token { +typedef struct unix_user_token { uid_t uid; gid_t gid; - int ngroups; + size_t ngroups; gid_t *groups; } UNIX_USER_TOKEN; @@ -421,12 +384,11 @@ struct fd_handle { unsigned long gen_id; }; -struct event_context; -struct fd_event; -struct timed_event; struct idle_event; struct share_mode_entry; struct uuid; +struct named_mutex; +struct pcap_cache; struct vfs_fsp_data { struct vfs_fsp_data *next; @@ -491,9 +453,13 @@ typedef struct files_struct { struct timeval open_time; 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). */ - bool pending_modtime_owner; - struct timespec pending_modtime; - struct timespec last_write_time; + + bool update_write_time_triggered; + struct timed_event *update_write_time_event; + bool update_write_time_on_close; + struct timespec close_write_time; + bool write_time_forced; + int oplock_type; int sent_oplock_break; struct timed_event *oplock_timeout; @@ -509,7 +475,6 @@ typedef struct files_struct { bool print_file; bool modified; bool is_directory; - bool is_stat; bool aio_write_behind; bool lockdb_clean; bool initial_delete_on_close; /* Only set at NTCreateX if file was created. */ @@ -517,41 +482,25 @@ typedef struct files_struct { char *fsp_name; struct vfs_fsp_data *vfs_extension; - FAKE_FILE_HANDLE *fake_file_handle; + struct fake_file_handle *fake_file_handle; struct notify_change_buf *notify; + + struct files_struct *base_fsp; /* placeholder for delete on close */ } files_struct; #include "ntquotas.h" #include "sysquotas.h" -/* used to hold an arbitrary blob of data */ -typedef struct data_blob { - uint8 *data; - size_t length; - void (*free)(struct data_blob *data_blob); -} DATA_BLOB; - -extern const DATA_BLOB data_blob_null; - -/* - * Structure used to keep directory state information around. - * Used in NT change-notify code. - */ - -typedef struct { - time_t modify_time; - time_t status_time; -} dir_status_struct; - struct vuid_cache_entry { - uint16 vuid; + struct auth_serversupplied_info *server_info; + uint16_t vuid; bool read_only; bool admin_user; }; struct vuid_cache { - unsigned int entries; + unsigned int next_entry; struct vuid_cache_entry array[VUID_CACHE_SIZE]; }; @@ -590,6 +539,16 @@ struct trans_state { char *data; }; +/* + * Info about an alternate data stream + */ + +struct stream_struct { + SMB_OFF_T size; + SMB_OFF_T alloc_size; + char *name; +}; + /* Include VFS stuff */ #include "smb_acls.h" @@ -615,11 +574,9 @@ struct share_iterator { typedef struct connection_struct { struct connection_struct *next, *prev; - TALLOC_CTX *mem_ctx; /* long-lived memory context for things hanging off this struct. */ unsigned cnum; /* an index passed over the wire */ struct share_params *params; bool force_user; - bool force_group; struct vuid_cache vuid_cache; struct dptr_struct *dirptr; bool printer; @@ -634,30 +591,32 @@ typedef struct connection_struct { struct vfs_ops vfs_opaque; /* OPAQUE Filesystem operations */ struct vfs_handle_struct *vfs_handles; /* for the new plugins */ - char *user; /* name of user who *opened* this connection */ - uid_t uid; /* uid of user who *opened* this connection */ - gid_t gid; /* gid of user who *opened* this connection */ + /* + * This represents the user information on this connection. Depending + * on the vuid using this tid, this might change per SMB request. + */ + struct auth_serversupplied_info *server_info; + char client_address[INET6_ADDRSTRLEN]; /* String version of client IP address. */ uint16 vuid; /* vuid of user who *opened* this connection, or UID_FIELD_INVALID */ - /* following groups stuff added by ih */ - - /* This groups info is valid for the user that *opened* the connection */ - size_t ngroups; - gid_t *groups; - NT_USER_TOKEN *nt_user_token; - time_t lastused; time_t lastused_count; bool used; int num_files_open; unsigned int num_smb_operations; /* Count of smb operations on this tree. */ + int encrypt_level; + bool encrypted_tid; + /* Semantics requested by the client or forced by the server config. */ bool case_sensitive; bool case_preserve; bool short_case_preserve; + /* Semantics provided by the underlying filesystem. */ + int fs_capabilities; + 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. */ @@ -684,6 +643,8 @@ struct smb_request { const uint8 *inbuf; uint8 *outbuf; size_t unread_bytes; + bool encrypted; + connection_struct *conn; }; /* Defines for the sent_oplock_break field above. */ @@ -747,12 +708,12 @@ struct pending_message_list { struct pending_message_list *next, *prev; struct timeval request_time; /* When was this first issued? */ struct timeval end_time; /* When does this time out? */ + bool encrypted; DATA_BLOB buf; DATA_BLOB private_data; }; #define SHARE_MODE_FLAG_POSIX_OPEN 0x1 -#define SHARE_MODE_ALLOW_INITIAL_DELETE_ON_CLOSE 0x2 /* struct returned by get_share_modes */ struct share_mode_entry { @@ -805,6 +766,8 @@ struct share_mode_lock { struct share_mode_entry *share_modes; UNIX_USER_TOKEN *delete_token; bool delete_on_close; + struct timespec old_write_time; + struct timespec changed_write_time; bool fresh; bool modified; struct db_record *record; @@ -820,6 +783,8 @@ struct locking_data { struct { int num_share_mode_entries; bool delete_on_close; + struct timespec old_write_time; + struct timespec changed_write_time; uint32 delete_token_size; /* Only valid if either of the two previous fields are True. */ @@ -1270,7 +1235,7 @@ struct bitmap { #define FILE_GENERIC_WRITE (STD_RIGHT_READ_CONTROL_ACCESS|FILE_WRITE_DATA|FILE_WRITE_ATTRIBUTES|\ FILE_WRITE_EA|FILE_APPEND_DATA|SYNCHRONIZE_ACCESS) -#define FILE_GENERIC_EXECUTE (STANDARD_RIGHTS_EXECUTE_ACCESS|\ +#define FILE_GENERIC_EXECUTE (STANDARD_RIGHTS_EXECUTE_ACCESS|FILE_READ_ATTRIBUTES|\ FILE_EXECUTE|SYNCHRONIZE_ACCESS) /* Share specific rights. */ @@ -1286,7 +1251,7 @@ struct bitmap { /* 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 -#define UNIX_DIRECTORY_ACCESS_W FILE_GENERIC_WRITE +#define UNIX_DIRECTORY_ACCESS_W (FILE_GENERIC_WRITE|FILE_DELETE_CHILD) #define UNIX_DIRECTORY_ACCESS_X FILE_GENERIC_EXECUTE #if 0 @@ -1362,9 +1327,19 @@ struct bitmap { #define FILE_DELETE_ON_CLOSE 0x1000 #define FILE_OPEN_BY_FILE_ID 0x2000 -/* Private create options used by the ntcreatex processing code. From Samba4. */ -#define NTCREATEX_OPTIONS_PRIVATE_DENY_DOS 0x01000000 -#define NTCREATEX_OPTIONS_PRIVATE_DENY_FCB 0x02000000 +#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. + * We reuse some ignored flags for private use. + */ +#define NTCREATEX_OPTIONS_PRIVATE_DENY_DOS 0x00010000 +#define NTCREATEX_OPTIONS_PRIVATE_DENY_FCB 0x00020000 + +/* Private options for streams support */ +#define NTCREATEX_OPTIONS_PRIVATE_STREAM_DELETE 0x00040000 /* Responses when opening a file. */ #define FILE_WAS_SUPERSEDED 0 @@ -1554,7 +1529,7 @@ enum printing_types {PRINT_BSD,PRINT_SYSV,PRINT_AIX,PRINT_HPUX, enum schema_types {SCHEMA_COMPAT, SCHEMA_AD, SCHEMA_SAMBA}; /* LDAP SSL options */ -enum ldap_ssl_types {LDAP_SSL_ON, LDAP_SSL_OFF, LDAP_SSL_START_TLS}; +enum ldap_ssl_types {LDAP_SSL_OFF, LDAP_SSL_START_TLS}; /* LDAP PASSWD SYNC methods */ enum ldap_passwd_sync_types {LDAP_PASSWD_SYNC_ON, LDAP_PASSWD_SYNC_OFF, LDAP_PASSWD_SYNC_ONLY}; @@ -1562,7 +1537,7 @@ enum ldap_passwd_sync_types {LDAP_PASSWD_SYNC_ON, LDAP_PASSWD_SYNC_OFF, LDAP_PAS /* Remote architectures we know about. */ enum remote_arch_types {RA_UNKNOWN, RA_WFWG, RA_OS2, RA_WIN95, RA_WINNT, RA_WIN2K, RA_WINXP, RA_WIN2K3, RA_VISTA, - RA_SAMBA, RA_CIFSFS}; + RA_SAMBA, RA_CIFSFS, RA_WINXP64}; /* case handling */ enum case_handling {CASE_LOWER,CASE_UPPER}; @@ -1701,7 +1676,8 @@ minimum length == 18. enum smbd_capability { KERNEL_OPLOCK_CAPABILITY, - DMAPI_ACCESS_CAPABILITY + DMAPI_ACCESS_CAPABILITY, + LEASE_CAPABILITY }; /* if a kernel does support oplocks then a structure of the following @@ -1761,24 +1737,6 @@ struct pending_auth_data { typedef struct user_struct { struct user_struct *next, *prev; uint16 vuid; /* Tag for this entry. */ - uid_t uid; /* uid of a validated user */ - gid_t gid; /* gid of a validated user */ - - userdom_struct user; - const char *homedir; - const char *unix_homedir; - const char *logon_script; - - bool guest; - - /* following groups stuff added by ih */ - /* This groups info is needed for when we become_user() for this uid */ - int n_groups; - gid_t *groups; - - NT_USER_TOKEN *nt_user_token; - - DATA_BLOB session_key; char *session_keystr; /* used by utmp and pam session code. TDB key string */ @@ -1856,6 +1814,7 @@ typedef struct _smb_iconv_t { #ifndef LDAP_PORT #define LDAP_PORT 389 #endif +#define LDAP_GC_PORT 3268 /* used by the IP comparison function */ struct ip_service { @@ -1896,6 +1855,8 @@ struct ea_list { #define SAMBA_POSIX_INHERITANCE_EA_NAME "user.SAMBA_PAI" /* EA to use for DOS attributes */ #define SAMBA_XATTR_DOS_ATTRIB "user.DOSATTRIB" +/* Prefix for DosStreams in the vfs_streams_xattr module */ +#define SAMBA_XATTR_DOSSTREAM_PREFIX "user.DosStream." #define UUID_SIZE 16 @@ -1926,4 +1887,15 @@ enum usershare_err { /* Different reasons for closing a file. */ enum file_close_type {NORMAL_CLOSE=0,SHUTDOWN_CLOSE,ERROR_CLOSE}; +/* 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]; +}; + #endif /* _SMB_H */