Add uint64_t mid field to the files_struct.
[kai/samba.git] / source3 / include / vfs.h
index 7ce364a51b5155fede8eb7882b30f3485f34320b..be4399feb8eb0b26ec13648ec20d14a073596292 100644 (file)
@@ -185,14 +185,15 @@ struct fd_handle {
 
 typedef struct files_struct {
        struct files_struct *next, *prev;
-       int fnum;
+       uint64_t fnum;
+       struct smbXsrv_open0 *op;
        struct connection_struct *conn;
        struct fd_handle *fh;
        unsigned int num_smb_operations;
        struct file_id file_id;
        uint64_t initial_allocation_size; /* Faked up initial allocation on disk. */
        uint16 file_pid;
-       uint16 vuid;
+       uint64_t vuid; /* SMB2 compat */
        struct write_cache *wcp;
        struct timeval open_time;
        uint32 access_mask;             /* NTCreateX access bits (FILE_READ_DATA etc.) */
@@ -226,6 +227,7 @@ typedef struct files_struct {
        bool is_sparse;
        struct smb_filename *fsp_name;
        uint32_t name_hash;             /* Jenkins hash of full pathname. */
+       uint64_t mid;                   /* Mid of the operation that created us. */
 
        struct vfs_fsp_data *vfs_extension;
        struct fake_file_handle *fake_file_handle;
@@ -251,7 +253,7 @@ typedef struct files_struct {
 
 struct vuid_cache_entry {
        struct auth_session_info *session_info;
-       uint16_t vuid;
+       uint64_t vuid; /* SMB2 compat */
        bool read_only;
 };
 
@@ -280,7 +282,8 @@ struct share_params {
 typedef struct connection_struct {
        struct connection_struct *next, *prev;
        struct smbd_server_connection *sconn; /* can be NULL */
-       unsigned cnum; /* an index passed over the wire */
+       struct smbXsrv_tcon0 *tcon; /* can be NULL */
+       uint32_t cnum; /* an index passed over the wire */
        struct share_params *params;
        bool force_user;
        struct vuid_cache vuid_cache;
@@ -309,7 +312,7 @@ typedef struct connection_struct {
         */
        gid_t force_group_gid;
 
-       uint16 vuid; /* vuid of user who *opened* this connection, or UID_FIELD_INVALID */
+       uint64_t vuid; /* vuid of user who *opened* this connection, or UID_FIELD_INVALID */
 
        time_t lastused;
        time_t lastused_count;
@@ -340,6 +343,69 @@ typedef struct connection_struct {
 
 } connection_struct;
 
+struct smbd_smb2_request;
+struct privilege_paths;
+
+struct smb_request {
+       uint8_t cmd;
+       uint16 flags2;
+       uint16 smbpid;
+       uint64_t mid; /* For compatibility with SMB2. */
+       uint32_t seqnum;
+       uint64_t vuid; /* For compatibility with SMB2. */
+       uint32_t tid;
+       uint8  wct;
+       const 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 care 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 smbd_server_connection *sconn;
+       struct smb_perfcount_data pcd;
+
+       /*
+        * Chained request handling
+        */
+       struct files_struct *chain_fsp;
+
+       /*
+        * state information for async smb handling
+        */
+       void *async_priv;
+
+       /*
+        * Back pointer to smb2 request.
+        */
+       struct smbd_smb2_request *smb2req;
+
+       /*
+        * Pathnames used if request done
+        * under privilege.
+        */
+       struct privilege_paths *priv_paths;
+
+       /*
+        * Request list for chained requests, we're part of it.
+        */
+       struct smb_request **chain;
+
+       struct timeval request_time;
+};
+
 /*
  * Info about an alternate data stream
  */