[SCM] Samba Shared Repository - branch master updated
Günther Deschner
gd at samba.org
Mon Sep 27 17:17:29 MDT 2010
The branch, master has been updated
via 48adfb2 samr: add three new ACB flags to IDL.
via 77d4c28 s3-spoolss: Fix _spoolss_EnumPrintProcDataTypes error handling
via 93d7230 s4-smbtorture: rework spoolss_EnumPrintProcDataTypes test.
via 2921888 s3-spoolss: Fix _spoolss_EnumPrintProcessors error handling
via a335848 s4-smbtorture: rework test_EnumPrintProcessors to let it test more combinations.
via 0e1588a s3-waf: add NDR_PERFCOUNT subsystem.
from 7fbe700 s4-ildap: fixed a talloc_steal with references error
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 48adfb264f0a8772ac04fc51af1c39460c011acb
Author: Günther Deschner <gd at samba.org>
Date: Tue Sep 28 01:10:57 2010 +0200
samr: add three new ACB flags to IDL.
Guenther
commit 77d4c280323ffc9f5f5f17023c90d0a904e14126
Author: Günther Deschner <gd at samba.org>
Date: Tue Sep 28 00:10:54 2010 +0200
s3-spoolss: Fix _spoolss_EnumPrintProcDataTypes error handling
commit 93d7230d25427af2955a9209335f657b8a901860
Author: Günther Deschner <gd at samba.org>
Date: Tue Sep 28 00:10:31 2010 +0200
s4-smbtorture: rework spoolss_EnumPrintProcDataTypes test.
Guenther
commit 2921888a0808efbe765e3f52a83a91c2e03a44a6
Author: Günther Deschner <gd at samba.org>
Date: Tue Sep 28 00:10:17 2010 +0200
s3-spoolss: Fix _spoolss_EnumPrintProcessors error handling
commit a335848a883d98247470b0beb1eed14afec802de
Author: Günther Deschner <gd at samba.org>
Date: Mon Sep 27 23:33:52 2010 +0200
s4-smbtorture: rework test_EnumPrintProcessors to let it test more combinations.
Guenther
commit 0e1588aa980069dd267b3b0207db453c6ab23023
Author: Günther Deschner <gd at samba.org>
Date: Mon Sep 27 08:10:58 2010 +0200
s3-waf: add NDR_PERFCOUNT subsystem.
Guenther
-----------------------------------------------------------------------
Summary of changes:
librpc/idl/samr.idl | 5 +-
source3/librpc/wscript_build | 5 +
source3/rpc_server/srv_spoolss_nt.c | 9 ++
source3/wscript_build | 5 +-
source4/torture/rpc/spoolss.c | 153 ++++++++++++++++++++--------------
5 files changed, 110 insertions(+), 67 deletions(-)
Changeset truncated at 500 lines:
diff --git a/librpc/idl/samr.idl b/librpc/idl/samr.idl
index d977ddd..f54d626 100644
--- a/librpc/idl/samr.idl
+++ b/librpc/idl/samr.idl
@@ -44,7 +44,10 @@ import "misc.idl", "lsa.idl", "security.idl";
ACB_USE_DES_KEY_ONLY = 0x00008000, /* 1 = Use DES key only */
ACB_DONT_REQUIRE_PREAUTH = 0x00010000, /* 1 = Preauth not required */
ACB_PW_EXPIRED = 0x00020000, /* 1 = Password Expired */
- ACB_NO_AUTH_DATA_REQD = 0x00080000 /* 1 = No authorization data required */
+ ACB_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION = 0x00040000,
+ ACB_NO_AUTH_DATA_REQD = 0x00080000, /* 1 = No authorization data required */
+ ACB_PARTIAL_SECRETS_ACCOUNT = 0x00100000,
+ ACB_USE_AES_KEYS = 0x00200000
} samr_AcctFlags;
/* SAM server specific access rights */
diff --git a/source3/librpc/wscript_build b/source3/librpc/wscript_build
index dfeacf6..66713ef 100644
--- a/source3/librpc/wscript_build
+++ b/source3/librpc/wscript_build
@@ -30,6 +30,11 @@ bld.SAMBA_SUBSYSTEM('NDR_SECRETS',
public_deps='LIBNDR'
)
+bld.SAMBA_SUBSYSTEM('NDR_PERFCOUNT',
+ source='gen_ndr/ndr_perfcount.c',
+ public_deps='LIBNDR'
+ )
+
bld.SAMBA_SUBSYSTEM('NDR_WBINT',
source='gen_ndr/ndr_wbint.c',
public_deps='LIBNDR'
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index acb0513..89a835f 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -8501,6 +8501,10 @@ WERROR _spoolss_EnumPrintProcessors(struct pipes_struct *p,
*r->out.needed = 0;
*r->out.info = NULL;
+ if (!get_short_archi(r->in.environment)) {
+ return WERR_INVALID_ENVIRONMENT;
+ }
+
switch (r->in.level) {
case 1:
result = enumprintprocessors_level_1(p->mem_ctx, r->out.info,
@@ -8592,6 +8596,11 @@ WERROR _spoolss_EnumPrintProcDataTypes(struct pipes_struct *p,
*r->out.needed = 0;
*r->out.info = NULL;
+ if (r->in.print_processor_name == NULL ||
+ !strequal(r->in.print_processor_name, "winprint")) {
+ return WERR_UNKNOWN_PRINTPROCESSOR;
+ }
+
switch (r->in.level) {
case 1:
result = enumprintprocdatatypes_level_1(p->mem_ctx, r->out.info,
diff --git a/source3/wscript_build b/source3/wscript_build
index e42e84b..c44485f 100644
--- a/source3/wscript_build
+++ b/source3/wscript_build
@@ -386,8 +386,7 @@ REG_FULL_SRC = '''${REG_SMBCONF_SRC}
${REG_BACKENDS_EXTRA_SRC}
${REG_INIT_FULL_SRC}
registry/reg_eventlog.c
- registry/reg_perfcount.c
- librpc/gen_ndr/ndr_perfcount.c'''
+ registry/reg_perfcount.c'''
SERVICES_SRC = '''services/svc_spoolss.c
services/svc_rcinit.c
@@ -1213,7 +1212,7 @@ bld.SAMBA_SUBSYSTEM('SMBD_BASE',
PARAM_WITHOUT_REG LIBS LIBSMB POPT_SAMBA KRBCLIENT AVAHI
LIBMSRPC_GEN LIBMSRPC LIBADS LIBADS_SERVER LIBADS_PRINTER
VFS RPC_MODULES AUTH LOCKING LIBAFS LIBAFS_SETTOKEN PROFILE LIBNET LIBEVENTLOG
- REGFIO REG_API_REGF PRINTING PRINTBACKEND SERVICES NDR_XATTR''',
+ REGFIO REG_API_REGF PRINTING PRINTBACKEND SERVICES NDR_XATTR NDR_PERFCOUNT''',
vars=locals())
bld.SAMBA_SUBSYSTEM('RPC_MODULES',
diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c
index c1079af..b577815 100644
--- a/source4/torture/rpc/spoolss.c
+++ b/source4/torture/rpc/spoolss.c
@@ -820,7 +820,8 @@ static bool test_EnumPrintProcessors_level(struct torture_context *tctx,
const char *environment,
uint32_t level,
uint32_t *count_p,
- union spoolss_PrintProcessorInfo **info_p)
+ union spoolss_PrintProcessorInfo **info_p,
+ WERROR expected_result)
{
struct spoolss_EnumPrintProcessors r;
DATA_BLOB blob;
@@ -837,7 +838,8 @@ static bool test_EnumPrintProcessors_level(struct torture_context *tctx,
r.out.count = &count;
r.out.info = &info;
- torture_comment(tctx, "Testing EnumPrintProcessors level %u\n", r.in.level);
+ torture_comment(tctx, "Testing EnumPrintProcessors(%s) level %u\n",
+ r.in.environment, r.in.level);
torture_assert_ntstatus_ok(tctx,
dcerpc_spoolss_EnumPrintProcessors_r(b, tctx, &r),
@@ -850,7 +852,7 @@ static bool test_EnumPrintProcessors_level(struct torture_context *tctx,
dcerpc_spoolss_EnumPrintProcessors_r(b, tctx, &r),
"EnumPrintProcessors failed");
}
- torture_assert_werr_ok(tctx, r.out.result,
+ torture_assert_werr_equal(tctx, r.out.result, expected_result,
"EnumPrintProcessors failed");
CHECK_NEEDED_SIZE_ENUM_LEVEL(spoolss_EnumPrintProcessors, info, level, count, needed, 4);
@@ -871,44 +873,76 @@ static bool test_EnumPrintProcessors(struct torture_context *tctx,
struct test_spoolss_context *ctx =
talloc_get_type_abort(private_data, struct test_spoolss_context);
- uint16_t levels[] = { 1 };
- int i, j;
+ uint16_t levels[] = {0, 1, 2, 3, 32, 256 };
+ uint16_t ok[] = {0, 1, 0, 0, 0, 0 };
+ int i;
struct dcerpc_pipe *p = ctx->spoolss_pipe;
struct dcerpc_binding_handle *b = p->binding_handle;
+ torture_assert(tctx,
+ test_EnumPrintProcessors_level(tctx, b, "phantasy", 1, NULL, NULL, WERR_INVALID_ENVIRONMENT),
+ "test_EnumPrintProcessors_level failed");
+
for (i=0;i<ARRAY_SIZE(levels);i++) {
- int level = levels[i];
union spoolss_PrintProcessorInfo *info;
uint32_t count;
+ WERROR expected_result = ok[i] ? WERR_OK : WERR_INVALID_LEVEL;
torture_assert(tctx,
- test_EnumPrintProcessors_level(tctx, b, ctx->environment, level, &count, &info),
+ test_EnumPrintProcessors_level(tctx, b, ctx->environment, levels[i], &count, &info, expected_result),
"test_EnumPrintProcessors_level failed");
-
- ctx->print_processor_count[level] = count;
- ctx->print_processors[level] = info;
}
- for (i=1;i<ARRAY_SIZE(levels);i++) {
- int level = levels[i];
- int old_level = levels[i-1];
- torture_assert_int_equal(tctx, ctx->print_processor_count[level], ctx->print_processor_count[old_level],
- "EnumPrintProcessors failed");
+ return true;
+}
+
+static bool test_EnumPrintProcDataTypes_level(struct torture_context *tctx,
+ struct dcerpc_binding_handle *b,
+ const char *print_processor_name,
+ uint32_t level,
+ uint32_t *count_p,
+ union spoolss_PrintProcDataTypesInfo **info_p,
+ WERROR expected_result)
+{
+ struct spoolss_EnumPrintProcDataTypes r;
+ DATA_BLOB blob;
+ uint32_t needed;
+ uint32_t count;
+ union spoolss_PrintProcDataTypesInfo *info;
+
+ r.in.servername = "";
+ r.in.print_processor_name = print_processor_name;
+ r.in.level = level;
+ r.in.buffer = NULL;
+ r.in.offered = 0;
+ r.out.needed = &needed;
+ r.out.count = &count;
+ r.out.info = &info;
+
+ torture_comment(tctx, "Testing EnumPrintProcDataTypes(%s) level %u\n",
+ r.in.print_processor_name, r.in.level);
+
+ torture_assert_ntstatus_ok(tctx,
+ dcerpc_spoolss_EnumPrintProcDataTypes_r(b, tctx, &r),
+ "EnumPrintProcDataTypes failed");
+ if (W_ERROR_EQUAL(r.out.result, WERR_INSUFFICIENT_BUFFER)) {
+ blob = data_blob_talloc_zero(tctx, needed);
+ r.in.buffer = &blob;
+ r.in.offered = needed;
+ torture_assert_ntstatus_ok(tctx,
+ dcerpc_spoolss_EnumPrintProcDataTypes_r(b, tctx, &r),
+ "EnumPrintProcDataTypes failed");
}
+ torture_assert_werr_equal(tctx, r.out.result, expected_result,
+ "EnumPrintProcDataTypes failed");
- for (i=0;i<ARRAY_SIZE(levels);i++) {
- int level = levels[i];
- for (j=0;j<ctx->print_processor_count[level];j++) {
-#if 0
- union spoolss_PrintProcessorInfo *cur = &ctx->print_processors[level][j];
- union spoolss_PrintProcessorInfo *ref = &ctx->print_processors[1][j];
-#endif
- switch (level) {
- case 1:
- /* level 1 is our reference, and it makes no sense to compare it to itself */
- break;
- }
- }
+ CHECK_NEEDED_SIZE_ENUM_LEVEL(spoolss_EnumPrintProcDataTypes, info, level, count, needed, 4);
+
+ if (count_p) {
+ *count_p = count;
+ }
+ if (info_p) {
+ *info_p = info;
}
return true;
@@ -920,57 +954,50 @@ static bool test_EnumPrintProcDataTypes(struct torture_context *tctx,
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 };
+ uint16_t levels[] = {0, 1, 2, 3, 32, 256 };
+ uint16_t ok[] = {0, 1, 0, 0, 0, 0 };
int i;
struct dcerpc_pipe *p = ctx->spoolss_pipe;
struct dcerpc_binding_handle *b = p->binding_handle;
+ torture_assert(tctx,
+ test_EnumPrintProcDataTypes_level(tctx, b, NULL, 1, NULL, NULL, WERR_UNKNOWN_PRINTPROCESSOR),
+ "test_EnumPrintProcDataTypes_level failed");
+
+ torture_assert(tctx,
+ test_EnumPrintProcDataTypes_level(tctx, b, "nonexisting", 1, NULL, NULL, WERR_UNKNOWN_PRINTPROCESSOR),
+ "test_EnumPrintProcDataTypes_level failed");
+
for (i=0;i<ARRAY_SIZE(levels);i++) {
int level = levels[i];
- DATA_BLOB blob;
- uint32_t needed;
uint32_t count;
union spoolss_PrintProcDataTypesInfo *info;
+ WERROR expected_result = ok[i] ? WERR_OK : WERR_INVALID_LEVEL;
- r.in.servername = "";
- r.in.print_processor_name = "winprint";
- r.in.level = level;
- r.in.buffer = NULL;
- r.in.offered = 0;
- r.out.needed = &needed;
- r.out.count = &count;
- r.out.info = &info;
-
- torture_comment(tctx, "Testing EnumPrintProcDataTypes level %u\n", r.in.level);
-
- status = dcerpc_spoolss_EnumPrintProcDataTypes_r(b, tctx, &r);
- torture_assert_ntstatus_ok(tctx, status, "dcerpc_spoolss_EnumPrintProcDataType failed");
- if (W_ERROR_IS_OK(r.out.result)) {
- /* TODO: do some more checks here */
- continue;
- }
- torture_assert_werr_equal(tctx, r.out.result, WERR_INSUFFICIENT_BUFFER,
- "EnumPrintProcDataTypes unexpected return code");
-
- blob = data_blob_talloc_zero(tctx, needed);
- r.in.buffer = &blob;
- r.in.offered = needed;
-
- status = dcerpc_spoolss_EnumPrintProcDataTypes_r(b, tctx, &r);
- torture_assert_ntstatus_ok(tctx, status, "dcerpc_spoolss_EnumPrintProcDataTypes failed");
+ torture_assert(tctx,
+ test_EnumPrintProcDataTypes_level(tctx, b, "winprint", level, &count, &info, expected_result),
+ "test_EnumPrintProcDataTypes_level failed");
+ }
- torture_assert_werr_ok(tctx, r.out.result, "EnumPrintProcDataTypes failed");
+ {
+ union spoolss_PrintProcessorInfo *info;
+ uint32_t count;
- CHECK_NEEDED_SIZE_ENUM_LEVEL(spoolss_EnumPrintProcDataTypes, info, r.in.level, count, needed, 4);
+ torture_assert(tctx,
+ test_EnumPrintProcessors_level(tctx, b, ctx->environment, 1, &count, &info, WERR_OK),
+ "test_EnumPrintProcessors_level failed");
+ for (i=0; i < count; i++) {
+ torture_assert(tctx,
+ test_EnumPrintProcDataTypes_level(tctx, b, info[i].info1.print_processor_name, 1, NULL, NULL, WERR_OK),
+ "test_EnumPrintProcDataTypes_level failed");
+ }
}
+
return true;
}
-
static bool test_EnumPrinters(struct torture_context *tctx,
void *private_data)
{
@@ -4424,7 +4451,7 @@ static bool test_PrintProcessors(struct torture_context *tctx,
torture_comment(tctx, "Testing Print Processor Info and winreg consistency\n");
torture_assert(tctx,
- test_EnumPrintProcessors_level(tctx, b, environment, 1, &count, &info),
+ test_EnumPrintProcessors_level(tctx, b, environment, 1, &count, &info, WERR_OK),
"failed to enum print processors level 1");
for (i=0; i < count; i++) {
--
Samba Shared Repository
More information about the samba-cvs
mailing list