svn commit: samba r3945 - in branches/SAMBA_4_0/source/torture: . basic

tridge at samba.org tridge at samba.org
Wed Nov 24 22:26:19 GMT 2004


Author: tridge
Date: 2004-11-24 22:26:19 +0000 (Wed, 24 Nov 2004)
New Revision: 3945

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=3945

Log:
expanded the BASE-PROPERTIES test to print a nicely formatted list of
the capabilities and filesystem attribute bits of the server.

Added:
   branches/SAMBA_4_0/source/torture/basic/properties.c
Modified:
   branches/SAMBA_4_0/source/torture/config.mk
   branches/SAMBA_4_0/source/torture/torture.c


Changeset:
Added: branches/SAMBA_4_0/source/torture/basic/properties.c
===================================================================
--- branches/SAMBA_4_0/source/torture/basic/properties.c	2004-11-24 22:05:59 UTC (rev 3944)
+++ branches/SAMBA_4_0/source/torture/basic/properties.c	2004-11-24 22:26:19 UTC (rev 3945)
@@ -0,0 +1,129 @@
+/* 
+   Unix SMB/CIFS implementation.
+
+   show server properties
+
+   Copyright (C) Andrew Tridgell 2004
+   
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+   
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+   
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "includes.h"
+#include "libcli/raw/libcliraw.h"
+
+struct bitmapping {
+	const char *name;
+	uint32_t value;
+};
+
+#define BIT_NAME(x) { #x, x }
+
+const static struct bitmapping fs_attr_bits[] = {
+	BIT_NAME(FS_ATTR_CASE_SENSITIVE_SEARCH),
+	BIT_NAME(FS_ATTR_CASE_PRESERVED_NAMES),
+	BIT_NAME(FS_ATTR_UNICODE_ON_DISK),
+	BIT_NAME(FS_ATTR_PERSISTANT_ACLS),
+	BIT_NAME(FS_ATTR_COMPRESSION),
+	BIT_NAME(FS_ATTR_QUOTAS),
+	BIT_NAME(FS_ATTR_SPARSE_FILES),
+	BIT_NAME(FS_ATTR_REPARSE_POINTS),
+	BIT_NAME(FS_ATTR_REMOTE_STORAGE),
+	BIT_NAME(FS_ATTR_LFN_SUPPORT),
+	BIT_NAME(FS_ATTR_IS_COMPRESSED),
+	BIT_NAME(FS_ATTR_OBJECT_IDS),
+	BIT_NAME(FS_ATTR_ENCRYPTION),
+	BIT_NAME(FS_ATTR_NAMED_STREAMS),
+	{ NULL, 0 }
+};
+
+const static struct bitmapping capability_bits[] = {
+	BIT_NAME(CAP_RAW_MODE),
+	BIT_NAME(CAP_MPX_MODE),
+	BIT_NAME(CAP_UNICODE),
+	BIT_NAME(CAP_LARGE_FILES),
+	BIT_NAME(CAP_NT_SMBS),
+	BIT_NAME(CAP_RPC_REMOTE_APIS),
+	BIT_NAME(CAP_STATUS32),
+	BIT_NAME(CAP_LEVEL_II_OPLOCKS),
+	BIT_NAME(CAP_LOCK_AND_READ),
+	BIT_NAME(CAP_NT_FIND),
+	BIT_NAME(CAP_DFS),
+	BIT_NAME(CAP_W2K_SMBS),
+	BIT_NAME(CAP_LARGE_READX),
+	BIT_NAME(CAP_LARGE_WRITEX),
+	BIT_NAME(CAP_UNIX),
+	BIT_NAME(CAP_EXTENDED_SECURITY),
+	{ NULL, 0 }
+};
+
+static void show_bits(const struct bitmapping *bm, uint32_t value)
+{
+	int i;
+	for (i=0;bm[i].name;i++) {
+		if (value & bm[i].value) {
+			d_printf("\t%s\n", bm[i].name);
+			value &= ~bm[i].value;
+		}
+	}
+	if (value != 0) {
+		d_printf("\tunknown bits: 0x%08x\n", value);
+	}
+}
+
+
+/*
+  print out server properties
+ */
+BOOL torture_test_properties(void)
+{
+	struct smbcli_state *cli;
+	BOOL correct = True;
+	union smb_fsinfo fs;
+	NTSTATUS status;
+	
+	printf("starting properties test\n");
+	
+	ZERO_STRUCT(cli);
+
+	if (!torture_open_connection(&cli)) {
+		return False;
+	}
+	
+	d_printf("Capabilities: 0x%08x\n", cli->transport->negotiate.capabilities);
+	show_bits(capability_bits, cli->transport->negotiate.capabilities);
+	d_printf("\n");
+
+	fs.attribute_info.level = RAW_QFS_ATTRIBUTE_INFO;
+	status = smb_raw_fsinfo(cli->tree, cli, &fs);
+	if (!NT_STATUS_IS_OK(status)) {
+		d_printf("qfsinfo failed - %s\n", nt_errstr(status));
+		correct = False;
+	} else {
+		d_printf("Filesystem attributes: 0x%08x\n", 
+			 fs.attribute_info.out.fs_attr);
+		show_bits(fs_attr_bits, fs.attribute_info.out.fs_attr);
+		d_printf("max_file_component_length: %d\n", 
+			 fs.attribute_info.out.max_file_component_length);
+		d_printf("fstype: %s\n", fs.attribute_info.out.fs_type.s);
+	}
+
+	if (!torture_close_connection(cli)) {
+		correct = False;
+	}
+
+	return correct;
+}
+
+

