summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2010-11-04 19:23:06 +0100
committerVolker Lendecke <vlendec@samba.org>2010-11-04 22:08:52 +0000
commita5d485112e464d52eef66d2084de2186d47668dc (patch)
treeb5d398de60d06606d38fbafe03f79fbaa47d3b51 /source3
parent83f78a30a05ba96e7c599d97feea24aa65cbad51 (diff)
downloadsamba-a5d485112e464d52eef66d2084de2186d47668dc.tar.gz
samba-a5d485112e464d52eef66d2084de2186d47668dc.tar.bz2
samba-a5d485112e464d52eef66d2084de2186d47668dc.zip
s3: Remove the use of cli_send_trans from cli_get_fs_full_size_info
Autobuild-User: Volker Lendecke <vlendec@samba.org> Autobuild-Date: Thu Nov 4 22:08:53 UTC 2010 on sn-devel-104
Diffstat (limited to 'source3')
-rw-r--r--source3/include/proto.h12
-rw-r--r--source3/libsmb/clifsinfo.c70
-rw-r--r--source3/libsmb/libsmb_stat.c14
3 files changed, 41 insertions, 55 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 058424359d..1989fb1a86 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -2158,12 +2158,12 @@ NTSTATUS cli_get_fs_attr_info_recv(struct tevent_req *req, uint32_t *fs_attr);
NTSTATUS cli_get_fs_attr_info(struct cli_state *cli, uint32_t *fs_attr);
NTSTATUS cli_get_fs_volume_info(struct cli_state *cli, fstring volume_name,
uint32 *pserial_number, time_t *pdate);
-bool cli_get_fs_full_size_info(struct cli_state *cli,
- uint64_t *total_allocation_units,
- uint64_t *caller_allocation_units,
- uint64_t *actual_allocation_units,
- uint64_t *sectors_per_allocation_unit,
- uint64_t *bytes_per_sector);
+NTSTATUS cli_get_fs_full_size_info(struct cli_state *cli,
+ uint64_t *total_allocation_units,
+ uint64_t *caller_allocation_units,
+ 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,
diff --git a/source3/libsmb/clifsinfo.c b/source3/libsmb/clifsinfo.c
index 5ca76ac16a..8a15878267 100644
--- a/source3/libsmb/clifsinfo.c
+++ b/source3/libsmb/clifsinfo.c
@@ -405,47 +405,33 @@ NTSTATUS cli_get_fs_volume_info(struct cli_state *cli, fstring volume_name,
return NT_STATUS_OK;
}
-bool cli_get_fs_full_size_info(struct cli_state *cli,
- uint64_t *total_allocation_units,
- uint64_t *caller_allocation_units,
- uint64_t *actual_allocation_units,
- uint64_t *sectors_per_allocation_unit,
- uint64_t *bytes_per_sector)
+NTSTATUS cli_get_fs_full_size_info(struct cli_state *cli,
+ uint64_t *total_allocation_units,
+ uint64_t *caller_allocation_units,
+ uint64_t *actual_allocation_units,
+ uint64_t *sectors_per_allocation_unit,
+ uint64_t *bytes_per_sector)
{
- bool ret = False;
- uint16 setup;
- char param[2];
- char *rparam=NULL, *rdata=NULL;
- unsigned int rparam_count=0, rdata_count=0;
-
- setup = TRANSACT2_QFSINFO;
-
- SSVAL(param,0,SMB_FS_FULL_SIZE_INFORMATION);
-
- 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;
- }
+ uint16 setup[1];
+ uint8_t param[2];
+ uint8_t *rdata = NULL;
+ uint32_t rdata_count;
+ NTSTATUS status;
- if (cli_is_error(cli)) {
- ret = False;
- goto cleanup;
- } else {
- ret = True;
- }
+ SSVAL(setup, 0, TRANSACT2_QFSINFO);
+ SSVAL(param, 0, SMB_FS_FULL_SIZE_INFORMATION);
- if (rdata_count != 32) {
- goto cleanup;
+ status = cli_trans(talloc_tos(), cli, SMBtrans2,
+ NULL, 0, 0, 0,
+ setup, 1, 0, /* setup */
+ param, 2, 0, /* param */
+ NULL, 0, 560, /* data */
+ NULL,
+ NULL, 0, NULL, /* rsetup */
+ NULL, 0, NULL, /* rparam */
+ &rdata, 32, &rdata_count); /* rdata */
+ if (!NT_STATUS_IS_OK(status)) {
+ goto fail;
}
if (total_allocation_units) {
@@ -464,11 +450,9 @@ bool cli_get_fs_full_size_info(struct cli_state *cli,
*bytes_per_sector = IVAL(rdata,28);
}
-cleanup:
- SAFE_FREE(rparam);
- SAFE_FREE(rdata);
-
- return ret;
+fail:
+ TALLOC_FREE(rdata);
+ return status;
}
bool cli_get_posix_fs_info(struct cli_state *cli,
diff --git a/source3/libsmb/libsmb_stat.c b/source3/libsmb/libsmb_stat.c
index 0f64502409..f34294e0c3 100644
--- a/source3/libsmb/libsmb_stat.c
+++ b/source3/libsmb/libsmb_stat.c
@@ -377,14 +377,16 @@ SMBC_fstatvfs_ctx(SMBCCTX *context,
uint64_t actual_allocation_units;
uint64_t sectors_per_allocation_unit;
uint64_t bytes_per_sector;
+ NTSTATUS status;
/* Nope. If size data is available... */
- if (cli_get_fs_full_size_info(cli,
- &total_allocation_units,
- &caller_allocation_units,
- &actual_allocation_units,
- &sectors_per_allocation_unit,
- &bytes_per_sector)) {
+ status = cli_get_fs_full_size_info(cli,
+ &total_allocation_units,
+ &caller_allocation_units,
+ &actual_allocation_units,
+ &sectors_per_allocation_unit,
+ &bytes_per_sector);
+ if (NT_STATUS_IS_OK(status)) {
/* ... then provide it */
st->f_bsize =