From: Jeremy Allison Date: Wed, 3 Jun 2020 20:15:17 +0000 (-0700) Subject: s3: libsmb: Change cli_getatr() and async versions to return a 32-bit attribute. X-Git-Tag: ldb-2.2.0~208 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ad5d5d94a3ff185e61ec1ca7d405aa2845653992;p=thirdparty%2Fsamba.git s3: libsmb: Change cli_getatr() and async versions to return a 32-bit attribute. Fix all callers. Signed-off-by: Jeremy Allison Reviewed-by: Volker Lendecke --- diff --git a/source3/client/client.c b/source3/client/client.c index 0c20839e27d..c9ce9bbbc8d 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -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); diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c index 868b8f357c1..308aaedc6e6 100644 --- a/source3/libsmb/clifile.c +++ b/source3/libsmb/clifile.c @@ -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(); diff --git a/source3/libsmb/libsmb_file.c b/source3/libsmb/libsmb_file.c index 26bf9fb61ed..5b868c21954 100644 --- a/source3/libsmb/libsmb_file.c +++ b/source3/libsmb/libsmb_file.c @@ -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; } diff --git a/source3/libsmb/proto.h b/source3/libsmb/proto.h index e4fb3de671e..c7cf3702bde 100644 --- a/source3/libsmb/proto.h +++ b/source3/libsmb/proto.h @@ -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, diff --git a/source3/torture/torture.c b/source3/torture/torture.c index ee9219f2404..cf1f2fd8e00 100644 --- a/source3/torture/torture.c +++ b/source3/torture/torture.c @@ -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;