libsmb: Use async cli_smb2_list_send() in cli_list_send()
authorVolker Lendecke <vl@samba.org>
Mon, 16 Nov 2020 07:26:09 +0000 (08:26 +0100)
committerJeremy Allison <jra@samba.org>
Thu, 19 Nov 2020 02:48:40 +0000 (02:48 +0000)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/libsmb/clilist.c

index 4d9c511f052eb9c2e6efe8514ff91b9f8298af73..25040438d9e8d93bc211142e803a3479a1dfd3a0 100644 (file)
@@ -989,6 +989,7 @@ struct tevent_req *cli_list_send(TALLOC_CTX *mem_ctx,
 {
        struct tevent_req *req = NULL;
        struct cli_list_state *state;
+       enum protocol_types proto = smbXcli_conn_protocol(cli->conn);
 
        req = tevent_req_create(mem_ctx, &state, struct cli_list_state);
        if (req == NULL) {
@@ -996,14 +997,17 @@ struct tevent_req *cli_list_send(TALLOC_CTX *mem_ctx,
        }
        state->ev = ev;
 
-       if (smbXcli_conn_protocol(cli->conn) <= PROTOCOL_LANMAN1) {
-               state->subreq = cli_list_old_send(
-                       state, ev, cli, mask, attribute);
-               state->recv_fn = cli_list_old_recv;
-       } else {
+       if (proto >= PROTOCOL_SMB2_02) {
+               state->subreq = cli_smb2_list_send(state, ev, cli, mask);
+               state->recv_fn = cli_smb2_list_recv;
+       } else if (proto >= PROTOCOL_LANMAN2) {
                state->subreq = cli_list_trans_send(
                        state, ev, cli, mask, attribute, info_level);
                state->recv_fn = cli_list_trans_recv;
+       } else {
+               state->subreq = cli_list_old_send(
+                       state, ev, cli, mask, attribute);
+               state->recv_fn = cli_list_old_recv;
        }
        if (tevent_req_nomem(state->subreq, req)) {
                return tevent_req_post(req, ev);
@@ -1185,10 +1189,6 @@ NTSTATUS cli_list(struct cli_state *cli,
        NTSTATUS status = NT_STATUS_NO_MEMORY;
        uint16_t info_level;
 
-       if (smbXcli_conn_protocol(cli->conn) >= PROTOCOL_SMB2_02) {
-               return cli_smb2_list(cli, mask, attribute, fn, private_data);
-       }
-
        frame = talloc_stackframe();
 
        if (smbXcli_conn_has_async_calls(cli->conn)) {