r4805: Last planned change to the privileges infrastructure:
[samba.git] / source3 / include / smb.h
index d8ca9bde057de9670cb122e91f4aad0cf747901d..913061014dbca17325af0aeb2aa73804a5e07dc7 100644 (file)
 #define SMB_PORT2 139
 #define SMB_PORTS "445 139"
 
+#define Undefined (-1)
 #define False (0)
 #define True (1)
 #define Auto (2)
+#define Required (3)
 
 #ifndef _BOOL
 typedef int BOOL;
 #define _BOOL       /* So we don't typedef BOOL again in vfs.h */
 #endif
 
-/* limiting size of ipc replies */
-#define REALLOC(ptr,size) Realloc(ptr,MAX((size),4*1024))
-
 #define SIZEOFWORD 2
 
 #ifndef DEF_CREATE_MASK
@@ -66,6 +65,7 @@ typedef int BOOL;
 #define STR_ASCII 4
 #define STR_UNICODE 8
 #define STR_NOALIGN 16
+#define STR_TERMINATE_ASCII 128
 
 /* how long to wait for secondary SMB packets (milli-seconds) */
 #define SMB_SECONDARY_WAIT (60*1000)
@@ -77,6 +77,9 @@ typedef int BOOL;
 #define READ_TIMEOUT 1
 #define READ_EOF 2
 #define READ_ERROR 3
+#define WRITE_ERROR 4 /* This error code can go into the client smb_rw_error. */
+#define READ_BAD_SIG 5
+#define DO_NOT_DO_TDIS 6 /* cli_close_connection() check for this when smbfs wants to keep tree connected */
 
 #define DIR_STRUCT_SIZE 43
 
@@ -151,6 +154,11 @@ typedef int BOOL;
 
 #include "doserr.h"
 
+typedef union unid_t {
+       uid_t uid;
+       gid_t gid;
+} unid_t;
+
 /*
  * SMB UCS2 (16-bit unicode) internal type.
  */
@@ -161,9 +169,6 @@ typedef uint16 smb_ucs2_t;
 typedef smb_ucs2_t wpstring[PSTRING_LEN];
 typedef smb_ucs2_t wfstring[FSTRING_LEN];
 
-/* This error code can go into the client smb_rw_error. */
-#define WRITE_ERROR 4
-
 #ifdef WORDS_BIGENDIAN
 #define UCS2_SHIFT 8
 #else
@@ -187,6 +192,7 @@ typedef smb_ucs2_t wfstring[FSTRING_LEN];
 #define PIPE_SPOOLSS  "\\PIPE\\spoolss"
 #define PIPE_NETDFS   "\\PIPE\\netdfs"
 #define PIPE_ECHO     "\\PIPE\\rpcecho"
+#define PIPE_SHUTDOWN "\\PIPE\\initshutdown"
 
 #define PIPE_NETLOGON_PLAIN "\\NETLOGON"
 
@@ -200,7 +206,8 @@ typedef smb_ucs2_t wfstring[FSTRING_LEN];
 #define PI_SPOOLSS             7
 #define PI_NETDFS              8
 #define PI_ECHO                9
-#define PI_MAX_PIPES           10
+#define PI_SHUTDOWN            10
+#define PI_MAX_PIPES           11
 
 /* 64 bit time (100usec) since ????? - cifs6.txt, section 3.5, page 30 */
 typedef struct nttime_info
@@ -237,9 +244,12 @@ typedef struct nttime_info
 #define MAXSUBAUTHS 15 /* max sub authorities in a SID */
 #endif
 
