summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/include/proto.h3
-rw-r--r--source3/libsmb/clirap.c48
-rw-r--r--source3/torture/torture.c2
3 files changed, 16 insertions, 37 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 55e4e1b9e9..e175454dae 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -2327,7 +2327,8 @@ NTSTATUS cli_qpathinfo_streams(struct cli_state *cli, const char *fname,
TALLOC_CTX *mem_ctx,
unsigned int *pnum_streams,
struct stream_struct **pstreams);
-bool cli_qfilename(struct cli_state *cli, uint16_t fnum, char *name, size_t namelen);
+NTSTATUS cli_qfilename(struct cli_state *cli, uint16_t fnum, char *name,
+ size_t namelen);
bool cli_qfileinfo_basic(struct cli_state *cli, uint16_t fnum,
uint16 *mode, SMB_OFF_T *size,
struct timespec *create_time,
diff --git a/source3/libsmb/clirap.c b/source3/libsmb/clirap.c
index 025a86b833..0b141d7497 100644
--- a/source3/libsmb/clirap.c
+++ b/source3/libsmb/clirap.c
@@ -1097,47 +1097,25 @@ static bool parse_streams_blob(TALLOC_CTX *mem_ctx, const uint8_t *rdata,
Send a qfileinfo QUERY_FILE_NAME_INFO call.
****************************************************************************/
-bool cli_qfilename(struct cli_state *cli, uint16_t fnum, char *name, size_t namelen)
+NTSTATUS cli_qfilename(struct cli_state *cli, uint16_t fnum, char *name,
+ size_t namelen)
{
- unsigned int data_len = 0;
- unsigned int param_len = 0;
- uint16 setup = TRANSACT2_QFILEINFO;
- char param[4];
- char *rparam=NULL, *rdata=NULL;
-
- param_len = 4;
- SSVAL(param, 0, fnum);
- SSVAL(param, 2, SMB_QUERY_FILE_NAME_INFO);
-
- if (!cli_send_trans(cli, SMBtrans2,
- NULL, /* name */
- -1, 0, /* fid, flags */
- &setup, 1, 0, /* setup, length, max */
- param, param_len, 2, /* param, length, max */
- NULL, data_len, cli->max_xmit /* data, length, max */
- )) {
- return False;
- }
-
- if (!cli_receive_trans(cli, SMBtrans2,
- &rparam, &param_len,
- &rdata, &data_len)) {
- return False;
- }
+ uint8_t *rdata;
+ uint32_t num_rdata;
+ NTSTATUS status;
- if (!rdata || data_len < 4) {
- SAFE_FREE(rparam);
- SAFE_FREE(rdata);
- return False;
+ status = cli_qfileinfo(talloc_tos(), cli, fnum,
+ SMB_QUERY_FILE_NAME_INFO,
+ 4, cli->max_xmit,
+ &rdata, &num_rdata);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
}
clistr_pull(cli->inbuf, name, rdata+4, namelen, IVAL(rdata, 0),
STR_UNICODE);
-
- SAFE_FREE(rparam);
- SAFE_FREE(rdata);
-
- return True;
+ TALLOC_FREE(rdata);
+ return NT_STATUS_OK;
}
/****************************************************************************
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index 32a9bbd2b9..39e0dda4e0 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -2984,7 +2984,7 @@ static bool run_trans2test(int dummy)
correct = False;
}
- if (!cli_qfilename(cli, fnum, pname, sizeof(pname))) {
+ if (!NT_STATUS_IS_OK(cli_qfilename(cli, fnum, pname, sizeof(pname)))) {
printf("ERROR: qfilename failed (%s)\n", cli_errstr(cli));
correct = False;
}