diff options
-rw-r--r-- | source4/include/smb_interfaces.h | 1 | ||||
-rw-r--r-- | source4/include/trans2.h | 1 | ||||
-rw-r--r-- | source4/libcli/raw/rawfileinfo.c | 261 | ||||
-rw-r--r-- | source4/libcli/raw/rawfsinfo.c | 141 | ||||
-rw-r--r-- | source4/libcli/raw/rawrequest.c | 18 |
5 files changed, 279 insertions, 143 deletions
diff --git a/source4/include/smb_interfaces.h b/source4/include/smb_interfaces.h index e91d2f7c53..f078134194 100644 --- a/source4/include/smb_interfaces.h +++ b/source4/include/smb_interfaces.h @@ -315,6 +315,7 @@ enum smb_fileinfo_level { RAW_FILEINFO_ACCESS_INFORMATION = SMB_QFILEINFO_ACCESS_INFORMATION, RAW_FILEINFO_NAME_INFORMATION = SMB_QFILEINFO_NAME_INFORMATION, RAW_FILEINFO_POSITION_INFORMATION = SMB_QFILEINFO_POSITION_INFORMATION, + RAW_FILEINFO_FULL_EA_INFORMATION = SMB_QFILEINFO_FULL_EA_INFORMATION, RAW_FILEINFO_MODE_INFORMATION = SMB_QFILEINFO_MODE_INFORMATION, RAW_FILEINFO_ALIGNMENT_INFORMATION = SMB_QFILEINFO_ALIGNMENT_INFORMATION, RAW_FILEINFO_ALL_INFORMATION = SMB_QFILEINFO_ALL_INFORMATION, diff --git a/source4/include/trans2.h b/source4/include/trans2.h index a3f6e28a2a..6768476e1d 100644 --- a/source4/include/trans2.h +++ b/source4/include/trans2.h @@ -147,6 +147,7 @@ Found 8 aliased levels #define SMB_QFILEINFO_ACCESS_INFORMATION 1008 #define SMB_QFILEINFO_NAME_INFORMATION 1009 #define SMB_QFILEINFO_POSITION_INFORMATION 1014 +#define SMB_QFILEINFO_FULL_EA_INFORMATION 1015 /* only on SMB2 */ #define SMB_QFILEINFO_MODE_INFORMATION 1016 #define SMB_QFILEINFO_ALIGNMENT_INFORMATION 1017 #define SMB_QFILEINFO_ALL_INFORMATION 1018 diff --git a/source4/libcli/raw/rawfileinfo.c b/source4/libcli/raw/rawfileinfo.c index f631522182..2edb6d5b42 100644 --- a/source4/libcli/raw/rawfileinfo.c +++ b/source4/libcli/raw/rawfileinfo.c @@ -79,67 +79,14 @@ NTSTATUS smbcli_parse_stream_info(DATA_BLOB blob, TALLOC_CTX *mem_ctx, return NT_STATUS_OK; } -/**************************************************************************** - Handle qfileinfo/qpathinfo trans2 backend. -****************************************************************************/ -static NTSTATUS smb_raw_info_backend(struct smbcli_session *session, - TALLOC_CTX *mem_ctx, - union smb_fileinfo *parms, - DATA_BLOB *blob) +/* + parse the fsinfo 'passthru' level replies +*/ +NTSTATUS smb_raw_fileinfo_passthru_parse(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, + enum smb_fileinfo_level level, + union smb_fileinfo *parms) { - switch (parms->generic.level) { - case RAW_FILEINFO_GENERIC: - case RAW_FILEINFO_GETATTR: - case RAW_FILEINFO_GETATTRE: - case RAW_FILEINFO_SEC_DESC: - /* not handled here */ - return NT_STATUS_INVALID_LEVEL; - - case RAW_FILEINFO_STANDARD: - FINFO_CHECK_SIZE(22); - parms->standard.out.create_time = raw_pull_dos_date2(session->transport, - blob->data + 0); - parms->standard.out.access_time = raw_pull_dos_date2(session->transport, - blob->data + 4); - parms->standard.out.write_time = raw_pull_dos_date2(session->transport, - blob->data + 8); - parms->standard.out.size = IVAL(blob->data, 12); - parms->standard.out.alloc_size = IVAL(blob->data, 16); - parms->standard.out.attrib = SVAL(blob->data, 20); - return NT_STATUS_OK; - - case RAW_FILEINFO_EA_SIZE: - FINFO_CHECK_SIZE(26); - parms->ea_size.out.create_time = raw_pull_dos_date2(session->transport, - blob->data + 0); - parms->ea_size.out.access_time = raw_pull_dos_date2(session->transport, - blob->data + 4); - parms->ea_size.out.write_time = raw_pull_dos_date2(session->transport, - blob->data + 8); - parms->ea_size.out.size = IVAL(blob->data, 12); - parms->ea_size.out.alloc_size = IVAL(blob->data, 16); - parms->ea_size.out.attrib = SVAL(blob->data, 20); - parms->ea_size.out.ea_size = IVAL(blob->data, 22); - return NT_STATUS_OK; - - case RAW_FILEINFO_EA_LIST: - FINFO_CHECK_MIN_SIZE(4); - return ea_pull_list(blob, mem_ctx, - &parms->ea_list.out.num_eas, - &parms->ea_list.out.eas); - - case RAW_FILEINFO_ALL_EAS: - FINFO_CHECK_MIN_SIZE(4); - return ea_pull_list(blob, mem_ctx, - &parms->all_eas.out.num_eas, - &parms->all_eas.out.eas); - - case RAW_FILEINFO_IS_NAME_VALID: - /* no data! */ - FINFO_CHECK_SIZE(0); - return NT_STATUS_OK; - - case RAW_FILEINFO_BASIC_INFO: + switch (level) { case RAW_FILEINFO_BASIC_INFORMATION: /* some servers return 40 bytes and some 36. w2k3 return 40, so thats what we should do, but we need to accept 36 */ @@ -153,7 +100,6 @@ static NTSTATUS smb_raw_info_backend(struct smbcli_session *session, parms->basic_info.out.attrib = IVAL(blob->data, 32); return NT_STATUS_OK; - case RAW_FILEINFO_STANDARD_INFO: case RAW_FILEINFO_STANDARD_INFORMATION: FINFO_CHECK_SIZE(24); parms->standard_info.out.alloc_size = BVAL(blob->data, 0); @@ -163,20 +109,17 @@ static NTSTATUS smb_raw_info_backend(struct smbcli_session *session, parms->standard_info.out.directory = CVAL(blob->data, 21); return NT_STATUS_OK; - case RAW_FILEINFO_EA_INFO: case RAW_FILEINFO_EA_INFORMATION: FINFO_CHECK_SIZE(4); parms->ea_info.out.ea_size = IVAL(blob->data, 0); return NT_STATUS_OK; - case RAW_FILEINFO_NAME_INFO: case RAW_FILEINFO_NAME_INFORMATION: FINFO_CHECK_MIN_SIZE(4); - smbcli_blob_pull_string(session, mem_ctx, blob, - &parms->name_info.out.fname, 0, 4, STR_UNICODE); + smbcli_blob_pull_string(NULL, mem_ctx, blob, + &parms->name_info.out.fname, 0, 4, STR_UNICODE); return NT_STATUS_OK; - case RAW_FILEINFO_ALL_INFO: case RAW_FILEINFO_ALL_INFORMATION: FINFO_CHECK_MIN_SIZE(72); parms->all_info.out.create_time = smbcli_pull_nttime(blob->data, 0); @@ -191,8 +134,8 @@ static NTSTATUS smb_raw_info_backend(struct smbcli_session *session, parms->all_info.out.directory = CVAL(blob->data, 61); #if 1 parms->all_info.out.ea_size = IVAL(blob->data, 64); - smbcli_blob_pull_string(session, mem_ctx, blob, - &parms->all_info.out.fname, 68, 72, STR_UNICODE); + smbcli_blob_pull_string(NULL, mem_ctx, blob, + &parms->all_info.out.fname, 68, 72, STR_UNICODE); #else /* this is what the CIFS spec says - and its totally wrong, but its useful having it here so we can @@ -204,19 +147,17 @@ static NTSTATUS smb_raw_info_backend(struct smbcli_session *session, mode 4 bytes at 88 alignment 4 bytes at 92 */ - smbcli_blob_pull_string(session, mem_ctx, blob, + smbcli_blob_pull_string(NULL, mem_ctx, blob, &parms->all_info.out.fname, 96, 100, STR_UNICODE); #endif return NT_STATUS_OK; - case RAW_FILEINFO_ALT_NAME_INFO: case RAW_FILEINFO_ALT_NAME_INFORMATION: FINFO_CHECK_MIN_SIZE(4); - smbcli_blob_pull_string(session, mem_ctx, blob, - &parms->alt_name_info.out.fname, 0, 4, STR_UNICODE); + smbcli_blob_pull_string(NULL, mem_ctx, blob, + &parms->alt_name_info.out.fname, 0, 4, STR_UNICODE); return NT_STATUS_OK; - case RAW_FILEINFO_STREAM_INFO: case RAW_FILEINFO_STREAM_INFORMATION: return smbcli_parse_stream_info(*blob, mem_ctx, &parms->stream_info.out); @@ -235,6 +176,12 @@ static NTSTATUS smb_raw_info_backend(struct smbcli_session *session, parms->position_information.out.position = BVAL(blob->data, 0); return NT_STATUS_OK; + case RAW_FILEINFO_FULL_EA_INFORMATION: + FINFO_CHECK_MIN_SIZE(4); + return ea_pull_list_chained(blob, mem_ctx, + &parms->all_eas.out.num_eas, + &parms->all_eas.out.eas); + case RAW_FILEINFO_MODE_INFORMATION: FINFO_CHECK_SIZE(4); parms->mode_information.out.mode = IVAL(blob->data, 0); @@ -246,7 +193,6 @@ static NTSTATUS smb_raw_info_backend(struct smbcli_session *session, = IVAL(blob->data, 0); return NT_STATUS_OK; - case RAW_FILEINFO_COMPRESSION_INFO: case RAW_FILEINFO_COMPRESSION_INFORMATION: FINFO_CHECK_SIZE(16); parms->compression_info.out.compressed_size = BVAL(blob->data, 0); @@ -257,6 +203,155 @@ static NTSTATUS smb_raw_info_backend(struct smbcli_session *session, /* 3 bytes of padding */ return NT_STATUS_OK; + case RAW_FILEINFO_NETWORK_OPEN_INFORMATION: + FINFO_CHECK_SIZE(56); + parms->network_open_information.out.create_time = smbcli_pull_nttime(blob->data, 0); + parms->network_open_information.out.access_time = smbcli_pull_nttime(blob->data, 8); + parms->network_open_information.out.write_time = smbcli_pull_nttime(blob->data, 16); + parms->network_open_information.out.change_time = smbcli_pull_nttime(blob->data, 24); + parms->network_open_information.out.alloc_size = BVAL(blob->data, 32); + parms->network_open_information.out.size = BVAL(blob->data, 40); + parms->network_open_information.out.attrib = IVAL(blob->data, 48); + return NT_STATUS_OK; + + case RAW_FILEINFO_ATTRIBUTE_TAG_INFORMATION: + FINFO_CHECK_SIZE(8); + parms->attribute_tag_information.out.attrib = IVAL(blob->data, 0); + parms->attribute_tag_information.out.reparse_tag = IVAL(blob->data, 4); + return NT_STATUS_OK; + + default: + break; + } + + return NT_STATUS_INVALID_LEVEL; +} + + +/**************************************************************************** + Handle qfileinfo/qpathinfo trans2 backend. +****************************************************************************/ +static NTSTATUS smb_raw_info_backend(struct smbcli_session *session, + TALLOC_CTX *mem_ctx, + union smb_fileinfo *parms, + DATA_BLOB *blob) +{ + switch (parms->generic.level) { + case RAW_FILEINFO_GENERIC: + case RAW_FILEINFO_GETATTR: + case RAW_FILEINFO_GETATTRE: + case RAW_FILEINFO_SEC_DESC: + /* not handled here */ + return NT_STATUS_INVALID_LEVEL; + + case RAW_FILEINFO_STANDARD: + FINFO_CHECK_SIZE(22); + parms->standard.out.create_time = raw_pull_dos_date2(session->transport, + blob->data + 0); + parms->standard.out.access_time = raw_pull_dos_date2(session->transport, + blob->data + 4); + parms->standard.out.write_time = raw_pull_dos_date2(session->transport, + blob->data + 8); + parms->standard.out.size = IVAL(blob->data, 12); + parms->standard.out.alloc_size = IVAL(blob->data, 16); + parms->standard.out.attrib = SVAL(blob->data, 20); + return NT_STATUS_OK; + + case RAW_FILEINFO_EA_SIZE: + FINFO_CHECK_SIZE(26); + parms->ea_size.out.create_time = raw_pull_dos_date2(session->transport, + blob->data + 0); + parms->ea_size.out.access_time = raw_pull_dos_date2(session->transport, + blob->data + 4); + parms->ea_size.out.write_time = raw_pull_dos_date2(session->transport, + blob->data + 8); + parms->ea_size.out.size = IVAL(blob->data, 12); + parms->ea_size.out.alloc_size = IVAL(blob->data, 16); + parms->ea_size.out.attrib = SVAL(blob->data, 20); + parms->ea_size.out.ea_size = IVAL(blob->data, 22); + return NT_STATUS_OK; + + case RAW_FILEINFO_EA_LIST: + FINFO_CHECK_MIN_SIZE(4); + return ea_pull_list(blob, mem_ctx, + &parms->ea_list.out.num_eas, + &parms->ea_list.out.eas); + + case RAW_FILEINFO_ALL_EAS: + FINFO_CHECK_MIN_SIZE(4); + return ea_pull_list(blob, mem_ctx, + &parms->all_eas.out.num_eas, + &parms->all_eas.out.eas); + + case RAW_FILEINFO_IS_NAME_VALID: + /* no data! */ + FINFO_CHECK_SIZE(0); + return NT_STATUS_OK; + + case RAW_FILEINFO_BASIC_INFO: + case RAW_FILEINFO_BASIC_INFORMATION: + return smb_raw_fileinfo_passthru_parse(blob, mem_ctx, + RAW_FILEINFO_BASIC_INFORMATION, parms); + + case RAW_FILEINFO_STANDARD_INFO: + case RAW_FILEINFO_STANDARD_INFORMATION: + return smb_raw_fileinfo_passthru_parse(blob, mem_ctx, + RAW_FILEINFO_STANDARD_INFORMATION, parms); + + case RAW_FILEINFO_EA_INFO: + case RAW_FILEINFO_EA_INFORMATION: + return smb_raw_fileinfo_passthru_parse(blob, mem_ctx, + RAW_FILEINFO_EA_INFORMATION, parms); + + case RAW_FILEINFO_NAME_INFO: + case RAW_FILEINFO_NAME_INFORMATION: + return smb_raw_fileinfo_passthru_parse(blob, mem_ctx, + RAW_FILEINFO_NAME_INFORMATION, parms); + + case RAW_FILEINFO_ALL_INFO: + case RAW_FILEINFO_ALL_INFORMATION: + return smb_raw_fileinfo_passthru_parse(blob, mem_ctx, + RAW_FILEINFO_ALL_INFORMATION, parms); + + case RAW_FILEINFO_ALT_NAME_INFO: + case RAW_FILEINFO_ALT_NAME_INFORMATION: + return smb_raw_fileinfo_passthru_parse(blob, mem_ctx, + RAW_FILEINFO_ALT_NAME_INFORMATION, parms); + + case RAW_FILEINFO_STREAM_INFO: + case RAW_FILEINFO_STREAM_INFORMATION: + return smb_raw_fileinfo_passthru_parse(blob, mem_ctx, + RAW_FILEINFO_STREAM_INFORMATION, parms); + + case RAW_FILEINFO_INTERNAL_INFORMATION: + return smb_raw_fileinfo_passthru_parse(blob, mem_ctx, + RAW_FILEINFO_INTERNAL_INFORMATION, parms); + + case RAW_FILEINFO_ACCESS_INFORMATION: + return smb_raw_fileinfo_passthru_parse(blob, mem_ctx, + RAW_FILEINFO_ACCESS_INFORMATION, parms); + + case RAW_FILEINFO_POSITION_INFORMATION: + return smb_raw_fileinfo_passthru_parse(blob, mem_ctx, + RAW_FILEINFO_POSITION_INFORMATION, parms); + + case RAW_FILEINFO_FULL_EA_INFORMATION: + return smb_raw_fileinfo_passthru_parse(blob, mem_ctx, + RAW_FILEINFO_FULL_EA_INFORMATION, parms); + + case RAW_FILEINFO_MODE_INFORMATION: + return smb_raw_fileinfo_passthru_parse(blob, mem_ctx, + RAW_FILEINFO_MODE_INFORMATION, parms); + + case RAW_FILEINFO_ALIGNMENT_INFORMATION: + return smb_raw_fileinfo_passthru_parse(blob, mem_ctx, + RAW_FILEINFO_ALIGNMENT_INFORMATION, parms); + + case RAW_FILEINFO_COMPRESSION_INFO: + case RAW_FILEINFO_COMPRESSION_INFORMATION: + return smb_raw_fileinfo_passthru_parse(blob, mem_ctx, + RAW_FILEINFO_COMPRESSION_INFORMATION, parms); + case RAW_FILEINFO_UNIX_BASIC: FINFO_CHECK_SIZE(100); parms->unix_basic_info.out.end_of_file = BVAL(blob->data, 0); @@ -280,26 +375,18 @@ static NTSTATUS smb_raw_info_backend(struct smbcli_session *session, return NT_STATUS_OK; case RAW_FILEINFO_NETWORK_OPEN_INFORMATION: - FINFO_CHECK_SIZE(56); - parms->network_open_information.out.create_time = smbcli_pull_nttime(blob->data, 0); - parms->network_open_information.out.access_time = smbcli_pull_nttime(blob->data, 8); - parms->network_open_information.out.write_time = smbcli_pull_nttime(blob->data, 16); - parms->network_open_information.out.change_time = smbcli_pull_nttime(blob->data, 24); - parms->network_open_information.out.alloc_size = BVAL(blob->data, 32); - parms->network_open_information.out.size = BVAL(blob->data, 40); - parms->network_open_information.out.attrib = IVAL(blob->data, 48); - return NT_STATUS_OK; + return smb_raw_fileinfo_passthru_parse(blob, mem_ctx, + RAW_FILEINFO_NETWORK_OPEN_INFORMATION, parms); case RAW_FILEINFO_ATTRIBUTE_TAG_INFORMATION: - FINFO_CHECK_SIZE(8); - parms->attribute_tag_information.out.attrib = IVAL(blob->data, 0); - parms->attribute_tag_information.out.reparse_tag = IVAL(blob->data, 4); - return NT_STATUS_OK; + return smb_raw_fileinfo_passthru_parse(blob, mem_ctx, + RAW_FILEINFO_ATTRIBUTE_TAG_INFORMATION, parms); } return NT_STATUS_INVALID_LEVEL; } + /**************************************************************************** Very raw query file info - returns param/data blobs - (async send) ****************************************************************************/ diff --git a/source4/libcli/raw/rawfsinfo.c b/source4/libcli/raw/rawfsinfo.c index 61f5a5027d..9b218586a2 100644 --- a/source4/libcli/raw/rawfsinfo.c +++ b/source4/libcli/raw/rawfsinfo.c @@ -151,6 +151,86 @@ struct smbcli_request *smb_raw_fsinfo_send(struct smbcli_tree *tree, return smb_raw_qfsinfo_send(tree, mem_ctx, info_level); } +/* + parse the fsinfo 'passthru' level replies +*/ +NTSTATUS smb_raw_fsinfo_passthru_parse(DATA_BLOB blob, TALLOC_CTX *mem_ctx, + enum smb_fsinfo_level level, + union smb_fsinfo *fsinfo) +{ + NTSTATUS status = NT_STATUS_OK; + int i; + + /* parse the results */ + switch (level) { + case RAW_QFS_VOLUME_INFORMATION: + QFS_CHECK_MIN_SIZE(18); + fsinfo->volume_info.out.create_time = smbcli_pull_nttime(blob.data, 0); + fsinfo->volume_info.out.serial_number = IVAL(blob.data, 8); + smbcli_blob_pull_string(NULL, mem_ctx, &blob, + &fsinfo->volume_info.out.volume_name, + 12, 18, STR_UNICODE); + break; + + case RAW_QFS_SIZE_INFORMATION: + QFS_CHECK_SIZE(24); + fsinfo->size_info.out.total_alloc_units = BVAL(blob.data, 0); + fsinfo->size_info.out.avail_alloc_units = BVAL(blob.data, 8); + fsinfo->size_info.out.sectors_per_unit = IVAL(blob.data, 16); + fsinfo->size_info.out.bytes_per_sector = IVAL(blob.data, 20); + break; + + case RAW_QFS_DEVICE_INFORMATION: + QFS_CHECK_SIZE(8); + fsinfo->device_info.out.device_type = IVAL(blob.data, 0); + fsinfo->device_info.out.characteristics = IVAL(blob.data, 4); + break; + + case RAW_QFS_ATTRIBUTE_INFORMATION: + QFS_CHECK_MIN_SIZE(12); + fsinfo->attribute_info.out.fs_attr = IVAL(blob.data, 0); + fsinfo->attribute_info.out.max_file_component_length = IVAL(blob.data, 4); + smbcli_blob_pull_string(NULL, mem_ctx, &blob, + &fsinfo->attribute_info.out.fs_type, + 8, 12, STR_UNICODE); + break; + + case RAW_QFS_QUOTA_INFORMATION: + QFS_CHECK_SIZE(48); + fsinfo->quota_information.out.unknown[0] = BVAL(blob.data, 0); + fsinfo->quota_information.out.unknown[1] = BVAL(blob.data, 8); + fsinfo->quota_information.out.unknown[2] = BVAL(blob.data, 16); + fsinfo->quota_information.out.quota_soft = BVAL(blob.data, 24); + fsinfo->quota_information.out.quota_hard = BVAL(blob.data, 32); + fsinfo->quota_information.out.quota_flags = BVAL(blob.data, 40); + break; + + case RAW_QFS_FULL_SIZE_INFORMATION: + QFS_CHECK_SIZE(32); + fsinfo->full_size_information.out.total_alloc_units = BVAL(blob.data, 0); + fsinfo->full_size_information.out.call_avail_alloc_units = BVAL(blob.data, 8); + fsinfo->full_size_information.out.actual_avail_alloc_units = BVAL(blob.data, 16); + fsinfo->full_size_information.out.sectors_per_unit = IVAL(blob.data, 24); + fsinfo->full_size_information.out.bytes_per_sector = IVAL(blob.data, 28); + break; + + case RAW_QFS_OBJECTID_INFORMATION: + QFS_CHECK_SIZE(64); + status = ndr_pull_struct_blob(&blob, mem_ctx, &fsinfo->objectid_information.out.guid, + (ndr_pull_flags_fn_t)ndr_pull_GUID); + for (i=0;i<6;i++) { + fsinfo->objectid_information.out.unknown[i] = BVAL(blob.data, 16 + i*8); + } + break; + + default: + status = NT_STATUS_INVALID_INFO_CLASS; + } + +failed: + return status; +} + /**************************************************************************** Query FSInfo raw interface (async recv) @@ -161,7 +241,6 @@ NTSTATUS smb_raw_fsinfo_recv(struct smbcli_request *req, { DATA_BLOB blob; NTSTATUS status; - int i; struct smbcli_session *session = req?req->session:NULL; if (fsinfo->generic.level == RAW_QFS_DSKATTR) { @@ -199,39 +278,23 @@ NTSTATUS smb_raw_fsinfo_recv(struct smbcli_request *req, case RAW_QFS_VOLUME_INFO: case RAW_QFS_VOLUME_INFORMATION: - QFS_CHECK_MIN_SIZE(18); - fsinfo->volume_info.out.create_time = smbcli_pull_nttime(blob.data, 0); - fsinfo->volume_info.out.serial_number = IVAL(blob.data, 8); - smbcli_blob_pull_string(session, mem_ctx, &blob, - &fsinfo->volume_info.out.volume_name, - 12, 18, STR_UNICODE); - break; + return smb_raw_fsinfo_passthru_parse(blob, mem_ctx, + RAW_QFS_VOLUME_INFORMATION, fsinfo); case RAW_QFS_SIZE_INFO: case RAW_QFS_SIZE_INFORMATION: - QFS_CHECK_SIZE(24); - fsinfo->size_info.out.total_alloc_units = BVAL(blob.data, 0); - fsinfo->size_info.out.avail_alloc_units = BVAL(blob.data, 8); - fsinfo->size_info.out.sectors_per_unit = IVAL(blob.data, 16); - fsinfo->size_info.out.bytes_per_sector = IVAL(blob.data, 20); - break; + return smb_raw_fsinfo_passthru_parse(blob, mem_ctx, + RAW_QFS_SIZE_INFORMATION, fsinfo); case RAW_QFS_DEVICE_INFO: case RAW_QFS_DEVICE_INFORMATION: - QFS_CHECK_SIZE(8); - fsinfo->device_info.out.device_type = IVAL(blob.data, 0); - fsinfo->device_info.out.characteristics = IVAL(blob.data, 4); - break; + return smb_raw_fsinfo_passthru_parse(blob, mem_ctx, + RAW_QFS_DEVICE_INFORMATION, fsinfo); case RAW_QFS_ATTRIBUTE_INFO: case RAW_QFS_ATTRIBUTE_INFORMATION: - QFS_CHECK_MIN_SIZE(12); - fsinfo->attribute_info.out.fs_attr = IVAL(blob.data, 0); - fsinfo->attribute_info.out.max_file_component_length = IVAL(blob.data, 4); - smbcli_blob_pull_string(session, mem_ctx, &blob, - &fsinfo->attribute_info.out.fs_type, - 8, 12, STR_UNICODE); - break; + return smb_raw_fsinfo_passthru_parse(blob, mem_ctx, + RAW_QFS_ATTRIBUTE_INFORMATION, fsinfo); case RAW_QFS_UNIX_INFO: QFS_CHECK_SIZE(12); @@ -241,32 +304,16 @@ NTSTATUS smb_raw_fsinfo_recv(struct smbcli_request *req, break; case RAW_QFS_QUOTA_INFORMATION: - QFS_CHECK_SIZE(48); - fsinfo->quota_information.out.unknown[0] = BVAL(blob.data, 0); - fsinfo->quota_information.out.unknown[1] = BVAL(blob.data, 8); - fsinfo->quota_information.out.unknown[2] = BVAL(blob.data, 16); - fsinfo->quota_information.out.quota_soft = BVAL(blob.data, 24); - fsinfo->quota_information.out.quota_hard = BVAL(blob.data, 32); - fsinfo->quota_information.out.quota_flags = BVAL(blob.data, 40); - break; + return smb_raw_fsinfo_passthru_parse(blob, mem_ctx, + RAW_QFS_QUOTA_INFORMATION, fsinfo); case RAW_QFS_FULL_SIZE_INFORMATION: - QFS_CHECK_SIZE(32); - fsinfo->full_size_information.out.total_alloc_units = BVAL(blob.data, 0); - fsinfo->full_size_information.out.call_avail_alloc_units = BVAL(blob.data, 8); - fsinfo->full_size_information.out.actual_avail_alloc_units = BVAL(blob.data, 16); - fsinfo->full_size_information.out.sectors_per_unit = IVAL(blob.data, 24); - fsinfo->full_size_information.out.bytes_per_sector = IVAL(blob.data, 28); - break; + return smb_raw_fsinfo_passthru_parse(blob, mem_ctx, + RAW_QFS_FULL_SIZE_INFORMATION, fsinfo); case RAW_QFS_OBJECTID_INFORMATION: - QFS_CHECK_SIZE(64); - status = ndr_pull_struct_blob(&blob, mem_ctx, &fsinfo->objectid_information.out.guid, - (ndr_pull_flags_fn_t)ndr_pull_GUID); - for (i=0;i<6;i++) { - fsinfo->objectid_information.out.unknown[i] = BVAL(blob.data, 16 + i*8); - } - break; + return smb_raw_fsinfo_passthru_parse(blob, mem_ctx, + RAW_QFS_OBJECTID_INFORMATION, fsinfo); } failed: diff --git a/source4/libcli/raw/rawrequest.c b/source4/libcli/raw/rawrequest.c index 33ac9c55b1..6e02ddc5c1 100644 --- a/source4/libcli/raw/rawrequest.c +++ b/source4/libcli/raw/rawrequest.c @@ -737,8 +737,8 @@ NTTIME smbcli_pull_nttime(void *base, uint16_t offset) of bytes consumed in the blob is returned */ static size_t smbcli_blob_pull_ucs2(TALLOC_CTX* mem_ctx, - DATA_BLOB *blob, const char **dest, - const uint8_t *src, int byte_len, uint_t flags) + const DATA_BLOB *blob, const char **dest, + const uint8_t *src, int byte_len, uint_t flags) { int src_len, src_len2, alignment=0; ssize_t ret; @@ -793,8 +793,8 @@ static size_t smbcli_blob_pull_ucs2(TALLOC_CTX* mem_ctx, of bytes consumed in the blob is returned */ static size_t smbcli_blob_pull_ascii(TALLOC_CTX *mem_ctx, - DATA_BLOB *blob, const char **dest, - const uint8_t *src, int byte_len, uint_t flags) + const DATA_BLOB *blob, const char **dest, + const uint8_t *src, int byte_len, uint_t flags) { int src_len, src_len2; ssize_t ret; @@ -841,11 +841,11 @@ static size_t smbcli_blob_pull_ascii(TALLOC_CTX *mem_ctx, of bytes consumed in the blob is returned */ size_t smbcli_blob_pull_string(struct smbcli_session *session, - TALLOC_CTX *mem_ctx, - DATA_BLOB *blob, - WIRE_STRING *dest, - uint16_t len_offset, uint16_t str_offset, - uint_t flags) + TALLOC_CTX *mem_ctx, + const DATA_BLOB *blob, + WIRE_STRING *dest, + uint16_t len_offset, uint16_t str_offset, + uint_t flags) { int extra; dest->s = NULL; |