[SCM] Samba Shared Repository - branch master updated

Volker Lendecke vlendec at samba.org
Sun Nov 14 03:25:02 MST 2010


The branch, master has been updated
       via  36637a7 s3: Convert cli_get_posix_fs_info() to cli_trans()
      from  52f2520 Fix the unexpected.tdb database problem. Change nmbd to store the transaction id of packets it was requested to send via a client, and only store replies that match these ids. On the client side change clients to always attempt to ask nmbd first for name_query and node_status calls, and then fall back to doing socket calls if we can't talk to nmbd (either nmbd is not running, or we're not root and cannot open the messaging tdb's). Fix readers of unexpected.tdb to delete packets they've successfully read.

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


- Log -----------------------------------------------------------------
commit 36637a7ced4ac9f0a0846ba75b56ccdf2599ffea
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Nov 11 16:29:33 2010 +0100

    s3: Convert cli_get_posix_fs_info() to cli_trans()
    
    Autobuild-User: Volker Lendecke <vlendec at samba.org>
    Autobuild-Date: Sun Nov 14 10:24:02 UTC 2010 on sn-devel-104

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

Summary of changes:
 source3/include/proto.h      |   18 +++++-----
 source3/libsmb/clifsinfo.c   |   71 +++++++++++++++---------------------------
 source3/libsmb/libsmb_stat.c |   20 ++++++-----
 3 files changed, 45 insertions(+), 64 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/include/proto.h b/source3/include/proto.h
index e31d30d..d199d1e 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 8a15878..69e6546 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 f34294e..9c61350 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 =


-- 
Samba Shared Repository


More information about the samba-cvs mailing list