[SCM] Samba Shared Repository - branch master updated
Günther Deschner
gd at samba.org
Thu Jun 3 11:21:03 MDT 2010
The branch, master has been updated
via e65164f... s4-smbtorture: convert RPC-SPOOLSS into a torture suite.
via 9884bf7... s4-smbtorture: allow to call single tests from a testcase in a testsuite directly on the commandline.
via 3eac633... libreplace: Fix readline build with libedit.
from 30a9ddc... s3-spoolss: add and use spoolss_printerinfo2_to_setprinterinfo2().
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit e65164ff482100c2590d724373aff11daffc7b50
Author: Günther Deschner <gd at samba.org>
Date: Tue May 18 23:40:43 2010 +0200
s4-smbtorture: convert RPC-SPOOLSS into a torture suite.
Guenther
commit 9884bf7d5737272db993b0602de85b12c2b4e0ea
Author: Günther Deschner <gd at samba.org>
Date: Thu Jun 3 17:08:55 2010 +0200
s4-smbtorture: allow to call single tests from a testcase in a testsuite
directly on the commandline.
Guenther
commit 3eac6335229fabfe3c985d0b206faa5d65ad1ce7
Author: James Peach <jpeach at samba.org>
Date: Thu Mar 18 19:30:54 2010 -0700
libreplace: Fix readline build with libedit.
libedit on MAc OSX 10.5 does not have the rl_completion_t typedef,
but uses a internal typedef names CPPFunction.
Signed-off-by: Günther Deschner <gd at samba.org>
-----------------------------------------------------------------------
Summary of changes:
lib/replace/system/readline.h | 8 +-
source4/lib/smbreadline/wscript_configure | 38 ++++
source4/torture/rpc/rpc.c | 2 +-
source4/torture/rpc/spoolss.c | 293 +++++++++++++++++++++--------
source4/torture/smbtorture.c | 10 +
5 files changed, 267 insertions(+), 84 deletions(-)
Changeset truncated at 500 lines:
diff --git a/lib/replace/system/readline.h b/lib/replace/system/readline.h
index ba34dc6..e6b8fb9 100644
--- a/lib/replace/system/readline.h
+++ b/lib/replace/system/readline.h
@@ -43,7 +43,13 @@
#endif
#ifdef HAVE_NEW_LIBREADLINE
-# define RL_COMPLETION_CAST (rl_completion_func_t *)
+#ifdef HAVE_CPPFUNCTION
+# define RL_COMPLETION_CAST (CPPFunction *)
+#elif HAVE_RL_COMPLETION_T
+# define RL_COMPLETION_CAST (rl_completion_t *)
+#else
+# define RL_COMPLETION_CAST
+#endif
#else
/* This type is missing from libreadline<4.0 (approximately) */
# define RL_COMPLETION_CAST
diff --git a/source4/lib/smbreadline/wscript_configure b/source4/lib/smbreadline/wscript_configure
index 76273dd..cec6526 100644
--- a/source4/lib/smbreadline/wscript_configure
+++ b/source4/lib/smbreadline/wscript_configure
@@ -7,6 +7,44 @@ for termlib in ['ncurses', 'curses', 'termcap', 'terminfo', 'termlib', 'tinfo']:
conf.env['READLINE_TERMLIB'] = termlib
break
+conf.CHECK_CODE('''
+#ifdef HAVE_READLINE_READLINE_H
+# include <readline/readline.h>
+# ifdef HAVE_READLINE_HISTORY_H
+# include <readline/history.h>
+# endif
+#else
+# ifdef HAVE_READLINE_H
+# include <readline.h>
+# ifdef HAVE_HISTORY_H
+# include <history.h>
+# endif
+# endif
+#endif
+int main(void) {rl_completion_t f; return 0;}
+''',
+'HAVE_RL_COMPLETION_FUNC_T', execute=False, addmain=False,
+msg='Checking for rl_completion_t')
+
+conf.CHECK_CODE('''
+#ifdef HAVE_READLINE_READLINE_H
+# include <readline/readline.h>
+# ifdef HAVE_READLINE_HISTORY_H
+# include <readline/history.h>
+# endif
+#else
+# ifdef HAVE_READLINE_H
+# include <readline.h>
+# ifdef HAVE_HISTORY_H
+# include <history.h>
+# endif
+# endif
+#endif
+int main(void) {CPPFunction f; return 0;}
+''',
+'HAVE_CPPFUNCTION', execute=False, addmain=False,
+msg='Checking for CPPFunction')
+
if conf.CHECK_FUNCS_IN('rl_completion_matches', 'readline'):
conf.DEFINE('HAVE_NEW_LIBREADLINE', 1)
diff --git a/source4/torture/rpc/rpc.c b/source4/torture/rpc/rpc.c
index 13855cd..63ebe6c 100644
--- a/source4/torture/rpc/rpc.c
+++ b/source4/torture/rpc/rpc.c
@@ -441,7 +441,7 @@ NTSTATUS torture_rpc_init(void)
torture_suite_add_suite(suite, torture_rpc_handles(suite));
torture_suite_add_suite(suite, torture_rpc_object_uuid(suite));
torture_suite_add_suite(suite, torture_rpc_winreg(suite));
- torture_suite_add_simple_test(suite, "SPOOLSS", torture_rpc_spoolss);
+ torture_suite_add_suite(suite, torture_rpc_spoolss(suite));
torture_suite_add_suite(suite, torture_rpc_spoolss_notify(suite));
torture_suite_add_suite(suite, torture_rpc_spoolss_win(suite));
torture_suite_add_suite(suite, torture_rpc_spoolss_printer(suite));
diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c
index b13bdc6..6d04690 100644
--- a/source4/torture/rpc/spoolss.c
+++ b/source4/torture/rpc/spoolss.c
@@ -53,6 +53,11 @@
#define TOP_LEVEL_CONTROL_ENVIRONMENTS_KEY TOP_LEVEL_CONTROL_KEY "\\Environments"
struct test_spoolss_context {
+ struct dcerpc_pipe *spoolss_pipe;
+
+ /* server environment */
+ const char *environment;
+
/* print server handle */
struct policy_handle server_handle;
@@ -278,9 +283,12 @@ static bool test_OpenPrinter_server(struct torture_context *tctx,
}
static bool test_EnumPorts(struct torture_context *tctx,
- struct dcerpc_binding_handle *b,
- struct test_spoolss_context *ctx)
+ void *private_data)
{
+ struct test_spoolss_context *ctx =
+ talloc_get_type_abort(private_data, struct test_spoolss_context);
+ struct dcerpc_pipe *p = ctx->spoolss_pipe;
+ struct dcerpc_binding_handle *b = p->binding_handle;
NTSTATUS status;
struct spoolss_EnumPorts r;
uint16_t levels[] = { 1, 2 };
@@ -357,10 +365,13 @@ static bool test_EnumPorts(struct torture_context *tctx,
}
static bool test_GetPrintProcessorDirectory(struct torture_context *tctx,
- struct dcerpc_pipe *p,
- const char *environment)
+ void *private_data)
{
+ struct test_spoolss_context *ctx =
+ talloc_get_type_abort(private_data, struct test_spoolss_context);
+
NTSTATUS status;
+ struct dcerpc_pipe *p = ctx->spoolss_pipe;
struct dcerpc_binding_handle *b = p->binding_handle;
struct spoolss_GetPrintProcessorDirectory r;
struct {
@@ -391,7 +402,7 @@ static bool test_GetPrintProcessorDirectory(struct torture_context *tctx,
DATA_BLOB blob;
r.in.server = levels[i].server;
- r.in.environment = environment;
+ r.in.environment = ctx->environment;
r.in.level = level;
r.in.buffer = NULL;
r.in.offered = 0;
@@ -422,10 +433,13 @@ static bool test_GetPrintProcessorDirectory(struct torture_context *tctx,
static bool test_GetPrinterDriverDirectory(struct torture_context *tctx,
- struct dcerpc_pipe *p,
- const char *environment)
+ void *private_data)
{
+ struct test_spoolss_context *ctx =
+ talloc_get_type_abort(private_data, struct test_spoolss_context);
+
NTSTATUS status;
+ struct dcerpc_pipe *p = ctx->spoolss_pipe;
struct dcerpc_binding_handle *b = p->binding_handle;
struct spoolss_GetPrinterDriverDirectory r;
struct {
@@ -456,7 +470,7 @@ static bool test_GetPrinterDriverDirectory(struct torture_context *tctx,
DATA_BLOB blob;
r.in.server = levels[i].server;
- r.in.environment = environment;
+ r.in.environment = ctx->environment;
r.in.level = level;
r.in.buffer = NULL;
r.in.offered = 0;
@@ -593,18 +607,25 @@ static bool test_EnumPrinterDrivers_findone(struct torture_context *tctx,
}
static bool test_EnumPrinterDrivers(struct torture_context *tctx,
- struct dcerpc_pipe *p,
- struct test_spoolss_context *ctx,
- const char *architecture)
+ void *private_data)
{
+ struct test_spoolss_context *ctx =
+ talloc_get_type_abort(private_data, struct test_spoolss_context);
+ struct dcerpc_pipe *p = ctx->spoolss_pipe;
struct dcerpc_binding_handle *b = p->binding_handle;
uint16_t levels[] = { 1, 2, 3, 4, 5, 6, 8 };
- int i, j;
+ int i, j, a;
/* FIXME: gd, come back and fix "" as server, and handle
* priority of returned error codes in torture test and samba 3
* server */
const char *server_name = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p));
+ const char *environments[2];
+
+ environments[0] = SPOOLSS_ARCHITECTURE_ALL;
+ environments[1] = ctx->environment;
+
+ for (a=0;a<ARRAY_SIZE(environments);a++) {
for (i=0;i<ARRAY_SIZE(levels);i++) {
int level = levels[i];
@@ -612,7 +633,7 @@ static bool test_EnumPrinterDrivers(struct torture_context *tctx,
union spoolss_DriverInfo *info;
torture_assert(tctx,
- test_EnumPrinterDrivers_args(tctx, b, server_name, architecture, level, &count, &info),
+ test_EnumPrinterDrivers_args(tctx, b, server_name, environments[a], level, &count, &info),
"failed to enumerate drivers");
ctx->driver_count[level] = count;
@@ -707,14 +728,18 @@ static bool test_EnumPrinterDrivers(struct torture_context *tctx,
}
}
}
+ }
return true;
}
static bool test_EnumMonitors(struct torture_context *tctx,
- struct dcerpc_binding_handle *b,
- struct test_spoolss_context *ctx)
+ void *private_data)
{
+ struct test_spoolss_context *ctx =
+ talloc_get_type_abort(private_data, struct test_spoolss_context);
+ struct dcerpc_pipe *p = ctx->spoolss_pipe;
+ struct dcerpc_binding_handle *b = p->binding_handle;
NTSTATUS status;
struct spoolss_EnumMonitors r;
uint16_t levels[] = { 1, 2 };
@@ -838,12 +863,15 @@ static bool test_EnumPrintProcessors_level(struct torture_context *tctx,
}
static bool test_EnumPrintProcessors(struct torture_context *tctx,
- struct dcerpc_binding_handle *b,
- struct test_spoolss_context *ctx,
- const char *environment)
+ void *private_data)
{
+ struct test_spoolss_context *ctx =
+ talloc_get_type_abort(private_data, struct test_spoolss_context);
+
uint16_t levels[] = { 1 };
int i, j;
+ struct dcerpc_pipe *p = ctx->spoolss_pipe;
+ struct dcerpc_binding_handle *b = p->binding_handle;
for (i=0;i<ARRAY_SIZE(levels);i++) {
int level = levels[i];
@@ -851,7 +879,7 @@ static bool test_EnumPrintProcessors(struct torture_context *tctx,
uint32_t count;
torture_assert(tctx,
- test_EnumPrintProcessors_level(tctx, b, environment, level, &count, &info),
+ test_EnumPrintProcessors_level(tctx, b, ctx->environment, level, &count, &info),
"test_EnumPrintProcessors_level failed");
ctx->print_processor_count[level] = count;
@@ -884,12 +912,17 @@ static bool test_EnumPrintProcessors(struct torture_context *tctx,
}
static bool test_EnumPrintProcDataTypes(struct torture_context *tctx,
- struct dcerpc_binding_handle *b)
+ void *private_data)
{
+ struct test_spoolss_context *ctx =
+ talloc_get_type_abort(private_data, struct test_spoolss_context);
+
NTSTATUS status;
struct spoolss_EnumPrintProcDataTypes r;
uint16_t levels[] = { 1 };
int i;
+ struct dcerpc_pipe *p = ctx->spoolss_pipe;
+ struct dcerpc_binding_handle *b = p->binding_handle;
for (i=0;i<ARRAY_SIZE(levels);i++) {
int level = levels[i];
@@ -936,9 +969,12 @@ static bool test_EnumPrintProcDataTypes(struct torture_context *tctx,
static bool test_EnumPrinters(struct torture_context *tctx,
- struct dcerpc_binding_handle *b,
- struct test_spoolss_context *ctx)
+ void *private_data)
{
+ struct test_spoolss_context *ctx =
+ talloc_get_type_abort(private_data, struct test_spoolss_context);
+ struct dcerpc_pipe *p = ctx->spoolss_pipe;
+ struct dcerpc_binding_handle *b = p->binding_handle;
struct spoolss_EnumPrinters r;
NTSTATUS status;
uint16_t levels[] = { 0, 1, 2, 4, 5 };
@@ -2838,13 +2874,17 @@ static bool test_Forms(struct torture_context *tctx,
}
static bool test_EnumPorts_old(struct torture_context *tctx,
- struct dcerpc_pipe *p)
+ void *private_data)
{
+ struct test_spoolss_context *ctx =
+ talloc_get_type_abort(private_data, struct test_spoolss_context);
+
NTSTATUS status;
struct spoolss_EnumPorts r;
uint32_t needed;
uint32_t count;
union spoolss_PortInfo *info;
+ struct dcerpc_pipe *p = ctx->spoolss_pipe;
struct dcerpc_binding_handle *b = p->binding_handle;
r.in.servername = talloc_asprintf(tctx, "\\\\%s",
@@ -2882,10 +2922,14 @@ static bool test_EnumPorts_old(struct torture_context *tctx,
}
static bool test_AddPort(struct torture_context *tctx,
- struct dcerpc_pipe *p)
+ void *private_data)
{
+ struct test_spoolss_context *ctx =
+ talloc_get_type_abort(private_data, struct test_spoolss_context);
+
NTSTATUS status;
struct spoolss_AddPort r;
+ struct dcerpc_pipe *p = ctx->spoolss_pipe;
struct dcerpc_binding_handle *b = p->binding_handle;
r.in.server_name = talloc_asprintf(tctx, "\\\\%s",
@@ -3529,10 +3573,11 @@ static bool test_get_environment(struct torture_context *tctx,
}
static bool test_GetPrinterData_list(struct torture_context *tctx,
- struct dcerpc_pipe *p,
- struct policy_handle *handle,
- const char **architecture)
+ void *private_data)
{
+ struct test_spoolss_context *ctx =
+ talloc_get_type_abort(private_data, struct test_spoolss_context);
+ struct dcerpc_pipe *p = ctx->spoolss_pipe;
struct dcerpc_binding_handle *b = p->binding_handle;
const char *list[] = {
"W3SvcInstalled",
@@ -3556,20 +3601,13 @@ static bool test_GetPrinterData_list(struct torture_context *tctx,
uint8_t *data, *data_ex;
uint32_t needed, needed_ex;
- torture_assert(tctx, test_GetPrinterData(tctx, b, handle, list[i], &type, &data, &needed),
+ torture_assert(tctx, test_GetPrinterData(tctx, b, &ctx->server_handle, list[i], &type, &data, &needed),
talloc_asprintf(tctx, "GetPrinterData failed on %s\n", list[i]));
- torture_assert(tctx, test_GetPrinterDataEx(tctx, p, handle, "random_string", list[i], &type_ex, &data_ex, &needed_ex),
+ torture_assert(tctx, test_GetPrinterDataEx(tctx, p, &ctx->server_handle, "random_string", list[i], &type_ex, &data_ex, &needed_ex),
talloc_asprintf(tctx, "GetPrinterDataEx failed on %s\n", list[i]));
torture_assert_int_equal(tctx, type, type_ex, "type mismatch");
torture_assert_int_equal(tctx, needed, needed_ex, "needed mismatch");
torture_assert_mem_equal(tctx, data, data_ex, needed, "data mismatch");
-
- if (strequal(list[i], "Architecture")) {
- if (architecture) {
- DATA_BLOB blob = data_blob_const(data, needed);
- *architecture = reg_val_data_string(tctx, REG_SZ, blob);
- }
- }
}
return true;
@@ -5199,6 +5237,17 @@ do {\
return true;
}
+static bool test_print_processors_winreg(struct torture_context *tctx,
+ void *private_data)
+{
+ struct test_spoolss_context *ctx =
+ talloc_get_type_abort(private_data, struct test_spoolss_context);
+ struct dcerpc_pipe *p = ctx->spoolss_pipe;
+ struct dcerpc_binding_handle *b = p->binding_handle;
+
+ return test_PrintProcessors_winreg(tctx, b, ctx->environment);
+}
+
static bool test_GetChangeID_PrinterData(struct torture_context *tctx,
struct dcerpc_binding_handle *b,
struct policy_handle *handle,
@@ -5449,9 +5498,11 @@ static bool test_OpenPrinter_badname(struct torture_context *tctx,
}
static bool test_OpenPrinter_badname_list(struct torture_context *tctx,
- struct dcerpc_binding_handle *b,
- const char *server_name)
+ void *private_data)
{
+ struct test_spoolss_context *ctx =
+ talloc_get_type_abort(private_data, struct test_spoolss_context);
+
const char *badnames[] = {
"__INVALID_PRINTER__",
"\\\\__INVALID_HOST__",
@@ -5460,6 +5511,9 @@ static bool test_OpenPrinter_badname_list(struct torture_context *tctx,
"\\\\\\__INVALID_PRINTER__"
};
const char *badname;
+ struct dcerpc_pipe *p = ctx->spoolss_pipe;
+ const char *server_name = dcerpc_server_name(p);
+ struct dcerpc_binding_handle *b = p->binding_handle;
int i;
for (i=0; i < ARRAY_SIZE(badnames); i++) {
@@ -5749,14 +5803,16 @@ static bool test_OpenPrinterEx(struct torture_context *tctx,
}
static bool test_EnumPrinters_old(struct torture_context *tctx,
- struct dcerpc_pipe *p,
- const char *environment)
+ void *private_data)
{
+ struct test_spoolss_context *ctx =
+ talloc_get_type_abort(private_data, struct test_spoolss_context);
struct spoolss_EnumPrinters r;
NTSTATUS status;
uint16_t levels[] = {1, 2, 4, 5};
int i;
bool ret = true;
+ struct dcerpc_pipe *p = ctx->spoolss_pipe;
struct dcerpc_binding_handle *b = p->binding_handle;
for (i=0;i<ARRAY_SIZE(levels);i++) {
@@ -5810,10 +5866,10 @@ static bool test_EnumPrinters_old(struct torture_context *tctx,
slash++;
name = slash;
}
- if (!test_OpenPrinter(tctx, p, name, environment)) {
+ if (!test_OpenPrinter(tctx, p, name, ctx->environment)) {
ret = false;
}
- if (!test_OpenPrinterEx(tctx, p, name, environment)) {
+ if (!test_OpenPrinterEx(tctx, p, name, ctx->environment)) {
ret = false;
}
}
@@ -5951,11 +6007,13 @@ static bool test_GetPrinterDriver2(struct torture_context *tctx,
}
static bool test_EnumPrinterDrivers_old(struct torture_context *tctx,
- struct dcerpc_pipe *p,
- const char *environment)
+ void *private_data)
{
+ struct test_spoolss_context *ctx =
+ talloc_get_type_abort(private_data, struct test_spoolss_context);
uint16_t levels[] = {1, 2, 3, 4, 5, 6};
int i;
+ struct dcerpc_pipe *p = ctx->spoolss_pipe;
struct dcerpc_binding_handle *b = p->binding_handle;
const char *server_name = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p));
@@ -5965,7 +6023,7 @@ static bool test_EnumPrinterDrivers_old(struct torture_context *tctx,
union spoolss_DriverInfo *info;
torture_assert(tctx,
- test_EnumPrinterDrivers_args(tctx, b, server_name, environment, levels[i], &count, &info),
+ test_EnumPrinterDrivers_args(tctx, b, server_name, ctx->environment, levels[i], &count, &info),
"failed to enumerate drivers");
if (!info) {
@@ -6839,8 +6897,11 @@ static bool test_add_printer_with_devmode(struct torture_context *tctx,
}
static bool test_architecture_buffer(struct torture_context *tctx,
- struct dcerpc_pipe *p)
+ void *private_data)
{
+ struct test_spoolss_context *ctx =
+ talloc_get_type_abort(private_data, struct test_spoolss_context);
+
struct spoolss_OpenPrinterEx r;
struct spoolss_UserLevel1 u1;
struct policy_handle handle;
@@ -6851,6 +6912,7 @@ static bool test_architecture_buffer(struct torture_context *tctx,
};
uint32_t needed[3];
int i;
+ struct dcerpc_pipe *p = ctx->spoolss_pipe;
struct dcerpc_binding_handle *b = p->binding_handle;
for (i=0; i < ARRAY_SIZE(architectures); i++) {
@@ -6910,49 +6972,116 @@ static bool test_architecture_buffer(struct torture_context *tctx,
return true;
}
-bool torture_rpc_spoolss(struct torture_context *torture)
+static bool test_PrintServer_Forms_Winreg(struct torture_context *tctx,
+ void *private_data)
+{
+ struct test_spoolss_context *ctx =
+ talloc_get_type_abort(private_data, struct test_spoolss_context);
+ struct dcerpc_pipe *p = ctx->spoolss_pipe;
+ struct dcerpc_binding_handle *b = p->binding_handle;
+
+ return test_Forms_winreg(tctx, b, &ctx->server_handle, true, NULL);
+}
+
+static bool test_PrintServer_Forms(struct torture_context *tctx,
+ void *private_data)
+{
+ struct test_spoolss_context *ctx =
+ talloc_get_type_abort(private_data, struct test_spoolss_context);
+ struct dcerpc_pipe *p = ctx->spoolss_pipe;
+ struct dcerpc_binding_handle *b = p->binding_handle;
--
Samba Shared Repository
More information about the samba-cvs
mailing list