#define _SMB_H
/* logged when starting the various Samba daemons */
-#define COPYRIGHT_STARTUP_MESSAGE "Copyright Andrew Tridgell and the Samba Team 1992-2008"
+#define COPYRIGHT_STARTUP_MESSAGE "Copyright Andrew Tridgell and the Samba Team 1992-2009"
#if defined(LARGE_SMB_OFF_T)
#define OPENX_FILE_CREATE_IF_NOT_EXIST 0x10
#define OPENX_FILE_FAIL_IF_NOT_EXIST 0
-#include "doserr.h"
+#include "../libcli/util/doserr.h"
typedef union unid_t {
uid_t uid;
/* 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_EPMAPPER "\\PIPE\\epmapper"
-#define PIPE_DRSUAPI "\\PIPE\\drsuapi"
-
-#define PIPE_NETLOGON_PLAIN "\\NETLOGON"
-
-#define PI_LSARPC 0
-#define PI_DSSETUP 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_EPMAPPER 14
-#define PI_DRSUAPI 15
-#define PI_MAX_PIPES 16
-
-/* 64 bit time (100usec) since ????? - cifs6.txt, section 3.5, page 30 */
-typedef uint64_t NTTIME;
#define MAX_HOURS_LEN 32
*
* @sa http://msdn.microsoft.com/library/default.asp?url=/library/en-us/security/accctrl_38yn.asp
**/
-typedef struct dom_sid {
- uint8 sid_rev_num; /**< SID revision number */
- uint8 num_auths; /**< Number of sub-authorities */
- uint8 id_auth[6]; /**< Identifier Authority */
- /*
- * Pointer to sub-authorities.
- *
- * @note The values in these uint32's are in *native* byteorder, not
- * neccessarily little-endian...... JRA.
- */
- uint32 sub_auths[MAXSUBAUTHS];
-} DOM_SID;
+typedef struct dom_sid DOM_SID;
enum id_mapping {
ID_UNKNOWN = 0,
enum id_mapping status;
};
-/* 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/ntsvcs.h"
#include "librpc/gen_ndr/nbt.h"
#include "librpc/gen_ndr/drsuapi.h"
+#include "librpc/gen_ndr/drsblobs.h"
+#include "librpc/gen_ndr/spoolss.h"
struct lsa_dom_info {
bool valid;
struct fd_handle {
size_t ref_count;
int fd;
- SMB_BIG_UINT position_information;
+ uint64_t position_information;
SMB_OFF_T pos;
uint32 private_options; /* NT Create options, but we only look at
* NTCREATEX_OPTIONS_PRIVATE_DENY_DOS and
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 wb_context;
+struct rpc_cli_smbd_conn;
struct vfs_fsp_data {
struct vfs_fsp_data *next;
struct vfs_handle_struct *owner;
- /* NOTE: This structure contains two pointers so that we can guarantee
+ void (*destroy)(void *p_data);
+ void *_dummy_;
+ /* NOTE: This structure contains four pointers so that we can guarantee
* that the end of the structure is always both 4-byte and 8-byte aligned.
*/
};
unsigned int num_smb_operations;
uint16 rap_print_jobid;
struct file_id file_id;
- SMB_BIG_UINT initial_allocation_size; /* Faked up initial allocation on disk. */
+ uint64_t initial_allocation_size; /* Faked up initial allocation on disk. */
mode_t mode;
uint16 file_pid;
uint16 vuid;
#include "sysquotas.h"
struct vuid_cache_entry {
- uint16 vuid;
struct auth_serversupplied_info *server_info;
+ uint16_t vuid;
bool read_only;
bool admin_user;
};
struct dfree_cached_info {
time_t last_dfree_time;
- SMB_BIG_UINT dfree_ret;
- SMB_BIG_UINT bsize;
- SMB_BIG_UINT dfree;
- SMB_BIG_UINT dsize;
+ uint64_t dfree_ret;
+ uint64_t bsize;
+ uint64_t dfree;
+ uint64_t dsize;
};
struct dptr_struct;
NT_USER_TOKEN *nt_user_token;
};
+
struct smb_request {
+ uint8_t cmd;
uint16 flags2;
uint16 smbpid;
uint16 mid;
uint16 vuid;
uint16 tid;
uint8 wct;
+ uint16_t *vwv;
+ uint16_t buflen;
+ const uint8_t *buf;
const uint8 *inbuf;
+
+ /*
+ * 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.
+ */
uint8 *outbuf;
+
size_t unread_bytes;
bool encrypted;
connection_struct *conn;
+ struct smb_perfcount_data pcd;
+
+ /*
+ * Chained request handling
+ */
+ struct files_struct *chain_fsp;
+
+ /*
+ * Here we collect the outbufs from the chain handlers
+ */
+ uint8_t *chain_outbuf;
+
+ /*
+ * state information for async smb handling
+ */
+ void *async_priv;
};
/* Defines for the sent_oplock_break field above. */
typedef struct {
fstring smb_name; /* user name from the client */
fstring unix_name; /* unix user name of a validated user */
- fstring full_name; /* to store full name (such as "Joe Bloggs") from gecos field of password file */
fstring domain; /* domain that the client specified */
} userdom_struct;
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? */
+ struct timed_event *te;
+ struct smb_perfcount_data pcd;
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 {
#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. */
/* 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
#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 0x04000000
+#define NTCREATEX_OPTIONS_PRIVATE_STREAM_DELETE 0x00040000
/* Responses when opening a file. */
#define FILE_WAS_SUPERSEDED 0
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};
*/
#define COPYBUF_SIZE (8*1024)
-/*
- * Used in chaining code.
- */
-extern int chain_size;
-
/*
* Map the Core and Extended Oplock requesst bits down
* to common bits (EXCLUSIVE_OPLOCK & BATCH_OPLOCK).
LEASE_CAPABILITY
};
+struct kernel_oplocks_ops;
+struct kernel_oplocks {
+ const struct kernel_oplocks_ops *ops;
+ void *private_data;
+};
+
/* if a kernel does support oplocks then a structure of the following
typee is used to describe how to interact with the kernel */
-struct kernel_oplocks {
- files_struct * (*receive_message)(fd_set *fds);
- bool (*set_oplock)(files_struct *fsp, int oplock_type);
- void (*release_oplock)(files_struct *fsp);
- bool (*msg_waiting)(fd_set *fds);
- int notification_fd;
+struct kernel_oplocks_ops {
+ bool (*set_oplock)(struct kernel_oplocks *ctx,
+ files_struct *fsp, int oplock_type);
+ void (*release_oplock)(struct kernel_oplocks *ctx,
+ files_struct *fsp);
};
#include "smb_macros.h"
#ifndef LDAP_PORT
#define LDAP_PORT 389
#endif
+#define LDAP_GC_PORT 3268
/* used by the IP comparison function */
struct ip_service {
char samba_version_string[SAMBA_EXTENDED_INFO_VERSION_STRING_LENGTH];
};
+/*
+ * create_file_flags
+ */
+#define CFF_DOS_PATH 0x00000001
+
+/* time info */
+struct smb_file_time {
+ struct timespec mtime;
+ struct timespec atime;
+ struct timespec create_time;
+};
+
#endif /* _SMB_H */