libcli: Make smb2cli_create return blobs
authorVolker Lendecke <vl@samba.org>
Fri, 27 Jun 2014 09:32:34 +0000 (09:32 +0000)
committerJeremy Allison <jra@samba.org>
Mon, 30 Jun 2014 20:28:14 +0000 (22:28 +0200)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
libcli/smb/smb2cli_create.c
libcli/smb/smbXcli_base.h
libcli/smb/tstream_smbXcli_np.c
source3/libsmb/cli_smb2_fnum.c
source3/torture/test_smb2.c

index bcd674e26a8af9ca4b03df679445ce6a73d75260..0db546c541464645fa399a056186f588f908075a 100644 (file)
@@ -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;
index 8cde85e5827474b644fb60b45021cb0d6d0eb17d..06015b12425aa69332d45868960658dadcf31d36 100644 (file)
@@ -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,
index c32fd6fb14411d0dc8d7e38cd3d4136c21434ddd..77a326b012d0032ec268bc2a70339c104a9db6d7 100644 (file)
@@ -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)) {
index 87edf4e29820a8ff647cd89627bb2e80995e4feb..e4dfbf319ee72efab8ecc8ad36fd0590504cfda9 100644 (file)
@@ -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;
index 1923668a15e32ae1059498a7c7a421f6adfb0fab..49acf3a3ba37830f390ebc930300ba927f135b0d 100644 (file)
@@ -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;