summaryrefslogtreecommitdiff
path: root/librpc
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-12-02 21:26:10 +0100
committerGünther Deschner <gd@samba.org>2009-12-03 01:04:02 +0100
commitf32ccc321a5467401781a0e2d4621175b6256368 (patch)
tree3bdf0ebe3f03f692c02de5446f260eb8d8796833 /librpc
parent8d7a43fed709b0ae4baaa861c30f2ee89a423dbb (diff)
downloadsamba-f32ccc321a5467401781a0e2d4621175b6256368.tar.gz
samba-f32ccc321a5467401781a0e2d4621175b6256368.tar.bz2
samba-f32ccc321a5467401781a0e2d4621175b6256368.zip
spoolss: hand-marshall the spoolss_StringArray2 struct for spoolss_EnumPrinterKey.
This call is just driving me nuts :-) Guenther
Diffstat (limited to 'librpc')
-rw-r--r--librpc/gen_ndr/ndr_spoolss.c46
-rw-r--r--librpc/gen_ndr/spoolss.h2
-rw-r--r--librpc/idl/spoolss.idl2
-rw-r--r--librpc/ndr/ndr_spoolss_buf.c62
-rw-r--r--librpc/ndr/ndr_spoolss_buf.h2
5 files changed, 63 insertions, 51 deletions
diff --git a/librpc/gen_ndr/ndr_spoolss.c b/librpc/gen_ndr/ndr_spoolss.c
index 41d07d1e60..f783a834ee 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 8b9a1ee8eb..e209cb464b 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 3ae1685e66..154a4efdaf 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 9968e90c6a..4965b5d709 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 9a76f824f0..74d0b52b3e 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);