+#define SID_MAX_SIZE ((size_t)(8+(MAXSUBAUTHS*4)))
+
 /* SID Types */
 enum SID_NAME_USE
 {
+       SID_NAME_USE_NONE = 0,
        SID_NAME_USER    = 1, /* user */
        SID_NAME_DOM_GRP,     /* domain group */
        SID_NAME_DOMAIN,      /* domain sid */
@@ -248,7 +258,7 @@ enum SID_NAME_USE
        SID_NAME_DELETED,     /* deleted account: needed for c2 rating */
        SID_NAME_INVALID,     /* invalid account */
        SID_NAME_UNKNOWN,     /* unknown sid type */
-       SID_NAME_COMPUTER,    /* sid for a computer */
+       SID_NAME_COMPUTER     /* sid for a computer */
 };
 
 /**
@@ -271,6 +281,11 @@ typedef struct sid_info
 
 } DOM_SID;
 
+typedef struct sid_list {
+       uint32 count;
+       DOM_SID *list;
+} SID_LIST;
+
 /*
  * The complete list of SIDS belonging to this user.
  * Created when a vuid is registered.
@@ -287,6 +302,7 @@ typedef struct sid_info
 typedef struct _nt_user_token {
        size_t num_sids;
        DOM_SID *user_sids;
+       SE_PRIV privileges;
 } NT_USER_TOKEN;
 
 /*** query a local group, get a list of these: shows who is in that group ***/
@@ -365,9 +381,9 @@ typedef struct
        SMB_STRUCT_STAT *statinfo;
 } smb_filename;
 
+#include "fake_file.h"
 
