diff options
author | Luk Claes <luk@debian.org> | 2012-05-10 18:35:50 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2012-05-12 00:45:53 +0200 |
commit | 473363a8078fca8ba7dbbdf310d984167cf92bf4 (patch) | |
tree | 9c45b02817a9d31f78269fc2b82a6cd02ff80041 | |
parent | 87d890fdd92195acca3e099c3f7b60aea91ac04e (diff) | |
download | samba-473363a8078fca8ba7dbbdf310d984167cf92bf4.tar.gz samba-473363a8078fca8ba7dbbdf310d984167cf92bf4.tar.bz2 samba-473363a8078fca8ba7dbbdf310d984167cf92bf4.zip |
s3/libsmb: Generalise cli_state in smb2 flush calls
Signed-off-by: Luk Claes <luk@debian.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
-rw-r--r-- | source3/libsmb/smb2cli.h | 10 | ||||
-rw-r--r-- | source3/libsmb/smb2cli_flush.c | 26 | ||||
-rw-r--r-- | source3/torture/test_smb2.c | 54 |
3 files changed, 60 insertions, 30 deletions
diff --git a/source3/libsmb/smb2cli.h b/source3/libsmb/smb2cli.h index 139ff44b0e..c20589ef83 100644 --- a/source3/libsmb/smb2cli.h +++ b/source3/libsmb/smb2cli.h @@ -98,11 +98,17 @@ NTSTATUS smb2cli_close(struct smbXcli_conn *conn, struct tevent_req *smb2cli_flush_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev, - struct cli_state *cli, + struct smbXcli_conn *conn, + uint32_t timeout_msec, + struct smbXcli_session *session, + uint32_t tcon_id, uint64_t fid_persistent, uint64_t fid_volatile); NTSTATUS smb2cli_flush_recv(struct tevent_req *req); -NTSTATUS smb2cli_flush(struct cli_state *cli, +NTSTATUS smb2cli_flush(struct smbXcli_conn *conn, + uint32_t timeout_msec, + struct smbXcli_session *session, + uint32_t tcon_id, uint64_t fid_persistent, uint64_t fid_volatile); diff --git a/source3/libsmb/smb2cli_flush.c b/source3/libsmb/smb2cli_flush.c index 738af24224..3b20c445e3 100644 --- a/source3/libsmb/smb2cli_flush.c +++ b/source3/libsmb/smb2cli_flush.c @@ -33,7 +33,10 @@ static void smb2cli_flush_done(struct tevent_req *subreq); struct tevent_req *smb2cli_flush_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev, - struct cli_state *cli, + struct smbXcli_conn *conn, + uint32_t timeout_msec, + struct smbXcli_session *session, + uint32_t tcon_id, uint64_t fid_persistent, uint64_t fid_volatile) { @@ -51,12 +54,12 @@ struct tevent_req *smb2cli_flush_send(TALLOC_CTX *mem_ctx, SBVAL(fixed, 8, fid_persistent); SBVAL(fixed, 16, fid_volatile); - subreq = smb2cli_req_send(state, ev, cli->conn, SMB2_OP_FLUSH, + subreq = smb2cli_req_send(state, ev, conn, SMB2_OP_FLUSH, 0, 0, /* flags */ - cli->timeout, - cli->smb2.pid, - cli->smb2.tid, - cli->smb2.session, + timeout_msec, + 0xFEFF, /* pid */ + tcon_id, + session, state->fixed, sizeof(state->fixed), NULL, 0); if (tevent_req_nomem(subreq, req)) { @@ -92,7 +95,10 @@ NTSTATUS smb2cli_flush_recv(struct tevent_req *req) return tevent_req_simple_recv_ntstatus(req); } -NTSTATUS smb2cli_flush(struct cli_state *cli, +NTSTATUS smb2cli_flush(struct smbXcli_conn *conn, + uint32_t timeout_msec, + struct smbXcli_session *session, + uint32_t tcon_id, uint64_t fid_persistent, uint64_t fid_volatile) { @@ -101,7 +107,7 @@ NTSTATUS smb2cli_flush(struct cli_state *cli, struct tevent_req *req; NTSTATUS status = NT_STATUS_NO_MEMORY; - if (cli_has_async_calls(cli)) { + if (smbXcli_conn_has_async_calls(conn)) { /* * Can't use sync call while an async call is in flight */ @@ -112,8 +118,8 @@ NTSTATUS smb2cli_flush(struct cli_state *cli, if (ev == NULL) { goto fail; } - req = smb2cli_flush_send(frame, ev, cli, - fid_persistent, fid_volatile); + req = smb2cli_flush_send(frame, ev, conn, timeout_msec, session, + tcon_id, fid_persistent, fid_volatile); if (req == NULL) { goto fail; } diff --git a/source3/torture/test_smb2.c b/source3/torture/test_smb2.c index 9cedef84e0..a8f7cd421e 100644 --- a/source3/torture/test_smb2.c +++ b/source3/torture/test_smb2.c @@ -96,7 +96,8 @@ bool run_smb2_basic(int dummy) return false; } - status = smb2cli_flush(cli, fid_persistent, fid_volatile); + status = smb2cli_flush(cli->conn, cli->timeout, cli->smb2.session, + cli->smb2.tid, fid_persistent, fid_volatile); if (!NT_STATUS_IS_OK(status)) { printf("smb2cli_flush returned %s\n", nt_errstr(status)); return false; @@ -343,7 +344,8 @@ bool run_smb2_session_reconnect(int dummy) return false; } - status = smb2cli_flush(cli1, fid_persistent, fid_volatile); + status = smb2cli_flush(cli1->conn, cli1->timeout, cli1->smb2.session, + cli1->smb2.tid, fid_persistent, fid_volatile); if (!NT_STATUS_IS_OK(status)) { printf("smb2cli_flush returned %s\n", nt_errstr(status)); return false; @@ -504,7 +506,8 @@ bool run_smb2_session_reconnect(int dummy) /* check file operation on the old client */ - status = smb2cli_flush(cli1, fid_persistent, fid_volatile); + status = smb2cli_flush(cli1->conn, cli1->timeout, cli1->smb2.session, + cli1->smb2.tid, fid_persistent, fid_volatile); if (!NT_STATUS_EQUAL(status, NT_STATUS_USER_SESSION_DELETED)) { printf("smb2cli_flush returned %s\n", nt_errstr(status)); return false; @@ -521,7 +524,8 @@ bool run_smb2_session_reconnect(int dummy) * on w2k8r2 at least, flush, read and write also work the same way, * while create gives ACCESS_DENIED without signing */ - status = smb2cli_flush(cli2, fid_persistent, fid_volatile); + status = smb2cli_flush(cli2->conn, cli2->timeout, cli2->smb2.session, + cli2->smb2.tid, fid_persistent, fid_volatile); if (!NT_STATUS_EQUAL(status, NT_STATUS_FILE_CLOSED)) { printf("smb2cli_flush returned %s\n", nt_errstr(status)); return false; @@ -575,7 +579,8 @@ bool run_smb2_session_reconnect(int dummy) cli2->smb2.tid = cli1->smb2.tid; - status = smb2cli_flush(cli2, fid_persistent, fid_volatile); + status = smb2cli_flush(cli2->conn, cli2->timeout, cli2->smb2.session, + cli2->smb2.tid, fid_persistent, fid_volatile); if (!NT_STATUS_EQUAL(status, NT_STATUS_FILE_CLOSED)) { printf("smb2cli_flush returned %s\n", nt_errstr(status)); return false; @@ -646,7 +651,8 @@ bool run_smb2_session_reconnect(int dummy) return false; } - status = smb2cli_flush(cli2, fid_persistent, fid_volatile); + status = smb2cli_flush(cli2->conn, cli2->timeout, cli2->smb2.session, + cli2->smb2.tid, fid_persistent, fid_volatile); if (!NT_STATUS_IS_OK(status)) { printf("smb2cli_flush returned %s\n", nt_errstr(status)); return false; @@ -738,7 +744,8 @@ bool run_smb2_tcon_dependence(int dummy) return false; } - status = smb2cli_flush(cli, fid_persistent, fid_volatile); + status = smb2cli_flush(cli->conn, cli->timeout, cli->smb2.session, + cli->smb2.tid, fid_persistent, fid_volatile); if (!NT_STATUS_IS_OK(status)) { printf("smb2cli_flush returned %s\n", nt_errstr(status)); return false; @@ -1141,19 +1148,22 @@ bool run_smb2_multi_channel(int dummy) return false; } - status = smb2cli_flush(cli2, fid_persistent, fid_volatile); + status = smb2cli_flush(cli2->conn, cli2->timeout, cli2->smb2.session, + cli2->smb2.tid, fid_persistent, fid_volatile); if (!NT_STATUS_IS_OK(status)) { printf("smb2cli_flush returned %s\n", nt_errstr(status)); return false; } - status = smb2cli_flush(cli1, fid_persistent, fid_volatile); + status = smb2cli_flush(cli1->conn, cli1->timeout, cli1->smb2.session, + cli1->smb2.tid, fid_persistent, fid_volatile); if (!NT_STATUS_IS_OK(status)) { printf("smb2cli_flush returned %s\n", nt_errstr(status)); return false; } - status = smb2cli_flush(cli3, fid_persistent, fid_volatile); + status = smb2cli_flush(cli3->conn, cli3->timeout, cli3->smb2.session, + cli3->smb2.tid, fid_persistent, fid_volatile); if (!NT_STATUS_IS_OK(status)) { printf("smb2cli_flush returned %s\n", nt_errstr(status)); return false; @@ -1252,19 +1262,22 @@ bool run_smb2_multi_channel(int dummy) return false; } - status = smb2cli_flush(cli1, fid_persistent, fid_volatile); + status = smb2cli_flush(cli1->conn, cli1->timeout, cli1->smb2.session, + cli1->smb2.tid, fid_persistent, fid_volatile); if (!NT_STATUS_IS_OK(status)) { printf("smb2cli_flush returned %s\n", nt_errstr(status)); return false; } - status = smb2cli_flush(cli2, fid_persistent, fid_volatile); + status = smb2cli_flush(cli2->conn, cli2->timeout, cli2->smb2.session, + cli2->smb2.tid, fid_persistent, fid_volatile); if (!NT_STATUS_IS_OK(status)) { printf("smb2cli_flush returned %s\n", nt_errstr(status)); return false; } - status = smb2cli_flush(cli3, fid_persistent, fid_volatile); + status = smb2cli_flush(cli3->conn, cli3->timeout, cli3->smb2.session, + cli3->smb2.tid, fid_persistent, fid_volatile); if (!NT_STATUS_IS_OK(status)) { printf("smb2cli_flush returned %s\n", nt_errstr(status)); return false; @@ -1356,19 +1369,22 @@ bool run_smb2_multi_channel(int dummy) return false; } - status = smb2cli_flush(cli3, fid_persistent, fid_volatile); + status = smb2cli_flush(cli3->conn, cli3->timeout, cli3->smb2.session, + cli3->smb2.tid, fid_persistent, fid_volatile); if (!NT_STATUS_EQUAL(status, NT_STATUS_FILE_CLOSED)) { printf("smb2cli_flush returned %s\n", nt_errstr(status)); return false; } - status = smb2cli_flush(cli2, fid_persistent, fid_volatile); + status = smb2cli_flush(cli2->conn, cli2->timeout, cli2->smb2.session, + cli2->smb2.tid, fid_persistent, fid_volatile); if (!NT_STATUS_EQUAL(status, NT_STATUS_FILE_CLOSED)) { printf("smb2cli_flush returned %s\n", nt_errstr(status)); return false; } - status = smb2cli_flush(cli1, fid_persistent, fid_volatile); + status = smb2cli_flush(cli1->conn, cli1->timeout, cli1->smb2.session, + cli1->smb2.tid, fid_persistent, fid_volatile); if (!NT_STATUS_EQUAL(status, NT_STATUS_FILE_CLOSED)) { printf("smb2cli_flush returned %s\n", nt_errstr(status)); return false; @@ -1555,7 +1571,8 @@ bool run_smb2_session_reauth(int dummy) return false; } - status = smb2cli_flush(cli, fid_persistent, fid_volatile); + status = smb2cli_flush(cli->conn, cli->timeout, cli->smb2.session, + cli->smb2.tid, fid_persistent, fid_volatile); if (!NT_STATUS_IS_OK(status)) { printf("smb2cli_flush returned %s\n", nt_errstr(status)); return false; @@ -1703,7 +1720,8 @@ bool run_smb2_session_reauth(int dummy) return false; } - status = smb2cli_flush(cli, fid_persistent, fid_volatile); + status = smb2cli_flush(cli->conn, cli->timeout, cli->smb2.session, + cli->smb2.tid, fid_persistent, fid_volatile); if (!NT_STATUS_IS_OK(status)) { printf("smb2cli_flush returned %s\n", nt_errstr(status)); return false; |