diff options
author | Jeremy Allison <jra@samba.org> | 2010-04-13 18:41:14 -0700 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2010-04-13 18:41:14 -0700 |
commit | f3b8e31f83c44f1e72b15711542d817af7ec9506 (patch) | |
tree | d2747a4497220392a2f12ac47cb4c6640eb2ac68 /source3/libsmb | |
parent | 589a42e2da7d7cd382deb94c57b0c6dbca269e55 (diff) | |
download | samba-f3b8e31f83c44f1e72b15711542d817af7ec9506.tar.gz samba-f3b8e31f83c44f1e72b15711542d817af7ec9506.tar.bz2 samba-f3b8e31f83c44f1e72b15711542d817af7ec9506.zip |
Split out the client unix capabilities to those the server offered, and those the client asked for.
This fixes a bug when using encrypted transport and DFS links. Found
by my basic DFS torture test, which I'll check in next. Testing *rocks* :-).
Jeremy.
Diffstat (limited to 'source3/libsmb')
-rw-r--r-- | source3/libsmb/clidfs.c | 4 | ||||
-rw-r--r-- | source3/libsmb/clifsinfo.c | 18 | ||||
-rw-r--r-- | source3/libsmb/clireadwrite.c | 4 |
3 files changed, 19 insertions, 7 deletions
diff --git a/source3/libsmb/clidfs.c b/source3/libsmb/clidfs.c index d5ae11ff8d..345d0f9212 100644 --- a/source3/libsmb/clidfs.c +++ b/source3/libsmb/clidfs.c @@ -320,7 +320,7 @@ static struct cli_state *cli_cm_connect(TALLOC_CTX *ctx, DLIST_ADD_END(referring_cli, cli, struct cli_state *); } - if (referring_cli && referring_cli->posix_capabilities) { + if (referring_cli && referring_cli->requested_posix_capabilities) { uint16 major, minor; uint32 caplow, caphigh; NTSTATUS status; @@ -564,7 +564,7 @@ static char *cli_dfs_make_full_path(TALLOC_CTX *ctx, dir++; } - if (cli->posix_capabilities & CIFS_UNIX_POSIX_PATHNAMES_CAP) { + if (cli->requested_posix_capabilities & CIFS_UNIX_POSIX_PATHNAMES_CAP) { path_sep = '/'; } return talloc_asprintf(ctx, "%c%s%c%s%c%s", diff --git a/source3/libsmb/clifsinfo.c b/source3/libsmb/clifsinfo.c index 3297ec76ca..b8430a5870 100644 --- a/source3/libsmb/clifsinfo.c +++ b/source3/libsmb/clifsinfo.c @@ -27,6 +27,7 @@ ****************************************************************************/ struct cli_unix_extensions_version_state { + struct cli_state *cli; uint16_t setup[1]; uint8_t param[2]; uint16_t major, minor; @@ -47,6 +48,7 @@ struct tevent_req *cli_unix_extensions_version_send(TALLOC_CTX *mem_ctx, if (req == NULL) { return NULL; } + state->cli = cli; SSVAL(state->setup, 0, TRANSACT2_QFSINFO); SSVAL(state->param, 0, SMB_QUERY_CIFS_UNIX_INFO); @@ -104,6 +106,7 @@ NTSTATUS cli_unix_extensions_version_recv(struct tevent_req *req, *pminor = state->minor; *pcaplow = state->caplow; *pcaphigh = state->caphigh; + state->cli->server_posix_capabilities = *pcaplow; return NT_STATUS_OK; } @@ -143,9 +146,6 @@ NTSTATUS cli_unix_extensions_version(struct cli_state *cli, uint16 *pmajor, status = cli_unix_extensions_version_recv(req, pmajor, pminor, pcaplow, pcaphigh); - if (NT_STATUS_IS_OK(status)) { - cli->posix_capabilities = *pcaplow; - } fail: TALLOC_FREE(frame); if (!NT_STATUS_IS_OK(status)) { @@ -159,6 +159,7 @@ NTSTATUS cli_unix_extensions_version(struct cli_state *cli, uint16 *pmajor, ****************************************************************************/ struct cli_set_unix_extensions_capabilities_state { + struct cli_state *cli; uint16_t setup[1]; uint8_t param[4]; uint8_t data[12]; @@ -181,6 +182,7 @@ struct tevent_req *cli_set_unix_extensions_capabilities_send( return NULL; } + state->cli = cli; SSVAL(state->setup+0, 0, TRANSACT2_SETFSINFO); SSVAL(state->param, 0, 0); @@ -207,8 +209,16 @@ struct tevent_req *cli_set_unix_extensions_capabilities_send( static void cli_set_unix_extensions_capabilities_done( struct tevent_req *subreq) { + struct tevent_req *req = tevent_req_callback_data( + subreq, struct tevent_req); + struct cli_set_unix_extensions_capabilities_state *state = tevent_req_data( + req, struct cli_set_unix_extensions_capabilities_state); + NTSTATUS status = cli_trans_recv(subreq, NULL, NULL, 0, NULL, NULL, 0, NULL, NULL, 0, NULL); + if (NT_STATUS_IS_OK(status)) { + state->cli->requested_posix_capabilities = IVAL(state->data, 4); + } tevent_req_simple_finish_ntstatus(subreq, status); } @@ -245,6 +255,8 @@ fail: TALLOC_FREE(ev); if (!NT_STATUS_IS_OK(status)) { cli_set_error(cli, status); + } else { + cli->requested_posix_capabilities = caplow; } return status; } diff --git a/source3/libsmb/clireadwrite.c b/source3/libsmb/clireadwrite.c index 7b688d4ff3..e9a9e0ed3d 100644 --- a/source3/libsmb/clireadwrite.c +++ b/source3/libsmb/clireadwrite.c @@ -25,7 +25,7 @@ static size_t cli_read_max_bufsize(struct cli_state *cli) { if (!client_is_signing_on(cli) && !cli_encryption_on(cli) - && (cli->posix_capabilities & CIFS_UNIX_LARGE_READ_CAP)) { + && (cli->server_posix_capabilities & CIFS_UNIX_LARGE_READ_CAP)) { return CLI_SAMBA_MAX_POSIX_LARGE_READX_SIZE; } if (cli->capabilities & CAP_LARGE_READX) { @@ -44,7 +44,7 @@ static size_t cli_write_max_bufsize(struct cli_state *cli, uint16_t write_mode) if (write_mode == 0 && !client_is_signing_on(cli) && !cli_encryption_on(cli) && - (cli->posix_capabilities & CIFS_UNIX_LARGE_WRITE_CAP) && + (cli->server_posix_capabilities & CIFS_UNIX_LARGE_WRITE_CAP) && (cli->capabilities & CAP_LARGE_FILES)) { /* Only do massive writes if we can do them direct * with no signing or encrypting - not on a pipe. */ |