From 6e8a6e033f4040630995f0c2f1889fbc251cb7dc Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 1 Aug 2011 16:42:23 +0200 Subject: [PATCH] s3:libsmb/cli*: make use of cli_state_capabilities() metze --- source3/libsmb/cliconnect.c | 8 ++++---- source3/libsmb/clidfs.c | 6 +++--- source3/libsmb/clientgen.c | 8 ++++---- source3/libsmb/clifile.c | 4 ++-- source3/libsmb/clilist.c | 2 +- source3/libsmb/clireadwrite.c | 8 ++++---- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c index 4f703b35791..1547a241be2 100644 --- a/source3/libsmb/cliconnect.c +++ b/source3/libsmb/cliconnect.c @@ -379,7 +379,7 @@ static uint32 cli_session_setup_capabilities(struct cli_state *cli) if (cli->use_level_II_oplocks) capabilities |= CAP_LEVEL_II_OPLOCKS; - capabilities |= (cli->capabilities & (CAP_UNICODE|CAP_LARGE_FILES|CAP_LARGE_READX|CAP_LARGE_WRITEX|CAP_DFS)); + capabilities |= (cli_state_capabilities(cli) & (CAP_UNICODE|CAP_LARGE_FILES|CAP_LARGE_READX|CAP_LARGE_WRITEX|CAP_DFS)); return capabilities; } @@ -2050,7 +2050,7 @@ NTSTATUS cli_session_setup(struct cli_state *cli, /* if the server supports extended security then use SPNEGO */ - if (cli->capabilities & CAP_EXTENDED_SECURITY) { + if (cli_state_capabilities(cli) & CAP_EXTENDED_SECURITY) { ADS_STATUS status = cli_session_setup_spnego(cli, user, pass, workgroup, NULL); if (!ADS_ERR_OK(status)) { @@ -2648,12 +2648,12 @@ static void cli_negprot_done(struct tevent_req *subreq) cli->servertime = ts.tv_sec; cli->secblob = data_blob(bytes, num_bytes); cli->capabilities = IVAL(vwv + 9, 1); - if (cli->capabilities & CAP_RAW_MODE) { + if (cli_state_capabilities(cli) & CAP_RAW_MODE) { cli->readbraw_supported = True; cli->writebraw_supported = True; } /* work out if they sent us a workgroup */ - if (!(cli->capabilities & CAP_EXTENDED_SECURITY) && + if (!(cli_state_capabilities(cli) & CAP_EXTENDED_SECURITY) && smb_buflen(inbuf) > 8) { ssize_t ret; status = smb_bytes_talloc_string( diff --git a/source3/libsmb/clidfs.c b/source3/libsmb/clidfs.c index d729649286f..514ff806957 100644 --- a/source3/libsmb/clidfs.c +++ b/source3/libsmb/clidfs.c @@ -201,7 +201,7 @@ static NTSTATUS do_connect(TALLOC_CTX *ctx, here before trying to connect to the original share. cli_check_msdfs_proxy() will fail if it is a normal share. */ - if ((c->capabilities & CAP_DFS) && + if ((cli_state_capabilities(c) & CAP_DFS) && cli_check_msdfs_proxy(ctx, c, sharename, &newserver, &newshare, force_encrypt, @@ -589,10 +589,10 @@ static bool cli_dfs_check_error(struct cli_state *cli, NTSTATUS expected, { /* only deal with DS when we negotiated NT_STATUS codes and UNICODE */ - if (!(cli->capabilities & CAP_UNICODE)) { + if (!(cli_state_capabilities(cli) & CAP_UNICODE)) { return false; } - if (!(cli->capabilities & CAP_STATUS32)) { + if (!(cli_state_capabilities(cli) & CAP_STATUS32)) { return false; } if (NT_STATUS_EQUAL(status, expected)) { diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c index 854d9a3c322..0135157500d 100644 --- a/source3/libsmb/clientgen.c +++ b/source3/libsmb/clientgen.c @@ -56,7 +56,7 @@ unsigned int cli_set_timeout(struct cli_state *cli, unsigned int timeout) bool cli_ucs2(struct cli_state *cli) { - return ((cli->capabilities & CAP_UNICODE) != 0); + return ((cli_state_capabilities(cli) & CAP_UNICODE) != 0); } /**************************************************************************** @@ -84,11 +84,11 @@ void cli_setup_packet_buf(struct cli_state *cli, char *buf) SCVAL(buf,smb_flg,0x8); } flags2 = FLAGS2_LONG_PATH_COMPONENTS; - if (cli->capabilities & CAP_UNICODE) + if (cli_state_capabilities(cli) & CAP_UNICODE) flags2 |= FLAGS2_UNICODE_STRINGS; - if ((cli->capabilities & CAP_DFS) && cli->dfsroot) + if ((cli_state_capabilities(cli) & CAP_DFS) && cli->dfsroot) flags2 |= FLAGS2_DFS_PATHNAMES; - if (cli->capabilities & CAP_STATUS32) + if (cli_state_capabilities(cli) & CAP_STATUS32) flags2 |= FLAGS2_32_BIT_ERROR_CODES; if (cli->use_spnego) flags2 |= FLAGS2_EXTENDED_SECURITY; diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c index 59cdb7b855d..812fcde85ef 100644 --- a/source3/libsmb/clifile.c +++ b/source3/libsmb/clifile.c @@ -2765,7 +2765,7 @@ NTSTATUS cli_lock64(struct cli_state *cli, uint16_t fnum, 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); } @@ -2878,7 +2878,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); } diff --git a/source3/libsmb/clilist.c b/source3/libsmb/clilist.c index 55a6636a730..e9a3355b690 100644 --- a/source3/libsmb/clilist.c +++ b/source3/libsmb/clilist.c @@ -946,7 +946,7 @@ NTSTATUS cli_list(struct cli_state *cli, const char *mask, uint16 attribute, goto fail; } - info_level = (cli->capabilities & CAP_NT_SMBS) + info_level = (cli_state_capabilities(cli) & CAP_NT_SMBS) ? SMB_FIND_FILE_BOTH_DIRECTORY_INFO : SMB_FIND_INFO_STANDARD; req = cli_list_send(frame, ev, cli, mask, attribute, info_level); diff --git a/source3/libsmb/clireadwrite.c b/source3/libsmb/clireadwrite.c index 413668d1081..2fe41b47637 100644 --- a/source3/libsmb/clireadwrite.c +++ b/source3/libsmb/clireadwrite.c @@ -37,7 +37,7 @@ static size_t cli_read_max_bufsize(struct cli_state *cli) && (cli->server_posix_capabilities & CIFS_UNIX_LARGE_READ_CAP)) { return CLI_SAMBA_MAX_POSIX_LARGE_READX_SIZE; } - if (cli->capabilities & CAP_LARGE_READX) { + if (cli_state_capabilities(cli) & CAP_LARGE_READX) { return cli->is_samba ? CLI_SAMBA_MAX_LARGE_READX_SIZE : CLI_WINDOWS_MAX_LARGE_READX_SIZE; @@ -62,7 +62,7 @@ static size_t cli_write_max_bufsize(struct cli_state *cli, !client_is_signing_on(cli) && !cli_encryption_on(cli) && (cli->server_posix_capabilities & CIFS_UNIX_LARGE_WRITE_CAP) && - (cli->capabilities & CAP_LARGE_FILES)) { + (cli_state_capabilities(cli) & CAP_LARGE_FILES)) { /* Only do massive writes if we can do them direct * with no signing or encrypting - not on a pipe. */ return CLI_SAMBA_MAX_POSIX_LARGE_WRITEX_SIZE; @@ -72,7 +72,7 @@ static size_t cli_write_max_bufsize(struct cli_state *cli, return CLI_SAMBA_MAX_LARGE_WRITEX_SIZE; } - if (((cli->capabilities & CAP_LARGE_WRITEX) == 0) + if (((cli_state_capabilities(cli) & CAP_LARGE_WRITEX) == 0) || client_is_signing_on(cli) || strequal(cli->dev, "LPT1:")) { size_t data_offset = smb_size - 4; @@ -803,7 +803,7 @@ struct tevent_req *cli_write_andx_create(TALLOC_CTX *mem_ctx, { struct tevent_req *req, *subreq; struct cli_write_andx_state *state; - bool bigoffset = ((cli->capabilities & CAP_LARGE_FILES) != 0); + bool bigoffset = ((cli_state_capabilities(cli) & CAP_LARGE_FILES) != 0); uint8_t wct = bigoffset ? 14 : 12; size_t max_write = cli_write_max_bufsize(cli, mode, wct); uint16_t *vwv;