diff options
author | Gregor Beck <gbeck@sernet.de> | 2013-10-11 10:53:45 +0200 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2013-10-30 15:23:51 -0700 |
commit | 30ba2c0580e1f1218243f62efdfb24db992660a5 (patch) | |
tree | 4f67914166fc7b58f20ba5db8a4bef252093b0ee | |
parent | 8228c3c68c8d5b6e5e4ec2f4ec6e4a9c99e35f48 (diff) | |
download | samba-30ba2c0580e1f1218243f62efdfb24db992660a5.tar.gz samba-30ba2c0580e1f1218243f62efdfb24db992660a5.tar.xz samba-30ba2c0580e1f1218243f62efdfb24db992660a5.zip |
s3:libsmb: add function cli_qpathinfo3()
This is a reimplemantation of cli_qpathinfo2 without the use of info level
SMB_QFILEINFO_ALL_INFO which leads to broken responses from NetApp.
Signed-off-by: Gregor Beck <gbeck@sernet.de>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
-rw-r--r-- | source3/libsmb/clirap.c | 54 | ||||
-rw-r--r-- | source3/libsmb/clirap.h | 7 |
2 files changed, 61 insertions, 0 deletions
diff --git a/source3/libsmb/clirap.c b/source3/libsmb/clirap.c index 1ca45c0a4bd..cedd6a65cdd 100644 --- a/source3/libsmb/clirap.c +++ b/source3/libsmb/clirap.c @@ -1412,3 +1412,57 @@ NTSTATUS cli_qpathinfo_standard(struct cli_state *cli, const char *fname, return NT_STATUS_OK; } + + +/* like cli_qpathinfo2 but do not use SMB_QUERY_FILE_ALL_INFO */ +NTSTATUS cli_qpathinfo3(struct cli_state *cli, const char *fname, + struct timespec *create_time, + struct timespec *access_time, + struct timespec *write_time, + struct timespec *change_time, + off_t *size, uint16 *mode, + SMB_INO_T *ino) +{ + NTSTATUS status = NT_STATUS_OK; + SMB_STRUCT_STAT st; + uint32_t attr; + uint64_t pos; + + if (create_time || access_time || write_time || change_time || mode) { + status = cli_qpathinfo_basic(cli, fname, &st, &attr); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + } + + if (size) { + status = cli_qpathinfo_standard(cli, fname, + NULL, &pos, NULL, NULL, NULL); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + *size = pos; + } + + if (create_time) { + *create_time = st.st_ex_btime; + } + if (access_time) { + *access_time = st.st_ex_atime; + } + if (write_time) { + *write_time = st.st_ex_mtime; + } + if (change_time) { + *change_time = st.st_ex_ctime; + } + if (mode) { + *mode = attr; + } + if (ino) { + *ino = 0; + } + + return NT_STATUS_OK; +} diff --git a/source3/libsmb/clirap.h b/source3/libsmb/clirap.h index 432642068a3..54f06b4e76c 100644 --- a/source3/libsmb/clirap.h +++ b/source3/libsmb/clirap.h @@ -82,6 +82,13 @@ NTSTATUS cli_qpathinfo2(struct cli_state *cli, const char *fname, struct timespec *change_time, off_t *size, uint16 *mode, SMB_INO_T *ino); +NTSTATUS cli_qpathinfo3(struct cli_state *cli, const char *fname, + struct timespec *create_time, + struct timespec *access_time, + struct timespec *write_time, + struct timespec *change_time, + off_t *size, uint16 *mode, + SMB_INO_T *ino); struct tevent_req *cli_qpathinfo_streams_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct cli_state *cli, |