summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/include/proto.h18
-rw-r--r--source3/libsmb/clifsinfo.c71
-rw-r--r--source3/libsmb/libsmb_stat.c20
3 files changed, 45 insertions, 64 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index e31d30d96c..d199d1e3df 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -2168,15 +2168,15 @@ NTSTATUS cli_get_fs_full_size_info(struct cli_state *cli,
uint64_t *actual_allocation_units,
uint64_t *sectors_per_allocation_unit,
uint64_t *bytes_per_sector);
-bool cli_get_posix_fs_info(struct cli_state *cli,
- uint32 *optimal_transfer_size,
- uint32 *block_size,
- uint64_t *total_blocks,
- uint64_t *blocks_available,
- uint64_t *user_blocks_available,
- uint64_t *total_file_nodes,
- uint64_t *free_file_nodes,
- uint64_t *fs_identifier);
+NTSTATUS cli_get_posix_fs_info(struct cli_state *cli,
+ uint32 *optimal_transfer_size,
+ uint32 *block_size,
+ uint64_t *total_blocks,
+ uint64_t *blocks_available,
+ uint64_t *user_blocks_available,
+ uint64_t *total_file_nodes,
+ uint64_t *free_file_nodes,
+ uint64_t *fs_identifier);
NTSTATUS cli_raw_ntlm_smb_encryption_start(struct cli_state *cli,
const char *user,
const char *pass,
diff --git a/source3/libsmb/clifsinfo.c b/source3/libsmb/clifsinfo.c
index 8a15878267..69e6546b5d 100644
--- a/source3/libsmb/clifsinfo.c
+++ b/source3/libsmb/clifsinfo.c
@@ -455,50 +455,34 @@ fail:
return status;
}
-bool cli_get_posix_fs_info(struct cli_state *cli,
- uint32 *optimal_transfer_size,
- uint32 *block_size,
- uint64_t *total_blocks,
- uint64_t *blocks_available,
- uint64_t *user_blocks_available,
- uint64_t *total_file_nodes,
- uint64_t *free_file_nodes,
- uint64_t *fs_identifier)
+NTSTATUS cli_get_posix_fs_info(struct cli_state *cli,
+ uint32 *optimal_transfer_size,
+ uint32 *block_size,
+ uint64_t *total_blocks,
+ uint64_t *blocks_available,
+ uint64_t *user_blocks_available,
+ uint64_t *total_file_nodes,
+ uint64_t *free_file_nodes,
+ uint64_t *fs_identifier)
{
- bool ret = False;
- uint16 setup;
- char param[2];
- char *rparam=NULL, *rdata=NULL;
- unsigned int rparam_count=0, rdata_count=0;
-
- setup = TRANSACT2_QFSINFO;
+ uint16 setup[1];
+ uint8_t param[2];
+ uint8_t *rdata = NULL;
+ NTSTATUS status;
+ SSVAL(setup, 0, TRANSACT2_QFSINFO);
SSVAL(param,0,SMB_QUERY_POSIX_FS_INFO);
- if (!cli_send_trans(cli, SMBtrans2,
- NULL,
- 0, 0,
- &setup, 1, 0,
- param, 2, 0,
- NULL, 0, 560)) {
- goto cleanup;
- }
-
- if (!cli_receive_trans(cli, SMBtrans2,
- &rparam, &rparam_count,
- &rdata, &rdata_count)) {
- goto cleanup;
- }
-
- if (cli_is_error(cli)) {
- ret = False;
- goto cleanup;
- } else {
- ret = True;
- }
-
- if (rdata_count != 56) {
- goto cleanup;
+ status = cli_trans(talloc_tos(), cli, SMBtrans2, NULL, 0, 0, 0,
+ setup, 1, 0,
+ param, 2, 0,
+ NULL, 0, 560,
+ NULL,
+ NULL, 0, NULL, /* rsetup */
+ NULL, 0, NULL, /* rparam */
+ &rdata, 56, NULL);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
}
if (optimal_transfer_size) {
@@ -525,12 +509,7 @@ bool cli_get_posix_fs_info(struct cli_state *cli,
if (fs_identifier) {
*fs_identifier = BIG_UINT(rdata,48);
}
-
-cleanup:
- SAFE_FREE(rparam);
- SAFE_FREE(rdata);
-
- return ret;
+ return NT_STATUS_OK;
}
diff --git a/source3/libsmb/libsmb_stat.c b/source3/libsmb/libsmb_stat.c
index f34294e0c3..9c613508eb 100644
--- a/source3/libsmb/libsmb_stat.c
+++ b/source3/libsmb/libsmb_stat.c
@@ -411,17 +411,19 @@ SMBC_fstatvfs_ctx(SMBCCTX *context,
uint64_t total_file_nodes;
uint64_t free_file_nodes;
uint64_t fs_identifier;
+ NTSTATUS status;
/* Has UNIXCIFS. If POSIX filesystem info is available... */
- if (cli_get_posix_fs_info(cli,
- &optimal_transfer_size,
- &block_size,
- &total_blocks,
- &blocks_available,
- &user_blocks_available,
- &total_file_nodes,
- &free_file_nodes,
- &fs_identifier)) {
+ status = cli_get_posix_fs_info(cli,
+ &optimal_transfer_size,
+ &block_size,
+ &total_blocks,
+ &blocks_available,
+ &user_blocks_available,
+ &total_file_nodes,
+ &free_file_nodes,
+ &fs_identifier);
+ if (NT_STATUS_IS_OK(status)) {
/* ... then what's provided here takes precedence. */
st->f_bsize =