summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/libcli/raw/interfaces.h20
-rw-r--r--source4/libcli/raw/libcliraw.h1
-rw-r--r--source4/libcli/raw/rawfsinfo.c73
3 files changed, 94 insertions, 0 deletions
diff --git a/source4/libcli/raw/interfaces.h b/source4/libcli/raw/interfaces.h
index 695c13fce6..8ce5ca2042 100644
--- a/source4/libcli/raw/interfaces.h
+++ b/source4/libcli/raw/interfaces.h
@@ -1344,6 +1344,26 @@ union smb_fsinfo {
};
+enum smb_setfsinfo_level {
+ RAW_SETFS_UNIX_INFO = SMB_SET_CIFS_UNIX_INFO};
+
+union smb_setfsinfo {
+ /* generic interface */
+ struct {
+ enum smb_fsinfo_level level;
+ } generic;
+
+ /* TRANS2 RAW_QFS_UNIX_INFO interface */
+ struct {
+ enum smb_fsinfo_level level;
+
+ struct {
+ uint16_t major_version;
+ uint16_t minor_version;
+ uint64_t capability;
+ } in;
+ } unix_info;
+};
enum smb_open_level {
RAW_OPEN_OPEN,
diff --git a/source4/libcli/raw/libcliraw.h b/source4/libcli/raw/libcliraw.h
index 81bf715f08..b7e5e21a92 100644
--- a/source4/libcli/raw/libcliraw.h
+++ b/source4/libcli/raw/libcliraw.h
@@ -280,6 +280,7 @@ struct smbcli_request *smb_raw_open_send(struct smbcli_tree *tree, union smb_ope
bool smbcli_transport_process(struct smbcli_transport *transport);
const char *smbcli_errstr(struct smbcli_tree *tree);
NTSTATUS smb_raw_fsinfo(struct smbcli_tree *tree, TALLOC_CTX *mem_ctx, union smb_fsinfo *fsinfo);
+NTSTATUS smb_raw_setfsinfo(struct smbcli_tree *tree, TALLOC_CTX *mem_ctx, union smb_setfsinfo *set_fsinfo);
NTSTATUS smb_raw_pathinfo(struct smbcli_tree *tree, TALLOC_CTX *mem_ctx, union smb_fileinfo *parms);
NTSTATUS smb_raw_shadow_data(struct smbcli_tree *tree, TALLOC_CTX *mem_ctx, struct smb_shadow_copy *info);
NTSTATUS smb_raw_fileinfo(struct smbcli_tree *tree, TALLOC_CTX *mem_ctx, union smb_fileinfo *parms);
diff --git a/source4/libcli/raw/rawfsinfo.c b/source4/libcli/raw/rawfsinfo.c
index 15599adebe..08f68dd46c 100644
--- a/source4/libcli/raw/rawfsinfo.c
+++ b/source4/libcli/raw/rawfsinfo.c
@@ -332,3 +332,76 @@ _PUBLIC_ NTSTATUS smb_raw_fsinfo(struct smbcli_tree *tree,
struct smbcli_request *req = smb_raw_fsinfo_send(tree, mem_ctx, fsinfo);
return smb_raw_fsinfo_recv(req, mem_ctx, fsinfo);
}
+
+/****************************************************************************
+ Set FSInfo raw interface (async recv)
+****************************************************************************/
+static NTSTATUS smb_raw_setfsinfo_recv(struct smbcli_request *req,
+ TALLOC_CTX *mem_ctx,
+ union smb_setfsinfo *set_fsinfo)
+{
+ DATA_BLOB blob = data_blob_null;
+ NTSTATUS status;
+
+ if (set_fsinfo->generic.level != RAW_SETFS_UNIX_INFO) {
+ return NT_STATUS_INVALID_PARAMETER;
+ }
+
+ status = smb_raw_qfsinfo_blob_recv(req, mem_ctx, &blob);
+ data_blob_free(&blob);
+ return status;
+}
+
+/****************************************************************************
+ Set FSInfo raw interface (async send)
+****************************************************************************/
+static struct smbcli_request *smb_raw_setfsinfo_send(struct smbcli_tree *tree,
+ TALLOC_CTX *mem_ctx,
+ union smb_setfsinfo *set_fsinfo)
+{
+ struct smb_trans2 tp;
+ uint16_t info_level;
+ uint16_t setup = TRANSACT2_SETFSINFO;
+
+ if (set_fsinfo->generic.level != RAW_SETFS_UNIX_INFO) {
+ return NULL;
+ }
+ tp.in.max_setup = 0;
+ tp.in.flags = 0;
+ tp.in.timeout = 0;
+ tp.in.setup_count = 1;
+ tp.in.max_param = 0;
+ tp.in.max_data = 0xFFFF;
+ tp.in.setup = &setup;
+ tp.in.timeout = 0;
+
+ tp.in.params = data_blob_talloc(mem_ctx, NULL, 4);
+ if (!tp.in.params.data) {
+ return NULL;
+ }
+ info_level = (uint16_t)set_fsinfo->generic.level;
+ SSVAL(tp.in.params.data, 0, 0);
+ SSVAL(tp.in.params.data, 2, info_level);
+
+ tp.in.data = data_blob_talloc(mem_ctx, NULL, 12);
+ if (!tp.in.data.data) {
+ return NULL;
+ }
+
+ SSVAL(tp.in.data.data, 0, set_fsinfo->unix_info.in.major_version);
+ SSVAL(tp.in.data.data, 2, set_fsinfo->unix_info.in.minor_version);
+ SBVAL(tp.in.data.data, 4, set_fsinfo->unix_info.in.capability);
+
+ return smb_raw_trans2_send(tree, &tp);
+}
+
+/****************************************************************************
+ Set FSInfo raw interface (sync interface)
+****************************************************************************/
+_PUBLIC_ NTSTATUS smb_raw_setfsinfo(struct smbcli_tree *tree,
+ TALLOC_CTX *mem_ctx,
+ union smb_setfsinfo *set_fsinfo)
+{
+ struct smbcli_request *req = smb_raw_setfsinfo_send(tree, mem_ctx, set_fsinfo);
+ return smb_raw_setfsinfo_recv(req, mem_ctx, set_fsinfo);
+}