diff options
author | Jeremy Allison <jra@samba.org> | 2017-07-21 12:46:23 -0700 |
---|---|---|
committer | Ralph Boehme <slow@samba.org> | 2017-07-25 17:43:16 +0200 |
commit | b1e5b894b089433e59c96915a27559d179bdb6c5 (patch) | |
tree | 5f5b6707de1d4f017c5ff2ca90a46458a8d1298b /source3/libsmb/cli_smb2_fnum.c | |
parent | 2a15c70603bb23a68a2e3de0b00bfd98508f78e0 (diff) | |
download | samba-b1e5b894b089433e59c96915a27559d179bdb6c5.tar.gz |
s3: libsmb: Implement cli_smb2_setatr() by calling cli_smb2_setpathinfo().
This removes duplicate code paths and ensures we have only one
function calling the underlying smb2cli_set_info() for setting
info levels by path.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12913
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Diffstat (limited to 'source3/libsmb/cli_smb2_fnum.c')
-rw-r--r-- | source3/libsmb/cli_smb2_fnum.c | 57 |
1 files changed, 5 insertions, 52 deletions
diff --git a/source3/libsmb/cli_smb2_fnum.c b/source3/libsmb/cli_smb2_fnum.c index 32c7c21bd6d..8ee97cad276 100644 --- a/source3/libsmb/cli_smb2_fnum.c +++ b/source3/libsmb/cli_smb2_fnum.c @@ -1724,41 +1724,8 @@ NTSTATUS cli_smb2_setatr(struct cli_state *cli, uint16_t attr, time_t mtime) { - NTSTATUS status; - uint16_t fnum = 0xffff; - struct smb2_hnd *ph = NULL; uint8_t inbuf_store[40]; DATA_BLOB inbuf = data_blob_null; - TALLOC_CTX *frame = talloc_stackframe(); - - if (smbXcli_conn_has_async_calls(cli->conn)) { - /* - * Can't use sync call while an async call is in flight - */ - status = NT_STATUS_INVALID_PARAMETER; - goto fail; - } - - if (smbXcli_conn_protocol(cli->conn) < PROTOCOL_SMB2_02) { - status = NT_STATUS_INVALID_PARAMETER; - goto fail; - } - - status = get_fnum_from_path(cli, - name, - FILE_WRITE_ATTRIBUTES, - &fnum); - - if (!NT_STATUS_IS_OK(status)) { - goto fail; - } - - status = map_fnum_to_smb2_handle(cli, - fnum, - &ph); - if (!NT_STATUS_IS_OK(status)) { - goto fail; - } /* setinfo on the handle with info_type SMB2_SETINFO_FILE (1), level 4 (SMB_FILE_BASIC_INFORMATION - 1000). */ @@ -1799,26 +1766,12 @@ NTSTATUS cli_smb2_setatr(struct cli_state *cli, SBVAL(inbuf.data, 8, 0xFFFFFFFFFFFFFFFFLL); SBVAL(inbuf.data, 24, 0xFFFFFFFFFFFFFFFFLL); - status = smb2cli_set_info(cli->conn, - cli->timeout, - cli->smb2.session, - cli->smb2.tcon, + return cli_smb2_setpathinfo(cli, + name, 1, /* in_info_type */ - SMB_FILE_BASIC_INFORMATION - 1000, /* in_file_info_class */ - &inbuf, /* in_input_buffer */ - 0, /* in_additional_info */ - ph->fid_persistent, - ph->fid_volatile); - fail: - - if (fnum != 0xffff) { - cli_smb2_close_fnum(cli, fnum); - } - - cli->raw_status = status; - - TALLOC_FREE(frame); - return status; + /* in_file_info_class */ + SMB_FILE_BASIC_INFORMATION - 1000, + &inbuf); } |