s3:libsmb: add function cli_qpathinfo3()
authorGregor Beck <gbeck@sernet.de>
Fri, 11 Oct 2013 08:53:45 +0000 (10:53 +0200)
committerJeremy Allison <jra@samba.org>
Wed, 30 Oct 2013 22:23:51 +0000 (15:23 -0700)
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>
source3/libsmb/clirap.c
source3/libsmb/clirap.h

index 1ca45c0a4bd17339b06a730e612733ac84179e63..cedd6a65cdd68d1a29f91a2d9334a5c4528c0759 100644 (file)
@@ -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;
+}
index 432642068a3bdbe0fcb049dec2b1eba3fc5de84c..54f06b4e76c60cedb04b47ac9554e30f4c9aa94c 100644 (file)
@@ -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,