]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: libsmb: Change cli_qfileinfo_basic() to return 32-bit attributes.
authorJeremy Allison <jra@samba.org>
Wed, 3 Jun 2020 19:54:10 +0000 (12:54 -0700)
committerJeremy Allison <jra@samba.org>
Thu, 4 Jun 2020 17:11:37 +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_stat.c

index d64423bc0783796f08bc5217a8c2de1b38d7620b..fe6a06c9cbd3ddc7f3b176adf5777e539d68df7a 100644 (file)
@@ -1121,7 +1121,7 @@ static int do_get(const char *rname, const char *lname_in, bool reget)
        uint16_t fnum;
        bool newhandle = false;
        struct timespec tp_start;
-       uint16_t attr;
+       uint32_t attr;
        off_t size;
        off_t start = 0;
        off_t nread = 0;
@@ -1186,7 +1186,8 @@ static int do_get(const char *rname, const char *lname_in, bool reget)
        status = cli_qfileinfo_basic(targetcli, fnum, &attr, &size, NULL, NULL,
                                     NULL, NULL, NULL);
        if (!NT_STATUS_IS_OK(status)) {
-               status = cli_getattrE(targetcli, fnum, &attr, &size, NULL, NULL,
+               uint16_t sattr = 0;
+               status = cli_getattrE(targetcli, fnum, &sattr, &size, NULL, NULL,
                                      NULL);
                if(!NT_STATUS_IS_OK(status)) {
                        d_printf("getattrib: %s\n", nt_errstr(status));
@@ -1195,6 +1196,7 @@ static int do_get(const char *rname, const char *lname_in, bool reget)
                        }
                        return 1;
                }
+               attr = sattr;
        }
 
        DEBUG(1,("getting file %s of size %.0f as %s ",
index 06954b0e69e95d666f3f16b8b25b43d7a6478090..d5baf59c1156339c7e0a57745154b2aae5bf5059 100644 (file)
@@ -1310,7 +1310,7 @@ NTSTATUS cli_qfilename(struct cli_state *cli, uint16_t fnum,
 ****************************************************************************/
 
 NTSTATUS cli_qfileinfo_basic(struct cli_state *cli, uint16_t fnum,
-                            uint16_t *pattr, off_t *size,
+                            uint32_t *pattr, off_t *size,
                             struct timespec *create_time,
                             struct timespec *access_time,
                             struct timespec *write_time,
@@ -1322,23 +1322,15 @@ NTSTATUS cli_qfileinfo_basic(struct cli_state *cli, uint16_t fnum,
        NTSTATUS status;
 
        if (smbXcli_conn_protocol(cli->conn) >= PROTOCOL_SMB2_02) {
-               uint32_t attr = 0;
-               status = cli_smb2_qfileinfo_basic(cli,
+               return cli_smb2_qfileinfo_basic(cli,
                                                fnum,
-                                               &attr,
+                                               pattr,
                                                size,
                                                create_time,
                                                access_time,
                                                write_time,
                                                change_time,
                                                ino);
-               if (!NT_STATUS_IS_OK(status)) {
-                       return status;
-               }
-               if (pattr != NULL) {
-                       *pattr = attr;
-               }
-               return status;
        }
 
        /* if its a win95 server then fail this - win95 totally screws it
index aca0e78be3a25eb5a65b63cba3dd750ef5a56348..f7c059aeaf3e3aadf1372a328e6a1544aba79600 100644 (file)
@@ -126,7 +126,7 @@ bool parse_streams_blob(TALLOC_CTX *mem_ctx, const uint8_t *rdata,
 NTSTATUS cli_qfilename(struct cli_state *cli, uint16_t fnum,
                       TALLOC_CTX *mem_ctx, char **name);
 NTSTATUS cli_qfileinfo_basic(struct cli_state *cli, uint16_t fnum,
-                            uint16_t *pattr, off_t *size,
+                            uint32_t *pattr, off_t *size,
                             struct timespec *create_time,
                             struct timespec *access_time,
                             struct timespec *write_time,
index 02d1b423b4a58d1ec8a7e89a1b9757bf4ffc89d1..70023fa4c234e6a49b6be916a975e4ea50bea085 100644 (file)
@@ -232,7 +232,7 @@ SMBC_fstat_ctx(SMBCCTX *context,
         struct timespec access_time_ts;
         struct timespec write_time_ts;
        off_t size;
-       uint16_t attr;
+       uint32_t attr;
        char *server = NULL;
        char *share = NULL;
        char *user = NULL;
@@ -299,8 +299,9 @@ SMBC_fstat_ctx(SMBCCTX *context,
                                     &change_time_ts,
                                     &ino))) {
                time_t change_time, access_time, write_time;
+               uint16_t sattr = 0;
 
-               if (!NT_STATUS_IS_OK(cli_getattrE(targetcli, file->cli_fd, &attr, &size,
+               if (!NT_STATUS_IS_OK(cli_getattrE(targetcli, file->cli_fd, &sattr, &size,
                                   &change_time, &access_time, &write_time))) {
                        errno = EINVAL;
                        TALLOC_FREE(frame);
@@ -309,6 +310,7 @@ SMBC_fstat_ctx(SMBCCTX *context,
                change_time_ts = convert_time_t_to_timespec(change_time);
                access_time_ts = convert_time_t_to_timespec(access_time);
                write_time_ts = convert_time_t_to_timespec(write_time);
+               attr = sattr;
        }
 
        setup_stat(st,