[SCM] Samba Shared Repository - branch master updated

Günther Deschner gd at samba.org
Mon May 10 03:50:52 MDT 2010


The branch, master has been updated
       via  f754942... testprogs: update Makefile.mingw (although mingw current cant build it).
       via  86ec5fe... testprogs: update README to reflect the util rename.
       via  cda0c75... testprogs: add readme for testspoolss.exe.
       via  e94825d... testprogs: add vcproj and sln files for testspoolss.exe.
       via  eb28a76... testprogs: rename spoolss.exe to testspoolss.exe.
      from  7887d99... s3-net: Fix Bug #7417. 'net rpc user password' can set the wrong password.

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


- Log -----------------------------------------------------------------
commit f754942862f0405454834154154c4b3b737ba53a
Author: Günther Deschner <gd at samba.org>
Date:   Mon May 10 11:22:32 2010 +0200

    testprogs: update Makefile.mingw (although mingw current cant build it).
    
    Guenther

commit 86ec5fe3ee843f35a4577203b1c9f7d8739b80e3
Author: Günther Deschner <gd at samba.org>
Date:   Mon May 10 11:15:59 2010 +0200

    testprogs: update README to reflect the util rename.
    
    Guenther

commit cda0c75e18f78022b94cb2c13f83342e0db7a8bc
Author: Günther Deschner <gd at samba.org>
Date:   Mon May 10 11:06:03 2010 +0200

    testprogs: add readme for testspoolss.exe.
    
    Patch from Kurt Pfeifle <Kurt.Pfeifle at ricoh.de>.
    
    Guenther

commit e94825d159db49da0bc7e6e68014ce0afbbfb167
Author: Günther Deschner <gd at samba.org>
Date:   Mon May 10 11:03:49 2010 +0200

    testprogs: add vcproj and sln files for testspoolss.exe.
    
    Patch from Kurt Pfeifle <Kurt.Pfeifle at ricoh.de>.
    
    Guenther

commit eb28a761e910f0ffec118ffd3a16ef4971da1232
Author: Günther Deschner <gd at samba.org>
Date:   Mon May 10 11:01:54 2010 +0200

    testprogs: rename spoolss.exe to testspoolss.exe.
    
    Patch from Kurt Pfeifle <Kurt.Pfeifle at ricoh.de>.
    
    Guenther

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

Summary of changes:
 testprogs/win32/spoolss/Makefile                   |    8 +-
 testprogs/win32/spoolss/Makefile.mingw             |    8 +-
 testprogs/win32/spoolss/README                     |    1 -
 testprogs/win32/spoolss/README.win32               |   65 +
 testprogs/win32/spoolss/error.c                    |    2 +-
 testprogs/win32/spoolss/spoolss.c                  | 1834 --------------------
 testprogs/win32/spoolss/testspoolss.c              | 1834 ++++++++++++++++++++
 .../win32/spoolss/{spoolss.h => testspoolss.h}     |    0 
 testprogs/win32/spoolss/testspoolss.sln            |   20 +
 testprogs/win32/spoolss/testspoolss.vcproj         |  224 +++
 testprogs/win32/spoolss/torture.c                  |    2 +-
 11 files changed, 2153 insertions(+), 1845 deletions(-)
 delete mode 100644 testprogs/win32/spoolss/README
 create mode 100644 testprogs/win32/spoolss/README.win32
 delete mode 100644 testprogs/win32/spoolss/spoolss.c
 create mode 100644 testprogs/win32/spoolss/testspoolss.c
 rename testprogs/win32/spoolss/{spoolss.h => testspoolss.h} (100%)
 create mode 100644 testprogs/win32/spoolss/testspoolss.sln
 create mode 100644 testprogs/win32/spoolss/testspoolss.vcproj


Changeset truncated at 500 lines:

diff --git a/testprogs/win32/spoolss/Makefile b/testprogs/win32/spoolss/Makefile
index 8c9d716..5e984d4 100644
--- a/testprogs/win32/spoolss/Makefile
+++ b/testprogs/win32/spoolss/Makefile
@@ -3,7 +3,7 @@ LIBS = kernel32.lib gdi32.lib user32.lib shell32.lib \
 	advapi32.lib ole32.lib ws2_32.lib rpcrt4.lib
 WINSPOOL_LIBS = winspool.lib
 
