s3:libsmb/cli*: use CLI_BUFFER_SIZE instead of cli->max_xmit
[metze/samba/wip.git] / source3 / libsmb / clifile.c
index 59cdb7b855d51a8a6ef2dd797a8c155baa879ce3..2a30d2cda9c92ab8978215feb8d541dd618b2e4a 100644 (file)
@@ -612,7 +612,7 @@ struct tevent_req *cli_posix_getfacl_send(TALLOC_CTX *mem_ctx,
                return NULL;
        }
        subreq = cli_qpathinfo_send(state, ev, cli, fname, SMB_QUERY_POSIX_ACL,
-                                   0, cli->max_xmit);
+                                   0, CLI_BUFFER_SIZE);
        if (tevent_req_nomem(subreq, req)) {
                return tevent_req_post(req, ev);
        }
@@ -2594,7 +2594,8 @@ NTSTATUS cli_locktype(struct cli_state *cli, uint16_t fnum,
        uint16_t vwv[8];
        uint8_t bytes[10];
        NTSTATUS status;
-       int saved_timeout;
+       unsigned int set_timeout = 0;
+       unsigned int saved_timeout = 0;
 
        SCVAL(vwv + 0, 0, 0xff);
        SCVAL(vwv + 0, 1, 0);
@@ -2610,17 +2611,21 @@ NTSTATUS cli_locktype(struct cli_state *cli, uint16_t fnum,
        SIVAL(bytes, 2, offset);
        SIVAL(bytes, 6, len);
 
-       saved_timeout = cli->timeout;
-
        if (timeout != 0) {
-               cli->timeout = (timeout == -1)
-                       ? 0x7FFFFFFF : (timeout + 2*1000);
+               if (timeout == -1) {
+                       set_timeout = 0x7FFFFFFF;
+               } else {
+                       set_timeout = timeout + 2*1000;
+               }
+               saved_timeout = cli_set_timeout(cli, set_timeout);
        }
 
        status = cli_smb(talloc_tos(), cli, SMBlockingX, 0, 8, vwv,
                         10, bytes, NULL, 0, NULL, NULL, NULL, NULL);
 
-       cli->timeout = saved_timeout;
+       if (saved_timeout != 0) {
+               cli_set_timeout(cli, saved_timeout);
+       }
 
        return status;
 }
@@ -2761,11 +2766,12 @@ NTSTATUS cli_lock64(struct cli_state *cli, uint16_t fnum,
 {
        uint16_t vwv[8];
        uint8_t bytes[20];
-        int saved_timeout = cli->timeout;
+       unsigned int set_timeout = 0;
+       unsigned int saved_timeout = 0;
        int ltype;
        NTSTATUS status;
 
-       if (! (cli->capabilities & CAP_LARGE_FILES)) {
+       if (! (cli_state_capabilities(cli) & CAP_LARGE_FILES)) {
                return cli_lock32(cli, fnum, offset, len, timeout, lock_type);
        }
 
@@ -2786,17 +2792,21 @@ NTSTATUS cli_lock64(struct cli_state *cli, uint16_t fnum,
        SOFF_T_R(bytes, 4, offset);
        SOFF_T_R(bytes, 12, len);
 
-       saved_timeout = cli->timeout;
-
        if (timeout != 0) {
-               cli->timeout = (timeout == -1)
-                       ? 0x7FFFFFFF : (timeout + 2*1000);
+               if (timeout == -1) {
+                       set_timeout = 0x7FFFFFFF;
+               } else {
+                       set_timeout = timeout + 2*1000;
+               }
+               saved_timeout = cli_set_timeout(cli, set_timeout);
        }
 
        status = cli_smb(talloc_tos(), cli, SMBlockingX, 0, 8, vwv,
                         20, bytes, NULL, 0, NULL, NULL, NULL, NULL);
 
-       cli->timeout = saved_timeout;
+       if (saved_timeout != 0) {
+               cli_set_timeout(cli, saved_timeout);
+       }
 
        return status;
 }
@@ -2878,7 +2888,7 @@ NTSTATUS cli_unlock64(struct cli_state *cli,
        struct tevent_req *req;
        NTSTATUS status = NT_STATUS_OK;
 
-       if (! (cli->capabilities & CAP_LARGE_FILES)) {
+       if (! (cli_state_capabilities(cli) & CAP_LARGE_FILES)) {
                return cli_unlock(cli, fnum, offset, len);
        }
 
@@ -4132,7 +4142,7 @@ static NTSTATUS cli_set_ea(struct cli_state *cli, uint16_t setup_val,
        status = cli_trans(talloc_tos(), cli, SMBtrans2, NULL, -1, 0, 0,
                           setup, 1, 0,
                           param, param_len, 2,
-                          data,  data_len, cli->max_xmit,
+                          data,  data_len, CLI_BUFFER_SIZE,
                           NULL,
                           NULL, 0, NULL, /* rsetup */
                           NULL, 0, NULL, /* rparam */
@@ -4317,7 +4327,7 @@ struct tevent_req *cli_get_ea_list_path_send(TALLOC_CTX *mem_ctx,
        }
        subreq = cli_qpathinfo_send(state, ev, cli, fname,
                                    SMB_INFO_QUERY_ALL_EAS, 4,
-                                   cli->max_xmit);
+                                   CLI_BUFFER_SIZE);
        if (tevent_req_nomem(subreq, req)) {
                return tevent_req_post(req, ev);
        }
@@ -5366,7 +5376,7 @@ struct tevent_req *cli_shadow_copy_data_send(TALLOC_CTX *mem_ctx,
                return NULL;
        }
        state->get_names = get_names;
-       ret_size = get_names ? cli->max_xmit : 16;
+       ret_size = get_names ? CLI_BUFFER_SIZE : 16;
 
        SIVAL(state->setup + 0, 0, FSCTL_GET_SHADOW_COPY_DATA);
        SSVAL(state->setup + 2, 0, fnum);