[SCM] Samba Shared Repository - branch master updated

Volker Lendecke vlendec at samba.org
Thu Nov 4 16:09:03 MDT 2010


The branch, master has been updated
       via  a5d4851 s3: Remove the use of cli_send_trans from cli_get_fs_full_size_info
      from  83f78a3 s4:ldap.py/passwords.py - just use objectclass "user" for users

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit a5d485112e464d52eef66d2084de2186d47668dc
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Nov 4 19:23:06 2010 +0100

    s3: Remove the use of cli_send_trans from cli_get_fs_full_size_info
    
    Autobuild-User: Volker Lendecke <vlendec at samba.org>
    Autobuild-Date: Thu Nov  4 22:08:53 UTC 2010 on sn-devel-104

-----------------------------------------------------------------------

Summary of changes:
 source3/include/proto.h      |   12 +++---
 source3/libsmb/clifsinfo.c   |   70 ++++++++++++++++-------------------------
 source3/libsmb/libsmb_stat.c |   14 +++++---
 3 files changed, 41 insertions(+), 55 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/include/proto.h b/source3/include/proto.h
index 0584243..1989fb1 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 5ca76ac..8a15878 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 0f64502..f34294e 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 =


-- 
Samba Shared Repository


More information about the samba-cvs mailing list