libcli/smb: pass smbXcli_tcon to smb2cli_query_directory*()
authorStefan Metzmacher <metze@samba.org>
Mon, 23 Jul 2012 20:32:49 +0000 (22:32 +0200)
committerStefan Metzmacher <metze@samba.org>
Tue, 24 Jul 2012 20:20:06 +0000 (22:20 +0200)
metze

libcli/smb/smb2cli_query_directory.c
libcli/smb/smbXcli_base.h
source3/torture/test_smb2.c

index efc52d1ea711aad176f9aabb8aae848152c88c20..4ff93de68d0f3fd391e128fa1f70521eb1d77bab 100644 (file)
@@ -38,7 +38,7 @@ struct tevent_req *smb2cli_query_directory_send(TALLOC_CTX *mem_ctx,
                                                struct smbXcli_conn *conn,
                                                uint32_t timeout_msec,
                                                struct smbXcli_session *session,
                                                struct smbXcli_conn *conn,
                                                uint32_t timeout_msec,
                                                struct smbXcli_session *session,
-                                               uint32_t tcon_id,
+                                               struct smbXcli_tcon *tcon,
                                                uint8_t level,
                                                uint8_t flags,
                                                uint32_t file_index,
                                                uint8_t level,
                                                uint8_t flags,
                                                uint32_t file_index,
@@ -52,6 +52,7 @@ struct tevent_req *smb2cli_query_directory_send(TALLOC_CTX *mem_ctx,
        uint8_t *fixed;
        uint8_t *dyn;
        size_t dyn_len;
        uint8_t *fixed;
        uint8_t *dyn;
        size_t dyn_len;
+       uint32_t tcon_id = 0;
 
        req = tevent_req_create(mem_ctx, &state,
                                struct smb2cli_query_directory_state);
 
        req = tevent_req_create(mem_ctx, &state,
                                struct smb2cli_query_directory_state);
@@ -87,6 +88,10 @@ struct tevent_req *smb2cli_query_directory_send(TALLOC_CTX *mem_ctx,
                dyn_len = sizeof(state->dyn_pad);
        }
 
                dyn_len = sizeof(state->dyn_pad);
        }
 
+       if (tcon) {
+               tcon_id = smb2cli_tcon_current_id(tcon);
+       }
+
        subreq = smb2cli_req_send(state, ev, conn, SMB2_OP_FIND,
                                  0, 0, /* flags */
                                  timeout_msec,
        subreq = smb2cli_req_send(state, ev, conn, SMB2_OP_FIND,
                                  0, 0, /* flags */
                                  timeout_msec,
@@ -162,7 +167,7 @@ NTSTATUS smb2cli_query_directory_recv(struct tevent_req *req,
 NTSTATUS smb2cli_query_directory(struct smbXcli_conn *conn,
                                 uint32_t timeout_msec,
                                 struct smbXcli_session *session,
 NTSTATUS smb2cli_query_directory(struct smbXcli_conn *conn,
                                 uint32_t timeout_msec,
                                 struct smbXcli_session *session,
-                                uint32_t tcon_id,
+                                struct smbXcli_tcon *tcon,
                                 uint8_t level,
                                 uint8_t flags,
                                 uint32_t file_index,
                                 uint8_t level,
                                 uint8_t flags,
                                 uint32_t file_index,
@@ -191,7 +196,8 @@ NTSTATUS smb2cli_query_directory(struct smbXcli_conn *conn,
                goto fail;
        }
        req = smb2cli_query_directory_send(frame, ev, conn, timeout_msec,
                goto fail;
        }
        req = smb2cli_query_directory_send(frame, ev, conn, timeout_msec,
-                                          session, tcon_id, level, flags,
+                                          session, tcon,
+                                          level, flags,
                                           file_index, fid_persistent,
                                           fid_volatile, mask, outbuf_len);
        if (req == NULL) {
                                           file_index, fid_persistent,
                                           fid_volatile, mask, outbuf_len);
        if (req == NULL) {
index 75948be6fb22a79c49abaacfbcb27a468115a835..9230c7ee4e04281d02ae90ae97ef9111a3556a3f 100644 (file)
@@ -500,7 +500,7 @@ struct tevent_req *smb2cli_query_directory_send(TALLOC_CTX *mem_ctx,
                                                struct smbXcli_conn *conn,
                                                uint32_t timeout_msec,
                                                struct smbXcli_session *session,
                                                struct smbXcli_conn *conn,
                                                uint32_t timeout_msec,
                                                struct smbXcli_session *session,
-                                               uint32_t tcon_id,
+                                               struct smbXcli_tcon *tcon,
                                                uint8_t level,
                                                uint8_t flags,
                                                uint32_t file_index,
                                                uint8_t level,
                                                uint8_t flags,
                                                uint32_t file_index,
@@ -515,7 +515,7 @@ NTSTATUS smb2cli_query_directory_recv(struct tevent_req *req,
 NTSTATUS smb2cli_query_directory(struct smbXcli_conn *conn,
                                 uint32_t timeout_msec,
                                 struct smbXcli_session *session,
 NTSTATUS smb2cli_query_directory(struct smbXcli_conn *conn,
                                 uint32_t timeout_msec,
                                 struct smbXcli_session *session,
-                                uint32_t tcon_id,
+                                struct smbXcli_tcon *tcon,
                                 uint8_t level,
                                 uint8_t flags,
                                 uint32_t file_index,
                                 uint8_t level,
                                 uint8_t flags,
                                 uint32_t file_index,
index a03e1cf985397492b44b5f922d3bffc0333f176f..6892ad0a23fc8adbf0ad7c9fc2fa520ec87174a0 100644 (file)
@@ -152,7 +152,7 @@ bool run_smb2_basic(int dummy)
        }
 
        status = smb2cli_query_directory(
        }
 
        status = smb2cli_query_directory(
-               cli->conn, cli->timeout, cli->smb2.session, cli->smb2.tid,
+               cli->conn, cli->timeout, cli->smb2.session, cli->smb2.tcon,
                1, 0, 0, fid_persistent, fid_volatile, "*", 0xffff,
                talloc_tos(), &dir_data, &dir_data_length);
 
                1, 0, 0, fid_persistent, fid_volatile, "*", 0xffff,
                talloc_tos(), &dir_data, &dir_data_length);
 
@@ -1517,7 +1517,7 @@ bool run_smb2_session_reauth(int dummy)
        }
 
        status = smb2cli_query_directory(
        }
 
        status = smb2cli_query_directory(
-               cli->conn, cli->timeout, cli->smb2.session, cli->smb2.tid,
+               cli->conn, cli->timeout, cli->smb2.session, cli->smb2.tcon,
                1, 0x3, 0, dir_persistent, dir_volatile,
                "session-reauth.txt", 0xffff,
                talloc_tos(), &dir_data, &dir_data_length);
                1, 0x3, 0, dir_persistent, dir_volatile,
                "session-reauth.txt", 0xffff,
                talloc_tos(), &dir_data, &dir_data_length);
@@ -1612,7 +1612,7 @@ bool run_smb2_session_reauth(int dummy)
        }
 
        status = smb2cli_query_directory(
        }
 
        status = smb2cli_query_directory(
-               cli->conn, cli->timeout, cli->smb2.session, cli->smb2.tid,
+               cli->conn, cli->timeout, cli->smb2.session, cli->smb2.tcon,
                1, 0x3, 0, dir_persistent, dir_volatile,
                "session-reauth.txt", 0xffff,
                talloc_tos(), &dir_data, &dir_data_length);
                1, 0x3, 0, dir_persistent, dir_volatile,
                "session-reauth.txt", 0xffff,
                talloc_tos(), &dir_data, &dir_data_length);
@@ -1864,7 +1864,7 @@ bool run_smb2_session_reauth(int dummy)
        }
 
        status = smb2cli_query_directory(
        }
 
        status = smb2cli_query_directory(
-               cli->conn, cli->timeout, cli->smb2.session, cli->smb2.tid,
+               cli->conn, cli->timeout, cli->smb2.session, cli->smb2.tcon,
                1, 0x3, 0, dir_persistent, dir_volatile,
                "session-reauth.txt", 0xffff,
                talloc_tos(), &dir_data, &dir_data_length);
                1, 0x3, 0, dir_persistent, dir_volatile,
                "session-reauth.txt", 0xffff,
                talloc_tos(), &dir_data, &dir_data_length);