[SCM] Samba Shared Repository - branch master updated
Günther Deschner
gd at samba.org
Wed Dec 2 17:04:54 MST 2009
The branch, master has been updated
via 9a3d9ab... s3-selftest: run LOCAL-NDR when running make selftest.
via 450211b... s4-smbtorture: be very strict in checking spools_EnumPrinterKey results.
via f32ccc3... spoolss: hand-marshall the spoolss_StringArray2 struct for spoolss_EnumPrinterKey.
from 8d7a43f... s4-drs: fixed UDV and overlapping sync calls in DRS
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 9a3d9abdd8e9737245e3cdd7f31d453c2062dba9
Author: Günther Deschner <gd at samba.org>
Date: Thu Dec 3 00:46:47 2009 +0100
s3-selftest: run LOCAL-NDR when running make selftest.
Guenther
commit 450211b61016a4fed71eb116c1b526af0f365f13
Author: Günther Deschner <gd at samba.org>
Date: Wed Dec 2 23:38:05 2009 +0100
s4-smbtorture: be very strict in checking spools_EnumPrinterKey results.
Guenther
commit f32ccc321a5467401781a0e2d4621175b6256368
Author: Günther Deschner <gd at samba.org>
Date: Wed Dec 2 21:26:10 2009 +0100
spoolss: hand-marshall the spoolss_StringArray2 struct for spoolss_EnumPrinterKey.
This call is just driving me nuts :-)
Guenther
-----------------------------------------------------------------------
Summary of changes:
librpc/gen_ndr/ndr_spoolss.c | 46 ------------------------
librpc/gen_ndr/spoolss.h | 2 +-
librpc/idl/spoolss.idl | 2 +-
librpc/ndr/ndr_spoolss_buf.c | 62 +++++++++++++++++++++++++++++++--
librpc/ndr/ndr_spoolss_buf.h | 2 +
source3/script/tests/test_posix_s3.sh | 2 +-
source4/torture/rpc/spoolss.c | 9 ++++-
source4/torture/rpc/spoolss_win.c | 9 ++++-
8 files changed, 79 insertions(+), 55 deletions(-)
Changeset truncated at 500 lines:
diff --git a/librpc/gen_ndr/ndr_spoolss.c b/librpc/gen_ndr/ndr_spoolss.c
index 41d07d1..f783a83 100644
--- a/librpc/gen_ndr/ndr_spoolss.c
+++ b/librpc/gen_ndr/ndr_spoolss.c
@@ -8125,52 +8125,6 @@ _PUBLIC_ void ndr_print_spoolss_StringArray(struct ndr_print *ndr, const char *n
ndr->depth--;
}
-_PUBLIC_ enum ndr_err_code ndr_push_spoolss_StringArray2(struct ndr_push *ndr, int ndr_flags, const struct spoolss_StringArray2 *r)
-{
- if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_push_align(ndr, 4));
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, (ndr_size_spoolss_StringArray2(r, ndr->iconv_convenience, ndr->flags) - 4) / 2));
- {
- uint32_t _flags_save_string_array = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
- {
- struct ndr_push *_ndr_string;
- NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_string, 0, (ndr_size_spoolss_StringArray2(r, ndr->iconv_convenience, ndr->flags) - 4) / 2 * 2));
- NDR_CHECK(ndr_push_string_array(_ndr_string, NDR_SCALARS, r->string));
- NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_string, 0, (ndr_size_spoolss_StringArray2(r, ndr->iconv_convenience, ndr->flags) - 4) / 2 * 2));
- }
- ndr->flags = _flags_save_string_array;
- }
- NDR_CHECK(ndr_push_trailer_align(ndr, 4));
- }
- if (ndr_flags & NDR_BUFFERS) {
- }
- return NDR_ERR_SUCCESS;
-}
-
-_PUBLIC_ enum ndr_err_code ndr_pull_spoolss_StringArray2(struct ndr_pull *ndr, int ndr_flags, struct spoolss_StringArray2 *r)
-{
- if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_pull_align(ndr, 4));
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->_ndr_size));
- {
- uint32_t _flags_save_string_array = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
- {
- struct ndr_pull *_ndr_string;
- NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_string, 0, r->_ndr_size * 2));
- NDR_CHECK(ndr_pull_string_array(_ndr_string, NDR_SCALARS, &r->string));
- NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_string, 0, r->_ndr_size * 2));
- }
- ndr->flags = _flags_save_string_array;
- }
- NDR_CHECK(ndr_pull_trailer_align(ndr, 4));
- }
- if (ndr_flags & NDR_BUFFERS) {
- }
- return NDR_ERR_SUCCESS;
-}
-
_PUBLIC_ void ndr_print_spoolss_StringArray2(struct ndr_print *ndr, const char *name, const struct spoolss_StringArray2 *r)
{
ndr_print_struct(ndr, name, "spoolss_StringArray2");
diff --git a/librpc/gen_ndr/spoolss.h b/librpc/gen_ndr/spoolss.h
index 8b9a1ee..e209cb4 100644
--- a/librpc/gen_ndr/spoolss.h
+++ b/librpc/gen_ndr/spoolss.h
@@ -1209,7 +1209,7 @@ struct spoolss_StringArray {
struct spoolss_StringArray2 {
uint32_t _ndr_size;/* [value((ndr_size_spoolss_StringArray2(r,ndr->iconv_convenience,ndr->flags)-4)/2)] */
const char ** string;/* [subcontext_size(_ndr_size*2),subcontext(0),flag(LIBNDR_FLAG_STR_NULLTERM)] */
-}/* [public] */;
+}/* [nopush,public,nopull] */;
struct spoolss_AddDriverInfo1 {
const char *driver_name;/* [unique,charset(UTF16)] */
diff --git a/librpc/idl/spoolss.idl b/librpc/idl/spoolss.idl
index 3ae1685..154a4ef 100644
--- a/librpc/idl/spoolss.idl
+++ b/librpc/idl/spoolss.idl
@@ -980,7 +980,7 @@ import "misc.idl", "security.idl", "winreg.idl";
/*[subcontext(0),subcontext_size(_ndr_size*2)]*/ nstring_array string;
} spoolss_StringArray;
- typedef [public] struct {
+ typedef [public,nopush,nopull] struct {
[value((ndr_size_spoolss_StringArray2(r, ndr->iconv_convenience, ndr->flags)-4)/2)] uint32 _ndr_size;
[subcontext(0),subcontext_size(_ndr_size*2)] nstring_array string;
} spoolss_StringArray2;
diff --git a/librpc/ndr/ndr_spoolss_buf.c b/librpc/ndr/ndr_spoolss_buf.c
index 9968e90..4965b5d 100644
--- a/librpc/ndr/ndr_spoolss_buf.c
+++ b/librpc/ndr/ndr_spoolss_buf.c
@@ -708,13 +708,69 @@ _PUBLIC_ size_t ndr_size_spoolss_StringArray(const struct spoolss_StringArray *r
return ndr_size_struct(r, flags, (ndr_push_flags_fn_t)ndr_push_spoolss_StringArray, ic);
}
+_PUBLIC_ enum ndr_err_code ndr_push_spoolss_StringArray2(struct ndr_push *ndr, int ndr_flags, const struct spoolss_StringArray2 *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ uint32_t _ndr_size;
+ _ndr_size = ndr_size_spoolss_StringArray2(r, ndr->iconv_convenience, ndr->flags);
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, _ndr_size));
+ if (_ndr_size > 0) {
+ uint32_t _flags_save_string_array = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ {
+ struct ndr_push *_ndr_string;
+ NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_string, 0, _ndr_size * 2));
+ NDR_CHECK(ndr_push_string_array(_ndr_string, NDR_SCALARS, r->string));
+ NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_string, 0, _ndr_size * 2));
+ }
+ ndr->flags = _flags_save_string_array;
+ }
+ NDR_CHECK(ndr_push_trailer_align(ndr, 4));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
_PUBLIC_ size_t ndr_size_spoolss_StringArray2(const struct spoolss_StringArray2 *r, struct smb_iconv_convenience *ic, int flags)
{
- if (!r) {
- return 4;
+ uint32_t i;
+
+ if (!r || !r->string) {
+ return 0;
}
- return ndr_size_struct((const struct spoolss_StringArray *)r, flags, (ndr_push_flags_fn_t)ndr_push_spoolss_StringArray, ic);
+ for (i=0; r->string[i]; i++) {
+ ;;
+ }
+
+ return (ndr_size_string_array(r->string, i, LIBNDR_FLAG_STR_NULLTERM) + 1);
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_spoolss_StringArray2(struct ndr_pull *ndr, int ndr_flags, struct spoolss_StringArray2 *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->_ndr_size));
+ if (r->_ndr_size) {
+ uint32_t _flags_save_string_array = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ {
+ struct ndr_pull *_ndr_string;
+ NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_string, 0, r->_ndr_size * 2));
+ NDR_CHECK(ndr_pull_string_array(_ndr_string, NDR_SCALARS, &r->string));
+ NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_string, 0, r->_ndr_size * 2));
+ }
+ ndr->flags = _flags_save_string_array;
+ } else {
+ r->string = NULL;
+ }
+ NDR_CHECK(ndr_pull_trailer_align(ndr, 4));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
}
/* hand marshall as pidl cannot (yet) generate a relative pointer to a fixed array of
diff --git a/librpc/ndr/ndr_spoolss_buf.h b/librpc/ndr/ndr_spoolss_buf.h
index 9a76f82..74d0b52 100644
--- a/librpc/ndr/ndr_spoolss_buf.h
+++ b/librpc/ndr/ndr_spoolss_buf.h
@@ -47,6 +47,8 @@ enum ndr_err_code ndr_pull_spoolss_GetPrinterData(struct ndr_pull *ndr, int flag
enum ndr_err_code ndr_push_spoolss_SetPrinterData(struct ndr_push *ndr, int flags, const struct spoolss_SetPrinterData *r);
uint32_t _ndr_size_spoolss_DeviceMode(struct spoolss_DeviceMode *devmode, struct smb_iconv_convenience *ic, uint32_t flags);
size_t ndr_size_spoolss_StringArray(const struct spoolss_StringArray *r, struct smb_iconv_convenience *ic, int flags);
+enum ndr_err_code ndr_push_spoolss_StringArray2(struct ndr_push *ndr, int ndr_flags, const struct spoolss_StringArray2 *r);
+enum ndr_err_code ndr_pull_spoolss_StringArray2(struct ndr_pull *ndr, int ndr_flags, struct spoolss_StringArray2 *r);
size_t ndr_size_spoolss_StringArray2(const struct spoolss_StringArray2 *r, struct smb_iconv_convenience *ic, int flags);
_PUBLIC_ enum ndr_err_code ndr_push_spoolss_DriverInfo101(struct ndr_push *ndr, int ndr_flags, const struct spoolss_DriverInfo101 *r);
_PUBLIC_ enum ndr_err_code ndr_pull_spoolss_DriverInfo101(struct ndr_pull *ndr, int ndr_flags, struct spoolss_DriverInfo101 *r);
diff --git a/source3/script/tests/test_posix_s3.sh b/source3/script/tests/test_posix_s3.sh
index d54cf7b..07d2873 100755
--- a/source3/script/tests/test_posix_s3.sh
+++ b/source3/script/tests/test_posix_s3.sh
@@ -48,7 +48,7 @@ rpc="$rpc RPC-SAMR-PASSWORDS-PWDLASTSET RPC-SAMR-LARGE-DC RPC-SAMR-MACHINE-AUTH"
rpc="$rpc RPC-NETLOGON-S3 RPC-NETLOGON-ADMIN"
rpc="$rpc RPC-SCHANNEL RPC-SCHANNEL2 RPC-BENCH-SCHANNEL1 RPC-JOIN"
-local="LOCAL-NSS-WRAPPER"
+local="LOCAL-NSS-WRAPPER LOCAL-NDR"
winbind="WINBIND-WBCLIENT"
diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c
index e341b71..bd5c455 100644
--- a/source4/torture/rpc/spoolss.c
+++ b/source4/torture/rpc/spoolss.c
@@ -3060,6 +3060,9 @@ bool test_printer_keys(struct torture_context *tctx,
torture_assert_ntstatus_ok(tctx, dcerpc_spoolss_EnumPrinterKey(p, tctx, &r),
"failed to call EnumPrinterKey");
if (W_ERROR_EQUAL(r.out.result, WERR_MORE_DATA)) {
+ torture_assert(tctx, (key_buffer._ndr_size == 0),
+ talloc_asprintf(tctx, "EnumPrinterKey did not return 0 _ndr_size (but %d), windows clients would abort here!", key_buffer._ndr_size));
+
r.in.offered = needed;
torture_assert_ntstatus_ok(tctx, dcerpc_spoolss_EnumPrinterKey(p, tctx, &r),
"failed to call EnumPrinterKey");
@@ -3067,10 +3070,14 @@ bool test_printer_keys(struct torture_context *tctx,
torture_assert_werr_ok(tctx, r.out.result,
"failed to call EnumPrinterKey");
+ torture_assert(tctx, (key_buffer._ndr_size * 2 == needed),
+ talloc_asprintf(tctx, "EnumPrinterKey size mismatch, _ndr_size %d (expected %d)",
+ key_buffer._ndr_size, needed/2));
+
key_array = key_buffer.string;
}
- for (i=0; key_array[i]; i++) {
+ for (i=0; key_array && key_array[i]; i++) {
struct spoolss_EnumPrinterDataEx r;
uint32_t count;
struct spoolss_PrinterEnumValues *info;
diff --git a/source4/torture/rpc/spoolss_win.c b/source4/torture/rpc/spoolss_win.c
index d2851cf..8856729 100644
--- a/source4/torture/rpc/spoolss_win.c
+++ b/source4/torture/rpc/spoolss_win.c
@@ -397,8 +397,9 @@ static bool test_EnumPrinterKey(struct torture_context *tctx,
status = dcerpc_spoolss_EnumPrinterKey(p, tctx, &epk);
torture_assert_ntstatus_ok(tctx, status, "EnumPrinterKey failed");
-
if (W_ERROR_EQUAL(epk.out.result, WERR_MORE_DATA)) {
+ torture_assert(tctx, (key_buffer._ndr_size == 0),
+ talloc_asprintf(tctx, "EnumPrinterKey did not return 0 _ndr_size (but %d), windows clients would abort here!", key_buffer._ndr_size));
epk.in.offered = needed;
status = dcerpc_spoolss_EnumPrinterKey(p, tctx, &epk);
torture_assert_ntstatus_ok(tctx, status,
@@ -407,6 +408,10 @@ static bool test_EnumPrinterKey(struct torture_context *tctx,
torture_assert_werr_ok(tctx, epk.out.result, "EnumPrinterKey failed");
+ torture_assert(tctx, (key_buffer._ndr_size * 2 == needed),
+ talloc_asprintf(tctx, "EnumPrinterKey size mismatch, _ndr_size %d (expected %d)",
+ key_buffer._ndr_size, needed/2));
+
ctx->printer_keys = key_buffer.string;
return true;
@@ -550,7 +555,7 @@ static bool test_WinXP(struct torture_context *tctx, struct dcerpc_pipe *p)
ret &= test_EnumPrinterKey(tctx, p, &handle03, "", ctx);
- for (i=0; ctx->printer_keys[i] != NULL; i++) {
+ for (i=0; ctx->printer_keys && ctx->printer_keys[i] != NULL; i++) {
ret &= test_EnumPrinterKey(tctx, p, &handle03,
ctx->printer_keys[i],
--
Samba Shared Repository
More information about the samba-cvs
mailing list