summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2010-11-11 16:29:33 +0100
committerVolker Lendecke <vlendec@samba.org>2010-11-14 10:24:02 +0000
commit36637a7ced4ac9f0a0846ba75b56ccdf2599ffea (patch)
treedec67dc716a112e29746eb5ead185753e506b9dd /source3
parent52f252064817b4be4d45d9fdbb0ad07748a0f317 (diff)
downloadsamba-36637a7ced4ac9f0a0846ba75b56ccdf2599ffea.tar.gz
samba-36637a7ced4ac9f0a0846ba75b56ccdf2599ffea.tar.bz2
samba-36637a7ced4ac9f0a0846ba75b56ccdf2599ffea.zip
s3: Convert cli_get_posix_fs_info() to cli_trans()
Autobuild-User: Volker Lendecke <vlendec@samba.org> Autobuild-Date: Sun Nov 14 10:24:02 UTC 2010 on sn-devel-104
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 =