smbd: qfilepathinfo has fixed/variable buffers
[samba.git] / source3 / smbd / globals.h
index 97d75fd4137e46bb7de4e92c4ff575890b37019d..7fbe608744076e6f87aed6e9eed59baa3935117d 100644 (file)
@@ -162,6 +162,7 @@ NTSTATUS smbd_do_qfilepathinfo(connection_struct *conn,
                               char *lock_data,
                               uint16_t flags2,
                               unsigned int max_data_bytes,
+                              size_t *fixed_portion,
                               char **ppdata,
                               unsigned int *pdata_size);
 
@@ -179,6 +180,7 @@ NTSTATUS smbd_do_qfsinfo(connection_struct *conn,
                         uint16_t info_level,
                         uint16_t flags2,
                         unsigned int max_data_bytes,
+                        struct smb_filename *smb_fname,
                         char **ppdata,
                         int *ret_data_len);
 
@@ -224,6 +226,11 @@ bool smbd_dirptr_lanman2_entry(TALLOC_CTX *ctx,
                               int *_last_entry_off,
                               struct ea_list *name_list);
 
+NTSTATUS smbd_calculate_access_mask(connection_struct *conn,
+                                   const struct smb_filename *smb_fname,
+                                   bool file_existed,
+                                   uint32_t access_mask,
+                                   uint32_t *access_mask_out);
 NTSTATUS smbd_check_open_rights(struct connection_struct *conn,
                                const struct smb_filename *smb_fname,
                                uint32_t access_mask,
@@ -273,6 +280,9 @@ NTSTATUS smbd_smb2_request_check_tcon(struct smbd_smb2_request *req);
 struct smb_request *smbd_smb2_fake_smb_request(struct smbd_smb2_request *req);
 void remove_smb2_chained_fsp(files_struct *fsp);
 
+NTSTATUS smbd_smb2_request_verify_sizes(struct smbd_smb2_request *req,
+                                       size_t expected_body_size);
+
 NTSTATUS smbd_smb2_request_process_negprot(struct smbd_smb2_request *req);
 NTSTATUS smbd_smb2_request_process_sesssetup(struct smbd_smb2_request *req);
 NTSTATUS smbd_smb2_request_process_logoff(struct smbd_smb2_request *req);
@@ -345,21 +355,22 @@ struct smbd_smb2_request {
 
        /* the session the request operates on, maybe NULL */
        struct smbd_smb2_session *session;
+       uint64_t last_session_id;
 
        /* the tcon the request operates on, maybe NULL */
        struct smbd_smb2_tcon *tcon;
+       uint32_t last_tid;
 
        int current_idx;
        bool do_signing;
        bool async;
        bool cancelled;
+       bool compound_related;
 
        /* fake smb1 request. */
        struct smb_request *smb1req;
        struct files_struct *compat_chain_fsp;
 
-       NTSTATUS next_status;
-
        /*
         * The sub request for async backend calls.
         * This is used for SMB2 Cancel.
@@ -483,6 +494,8 @@ struct smbd_server_connection {
                int dirhandles_open;
        } searches;
 
+       uint64_t num_requests;
+
        struct {
                struct fd_event *fde;
 
@@ -510,7 +523,6 @@ struct smbd_server_connection {
                        int ref_count;
                } echo_handler;
 
-               uint64_t num_requests;
                struct {
                        bool encrypted_passwords;
                        bool spnego;
@@ -591,10 +603,51 @@ struct smbd_server_connection {
                        bool blocking_lock_unlock_state;
                } locks;
                struct smbd_smb2_request *requests;
+               /*
+                * seqnum_low is the lowest sequence number
+                * we will accept.
+                */
                uint64_t seqnum_low;
-               uint32_t credits_granted;
-               uint32_t max_credits;
+               /*
+                * seqnum_range is the range of credits we have
+                * granted from the sequence windows starting
+                * at seqnum_low.
+                *
+                * This gets incremented when new credits are
+                * granted and gets decremented when the
+                * lowest sequence number is consumed
+                * (when seqnum_low gets incremented).
+                */
+               uint16_t seqnum_range;
+               /*
+                * credits_grantedThe number of credits we have currently granted
+                * to the client.
+                *
+                * This gets incremented when new credits are
+                * granted and gets decremented when any credit
+                * is comsumed.
+                *
+                * Note: the decrementing is different compared
+                *       to seqnum_range.
+                */
+               uint16_t credits_granted;
+               /*
+                * The maximum number of credits we will ever
+                * grant to the client.
+                *
+                * Typically we will only grant 1/16th of
+                * max_credits.
+                *
+                * This is the "server max credits" parameter.
+                */
+               uint16_t max_credits;
+               /*
+                * a bitmap of size max_credits
+                */
                struct bitmap *credits_bitmap;
+               uint32_t max_trans;
+               uint32_t max_read;
+               uint32_t max_write;
        } smb2;
 };