mirror of
https://github.com/samba-team/samba.git
synced 2025-03-05 20:58:40 +03:00
libsmb: Use cli_smb2_qpathinfo() for streams
Remove sync cli_smb2_qpathinfo_streams() wrapper. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
parent
55539629b2
commit
50edb0266f
@ -2611,80 +2611,6 @@ NTSTATUS cli_smb2_qpathinfo2_recv(struct tevent_req *req,
|
|||||||
return NT_STATUS_OK;
|
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
|
Wrapper that allows SMB2 to set SMB_FILE_BASIC_INFORMATION on
|
||||||
a pathname.
|
a pathname.
|
||||||
|
@ -187,11 +187,6 @@ NTSTATUS cli_smb2_qpathinfo2_recv(struct tevent_req *req,
|
|||||||
off_t *size,
|
off_t *size,
|
||||||
uint32_t *attr,
|
uint32_t *attr,
|
||||||
SMB_INO_T *ino);
|
SMB_INO_T *ino);
|
||||||
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 cli_smb2_setpathinfo(struct cli_state *cli,
|
NTSTATUS cli_smb2_setpathinfo(struct cli_state *cli,
|
||||||
const char *name,
|
const char *name,
|
||||||
uint8_t in_info_type,
|
uint8_t in_info_type,
|
||||||
|
@ -1099,6 +1099,7 @@ struct cli_qpathinfo_streams_state {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static void cli_qpathinfo_streams_done(struct tevent_req *subreq);
|
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_req *cli_qpathinfo_streams_send(TALLOC_CTX *mem_ctx,
|
||||||
struct tevent_context *ev,
|
struct tevent_context *ev,
|
||||||
@ -1113,6 +1114,22 @@ struct tevent_req *cli_qpathinfo_streams_send(TALLOC_CTX *mem_ctx,
|
|||||||
if (req == NULL) {
|
if (req == NULL) {
|
||||||
return 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,
|
subreq = cli_qpathinfo_send(state, ev, cli, fname,
|
||||||
SMB_FILE_STREAM_INFORMATION,
|
SMB_FILE_STREAM_INFORMATION,
|
||||||
0, CLI_BUFFER_SIZE);
|
0, CLI_BUFFER_SIZE);
|
||||||
@ -1133,12 +1150,22 @@ static void cli_qpathinfo_streams_done(struct tevent_req *subreq)
|
|||||||
|
|
||||||
status = cli_qpathinfo_recv(subreq, state, &state->data,
|
status = cli_qpathinfo_recv(subreq, state, &state->data,
|
||||||
&state->num_data);
|
&state->num_data);
|
||||||
TALLOC_FREE(subreq);
|
tevent_req_simple_finish_ntstatus(subreq, status);
|
||||||
if (!NT_STATUS_IS_OK(status)) {
|
}
|
||||||
tevent_req_nterror(req, status);
|
|
||||||
return;
|
static void cli_qpathinfo_streams_done2(struct tevent_req *subreq)
|
||||||
}
|
{
|
||||||
tevent_req_done(req);
|
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,
|
NTSTATUS cli_qpathinfo_streams_recv(struct tevent_req *req,
|
||||||
@ -1170,14 +1197,6 @@ NTSTATUS cli_qpathinfo_streams(struct cli_state *cli, const char *fname,
|
|||||||
struct tevent_req *req;
|
struct tevent_req *req;
|
||||||
NTSTATUS status = NT_STATUS_NO_MEMORY;
|
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();
|
frame = talloc_stackframe();
|
||||||
|
|
||||||
if (smbXcli_conn_has_async_calls(cli->conn)) {
|
if (smbXcli_conn_has_async_calls(cli->conn)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user