summaryrefslogtreecommitdiff
path: root/source3/libsmb/cli_smb2_fnum.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2017-07-21 12:41:11 -0700
committerRalph Boehme <slow@samba.org>2017-07-25 17:43:15 +0200
commit2a15c70603bb23a68a2e3de0b00bfd98508f78e0 (patch)
tree6f09b8170187a7c94186975683f5954b251f97e6 /source3/libsmb/cli_smb2_fnum.c
parent812006fa8f26004609901b0ddef1c3ed05eff35e (diff)
downloadsamba-2a15c70603bb23a68a2e3de0b00bfd98508f78e0.tar.gz
s3: libsmb: Add cli_smb2_setpathinfo(), to be called by cli_setpathinfo_basic().
Fix to prevent libsmbclient from accidently making SMB1 calls inside an SMB2 connection. 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.c70
1 files changed, 70 insertions, 0 deletions
diff --git a/source3/libsmb/cli_smb2_fnum.c b/source3/libsmb/cli_smb2_fnum.c
index 6967555797a..32c7c21bd6d 100644
--- a/source3/libsmb/cli_smb2_fnum.c
+++ b/source3/libsmb/cli_smb2_fnum.c
@@ -1646,6 +1646,75 @@ NTSTATUS cli_smb2_qpathinfo_streams(struct cli_state *cli,
}
/***************************************************************
+ Wrapper that allows SMB2 to set SMB_FILE_BASIC_INFORMATION on
+ a pathname.
+ Synchronous only.
+***************************************************************/
+
+NTSTATUS cli_smb2_setpathinfo(struct cli_state *cli,
+ const char *name,
+ uint8_t in_info_type,
+ uint8_t in_file_info_class,
+ const DATA_BLOB *p_in_data)
+{
+ NTSTATUS status;
+ uint16_t fnum = 0xffff;
+ struct smb2_hnd *ph = 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;
+ }
+
+ status = smb2cli_set_info(cli->conn,
+ cli->timeout,
+ cli->smb2.session,
+ cli->smb2.tcon,
+ in_info_type,
+ in_file_info_class,
+ p_in_data, /* 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;
+}
+
+
+/***************************************************************
Wrapper that allows SMB2 to set pathname attributes.
Synchronous only.
***************************************************************/
@@ -1752,6 +1821,7 @@ NTSTATUS cli_smb2_setatr(struct cli_state *cli,
return status;
}
+
/***************************************************************
Wrapper that allows SMB2 to set file handle times.
Synchronous only.