Modified: branches/SAMBA_4_0/source/torture/config.mk
===================================================================
--- branches/SAMBA_4_0/source/torture/config.mk	2004-11-24 22:05:59 UTC (rev 3944)
+++ branches/SAMBA_4_0/source/torture/config.mk	2004-11-24 22:26:19 UTC (rev 3945)
@@ -18,7 +18,8 @@
 		torture/basic/unlink.o \
 		torture/basic/disconnect.o \
 		torture/basic/delaywrite.o \
-		torture/basic/attr.o 
+		torture/basic/attr.o \
+		torture/basic/properties.o 
 REQUIRED_SUBSYSTEMS = \
 		LIBSMB 
 # End SUBSYSTEM TORTURE_BASIC

Modified: branches/SAMBA_4_0/source/torture/torture.c
===================================================================
--- branches/SAMBA_4_0/source/torture/torture.c	2004-11-24 22:05:59 UTC (rev 3944)
+++ branches/SAMBA_4_0/source/torture/torture.c	2004-11-24 22:26:19 UTC (rev 3945)
@@ -1309,33 +1309,7 @@
 }
 
 
-/*
-  print out server properties
- */
-static BOOL run_properties(void)
-{
-	struct smbcli_state *cli;
-	BOOL correct = True;
-	
-	printf("starting properties test\n");
-	
-	ZERO_STRUCT(cli);
 
-	if (!torture_open_connection(&cli)) {
-		return False;
-	}
-	
-	d_printf("Capabilities 0x%08x\n", cli->transport->negotiate.capabilities);
-
-	if (!torture_close_connection(cli)) {
-		correct = False;
-	}
-
-	return correct;
-}
-
-
-
 /* FIRST_DESIRED_ACCESS   0xf019f */
 #define FIRST_DESIRED_ACCESS   SA_RIGHT_FILE_READ_DATA|SA_RIGHT_FILE_WRITE_DATA|SA_RIGHT_FILE_APPEND_DATA|\
                                SA_RIGHT_FILE_READ_EA|                           /* 0xf */ \
@@ -2333,10 +2307,11 @@
 	for (i=0;i<torture_nprocs;i++) {
 		child_status[i] = 0;
 	}
-	kill(0, SIGCONT);
 
 	printf("%d clients started\n", torture_nprocs);
 
+	kill(0, SIGCONT);
+
 	for (i=0;i<torture_nprocs;i++) {
 		int ret;
 		while ((ret=sys_waitpid(0, &status, 0)) == -1 && errno == EINTR) /* noop */ ;
@@ -2393,7 +2368,7 @@
 	{"BASE-XCOPY", run_xcopy, 0},
 	{"BASE-RENAME", torture_test_rename, 0},
 	{"BASE-DELETE", torture_test_delete, 0},
-	{"BASE-PROPERTIES", run_properties, 0},
+	{"BASE-PROPERTIES", torture_test_properties, 0},
 	{"BASE-MANGLE", torture_mangle, 0},
 	{"BASE-OPENATTR", torture_openattrtest, 0},
 	{"BASE-CHARSET", torture_charset, 0},



More information about the samba-cvs mailing list