return NT_STATUS_OK;
}
-/***************************************************************
- Wrapper that allows SMB2 to query pathname streams.
- Synchronous only.
-***************************************************************/
-
-NTSTATUS cli_smb2_qpathinfo_streams(struct cli_state *cli,
- const char *name,
- TALLOC_CTX *mem_ctx,
- unsigned int *pnum_streams,
- struct stream_struct **pstreams)
-{
- NTSTATUS status;
- uint16_t fnum = 0xffff;
- DATA_BLOB outbuf = data_blob_null;
- TALLOC_CTX *frame = talloc_stackframe();
-
- if (smbXcli_conn_has_async_calls(cli->conn)) {
- /*
- * Can't use sync call while an async call is in flight
- */
- status = NT_STATUS_INVALID_PARAMETER;
- goto fail;
- }
-
- status = get_fnum_from_path(cli,
- name,
- FILE_READ_ATTRIBUTES,
- &fnum);
-
- if (!NT_STATUS_IS_OK(status)) {
- goto fail;
- }
-
- /* getinfo on the handle with info_type SMB2_GETINFO_FILE (1),
- level 22 (SMB2_FILE_STREAM_INFORMATION). */
-
- status = cli_smb2_query_info_fnum(
- cli,
- fnum,
- 1, /* in_info_type */
- (SMB_FILE_STREAM_INFORMATION - 1000), /* in_file_info_class */
- 0xFFFF, /* in_max_output_length */
- NULL, /* in_input_buffer */
- 0, /* in_additional_info */
- 0, /* in_flags */
- frame,
- &outbuf);
-
- if (!NT_STATUS_IS_OK(status)) {
- goto fail;
- }
-
- /* Parse the reply. */
- if (!parse_streams_blob(mem_ctx,
- outbuf.data,
- outbuf.length,
- pnum_streams,
- pstreams)) {
- status = NT_STATUS_INVALID_NETWORK_RESPONSE;
- goto fail;
- }
-
- fail:
-
- if (fnum != 0xffff) {
- cli_smb2_close_fnum(cli, fnum);
- }
-
- cli->raw_status = status;
-
- TALLOC_FREE(frame);
- return status;
-}
-
/***************************************************************
Wrapper that allows SMB2 to set SMB_FILE_BASIC_INFORMATION on
a pathname.
};
static void cli_qpathinfo_streams_done(struct tevent_req *subreq);
+static void cli_qpathinfo_streams_done2(struct tevent_req *subreq);
struct tevent_req *cli_qpathinfo_streams_send(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
if (req == NULL) {
return NULL;
}
+ if (smbXcli_conn_protocol(cli->conn) >= PROTOCOL_SMB2_02) {
+ subreq = cli_smb2_qpathinfo_send(state,
+ ev,
+ cli,
+ fname,
+ FSCC_FILE_STREAM_INFORMATION,
+ 0,
+ CLI_BUFFER_SIZE);
+ if (tevent_req_nomem(subreq, req)) {
+ return tevent_req_post(req, ev);
+ }
+ tevent_req_set_callback(subreq,
+ cli_qpathinfo_streams_done2,
+ req);
+ return req;
+ }
subreq = cli_qpathinfo_send(state, ev, cli, fname,
SMB_FILE_STREAM_INFORMATION,
0, CLI_BUFFER_SIZE);
status = cli_qpathinfo_recv(subreq, state, &state->data,
&state->num_data);
- TALLOC_FREE(subreq);
- if (!NT_STATUS_IS_OK(status)) {
- tevent_req_nterror(req, status);
- return;
- }
- tevent_req_done(req);
+ tevent_req_simple_finish_ntstatus(subreq, status);
+}
+
+static void cli_qpathinfo_streams_done2(struct tevent_req *subreq)
+{
+ struct tevent_req *req =
+ tevent_req_callback_data(subreq, struct tevent_req);
+ struct cli_qpathinfo_streams_state *state =
+ tevent_req_data(req, struct cli_qpathinfo_streams_state);
+ NTSTATUS status;
+
+ status = cli_smb2_qpathinfo_recv(subreq,
+ state,
+ &state->data,
+ &state->num_data);
+ tevent_req_simple_finish_ntstatus(subreq, status);
}
NTSTATUS cli_qpathinfo_streams_recv(struct tevent_req *req,
struct tevent_req *req;
NTSTATUS status = NT_STATUS_NO_MEMORY;
- if (smbXcli_conn_protocol(cli->conn) >= PROTOCOL_SMB2_02) {
- return cli_smb2_qpathinfo_streams(cli,
- fname,
- mem_ctx,
- pnum_streams,
- pstreams);
- }
-
frame = talloc_stackframe();
if (smbXcli_conn_has_async_calls(cli->conn)) {