-all: spoolss.exe
+all: testspoolss.exe
 
 .cpp.obj:
 	cl /c $(CFLAGS) $*.cpp
@@ -32,9 +32,9 @@ torture.obj: torture.c
 # binaries
 ###############################
 
-spoolss.obj: spoolss.c
+testspoolss.obj: testspoolss.c
 
-spoolss.exe: spoolss.obj printlib.obj error.obj torture.obj
-	cl $(CFLAGS) /Fe$@ spoolss.obj printlib.obj error.obj torture.obj \
+testspoolss.exe: testspoolss.obj printlib.obj error.obj torture.obj
+	cl $(CFLAGS) /Fe$@ testspoolss.obj printlib.obj error.obj torture.obj \
 	/link /incremental:no /subsystem:console $(LIBS) $(WINSPOOL_LIBS)
 
diff --git a/testprogs/win32/spoolss/Makefile.mingw b/testprogs/win32/spoolss/Makefile.mingw
index 4ff7155..7c66075 100644
--- a/testprogs/win32/spoolss/Makefile.mingw
+++ b/testprogs/win32/spoolss/Makefile.mingw
@@ -4,7 +4,7 @@ LDFLAGS=-L/usr/i686-pc-mingw32/sys-root/mingw/lib
 CC=/usr/bin/i686-pc-mingw32-gcc
 LIBS=-lwinspool
 
-all: spoolss.exe
+all: testspoolss.exe
 
 clean:
 	rm -vf *.exe tags
@@ -17,7 +17,7 @@ proto:
 	mkproto.pl printlib.c --private=printlib_proto.h --public=printlib_proto_pub.h --srcdir=. --builddir=.
 	mkproto.pl torture.c --private=torture_proto.h --public=torture_proto_pub.h --srcdir=. --builddir=.
 
-spoolss.exe: spoolss.c printlib.c torture.c error.c
-	@echo Compiling spoolss.exe
-	@$(CC) $(CFLAGS) $(LDFLAGS) spoolss.c printlib.c torture.c error.c $(LIBS) -o spoolss.exe
+testspoolss.exe: testspoolss.c printlib.c torture.c error.c
+	@echo Compiling testspoolss.exe
+	@$(CC) $(CFLAGS) $(LDFLAGS) testspoolss.c printlib.c torture.c error.c $(LIBS) -o testspoolss.exe
 
