diff options
author | Volker Lendecke <vl@samba.org> | 2010-10-23 09:43:31 +0200 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2010-10-24 11:39:30 +0200 |
commit | d864b1bace0038b86cb393ca811dcce2e938bebd (patch) | |
tree | 8924ebb865da53efbf7b9257fdd9228fe6622fed | |
parent | 94232578064e146b810f1320f67e1ab485737a17 (diff) | |
download | samba-d864b1bace0038b86cb393ca811dcce2e938bebd.tar.gz samba-d864b1bace0038b86cb393ca811dcce2e938bebd.tar.bz2 samba-d864b1bace0038b86cb393ca811dcce2e938bebd.zip |
s3: Convert cli_qfilename to cli_qfileinfo
-rw-r--r-- | source3/include/proto.h | 3 | ||||
-rw-r--r-- | source3/libsmb/clirap.c | 48 | ||||
-rw-r--r-- | source3/torture/torture.c | 2 |
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, ¶m_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; } |