summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2014-06-27 09:32:34 +0000
committerJeremy Allison <jra@samba.org>2014-06-30 22:28:14 +0200
commit9f3e89446847425881e07cafadddc2af8723e8c2 (patch)
treecd87e746cce73e6b27df6e02d687abc31e47980b
parentf0f18c56c68325e9a1cf9b422d270a8787c980ba (diff)
downloadsamba-9f3e89446847425881e07cafadddc2af8723e8c2.tar.gz
samba-9f3e89446847425881e07cafadddc2af8723e8c2.tar.xz
samba-9f3e89446847425881e07cafadddc2af8723e8c2.zip
libcli: Make smb2cli_create return blobs
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
-rw-r--r--libcli/smb/smb2cli_create.c15
-rw-r--r--libcli/smb/smbXcli_base.h8
-rw-r--r--libcli/smb/tstream_smbXcli_np.c2
-rw-r--r--source3/libsmb/cli_smb2_fnum.c2
-rw-r--r--source3/torture/test_smb2.c32
5 files changed, 36 insertions, 23 deletions
diff --git a/libcli/smb/smb2cli_create.c b/libcli/smb/smb2cli_create.c
index bcd674e26a..0db546c541 100644
--- a/libcli/smb/smb2cli_create.c
+++ b/libcli/smb/smb2cli_create.c
@@ -238,7 +238,9 @@ static void smb2cli_create_done(struct tevent_req *subreq)
NTSTATUS smb2cli_create_recv(struct tevent_req *req,
uint64_t *fid_persistent,
uint64_t *fid_volatile,
- struct smb_create_returns *cr)
+ struct smb_create_returns *cr,
+ TALLOC_CTX *mem_ctx,
+ struct smb2_create_blobs *blobs)
{
struct smb2cli_create_state *state =
tevent_req_data(req,
@@ -253,6 +255,10 @@ NTSTATUS smb2cli_create_recv(struct tevent_req *req,
if (cr) {
*cr = state->cr;
}
+ if (blobs) {
+ blobs->num_blobs = state->blobs.num_blobs;
+ blobs->blobs = talloc_move(mem_ctx, &state->blobs.blobs);
+ }
return NT_STATUS_OK;
}
@@ -271,7 +277,9 @@ NTSTATUS smb2cli_create(struct smbXcli_conn *conn,
struct smb2_create_blobs *blobs,
uint64_t *fid_persistent,
uint64_t *fid_volatile,
- struct smb_create_returns *cr)
+ struct smb_create_returns *cr,
+ TALLOC_CTX *mem_ctx,
+ struct smb2_create_blobs *ret_blobs)
{
TALLOC_CTX *frame = talloc_stackframe();
struct tevent_context *ev;
@@ -302,7 +310,8 @@ NTSTATUS smb2cli_create(struct smbXcli_conn *conn,
if (!tevent_req_poll_ntstatus(req, ev, &status)) {
goto fail;
}
- status = smb2cli_create_recv(req, fid_persistent, fid_volatile, cr);
+ status = smb2cli_create_recv(req, fid_persistent, fid_volatile, cr,
+ mem_ctx, ret_blobs);
fail:
TALLOC_FREE(frame);
return status;
diff --git a/libcli/smb/smbXcli_base.h b/libcli/smb/smbXcli_base.h
index 8cde85e582..06015b1242 100644
--- a/libcli/smb/smbXcli_base.h
+++ b/libcli/smb/smbXcli_base.h
@@ -461,7 +461,9 @@ struct tevent_req *smb2cli_create_send(
NTSTATUS smb2cli_create_recv(struct tevent_req *req,
uint64_t *fid_persistent,
uint64_t *fid_volatile,
- struct smb_create_returns *cr);
+ struct smb_create_returns *cr,
+ TALLOC_CTX *mem_ctx,
+ struct smb2_create_blobs *blobs);
NTSTATUS smb2cli_create(struct smbXcli_conn *conn,
uint32_t timeout_msec,
struct smbXcli_session *session,
@@ -477,7 +479,9 @@ NTSTATUS smb2cli_create(struct smbXcli_conn *conn,
struct smb2_create_blobs *blobs,
uint64_t *fid_persistent,
uint64_t *fid_volatile,
- struct smb_create_returns *cr);
+ struct smb_create_returns *cr,
+ TALLOC_CTX *mem_ctx,
+ struct smb2_create_blobs *ret_blobs);
struct tevent_req *smb2cli_close_send(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
diff --git a/libcli/smb/tstream_smbXcli_np.c b/libcli/smb/tstream_smbXcli_np.c
index c32fd6fb14..77a326b012 100644
--- a/libcli/smb/tstream_smbXcli_np.c
+++ b/libcli/smb/tstream_smbXcli_np.c
@@ -279,7 +279,7 @@ static void tstream_smbXcli_np_open_done(struct tevent_req *subreq)
status = smb2cli_create_recv(subreq,
&state->fid_persistent,
&state->fid_volatile,
- NULL);
+ NULL, NULL, NULL);
}
TALLOC_FREE(subreq);
if (!NT_STATUS_IS_OK(status)) {
diff --git a/source3/libsmb/cli_smb2_fnum.c b/source3/libsmb/cli_smb2_fnum.c
index 87edf4e298..e4dfbf319e 100644
--- a/source3/libsmb/cli_smb2_fnum.c
+++ b/source3/libsmb/cli_smb2_fnum.c
@@ -234,7 +234,7 @@ static void cli_smb2_create_fnum_done(struct tevent_req *subreq)
NTSTATUS status;
status = smb2cli_create_recv(subreq, &h.fid_persistent,
- &h.fid_volatile, &state->cr);
+ &h.fid_volatile, &state->cr, NULL, NULL);
TALLOC_FREE(subreq);
if (tevent_req_nterror(req, status)) {
return;
diff --git a/source3/torture/test_smb2.c b/source3/torture/test_smb2.c
index 1923668a15..49acf3a3ba 100644
--- a/source3/torture/test_smb2.c
+++ b/source3/torture/test_smb2.c
@@ -84,7 +84,7 @@ bool run_smb2_basic(int dummy)
NULL, /* smb2_create_blobs *blobs */
&fid_persistent,
&fid_volatile,
- NULL);
+ NULL, NULL, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("smb2cli_create returned %s\n", nt_errstr(status));
return false;
@@ -147,7 +147,7 @@ bool run_smb2_basic(int dummy)
NULL, /* smb2_create_blobs *blobs */
&fid_persistent,
&fid_volatile,
- NULL);
+ NULL, NULL, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("smb2cli_create returned %s\n", nt_errstr(status));
return false;
@@ -347,7 +347,7 @@ bool run_smb2_session_reconnect(int dummy)
NULL, /* smb2_create_blobs *blobs */
&fid_persistent,
&fid_volatile,
- NULL);
+ NULL, NULL, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("smb2cli_create on cli1 %s\n", nt_errstr(status));
return false;
@@ -584,7 +584,7 @@ bool run_smb2_session_reconnect(int dummy)
NULL, /* smb2_create_blobs *blobs */
&fid_persistent,
&fid_volatile,
- NULL);
+ NULL, NULL, NULL);
if (!NT_STATUS_EQUAL(status, NT_STATUS_ACCESS_DENIED) &&
!NT_STATUS_EQUAL(status, NT_STATUS_NETWORK_NAME_DELETED)) {
printf("smb2cli_create on cli2 %s\n", nt_errstr(status));
@@ -645,7 +645,7 @@ bool run_smb2_session_reconnect(int dummy)
NULL, /* smb2_create_blobs *blobs */
&fid_persistent,
&fid_volatile,
- NULL);
+ NULL, NULL, NULL);
if (!NT_STATUS_EQUAL(status, NT_STATUS_NETWORK_NAME_DELETED) &&
!NT_STATUS_EQUAL(status, NT_STATUS_NETWORK_NAME_DELETED))
{
@@ -673,7 +673,7 @@ bool run_smb2_session_reconnect(int dummy)
NULL, /* smb2_create_blobs *blobs */
&fid_persistent,
&fid_volatile,
- NULL);
+ NULL, NULL, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("smb2cli_create on cli2 %s\n", nt_errstr(status));
return false;
@@ -769,7 +769,7 @@ bool run_smb2_tcon_dependence(int dummy)
NULL, /* smb2_create_blobs *blobs */
&fid_persistent,
&fid_volatile,
- NULL);
+ NULL, NULL, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("smb2cli_create on cli %s\n", nt_errstr(status));
return false;
@@ -1181,7 +1181,7 @@ bool run_smb2_multi_channel(int dummy)
NULL, /* smb2_create_blobs *blobs */
&fid_persistent,
&fid_volatile,
- NULL);
+ NULL, NULL, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("smb2cli_create on cli2 %s\n", nt_errstr(status));
return false;
@@ -1344,7 +1344,7 @@ bool run_smb2_multi_channel(int dummy)
NULL, /* smb2_create_blobs *blobs */
&fid_persistent,
&fid_volatile,
- NULL);
+ NULL, NULL, NULL);
if (!NT_STATUS_EQUAL(status, NT_STATUS_INVALID_HANDLE)) {
printf("smb2cli_create %s\n", nt_errstr(status));
return false;
@@ -1362,7 +1362,7 @@ bool run_smb2_multi_channel(int dummy)
NULL, /* smb2_create_blobs *blobs */
&fid_persistent,
&fid_volatile,
- NULL);
+ NULL, NULL, NULL);
if (!NT_STATUS_EQUAL(status, NT_STATUS_INVALID_HANDLE)) {
printf("smb2cli_create %s\n", nt_errstr(status));
return false;
@@ -1380,7 +1380,7 @@ bool run_smb2_multi_channel(int dummy)
NULL, /* smb2_create_blobs *blobs */
&fid_persistent,
&fid_volatile,
- NULL);
+ NULL, NULL, NULL);
if (!NT_STATUS_EQUAL(status, NT_STATUS_INVALID_HANDLE)) {
printf("smb2cli_create %s\n", nt_errstr(status));
return false;
@@ -1512,7 +1512,7 @@ bool run_smb2_session_reauth(int dummy)
NULL, /* smb2_create_blobs *blobs */
&fid_persistent,
&fid_volatile,
- NULL);
+ NULL, NULL, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("smb2cli_create %s\n", nt_errstr(status));
return false;
@@ -1532,7 +1532,7 @@ bool run_smb2_session_reauth(int dummy)
NULL, /* smb2_create_blobs *blobs */
&dir_persistent,
&dir_volatile,
- NULL);
+ NULL, NULL, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("smb2cli_create returned %s\n", nt_errstr(status));
return false;
@@ -1718,7 +1718,7 @@ bool run_smb2_session_reauth(int dummy)
NULL, /* smb2_create_blobs *blobs */
&fid_persistent,
&fid_volatile,
- NULL);
+ NULL, NULL, NULL);
if (!NT_STATUS_EQUAL(status, NT_STATUS_INVALID_HANDLE)) {
printf("smb2cli_create %s\n", nt_errstr(status));
return false;
@@ -1738,7 +1738,7 @@ bool run_smb2_session_reauth(int dummy)
NULL, /* smb2_create_blobs *blobs */
&dir_persistent,
&dir_volatile,
- NULL);
+ NULL, NULL, NULL);
if (!NT_STATUS_EQUAL(status, NT_STATUS_INVALID_HANDLE)) {
printf("smb2cli_create returned %s\n", nt_errstr(status));
return false;
@@ -1894,7 +1894,7 @@ bool run_smb2_session_reauth(int dummy)
NULL, /* smb2_create_blobs *blobs */
&fid_persistent,
&fid_volatile,
- NULL);
+ NULL, NULL, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("smb2cli_create %s\n", nt_errstr(status));
return false;