summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/client/client.c12
-rw-r--r--source3/include/proto.h14
-rw-r--r--source3/libsmb/clirap.c47
-rw-r--r--source3/libsmb/libsmb_file.c7
-rw-r--r--source3/libsmb/libsmb_stat.c17
-rw-r--r--source3/torture/torture.c17
-rw-r--r--source3/torture/utable.c5
-rw-r--r--source3/utils/smbcacls.c5
8 files changed, 61 insertions, 63 deletions
diff --git a/source3/client/client.c b/source3/client/client.c
index 01d5d90e6b..761d8d39ee 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -1084,8 +1084,9 @@ static int do_get(const char *rname, const char *lname_in, bool reget)
}
- if (!cli_qfileinfo_basic(targetcli, fnum,
- &attr, &size, NULL, NULL, NULL, NULL, NULL) &&
+ if (!NT_STATUS_IS_OK(cli_qfileinfo_basic(
+ targetcli, fnum, &attr, &size, NULL, NULL,
+ NULL, NULL, NULL)) &&
!NT_STATUS_IS_OK(cli_getattrE(targetcli, fnum,
&attr, &size, NULL, NULL, NULL))) {
d_printf("getattrib: %s\n",cli_errstr(targetcli));
@@ -1699,9 +1700,10 @@ static int do_put(const char *rname, const char *lname, bool reput)
if (reput) {
status = cli_open(targetcli, targetname, O_RDWR|O_CREAT, DENY_NONE, &fnum);
if (NT_STATUS_IS_OK(status)) {
- if (!cli_qfileinfo_basic(
- targetcli, fnum, NULL, &start, NULL, NULL,
- NULL, NULL, NULL) &&
+ if (!NT_STATUS_IS_OK(cli_qfileinfo_basic(
+ targetcli, fnum, NULL,
+ &start, NULL, NULL,
+ NULL, NULL, NULL)) &&
!NT_STATUS_IS_OK(cli_getattrE(targetcli, fnum, NULL, &start, NULL, NULL, NULL))) {
d_printf("getattrib: %s\n",cli_errstr(cli));
return 1;
diff --git a/source3/include/proto.h b/source3/include/proto.h
index e175454dae..2edfb6aa46 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -2329,13 +2329,13 @@ NTSTATUS cli_qpathinfo_streams(struct cli_state *cli, const char *fname,
struct stream_struct **pstreams);
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,
- struct timespec *access_time,
- struct timespec *write_time,
- struct timespec *change_time,
- SMB_INO_T *ino);
+NTSTATUS cli_qfileinfo_basic(struct cli_state *cli, uint16_t fnum,
+ uint16 *mode, SMB_OFF_T *size,
+ struct timespec *create_time,
+ struct timespec *access_time,
+ struct timespec *write_time,
+ struct timespec *change_time,
+ SMB_INO_T *ino);
struct tevent_req *cli_qpathinfo_basic_send(TALLOC_CTX *mem_ctx,
struct event_context *ev,
struct cli_state *cli,
diff --git a/source3/libsmb/clirap.c b/source3/libsmb/clirap.c
index 0b141d7497..17311ddb4e 100644
--- a/source3/libsmb/clirap.c
+++ b/source3/libsmb/clirap.c
@@ -1122,41 +1122,30 @@ NTSTATUS cli_qfilename(struct cli_state *cli, uint16_t fnum, char *name,
Send a qfileinfo call.
****************************************************************************/
-bool cli_qfileinfo_basic(struct cli_state *cli, uint16_t fnum,
- uint16 *mode, SMB_OFF_T *size,
- struct timespec *create_time,
- struct timespec *access_time,
- struct timespec *write_time,
- struct timespec *change_time,
- SMB_INO_T *ino)
+NTSTATUS cli_qfileinfo_basic(struct cli_state *cli, uint16_t fnum,
+ uint16 *mode, SMB_OFF_T *size,
+ struct timespec *create_time,
+ struct timespec *access_time,
+ struct timespec *write_time,
+ struct timespec *change_time,
+ SMB_INO_T *ino)
{
- uint32_t data_len = 0;
- uint16 setup;
- uint8_t param[4];
- uint8_t *rdata=NULL;
+ uint8_t *rdata;
+ uint32_t num_rdata;
NTSTATUS status;
/* if its a win95 server then fail this - win95 totally screws it
up */
- if (cli->win95) return False;
-
- SSVAL(param, 0, fnum);
- SSVAL(param, 2, SMB_QUERY_FILE_ALL_INFO);
-
- SSVAL(&setup, 0, TRANSACT2_QFILEINFO);
-
- status = cli_trans(talloc_tos(), cli, SMBtrans2,
- NULL, -1, 0, 0, /* name, fid, function, flags */
- &setup, 1, 0, /* setup, length, max */
- param, 4, 2, /* param, length, max */
- NULL, 0, MIN(cli->max_xmit, 0xffff), /* data, length, max */
- NULL, /* recv_flags2 */
- NULL, 0, NULL, /* rsetup, length */
- NULL, 0, NULL, /* rparam, length */
- &rdata, 68, &data_len);
+ if (cli->win95) {
+ return NT_STATUS_NOT_SUPPORTED;
+ }
+ status = cli_qfileinfo(talloc_tos(), cli, fnum,
+ SMB_QUERY_FILE_ALL_INFO,
+ 68, MIN(cli->max_xmit, 0xffff),
+ &rdata, &num_rdata);
if (!NT_STATUS_IS_OK(status)) {
- return false;
+ return status;
}
if (create_time) {
@@ -1182,7 +1171,7 @@ bool cli_qfileinfo_basic(struct cli_state *cli, uint16_t fnum,
}
TALLOC_FREE(rdata);
- return True;
+ return NT_STATUS_OK;
}
/****************************************************************************
diff --git a/source3/libsmb/libsmb_file.c b/source3/libsmb/libsmb_file.c
index 1a44f0e9af..6b08b61c2e 100644
--- a/source3/libsmb/libsmb_file.c
+++ b/source3/libsmb/libsmb_file.c
@@ -730,9 +730,10 @@ SMBC_lseek_ctx(SMBCCTX *context,
}
/*d_printf(">>>lseek: resolved path as %s\n", targetpath);*/
- if (!cli_qfileinfo_basic(targetcli, file->cli_fd, NULL,
- &size, NULL, NULL, NULL, NULL, NULL))
- {
+ if (!NT_STATUS_IS_OK(cli_qfileinfo_basic(
+ targetcli, file->cli_fd, NULL,
+ &size, NULL, NULL, NULL, NULL,
+ NULL))) {
SMB_OFF_T b_size = size;
if (!NT_STATUS_IS_OK(cli_getattrE(targetcli, file->cli_fd,
NULL, &b_size, NULL, NULL, NULL))) {
diff --git a/source3/libsmb/libsmb_stat.c b/source3/libsmb/libsmb_stat.c
index fd390017c6..0f64502409 100644
--- a/source3/libsmb/libsmb_stat.c
+++ b/source3/libsmb/libsmb_stat.c
@@ -250,8 +250,8 @@ SMBC_fstat_ctx(SMBCCTX *context,
/*d_printf(">>>fstat: resolving %s\n", path);*/
if (!cli_resolve_path(frame, "", context->internal->auth_info,
- file->srv->cli, path,
- &targetcli, &targetpath)) {
+ file->srv->cli, path,
+ &targetcli, &targetpath)) {
d_printf("Could not resolve %s\n", path);
errno = ENOENT;
TALLOC_FREE(frame);
@@ -259,12 +259,13 @@ SMBC_fstat_ctx(SMBCCTX *context,
}
/*d_printf(">>>fstat: resolved path as %s\n", targetpath);*/
- if (!cli_qfileinfo_basic(targetcli, file->cli_fd, &mode, &size,
- NULL,
- &access_time_ts,
- &write_time_ts,
- &change_time_ts,
- &ino)) {
+ if (!NT_STATUS_IS_OK(cli_qfileinfo_basic(
+ targetcli, file->cli_fd, &mode, &size,
+ NULL,
+ &access_time_ts,
+ &write_time_ts,
+ &change_time_ts,
+ &ino))) {
time_t change_time, access_time, write_time;
if (!NT_STATUS_IS_OK(cli_getattrE(targetcli, file->cli_fd, &mode, &size,
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index 39e0dda4e0..143120bf00 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -915,8 +915,9 @@ static bool run_readwritelarge(int dummy)
cli_write(cli1, fnum1, 0, buf, 0, sizeof(buf));
- if (!cli_qfileinfo_basic(cli1, fnum1, NULL, &fsize, NULL, NULL, NULL,
- NULL, NULL)) {
+ if (!NT_STATUS_IS_OK(cli_qfileinfo_basic(
+ cli1, fnum1, NULL, &fsize, NULL, NULL,
+ NULL, NULL, NULL))) {
printf("qfileinfo failed (%s)\n", cli_errstr(cli1));
correct = False;
}
@@ -949,8 +950,9 @@ static bool run_readwritelarge(int dummy)
cli_smbwrite(cli1, fnum1, buf, 0, sizeof(buf));
- if (!cli_qfileinfo_basic(cli1, fnum1, NULL, &fsize, NULL, NULL, NULL,
- NULL, NULL)) {
+ if (!NT_STATUS_IS_OK(cli_qfileinfo_basic(
+ cli1, fnum1, NULL, &fsize, NULL, NULL,
+ NULL, NULL, NULL))) {
printf("qfileinfo failed (%s)\n", cli_errstr(cli1));
correct = False;
}
@@ -2977,9 +2979,10 @@ static bool run_trans2test(int dummy)
cli_unlink(cli, fname, aSYSTEM | aHIDDEN);
cli_open(cli, fname,
O_RDWR | O_CREAT | O_TRUNC, DENY_NONE, &fnum);
- if (!cli_qfileinfo_basic(cli, fnum, NULL, &size, &c_time_ts,
- &a_time_ts, &w_time_ts,
- &m_time_ts, NULL)) {
+ if (!NT_STATUS_IS_OK(cli_qfileinfo_basic(
+ cli, fnum, NULL, &size, &c_time_ts,
+ &a_time_ts, &w_time_ts,
+ &m_time_ts, NULL))) {
printf("ERROR: qfileinfo failed (%s)\n", cli_errstr(cli));
correct = False;
}
diff --git a/source3/torture/utable.c b/source3/torture/utable.c
index 4162ecacfe..d537ad77c5 100644
--- a/source3/torture/utable.c
+++ b/source3/torture/utable.c
@@ -159,8 +159,9 @@ bool torture_casetable(int dummy)
size = 0;
- if (!cli_qfileinfo_basic(cli, fnum, NULL, &size,
- NULL, NULL, NULL, NULL, NULL)) {
+ if (!NT_STATUS_IS_OK(cli_qfileinfo_basic(
+ cli, fnum, NULL, &size,
+ NULL, NULL, NULL, NULL, NULL))) {
continue;
}
diff --git a/source3/utils/smbcacls.c b/source3/utils/smbcacls.c
index 8a409fda28..d9a4304463 100644
--- a/source3/utils/smbcacls.c
+++ b/source3/utils/smbcacls.c
@@ -680,8 +680,9 @@ static uint16 get_fileinfo(struct cli_state *cli, const char *filename)
printf("Failed to open %s: %s\n", filename, cli_errstr(cli));
}
- if (!cli_qfileinfo_basic(cli, fnum, &mode, NULL, NULL, NULL,
- NULL, NULL, NULL)) {
+ if (!NT_STATUS_IS_OK(cli_qfileinfo_basic(
+ cli, fnum, &mode, NULL, NULL, NULL,
+ NULL, NULL, NULL))) {
printf("Failed to file info %s: %s\n", filename,
cli_errstr(cli));
}