]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: libsmb: Change cli_qpathinfo3() to return a 32-bit attribute.
authorJeremy Allison <jra@samba.org>
Wed, 3 Jun 2020 20:36:05 +0000 (13:36 -0700)
committerJeremy Allison <jra@samba.org>
Thu, 4 Jun 2020 17:11:38 +0000 (17:11 +0000)
Fix all callers.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
source3/client/client.c
source3/libsmb/clirap.c
source3/libsmb/clirap.h
source3/libsmb/libsmb_file.c

index c9ce9bbbc8d3ce45586d690820eb2971164aa225..f423b5d3d586060a2964e1f35b2f62fd96b33446 100644 (file)
@@ -1785,7 +1785,7 @@ static int do_allinfo(const char *name)
        fstring altname;
        struct timespec b_time, a_time, m_time, c_time;
        off_t size;
-       uint16_t attr;
+       uint32_t attr;
        NTTIME tmp;
        uint16_t fnum;
        unsigned int num_streams;
index 8e4d31e0ae8c4cb9b7612260cffc7aa9f70177bf..35064feac4c8ca3ff298e8ade3ecb25043750601 100644 (file)
@@ -1585,7 +1585,7 @@ NTSTATUS cli_qpathinfo3(struct cli_state *cli, const char *fname,
                        struct timespec *access_time,
                        struct timespec *write_time,
                        struct timespec *change_time,
-                       off_t *size, uint16_t *pattr,
+                       off_t *size, uint32_t *pattr,
                        SMB_INO_T *ino)
 {
        NTSTATUS status = NT_STATUS_OK;
@@ -1594,19 +1594,24 @@ NTSTATUS cli_qpathinfo3(struct cli_state *cli, const char *fname,
        uint64_t pos;
 
        if (smbXcli_conn_protocol(cli->conn) >= PROTOCOL_SMB2_02) {
-               status = cli_qpathinfo2(cli, fname,
+               /*
+                * NB. cli_qpathinfo2() checks pattr is valid before
+                * storing a value into it, so we don't need to use
+                * an intermediate attr variable as below but can
+                * pass pattr directly.
+                */
+               return cli_qpathinfo2(cli, fname,
                                      create_time, access_time, write_time, change_time,
-                                     size, &attr, ino);
-               if (!NT_STATUS_IS_OK(status)) {
-                       return status;
-               }
-               if (pattr != NULL) {
-                       *pattr = attr;
-               }
-               return status;
+                                     size, pattr, ino);
        }
 
        if (create_time || access_time || write_time || change_time || pattr) {
+               /*
+                * cli_qpathinfo_basic() always indirects the passed
+                * in pointers so we use intermediate variables to
+                * collect all of them before assigning any requested
+                * below.
+                */
                status = cli_qpathinfo_basic(cli, fname, &st, &attr);
                if (!NT_STATUS_IS_OK(status)) {
                        return status;
index e64fc2bc61f160af15b9d90f03a2f1ea98cb7e55..bbd585f23a0bcfc6260ddfa478379df2f31fb593 100644 (file)
@@ -105,7 +105,7 @@ NTSTATUS cli_qpathinfo3(struct cli_state *cli, const char *fname,
                        struct timespec *access_time,
                        struct timespec *write_time,
                        struct timespec *change_time,
-                       off_t *size, uint16_t *pattr,
+                       off_t *size, uint32_t *pattr,
                        SMB_INO_T *ino);
 struct tevent_req *cli_qpathinfo_streams_send(TALLOC_CTX *mem_ctx,
                                              struct tevent_context *ev,
index 14474ea316f4b8a0d1426dca0395c92f3f0167dc..d1fa3cb10acf658acba8c3fb204f437c50bb0ffc 100644 (file)
@@ -453,7 +453,6 @@ SMBC_getatr(SMBCCTX * context,
        char *fixedpath = NULL;
        char *targetpath = NULL;
        struct cli_state *targetcli = NULL;
-       uint16_t sattr = 0;
        uint32_t attr = 0;
        off_t size = 0;
        struct timespec create_time_ts = {0};
@@ -512,7 +511,6 @@ SMBC_getatr(SMBCCTX * context,
                                        &attr,
                                        &ino);
                if (NT_STATUS_IS_OK(status)) {
-                       sattr = attr;
                        goto setup_stat;
                }
         }
@@ -527,7 +525,7 @@ SMBC_getatr(SMBCCTX * context,
                                        &write_time_ts,
                                        &change_time_ts,
                                        &size,
-                                       &sattr,
+                                       &attr,
                                        &ino);
                if (NT_STATUS_IS_OK(status)) {
                        goto setup_stat;
@@ -547,7 +545,6 @@ SMBC_getatr(SMBCCTX * context,
                        convert_time_t_to_timespec(write_time);
 
                access_time_ts = change_time_ts = write_time_ts = w_time_ts;
-               sattr = attr;
 
                goto setup_stat;
        }
@@ -556,7 +553,7 @@ setup_stat:
        setup_stat(sb,
                   path,
                   size,
-                  sattr,
+                  attr,
                   ino,
                   srv->dev,
                   access_time_ts,