s3: libsmb: Change cli_getatr() and async versions to return a 32-bit attribute.
authorJeremy Allison <jra@samba.org>
Wed, 3 Jun 2020 20:15:17 +0000 (13:15 -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/clifile.c
source3/libsmb/libsmb_file.c
source3/libsmb/proto.h
source3/torture/torture.c

index 0c20839e27d327945beb28c5b6c3bf102246d152..c9ce9bbbc8d3ce45586d690820eb2971164aa225 100644 (file)
@@ -5305,7 +5305,7 @@ out:
 int set_remote_attr(const char *filename, uint16_t new_attr, int mode)
 {
        extern struct cli_state *cli;
-       uint16_t old_attr;
+       uint32_t old_attr;
        NTSTATUS status;
 
        status = cli_getatr(cli, filename, &old_attr, NULL, NULL);
index 868b8f357c1de28d138d84ca25614f8718fdf693..308aaedc6e6203dd3f06bcad85dc886155572042 100644 (file)
@@ -4210,7 +4210,7 @@ static void cli_getatr_done(struct tevent_req *subreq);
 
 struct cli_getatr_state {
        int zone_offset;
-       uint16_t attr;
+       uint32_t attr;
        off_t size;
        time_t write_time;
 };
@@ -4284,7 +4284,7 @@ static void cli_getatr_done(struct tevent_req *subreq)
 }
 
 NTSTATUS cli_getatr_recv(struct tevent_req *req,
-                       uint16_t *pattr,
+                       uint32_t *pattr,
                        off_t *size,
                        time_t *write_time)
 {
@@ -4309,7 +4309,7 @@ NTSTATUS cli_getatr_recv(struct tevent_req *req,
 
 NTSTATUS cli_getatr(struct cli_state *cli,
                        const char *fname,
-                       uint16_t *pattr,
+                       uint32_t *pattr,
                        off_t *size,
                        time_t *write_time)
 {
@@ -4319,19 +4319,11 @@ NTSTATUS cli_getatr(struct cli_state *cli,
        NTSTATUS status = NT_STATUS_OK;
 
        if (smbXcli_conn_protocol(cli->conn) >= PROTOCOL_SMB2_02) {
-               uint32_t attr;
-               status = cli_smb2_getatr(cli,
+               return cli_smb2_getatr(cli,
                                        fname,
-                                       &attr,
+                                       pattr,
                                        size,
                                        write_time);
-               if (!NT_STATUS_IS_OK(status)) {
-                       return status;
-               }
-               if (pattr != NULL) {
-                       *pattr = attr;
-               }
-               return status;
        }
 
        frame = talloc_stackframe();
index 26bf9fb61edd53ba8739182bb054b808bbcd9677..5b868c21954d0c4eb52bb92574205d001786eea7 100644 (file)
@@ -454,6 +454,7 @@ SMBC_getatr(SMBCCTX * context,
        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};
        struct timespec access_time_ts = {0};
@@ -539,12 +540,13 @@ SMBC_getatr(SMBCCTX * context,
                goto all_failed;
         }
 
-       status = cli_getatr(targetcli, targetpath, &sattr, &size, &write_time);
+       status = cli_getatr(targetcli, targetpath, &attr, &size, &write_time);
        if (NT_STATUS_IS_OK(status)) {
                struct timespec w_time_ts =
                        convert_time_t_to_timespec(write_time);
 
                access_time_ts = change_time_ts = write_time_ts = w_time_ts;
+               sattr = attr;
 
                goto setup_stat;
        }
index e4fb3de671efef54f9d79e47d7b425f754ebf53a..c7cf3702bdeacc810aa061a1669c379f2bdd4473 100644 (file)
@@ -548,12 +548,12 @@ struct tevent_req *cli_getatr_send(TALLOC_CTX *mem_ctx,
                                struct cli_state *cli,
                                const char *fname);
 NTSTATUS cli_getatr_recv(struct tevent_req *req,
-                               uint16_t *pattr,
+                               uint32_t *pattr,
                                off_t *size,
                                time_t *write_time);
 NTSTATUS cli_getatr(struct cli_state *cli,
                        const char *fname,
-                       uint16_t *pattr,
+                       uint32_t *pattr,
                        off_t *size,
                        time_t *write_time);
 struct tevent_req *cli_setatr_send(TALLOC_CTX *mem_ctx,
index ee9219f240496e99e43b32369596200766b0cad2..cf1f2fd8e00981626d026960cc6d32156a8b027c 100644 (file)
@@ -3975,9 +3975,9 @@ static bool run_browsetest(int dummy)
 
 static bool check_attributes(struct cli_state *cli,
                                const char *fname,
-                               uint16_t expected_attrs)
+                               uint32_t expected_attrs)
 {
-       uint16_t attrs = 0;
+       uint32_t attrs = 0;
        NTSTATUS status = cli_getatr(cli,
                                fname,
                                &attrs,
@@ -6248,7 +6248,7 @@ static bool run_rename(int dummy)
        const char *fname1 = "\\test1.txt";
        bool correct = True;
        uint16_t fnum1;
-       uint16_t attr;
+       uint32_t attr;
        NTSTATUS status;
 
        printf("starting rename test\n");
@@ -9539,7 +9539,7 @@ static bool run_openattrtest(int dummy)
        const char *fname = "\\openattr.file";
        uint16_t fnum1;
        bool correct = True;
-       uint16_t attr;
+       uint32_t attr;
        unsigned int i, j, k, l;
        NTSTATUS status;