-typedef struct files_struct
-{
+typedef struct files_struct {
        struct files_struct *next, *prev;
        int fnum;
        struct connection_struct *conn;
@@ -379,7 +395,9 @@ typedef struct files_struct
        SMB_OFF_T pos;
        SMB_BIG_UINT size;
        SMB_BIG_UINT initial_allocation_size; /* Faked up initial allocation on disk. */
+       SMB_BIG_UINT position_information;
        mode_t mode;
+       uint16 file_pid;
        uint16 vuid;
        write_bmpx_struct *wbmpx_ptr;
        write_cache *wcp;
@@ -399,10 +417,15 @@ typedef struct files_struct
        BOOL is_stat;
        BOOL directory_delete_on_close;
        char *fsp_name;
+       FAKE_FILE_HANDLE *fake_file_handle;
 } files_struct;
 
+#include "ntquotas.h"
+#include "sysquotas.h"
+
 /* used to hold an arbitrary blob of data */
-typedef struct data_blob {
+typedef struct data_blob
+{
        uint8 *data;
        size_t length;
        void (*free)(struct data_blob *data_blob);
@@ -415,19 +438,27 @@ typedef struct data_blob {
 
 typedef struct
 {
-  time_t modify_time;
-  time_t status_time;
+       time_t modify_time;
+       time_t status_time;
 } dir_status_struct;
 
-struct vuid_cache {
-  unsigned int entries;
-  uint16 list[VUID_CACHE_SIZE];
+struct vuid_cache_entry
+{
+       uint16 vuid;
+       BOOL read_only;
+       BOOL admin_user;
+};
+
+struct vuid_cache
+{
+       unsigned int entries;
+       struct vuid_cache_entry array[VUID_CACHE_SIZE];
 };
 
 typedef struct
 {
-  char *name;
-  BOOL is_wild;
+       char *name;
+       BOOL is_wild;
 } name_compare_entry;
 
 /* Include VFS stuff */
@@ -435,18 +466,10 @@ typedef struct
 #include "smb_acls.h"
 #include "vfs.h"
 
-typedef struct smb_vfs_handle_struct
-{
-    void *data;
-    /* Handle on dlopen() call */
-    void *handle;
-    struct smb_vfs_handle_struct  *next, *prev;
-    
-} smb_vfs_handle_struct;
-
 typedef struct connection_struct
 {
        struct connection_struct *next, *prev;
+       TALLOC_CTX *mem_ctx;
        unsigned cnum; /* an index passed over the wire */
        int service;
        BOOL force_user;
@@ -455,14 +478,15 @@ typedef struct connection_struct
        void *dirptr;
        BOOL printer;
        BOOL ipc;
-       BOOL read_only;
-       BOOL admin_user;
+       BOOL read_only; /* Attributes for the current user of the share. */
+       BOOL admin_user; /* Attributes for the current user of the share. */
        char *dirpath;
        char *connectpath;
        char *origpath;
 
-       struct vfs_ops vfs_ops;                   /* Filesystem operations */
-       struct smb_vfs_handle_struct *vfs_private;
+       struct vfs_ops vfs;                   /* Filesystem operations */
+       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 */
@@ -481,6 +505,11 @@ typedef struct connection_struct
        time_t lastused;
        BOOL used;
        int num_files_open;
+
+       BOOL case_sensitive;
+       BOOL case_preserve;
+       BOOL short_case_preserve;
+
        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. */       
@@ -517,7 +546,8 @@ enum {LPQ_QUEUED=0,LPQ_PAUSED,LPQ_SPOOLING,LPQ_PRINTING,LPQ_ERROR,LPQ_DELETING,
 
 typedef struct _print_queue_struct
 {
-  int job;
+  int job;             /* normally the UNIX jobid -- see note in 
+                          printing.c:traverse_fn_delete() */
   int size;
   int page_count;
   int status;
@@ -556,6 +586,24 @@ struct interface
        struct in_addr nmask;
 };
 
+/* struct used by share mode violation error processing */
+typedef struct {
+       pid_t pid;
+       uint16 mid;
+       struct timeval time;
+       SMB_DEV_T dev;
+       SMB_INO_T inode;
+       uint16 port;
+} deferred_open_entry;
+
+/* Internal message queue for deferred opens. */
+struct pending_message_list {
+       struct pending_message_list *next, *prev;
+       struct timeval msg_time; /* The timeout time */
+       DATA_BLOB buf;
+       DATA_BLOB private_data;
+};
+
 /* struct returned by get_share_modes */
 typedef struct {
        pid_t pid;
@@ -579,121 +627,10 @@ typedef struct {
 #define NT_HASH_LEN 16
 #define LM_HASH_LEN 16
 
-/*
- * bit flags representing initialized fields in SAM_ACCOUNT
- */
-enum pdb_elements {
-       PDB_UNINIT,
-       PDB_UID,
-       PDB_GID,
-       PDB_SMBHOME,
-       PDB_PROFILE,
-       PDB_DRIVE,
-       PDB_LOGONSCRIPT,
-       PDB_LOGONTIME,
-       PDB_LOGOFFTIME,
-       PDB_KICKOFFTIME,
-       PDB_CANCHANGETIME,
-       PDB_MUSTCHANGETIME,
-       PDB_PLAINTEXT_PW,
-       PDB_USERNAME,
-       PDB_FULLNAME,
-       PDB_DOMAIN,
-       PDB_NTUSERNAME,
-       PDB_HOURSLEN,
-       PDB_LOGONDIVS,
-       PDB_USERSID,
-       PDB_GROUPSID,
-       PDB_ACCTCTRL,
-       PDB_PASSLASTSET,
-       PDB_UNIXHOMEDIR,
-       PDB_ACCTDESC,
-       PDB_WORKSTATIONS,
-       PDB_UNKNOWNSTR,
-       PDB_MUNGEDDIAL,
-       PDB_HOURS,
-       PDB_UNKNOWN3,
-       PDB_UNKNOWN5,
-       PDB_UNKNOWN6,
-       PDB_LMPASSWD,
-       PDB_NTPASSWD,
-
-       /* this must be the last element */
-       PDB_COUNT,
-};
-
-enum pdb_value_state {
-       PDB_DEFAULT=0,
-       PDB_SET,
-       PDB_CHANGED
-};
-
-#define IS_SAM_UNIX_USER(x) \
-       (( pdb_get_init_flags(x, PDB_UID) != PDB_DEFAULT ) \
-        && ( pdb_get_init_flags(x,PDB_GID) != PDB_DEFAULT ))
-
-#define IS_SAM_SET(x, flag)    (pdb_get_init_flags(x, flag) == PDB_SET)
-#define IS_SAM_CHANGED(x, flag)        (pdb_get_init_flags(x, flag) == PDB_CHANGED)
-#define IS_SAM_DEFAULT(x, flag)        (pdb_get_init_flags(x, flag) == PDB_DEFAULT)
-               
-typedef struct sam_passwd
-{
-       TALLOC_CTX *mem_ctx;
-       
-       void (*free_fn)(struct sam_passwd **);
-
-       struct pdb_methods *methods;
-
-       struct user_data {
-               /* initiailization flags */
-               struct bitmap *change_flags;
-               struct bitmap *set_flags;
-
-               time_t logon_time;            /* logon time */
-               time_t logoff_time;           /* logoff time */
-               time_t kickoff_time;          /* kickoff time */
-               time_t pass_last_set_time;    /* password last set time */
-               time_t pass_can_change_time;  /* password can change time */
-               time_t pass_must_change_time; /* password must change time */
-               
-               const char * username;     /* UNIX username string */
-               const char * domain;       /* Windows Domain name */
-               const char * nt_username;  /* Windows username string */
-               const char * full_name;    /* user's full name string */
-               const char * unix_home_dir;     /* UNIX home directory string */
-               const char * home_dir;     /* home directory string */
-               const char * dir_drive;    /* home directory drive string */
-               const char * logon_script; /* logon script string */
-               const char * profile_path; /* profile path string */
-               const char * acct_desc  ;  /* user description string */
-               const char * workstations; /* login from workstations string */
-               const char * unknown_str ; /* don't know what this is, yet. */
-               const char * munged_dial ; /* munged path name and dial-back tel number */
-               
-               uid_t uid;          /* this is a unix uid_t */
-               gid_t gid;          /* this is a unix gid_t */
-               DOM_SID user_sid;    /* Primary User SID */
-               DOM_SID group_sid;   /* Primary Group SID */
-               
-               DATA_BLOB lm_pw; /* .data is Null if no password */
-               DATA_BLOB nt_pw; /* .data is Null if no password */
-               char* plaintext_pw; /* is Null if not available */
-               
-               uint16 acct_ctrl; /* account info (ACB_xxxx bit-mask) */
-               uint32 unknown_3; /* 0x00ff ffff */
-               
-               uint16 logon_divs; /* 168 - number of hours in a week */
-               uint32 hours_len; /* normally 21 bytes */
-               uint8 hours[MAX_HOURS_LEN];
-               
-               uint32 unknown_5; /* 0x0002 0000 */
-               uint32 unknown_6; /* 0x0000 04ec */
-       } private;
-
-       /* Lets see if the remaining code can get the hint that you
-          are meant to use the pdb_...() functions. */
-       
-} SAM_ACCOUNT;
+/* 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)
 
 /*
  * Flags for account policy.
@@ -707,7 +644,7 @@ typedef struct sam_passwd
 #define AP_RESET_COUNT_TIME            7
 #define AP_BAD_ATTEMPT_LOCKOUT         8
 #define AP_TIME_TO_LOGOUT              9
-
+#define AP_REFUSE_MACHINE_PW_CHANGE    10
 
 /*
  * Flags for local user manipulation.
@@ -751,28 +688,14 @@ struct locking_key {
        SMB_INO_T inode;
 };
 
-struct locking_data {
-       union {
-               int num_share_mode_entries;
-               share_mode_entry dummy; /* Needed for alignment. */
-       } u;
-       /* the following two entries are implicit 
-          share_mode_entry modes[num_share_mode_entries];
-           char file_name[];
-       */
-};
-
-
 /* the following are used by loadparm for option lists */
-typedef enum
-{
-  P_BOOL,P_BOOLREV,P_CHAR,P_INTEGER,P_OCTAL,P_LIST,
-  P_STRING,P_USTRING,P_GSTRING,P_UGSTRING,P_ENUM,P_SEP
+typedef enum {
+       P_BOOL,P_BOOLREV,P_CHAR,P_INTEGER,P_OCTAL,P_LIST,
+       P_STRING,P_USTRING,P_GSTRING,P_UGSTRING,P_ENUM,P_SEP
 } parm_type;
 
-typedef enum
-{
-  P_LOCAL,P_GLOBAL,P_SEPARATOR,P_NONE
+typedef enum {
+       P_LOCAL,P_GLOBAL,P_SEPARATOR,P_NONE
 } parm_class;
 
 /* passed to br lock code */
@@ -797,7 +720,7 @@ struct parm_struct
        parm_type type;
        parm_class class;
        void *ptr;
-       BOOL (*special)(const char *, char **);
+       BOOL (*special)(int snum, const char *, char **);
        const struct enum_list *enum_list;
        unsigned flags;
        union {
@@ -814,13 +737,14 @@ struct bitmap {
        unsigned int n;
 };
 
-#define FLAG_BASIC     0x0001 /* fundamental options */
+/* The following flags are used in SWAT */
+#define FLAG_BASIC     0x0001 /* Display only in BASIC view */
 #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 */
-#define FLAG_ADVANCED  0x0020 /* Parameters that the wizard will operate on */
-#define FLAG_DEVELOPER         0x0040 /* Parameters that the wizard will operate on */
+#define FLAG_ADVANCED  0x0020 /* Parameters that will be visible in advanced view */
+#define FLAG_DEVELOPER         0x0040 /* No longer used */
 #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. */
@@ -964,6 +888,7 @@ struct bitmap {
 #define SMBnttranss      0xA1   /* NT transact secondary */
 #define SMBntcreateX     0xA2   /* NT create and X */
 #define SMBntcancel      0xA4   /* NT cancel */
+#define SMBntrename      0xA5   /* NT rename */
 
 /* These are the trans subcommands */
 #define TRANSACT_SETNAMEDPIPEHANDLESTATE  0x01 
@@ -971,23 +896,23 @@ struct bitmap {
 #define TRANSACT_WAITNAMEDPIPEHANDLESTATE 0x53
 
 /* These are the TRANS2 sub commands */
-#define TRANSACT2_OPEN                        0
-#define TRANSACT2_FINDFIRST                   1
-#define TRANSACT2_FINDNEXT                    2
-#define TRANSACT2_QFSINFO                     3
-#define TRANSACT2_SETFSINFO                   4
-#define TRANSACT2_QPATHINFO                   5
-#define TRANSACT2_SETPATHINFO                 6
-#define TRANSACT2_QFILEINFO                   7
-#define TRANSACT2_SETFILEINFO                 8
-#define TRANSACT2_FSCTL                       9
-#define TRANSACT2_IOCTL                     0xA
-#define TRANSACT2_FINDNOTIFYFIRST           0xB
-#define TRANSACT2_FINDNOTIFYNEXT            0xC
-#define TRANSACT2_MKDIR                     0xD
-#define TRANSACT2_SESSION_SETUP             0xE
-#define TRANSACT2_GET_DFS_REFERRAL         0x10
-#define TRANSACT2_REPORT_DFS_INCONSISTANCY 0x11
+#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
+#define TRANSACT2_GET_DFS_REFERRAL             0x10
+#define TRANSACT2_REPORT_DFS_INCONSISTANCY     0x11
 
 /* These are the NT transact sub commands. */
 #define NT_TRANSACT_CREATE                1
@@ -996,6 +921,13 @@ struct bitmap {
 #define NT_TRANSACT_NOTIFY_CHANGE         4
 #define NT_TRANSACT_RENAME                5
 #define NT_TRANSACT_QUERY_SECURITY_DESC   6
+#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
 
 /* Relevant IOCTL codes */
 #define IOCTL_QUERY_JOB_INFO      0x530060
@@ -1140,7 +1072,7 @@ struct bitmap {
 #define FILE_GENERIC_WRITE (STANDARD_RIGHTS_WRITE_ACCESS|FILE_WRITE_DATA|FILE_WRITE_ATTRIBUTES|\
                                                        FILE_WRITE_EA|FILE_APPEND_DATA|SYNCHRONIZE_ACCESS)
 
-#define FILE_GENERIC_EXECUTE (STANDARD_RIGHTS_EXECUTE_ACCESS|FILE_READ_ATTRIBUTES|\
+#define FILE_GENERIC_EXECUTE (STANDARD_RIGHTS_EXECUTE_ACCESS|\
                                                                FILE_EXECUTE|SYNCHRONIZE_ACCESS)
 
 /* Mapping of access rights to UNIX perms. */
@@ -1170,6 +1102,7 @@ struct bitmap {
 #define REQUEST_OPLOCK 2
 #define REQUEST_BATCH_OPLOCK 4
 #define OPEN_DIRECTORY 8
+#define EXTENDED_RESPONSE_REQUIRED 0x10
 
 /* ShareAccess field. */
 #define FILE_SHARE_NONE 0 /* Cannot be used in bitmask. */
@@ -1235,19 +1168,30 @@ struct bitmap {
 /* Flag for NT transact rename call. */
 #define RENAME_REPLACE_IF_EXISTS 1
 
+/* 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
+
 /* Filesystem Attributes. */
-#define FILE_CASE_SENSITIVE_SEARCH 0x01
-#define FILE_CASE_PRESERVED_NAMES 0x02
-#define FILE_UNICODE_ON_DISK 0x04
+#define FILE_CASE_SENSITIVE_SEARCH      0x00000001
+#define FILE_CASE_PRESERVED_NAMES       0x00000002
+#define FILE_UNICODE_ON_DISK            0x00000004
 /* According to cifs9f, this is 4, not 8 */
 /* Acconding to testing, this actually sets the security attribute! */
-#define FILE_PERSISTENT_ACLS 0x08
-/* These entries added from cifs9f --tsb */
-#define FILE_FILE_COMPRESSION 0x10
-#define FILE_VOLUME_QUOTAS 0x20
-/* I think this is wrong. JRA #define FILE_DEVICE_IS_MOUNTED 0x20 */
-#define FILE_VOLUME_SPARSE_FILE 0x40
-#define FILE_VOLUME_IS_COMPRESSED 0x8000
+#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
 
 /* ChangeNotify flags. */
 #define FILE_NOTIFY_CHANGE_FILE        0x001
@@ -1412,7 +1356,8 @@ enum ldap_ssl_types {LDAP_SSL_ON, LDAP_SSL_OFF, LDAP_SSL_START_TLS};
 enum ldap_passwd_sync_types {LDAP_PASSWD_SYNC_ON, LDAP_PASSWD_SYNC_OFF, LDAP_PASSWD_SYNC_ONLY};
 
 /* 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_SAMBA};
+enum remote_arch_types {RA_UNKNOWN, RA_WFWG, RA_OS2, RA_WIN95, RA_WINNT,
+                       RA_WIN2K, RA_WINXP, RA_WIN2K3, RA_SAMBA, RA_CIFSFS};
 
 /* case handling */
 enum case_handling {CASE_LOWER,CASE_UPPER};
@@ -1477,6 +1422,7 @@ extern int chain_size;
 #define EXCLUSIVE_OPLOCK 1
 #define BATCH_OPLOCK 2
 #define LEVEL_II_OPLOCK 4
+#define INTERNAL_OPEN_ONLY 8
 
 #define EXCLUSIVE_OPLOCK_TYPE(lck) ((lck) & (EXCLUSIVE_OPLOCK|BATCH_OPLOCK))
 #define BATCH_OPLOCK_TYPE(lck) ((lck) & BATCH_OPLOCK)
@@ -1528,6 +1474,25 @@ extern int chain_size;
 #define LEVEL_II_OPLOCK_BREAK_CMD 0x3
 #define ASYNC_LEVEL_II_OPLOCK_BREAK_CMD 0x4
 
+/* Add the "deferred open" message. */
+#define RETRY_DEFERRED_OPEN_CMD 0x5
+
+/*
+ * And the message format for it. Keep the same message length.
+ *
+ *  0     2       2+pid   2+pid+dev 2+pid+dev+ino
+ *  +----+--------+-------+--------+---------+
+ *  | cmd| pid    | dev   |  inode | mid     |
+ *  +----+--------+-------+--------+---------+
+ */
+
+#define DEFERRED_OPEN_CMD_OFFSET 0
+#define DEFERRED_OPEN_PID_OFFSET 2 /* pid we're *sending* from. */
+#define DEFERRED_OPEN_DEV_OFFSET (DEFERRED_OPEN_PID_OFFSET + sizeof(pid_t))
+#define DEFERRED_OPEN_INODE_OFFSET (DEFERRED_OPEN_DEV_OFFSET + sizeof(SMB_DEV_T))
+#define DEFERRED_OPEN_MID_OFFSET (DEFERRED_OPEN_INODE_OFFSET + sizeof(SMB_INO_T))
+#define DEFERRED_OPEN_MSG_LEN OPLOCK_BREAK_MSG_LEN
+
 /*
  * Capabilities abstracted for different systems.
  */
@@ -1577,48 +1542,42 @@ struct cnotify_fns {
 
 #include "smb_macros.h"
 
+#define MAX_NETBIOSNAME_LEN 16
+/* DOS character, NetBIOS namestring. Type used on the wire. */
+typedef char nstring[MAX_NETBIOSNAME_LEN];
+/* Unix character, NetBIOS namestring. Type used to manipulate name in nmbd. */
+typedef char unstring[MAX_NETBIOSNAME_LEN*4];
+
 /* A netbios name structure. */
 struct nmb_name {
-  char         name[17];
-  char         scope[64];
-  unsigned int name_type;
+       nstring      name;
+       char         scope[64];
+       unsigned int name_type;
 };
 
 
 /* A netbios node status array element. */
 struct node_status {
-       char name[16];
+       nstring name;
        unsigned char type;
        unsigned char flags;
 };
 
+/* The extra info from a NetBIOS node status query */
+struct node_status_extra {
+       unsigned char mac_addr[6];
+       /* There really is more here ... */ 
+};
+
 struct pwd_info
 {
        BOOL null_pwd;
        BOOL cleartext;
-       BOOL crypted;
 
        fstring password;
 
-       uchar smb_lm_pwd[16];
-       uchar smb_nt_pwd[16];
-
-       uchar smb_lm_owf[24];
-       uchar smb_nt_owf[128];
-       size_t nt_owf_len;
-
-       uchar lm_cli_chal[8];
-       uchar nt_cli_chal[128];
-       size_t nt_cli_chal_len;
-
-       uchar sess_key[16];
 };
 
-#include "rpc_creds.h"
-#include "rpc_misc.h"
-#include "rpc_secdes.h"
-#include "nt_printing.h"
-
 typedef struct user_struct
 {
        struct user_struct *next, *prev;
@@ -1640,7 +1599,7 @@ typedef struct user_struct
 
        NT_USER_TOKEN *nt_user_token;
 
-       uint8 session_key[16];
+       DATA_BLOB session_key;
 
        char *session_keystr; /* used by utmp and pam session code.  
                                 TDB key string */
@@ -1658,9 +1617,11 @@ struct unix_error_map {
        NTSTATUS nt_error;
 };
 
+/*
 #include "ntdomain.h"
 
 #include "client.h"
+*/
 
 /*
  * Size of new password account encoding string.  This is enough space to
@@ -1698,12 +1659,12 @@ struct unix_error_map {
 #define SAFE_NETBIOS_CHARS ". -_"
 
 /* generic iconv conversion structure */
-typedef struct {
-       size_t (*direct)(void *cd, char **inbuf, size_t *inbytesleft,
+typedef struct _smb_iconv_t {
+       size_t (*direct)(void *cd, const char **inbuf, size_t *inbytesleft,
                         char **outbuf, size_t *outbytesleft);
-       size_t (*pull)(void *cd, char **inbuf, size_t *inbytesleft,
+       size_t (*pull)(void *cd, const char **inbuf, size_t *inbytesleft,
                       char **outbuf, size_t *outbytesleft);
-       size_t (*push)(void *cd, char **inbuf, size_t *inbytesleft,
+       size_t (*push)(void *cd, const char **inbuf, size_t *inbytesleft,
                       char **outbuf, size_t *outbytesleft);
        void *cd_direct, *cd_pull, *cd_push;
        char *from_name, *to_name;
@@ -1717,7 +1678,41 @@ typedef struct {
 
 #include "popt_common.h"
 
-/* Module support */
-typedef int (init_module_function) (void);
+#define PORT_NONE      0
+#ifndef LDAP_PORT
+#define LDAP_PORT      389
+#endif
+
+/* used by the IP comparison function */
+struct ip_service {
+       struct in_addr ip;
+       unsigned port;
+};
+
+/* Used by the SMB signing functions. */
+
+typedef struct smb_sign_info {
+       void (*sign_outgoing_message)(char *outbuf, struct smb_sign_info *si);
+       BOOL (*check_incoming_message)(char *inbuf, struct smb_sign_info *si, BOOL must_be_ok);
+       void (*free_signing_context)(struct smb_sign_info *si);
+       void *signing_context;
+
+       BOOL negotiated_smb_signing;
+       BOOL allow_smb_signing;
+       BOOL doing_signing;
+       BOOL mandatory_signing;
+       BOOL seen_valid; /* Have I ever seen a validly signed packet? */
+} smb_sign_info;
+
+struct ea_struct {
+       uint8 flags;
+       char *name;
+       DATA_BLOB value;
+};
+
+/* 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"
+/* EA to use for DOS attributes */
+#define SAMBA_XATTR_DOS_ATTRIB "user.DOSATTRIB"
 
 #endif /* _SMB_H */