diff options
author | Jeremy Allison <jra@samba.org> | 2020-06-03 13:36:05 -0700 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2020-06-04 17:11:38 +0000 |
commit | e527ccd29c11c0597a4c04b636186d485deadfd5 (patch) | |
tree | c87cd289d0cae8e1df8559fbc428ff3085bbfe0e /source3 | |
parent | 3849ceaa699e0be16cb3c84955eeb39ecdad682e (diff) | |
download | samba-e527ccd29c11c0597a4c04b636186d485deadfd5.tar.gz |
s3: libsmb: Change cli_qpathinfo3() to return a 32-bit attribute.
Fix all callers.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Diffstat (limited to 'source3')
-rw-r--r-- | source3/client/client.c | 2 | ||||
-rw-r--r-- | source3/libsmb/clirap.c | 25 | ||||
-rw-r--r-- | source3/libsmb/clirap.h | 2 | ||||
-rw-r--r-- | source3/libsmb/libsmb_file.c | 7 |
4 files changed, 19 insertions, 17 deletions
diff --git a/source3/client/client.c b/source3/client/client.c index c9ce9bbbc8d..f423b5d3d58 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -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; diff --git a/source3/libsmb/clirap.c b/source3/libsmb/clirap.c index 8e4d31e0ae8..35064feac4c 100644 --- a/source3/libsmb/clirap.c +++ b/source3/libsmb/clirap.c @@ -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; diff --git a/source3/libsmb/clirap.h b/source3/libsmb/clirap.h index e64fc2bc61f..bbd585f23a0 100644 --- a/source3/libsmb/clirap.h +++ b/source3/libsmb/clirap.h @@ -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, diff --git a/source3/libsmb/libsmb_file.c b/source3/libsmb/libsmb_file.c index 14474ea316f..d1fa3cb10ac 100644 --- a/source3/libsmb/libsmb_file.c +++ b/source3/libsmb/libsmb_file.c @@ -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, |