Fix bug #8541 - readlink() on Linux clients fails if the symlink target is outside...
[rusty/samba.git] / source3 / include / smb.h
index c867d607b6812d1ff03b3b419cbd8eee39855f0b..ace3c5efba8278e1ab5389a5713144904d0b3891 100644 (file)
 /* how long to wait for secondary SMB packets (milli-seconds) */
 #define SMB_SECONDARY_WAIT (60*1000)
 
-/* this defines the error codes that receive_smb can put in smb_read_error */
-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,
-       SMB_NO_MEMORY,
-       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
 
 /* deny modes */
@@ -317,13 +304,8 @@ typedef struct files_struct {
 #include "ntquotas.h"
 #include "sysquotas.h"
 
-struct client_address {
-       char addr[INET6_ADDRSTRLEN];
-       const char *name;
-};
-
 struct vuid_cache_entry {
-       struct auth_serversupplied_info *session_info;
+       struct auth_session_info *session_info;
        uint16_t vuid;
        bool read_only;
 };
@@ -407,6 +389,7 @@ typedef struct connection_struct {
        bool printer;
        bool ipc;
        bool read_only; /* Attributes for the current user of the share. */
+       uint32_t share_access;
        /* Does this filesystem honor
           sub second timestamps on files
           and directories when setting time ? */
@@ -420,7 +403,7 @@ typedef struct connection_struct {
         * 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 *session_info;
+       struct auth_session_info *session_info;
 
        /*
         * If the "force group" parameter is set, this is the primary gid that
@@ -709,44 +692,44 @@ struct connections_data {
        uint32 unused_compatitibility_field;
 };
 
-struct bitmap {
-       uint32 *b;
-       unsigned int n;
-};
-
 /* 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
-#define smb_pidhigh 16
-#define smb_ss_field 18
-#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
+#define smb_com                (NBT_HDR_SIZE+HDR_COM)
+#define smb_rcls       (NBT_HDR_SIZE+HDR_RCLS)
+#define smb_reh                (NBT_HDR_SIZE+HDR_REH)
+#define smb_err                (NBT_HDR_SIZE+HDR_ERR)
+#define smb_flg                (NBT_HDR_SIZE+HDR_FLG)
+#define smb_flg2       (NBT_HDR_SIZE+HDR_FLG2)
+#define smb_pidhigh    (NBT_HDR_SIZE+HDR_PIDHIGH)
+#define smb_ss_field   (NBT_HDR_SIZE+HDR_SS_FIELD)
+#define smb_tid                (NBT_HDR_SIZE+HDR_TID)
+#define smb_pid                (NBT_HDR_SIZE+HDR_PID)
+#define smb_uid                (NBT_HDR_SIZE+HDR_UID)
+#define smb_mid                (NBT_HDR_SIZE+HDR_MID)
+#define smb_wct                (NBT_HDR_SIZE+HDR_WCT)
+#define smb_vwv                (NBT_HDR_SIZE+HDR_VWV)
+#define smb_vwv0       (smb_vwv+( 0*2))
+#define smb_vwv1       (smb_vwv+( 1*2))
+#define smb_vwv2       (smb_vwv+( 2*2))
+#define smb_vwv3       (smb_vwv+( 3*2))
+#define smb_vwv4       (smb_vwv+( 4*2))
+#define smb_vwv5       (smb_vwv+( 5*2))
+#define smb_vwv6       (smb_vwv+( 6*2))
+#define smb_vwv7       (smb_vwv+( 7*2))
+#define smb_vwv8       (smb_vwv+( 8*2))
+#define smb_vwv9       (smb_vwv+( 9*2))
+#define smb_vwv10      (smb_vwv+(10*2))
+#define smb_vwv11      (smb_vwv+(11*2))
+#define smb_vwv12      (smb_vwv+(12*2))
+#define smb_vwv13      (smb_vwv+(13*2))
+#define smb_vwv14      (smb_vwv+(14*2))
+#define smb_vwv15      (smb_vwv+(15*2))
+#define smb_vwv16      (smb_vwv+(16*2))
+#define smb_vwv17      (smb_vwv+(17*2))
+
+/* types of buffers in core SMB protocol */
+#define SMB_DATA_BLOCK 0x1
+#define SMB_ASCII4     0x4
+
 
 /* flag defines. CIFS spec 3.1.1 */
 #define FLAG_SUPPORT_LOCKREAD       0x01
@@ -830,7 +813,6 @@ struct bitmap {
 #define SMBffirst        0x82   /* find first */
 #define SMBfunique       0x83   /* find unique */
 #define SMBfclose        0x84   /* find close */
-#define SMBkeepalive     0x85   /* keepalive */
 #define SMBinvalid       0xFE   /* invalid command */
 
 /* Extended 2.0 protocol */
@@ -847,6 +829,9 @@ struct bitmap {
 #define SMBntcancel      0xA4   /* NT cancel */
 #define SMBntrename      0xA5   /* NT rename */
 
+/* used to indicate end of chain */
+#define SMB_CHAIN_NONE   0xFF
+
 /* These are the trans subcommands */
 #define TRANSACT_SETNAMEDPIPEHANDLESTATE  0x01 
 #define TRANSACT_DCERPCCMD                0x26
@@ -1089,14 +1074,6 @@ struct bitmap {
 #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
-
 /* Flag for NT transact rename call. */
 #define RENAME_REPLACE_IF_EXISTS 1
 
@@ -1230,20 +1207,35 @@ http://msdn.microsoft.com/en-us/library/cc246334(PROT.13).aspx
 #define CAP_W2K_SMBS         0x2000
 #define CAP_LARGE_READX      0x4000
 #define CAP_LARGE_WRITEX     0x8000
+#define CAP_LWIO             0x10000
 #define CAP_UNIX             0x800000 /* Capabilities for UNIX extensions. Created by HP. */
+#define CAP_DYNAMIC_REAUTH    0x20000000
 #define CAP_EXTENDED_SECURITY 0x80000000
 
-/* protocol types. It assumes that higher protocols include lower protocols
-   as subsets */
-enum protocol_types {
-       PROTOCOL_NONE,
-       PROTOCOL_CORE,
-       PROTOCOL_COREPLUS,
-       PROTOCOL_LANMAN1,
-       PROTOCOL_LANMAN2,
-       PROTOCOL_NT1,
-       PROTOCOL_SMB2
-};
+#define SMB_CAP_BOTH_MASK ( \
+       CAP_UNICODE | \
+       CAP_NT_SMBS | \
+       CAP_STATUS32 | \
+       CAP_LEVEL_II_OPLOCKS | \
+       CAP_EXTENDED_SECURITY | \
+       0)
+#define SMB_CAP_SERVER_MASK ( \
+       CAP_RAW_MODE | \
+       CAP_MPX_MODE | \
+       CAP_LARGE_FILES | \
+       CAP_RPC_REMOTE_APIS | \
+       CAP_LOCK_AND_READ | \
+       CAP_NT_FIND | \
+       CAP_DFS | \
+       CAP_W2K_SMBS | \
+       CAP_LARGE_READX | \
+       CAP_LARGE_WRITEX | \
+       CAP_LWIO | \
+       CAP_UNIX | \
+       0)
+#define SMB_CAP_CLIENT_MASK ( \
+       CAP_DYNAMIC_REAUTH | \
+       0)
 
 /* printing types */
 enum printing_types {PRINT_BSD,PRINT_SYSV,PRINT_AIX,PRINT_HPUX,
@@ -1490,7 +1482,7 @@ typedef struct user_struct {
                                 TDB key string */
        int homes_snum;
 
-       struct auth_serversupplied_info *session_info;
+       struct auth_session_info *session_info;
 
        struct auth_ntlmssp_state *auth_ntlmssp_state;
 } user_struct;
@@ -1611,6 +1603,7 @@ struct smb_file_time {
 #define UCF_ALWAYS_ALLOW_WCARD_LCOMP   0x00000002
 #define UCF_COND_ALLOW_WCARD_LCOMP     0x00000004
 #define UCF_POSIX_PATHNAMES            0x00000008
+#define UCF_UNIX_NAME_LOOKUP           0x00000010
 
 /*
  * smb_filename
@@ -1631,12 +1624,6 @@ struct child_pid {
 /* Used to keep track of deferred opens. */
 struct deferred_open_record;
 
-/* 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
-
 /* Used inside aio code. */
 struct aio_extra;