diff --git a/testprogs/win32/spoolss/README b/testprogs/win32/spoolss/README
deleted file mode 100644
index 9d6cf4b..0000000
--- a/testprogs/win32/spoolss/README
+++ /dev/null
@@ -1 +0,0 @@
-FIXME
diff --git a/testprogs/win32/spoolss/README.win32 b/testprogs/win32/spoolss/README.win32
new file mode 100644
index 0000000..1e7bacc
--- /dev/null
+++ b/testprogs/win32/spoolss/README.win32
@@ -0,0 +1,65 @@
+
+This directory holds sources for a Win32 test utility to test the "spoolss"
+(print spool subsystem) functions of either a Windows or a Samba server. The
+sources are known to build with (free as in beer) Microsoft Visual C++ 2008
+Express Edition's "nmake.exe" on Windows XP Professional.
+
+
+How to build
+------------
+
+Use the Microsoft "nmake" command to build the *.exe. This command is in your
+%path% if you start the "Visual Studio 2008 Command Prompt" from your Start
+menu.
+
+Currently the real build target is named "testspoolss.exe". Run
+
+    nmake /f Makefile
+
+to build the testspoolss.exe. After a successfull build you may want to clean up
+temporary files:
+
+    nmake /f Makefile cleantmp
+
+
+How to use
+----------
+
+Running testspoolss.exe with no additional params displays a short usage info.
+
+..............................................................................
+usage: testspoolss.exe <name> [print] [samba3] [architecture=ARCHITECTURE]
+
+        <name>           can be a server or printer name URI
+        [print]          will print all data that has been retrieved
+                         from the printserver
+        [samba3]         will skip some tests samba servers are known
+                         not to have implemented
+        [architecture=X] allows to define a specific
+                         architecture to test with. choose between:
+                         "Windows NT x86" or "Windows x64"
+..............................................................................
+
+The utility may be most useful if you use the "print" parameter to output all
+data received from the print server. You may re-direct the data into log files
+for later evaluation like this:
+
+   testspoolss.exe \\smbserver print samba3 1>smbserver.log 2>smbserver.err
+   testspoolss.exe \\smbserver print        1>smbserver.log 2>smbserver.err
+   testspoolss.exe \\winserver print        1>winserver.log 2>winserver.err
+
+One interesting source of learning could be to compare the output for (maybe
+"the same") printers/drivers as installed on a Windows and on a Samba print
+server:
+
+   testspoolss.exe \\winserver\printername print 1>winprinter.log 2>winprinter.err
+   testspoolss.exe \\smbserver\printername print 1>smbprinter.log 2>smbprinter.err
+
+and then compare the respective log files with a diff utility of your choice.
+To install "the same" printer/driver on a Samba server as on a Windows server,
+you can use the Samba "net" utility, which has the following syntax:
+
+   net rpc printer MIGRATE PRINTERS printername \
+       --server=winserver \
+       --destination=smbserver \
+       -UAdministrator%secretpassword
diff --git a/testprogs/win32/spoolss/error.c b/testprogs/win32/spoolss/error.c
index e5ad661..3f96594 100644
--- a/testprogs/win32/spoolss/error.c
+++ b/testprogs/win32/spoolss/error.c
@@ -18,7 +18,7 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#include "spoolss.h"
+#include "testspoolss.h"
 
 const char *errstr(DWORD error)
 {
diff --git a/testprogs/win32/spoolss/spoolss.c b/testprogs/win32/spoolss/spoolss.c
deleted file mode 100644
index d98aee2..0000000
--- a/testprogs/win32/spoolss/spoolss.c
+++ /dev/null
@@ -1,1834 +0,0 @@
-/*
-   Unix SMB/CIFS implementation.
-   test suite for spoolss rpc operations
-
-   Copyright (C) Guenther Deschner 2009-2010
-
-   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 3 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, see <http://www.gnu.org/licenses/>.
-*/
-
-/****************************************************************************
-****************************************************************************/
-
-#include "spoolss.h"
-#include "string.h"
-#include "torture.h"
-
-/****************************************************************************
-****************************************************************************/
-
-static BOOL test_OpenPrinter(struct torture_context *tctx,
-			     LPSTR printername,
-			     LPPRINTER_DEFAULTS defaults,
-			     LPHANDLE handle)
-{
-	torture_comment(tctx, "Testing OpenPrinter(%s)", printername);
-
-	if (!OpenPrinter(printername, handle, defaults)) {
-		char tmp[1024];
-		sprintf(tmp, "failed to open printer %s, error was: 0x%08x\n",
-			printername, GetLastError());
-		torture_fail(tctx, tmp);
-	}
-
-	return TRUE;
-}
-
-/****************************************************************************
-****************************************************************************/
-
-static BOOL test_ClosePrinter(struct torture_context *tctx,
-			      HANDLE handle)
-{
-	torture_comment(tctx, "Testing ClosePrinter");
-
-	if (!ClosePrinter(handle)) {
-		char tmp[1024];
-		sprintf(tmp, "failed to close printer, error was: %s\n",
-			errstr(GetLastError()));
-		torture_fail(tctx, tmp);
-	}
-
-	return TRUE;
-}
-
-
-/****************************************************************************
-****************************************************************************/
-
-static BOOL test_EnumPrinters(struct torture_context *tctx,
-			      LPSTR servername)
-{
-	DWORD levels[]  = { 1, 2, 5 };
-	DWORD success[] = { 1, 1, 1 };
-	DWORD i;
-	DWORD flags = PRINTER_ENUM_NAME;
-	LPBYTE buffer = NULL;
-
-	for (i=0; i < ARRAY_SIZE(levels); i++) {
-
-		DWORD needed = 0;
-		DWORD returned = 0;
-		DWORD err = 0;
-		char tmp[1024];
-
-		torture_comment(tctx, "Testing EnumPrinters level %d", levels[i]);
-
-		EnumPrinters(flags, servername, levels[i], NULL, 0, &needed, &returned);
-		err = GetLastError();
-		if (err == ERROR_INSUFFICIENT_BUFFER) {
-			err = 0;
-			buffer = malloc(needed);
-			torture_assert(tctx, buffer, "malloc failed");
-			if (!EnumPrinters(flags, servername, levels[i], buffer, needed, &needed, &returned)) {
-				err = GetLastError();
-			}
-		}
-		if (err) {
-			sprintf(tmp, "EnumPrinters failed level %d on [%s] (buffer size = %d), error: %s\n",
-				levels[i], servername, needed, errstr(err));
-			if (success[i]) {
-				torture_fail(tctx, tmp);
-			} else {
-				torture_warning(tctx, tmp);
-			}
-		}
-
-		if (tctx->print) {
-			print_printer_info_bylevel(levels[i], buffer, returned);
-		}
-
-		free(buffer);
-		buffer = NULL;
-	}
-
-	return TRUE;
-}
-
-/****************************************************************************
-****************************************************************************/
-
-static BOOL test_EnumDrivers(struct torture_context *tctx,
-			     LPSTR servername,
-			     LPSTR architecture)
-{
-	DWORD levels[]  = { 1, 2, 3, 4, 5, 6 };
-	DWORD success[] = { 1, 1, 1, 1, 1, 1 };
-	DWORD i;
-	LPBYTE buffer = NULL;
-
-	for (i=0; i < ARRAY_SIZE(levels); i++) {
-
-		DWORD needed = 0;
-		DWORD returned = 0;
-		DWORD err = 0;
-		char tmp[1024];
-
-		torture_comment(tctx, "Testing EnumPrinterDrivers level %d", levels[i]);
-
-		EnumPrinterDrivers(servername, architecture, levels[i], NULL, 0, &needed, &returned);
-		err = GetLastError();
-		if (err == ERROR_INSUFFICIENT_BUFFER) {
-			err = 0;
-			buffer = malloc(needed);
-			torture_assert(tctx, buffer, "malloc failed");
-			if (!EnumPrinterDrivers(servername, architecture, levels[i], buffer, needed, &needed, &returned)) {
-				err = GetLastError();
-			}
-		}
-		if (err) {
-			sprintf(tmp, "EnumPrinterDrivers failed level %d on [%s] (buffer size = %d), error: %s\n",
-				levels[i], servername, needed, errstr(err));
-			if (success[i]) {
-				torture_fail(tctx, tmp);
-			} else {
-				torture_warning(tctx, tmp);
-			}
-		}
-
-		if (tctx->print) {
-			print_driver_info_bylevel(levels[i], buffer, returned);
-		}
-
-		free(buffer);
-		buffer = NULL;
-	}
-
-	return TRUE;
-}
-
-/****************************************************************************
-****************************************************************************/
-
-static BOOL test_GetForm(struct torture_context *tctx,
-			 LPSTR servername,
-			 HANDLE handle,
-			 LPSTR formname)
-{
-	DWORD levels[]  = { 1, 2 };
-	DWORD success[] = { 1, 0 };
-	DWORD i;
-	LPBYTE buffer = NULL;
-
-	for (i=0; i < ARRAY_SIZE(levels); i++) {
-
-		DWORD needed = 0;
-		DWORD err = 0;
-		char tmp[1024];
-
-		torture_comment(tctx, "Testing GetForm(%s) level %d", formname, levels[i]);
-
-		GetForm(handle, formname, levels[i], NULL, 0, &needed);
-		err = GetLastError();
-		if (err == ERROR_INSUFFICIENT_BUFFER) {
-			err = 0;
-			buffer = malloc(needed);
-			torture_assert(tctx, buffer, "malloc failed");
-			if (!GetForm(handle, formname, levels[i], buffer, needed, &needed)) {
-				err = GetLastError();
-			}
-		}
-		if (err) {
-			sprintf(tmp, "GetForm failed level %d on [%s] (buffer size = %d), error: %s\n",
-				levels[i], servername, needed, errstr(err));
-			if (success[i]) {
-				torture_fail(tctx, tmp);
-			} else {
-				torture_warning(tctx, tmp);
-			}
-		}
-
-		if (tctx->print) {
-			print_form_info_bylevel(levels[i], buffer, 1);
-		}
-
-		free(buffer);
-		buffer = NULL;
-	}
-
-	return TRUE;
-}
-
-/****************************************************************************
-****************************************************************************/
-
-static BOOL test_EnumForms(struct torture_context *tctx,
-			   LPSTR servername,
-			   HANDLE handle)
-{
-	DWORD levels[]  = { 1, 2 };
-	DWORD success[] = { 1, 1 };
-	DWORD i;
-	LPBYTE buffer = NULL;
-
-	for (i=0; i < ARRAY_SIZE(levels); i++) {
-
-		DWORD needed = 0;
-		DWORD returned = 0;
-		DWORD err = 0;
-		char tmp[1024];
-
-		torture_comment(tctx, "Testing EnumForms level %d", levels[i]);
-
-		if (tctx->samba3 && levels[i] == 2) {
-			torture_comment(tctx, "skipping level %d enum against samba\n", levels[i]);
-			continue;
-		}
-
-		EnumForms(handle, levels[i], NULL, 0, &needed, &returned);
-		err = GetLastError();
-		if (err == ERROR_INSUFFICIENT_BUFFER) {
-			err = 0;
-			buffer = malloc(needed);
-			torture_assert(tctx, buffer, "malloc failed");
-			if (!EnumForms(handle, levels[i], buffer, needed, &needed, &returned)) {
-				err = GetLastError();
-			}
-		}
-		if (err) {
-			sprintf(tmp, "EnumForms failed level %d on [%s] (buffer size = %d), error: %s\n",
-				levels[i], servername, needed, errstr(err));
-			if (success[i]) {
-				torture_fail(tctx, tmp);
-			} else {
-				torture_warning(tctx, tmp);
-			}
-		}
-
-		if (tctx->print) {
-			print_form_info_bylevel(levels[i], buffer, returned);
-		}
-
-		free(buffer);
-		buffer = NULL;
-	}
-
-	return TRUE;
-}
-
-/****************************************************************************
-****************************************************************************/
-
-static BOOL test_EnumPorts(struct torture_context *tctx,
-			   LPSTR servername)
-{
-	DWORD levels[]  = { 1, 2 };
-	DWORD success[] = { 1, 1 };
-	DWORD i;
-	LPBYTE buffer = NULL;
-
-	for (i=0; i < ARRAY_SIZE(levels); i++) {
-
-		DWORD needed = 0;
-		DWORD returned = 0;
-		DWORD err = 0;
-		char tmp[1024];
-
-		torture_comment(tctx, "Testing EnumPorts level %d", levels[i]);
-
-		EnumPorts(servername, levels[i], NULL, 0, &needed, &returned);
-		err = GetLastError();
-		if (err == ERROR_INSUFFICIENT_BUFFER) {
-			err = 0;
-			buffer = malloc(needed);
-			torture_assert(tctx, buffer, "malloc failed");
-			if (!EnumPorts(servername, levels[i], buffer, needed, &needed, &returned)) {
-				err = GetLastError();
-			}
-		}
-		if (err) {
-			sprintf(tmp, "EnumPorts failed level %d on [%s] (buffer size = %d), error: %s\n",
-				levels[i], servername, needed, errstr(err));
-			if (success[i]) {
-				torture_fail(tctx, tmp);
-			} else {
-				torture_warning(tctx, tmp);
-			}
-		}
-
-		if (tctx->print) {
-			print_port_info_bylevel(levels[i], buffer, returned);
-		}
-
-		free(buffer);
-		buffer = NULL;
-	}
-
-	return TRUE;
-}
-
-/****************************************************************************
-****************************************************************************/
-
-static BOOL test_EnumMonitors(struct torture_context *tctx,
-			      LPSTR servername)
-{
-	DWORD levels[]  = { 1, 2 };
-	DWORD success[] = { 1, 1 };
-	DWORD i;
-	LPBYTE buffer = NULL;
-
-	for (i=0; i < ARRAY_SIZE(levels); i++) {
-
-		DWORD needed = 0;
-		DWORD returned = 0;
-		DWORD err = 0;
-		char tmp[1024];
-
-		torture_comment(tctx, "Testing EnumMonitors level %d", levels[i]);
-
-		EnumMonitors(servername, levels[i], NULL, 0, &needed, &returned);
-		err = GetLastError();
-		if (err == ERROR_INSUFFICIENT_BUFFER) {


-- 
Samba Shared Repository


More information about the samba-cvs mailing list