The branch, master has been updated
       via  835e7d6... spoolss: remove unused spoolss_StringArray2.
       via  ce33967... s4-smbtorture: fix and extend enum printerkey test.
       via  f20effc... s3-spoolss: fix enumprinter key client and server.
       via  fa413d1... s3: re-run make samba3-idl.
       via  0ecb7f6... spoolss: use spoolss_KeyNames in spoolss_EnumPrinterKey.
       via  cf25614... spoolss: add spoolss_KeyNames union.
      from  0604c69... s3:packaging: Fix version detection.

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


- Log -----------------------------------------------------------------
commit 835e7d6c98406725dc9dab891d3025b9a11b7eb9
Author: Günther Deschner <[email protected]>
Date:   Thu Dec 10 14:23:49 2009 +0100

    spoolss: remove unused spoolss_StringArray2.
    
    Guenther

commit ce33967f4a6a762e97a87513df7d33716db689fb
Author: Günther Deschner <[email protected]>
Date:   Thu Dec 10 14:21:12 2009 +0100

    s4-smbtorture: fix and extend enum printerkey test.
    
    Guenther

commit f20effc437970d826c5bd4f047ff47e23e7a1a73
Author: Günther Deschner <[email protected]>
Date:   Thu Dec 10 14:20:22 2009 +0100

    s3-spoolss: fix enumprinter key client and server.
    
    Guenther

commit fa413d167bc3ea9aff3dcff97152ef07a1173939
Author: Günther Deschner <[email protected]>
Date:   Thu Dec 10 14:27:33 2009 +0100

    s3: re-run make samba3-idl.
    
    Guenther

commit 0ecb7f6ab28d7b7c1844554289f5ae8e876b1dcf
Author: Günther Deschner <[email protected]>
Date:   Thu Dec 10 14:19:28 2009 +0100

    spoolss: use spoolss_KeyNames in spoolss_EnumPrinterKey.
    
    Guenther

commit cf2561473f7bd0bcef5c562c1e901d4ad17e6ee3
Author: Günther Deschner <[email protected]>
Date:   Thu Dec 10 14:18:46 2009 +0100

    spoolss: add spoolss_KeyNames union.
    
    Guenther

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

Summary of changes:
 librpc/gen_ndr/cli_spoolss.c        |    9 ++-
 librpc/gen_ndr/cli_spoolss.h        |    6 +-
 librpc/gen_ndr/ndr_spoolss.c        |  145 ++++++++++++++++++++++++++++++++---
 librpc/gen_ndr/ndr_spoolss.h        |    4 +-
 librpc/gen_ndr/spoolss.h            |   12 ++--
 librpc/gen_ndr/srv_spoolss.c        |   15 +++-
 librpc/idl/spoolss.idl              |   14 ++--
 librpc/ndr/ndr_spoolss_buf.c        |   65 ----------------
 librpc/ndr/ndr_spoolss_buf.h        |    3 -
 source3/rpc_client/cli_spoolss.c    |    7 +-
 source3/rpc_server/srv_spoolss_nt.c |   13 +++-
 source4/torture/rpc/spoolss.c       |   58 +++++++++++---
 source4/torture/rpc/spoolss_win.c   |   12 +--
 13 files changed, 237 insertions(+), 126 deletions(-)


Changeset truncated at 500 lines:

diff --git a/librpc/gen_ndr/cli_spoolss.c b/librpc/gen_ndr/cli_spoolss.c
index e63a781..c6bb8ed 100644
--- a/librpc/gen_ndr/cli_spoolss.c
+++ b/librpc/gen_ndr/cli_spoolss.c
@@ -12207,7 +12207,8 @@ struct tevent_req 
*rpccli_spoolss_EnumPrinterKey_send(TALLOC_CTX *mem_ctx,
                                                      struct rpc_pipe_client 
*cli,
                                                      struct policy_handle 
*_handle /* [in] [ref] */,
                                                      const char *_key_name /* 
[in] [charset(UTF16)] */,
-                                                     struct 
spoolss_StringArray2 *_key_buffer /* [out] [ref] */,
+                                                     uint32_t *__ndr_size /* 
[out] [ref] */,
+                                                     union spoolss_KeyNames 
*_key_buffer /* [out] 
[subcontext_size(*_ndr_size*2),ref,subcontext(0),switch_is(*_ndr_size)] */,
                                                      uint32_t _offered /* [in] 
 */,
                                                      uint32_t *_needed /* 
[out] [ref] */)
 {
@@ -12229,6 +12230,7 @@ struct tevent_req 
*rpccli_spoolss_EnumPrinterKey_send(TALLOC_CTX *mem_ctx,
        state->orig.in.offered = _offered;
 
        /* Out parameters */
+       state->orig.out._ndr_size = __ndr_size;
        state->orig.out.key_buffer = _key_buffer;
        state->orig.out.needed = _needed;
 
@@ -12278,6 +12280,7 @@ static void rpccli_spoolss_EnumPrinterKey_done(struct 
tevent_req *subreq)
        }
 
        /* Copy out parameters */
+       *state->orig.out._ndr_size = *state->tmp.out._ndr_size;
        *state->orig.out.key_buffer = *state->tmp.out.key_buffer;
        *state->orig.out.needed = *state->tmp.out.needed;
 
@@ -12317,7 +12320,8 @@ NTSTATUS rpccli_spoolss_EnumPrinterKey(struct 
rpc_pipe_client *cli,
                                       TALLOC_CTX *mem_ctx,
                                       struct policy_handle *handle /* [in] 
[ref] */,
                                       const char *key_name /* [in] 
[charset(UTF16)] */,
-                                      struct spoolss_StringArray2 *key_buffer 
/* [out] [ref] */,
+                                      uint32_t *_ndr_size /* [out] [ref] */,
+                                      union spoolss_KeyNames *key_buffer /* 
[out] [subcontext_size(*_ndr_size*2),ref,subcontext(0),switch_is(*_ndr_size)] 
*/,
                                       uint32_t offered /* [in]  */,
                                       uint32_t *needed /* [out] [ref] */,
                                       WERROR *werror)
@@ -12345,6 +12349,7 @@ NTSTATUS rpccli_spoolss_EnumPrinterKey(struct 
rpc_pipe_client *cli,
        }
 
        /* Return variables */
+       *_ndr_size = *r.out._ndr_size;
        *key_buffer = *r.out.key_buffer;
        *needed = *r.out.needed;
 
diff --git a/librpc/gen_ndr/cli_spoolss.h b/librpc/gen_ndr/cli_spoolss.h
index f2c1353..cae24be 100644
--- a/librpc/gen_ndr/cli_spoolss.h
+++ b/librpc/gen_ndr/cli_spoolss.h
@@ -1262,7 +1262,8 @@ struct tevent_req 
*rpccli_spoolss_EnumPrinterKey_send(TALLOC_CTX *mem_ctx,
                                                      struct rpc_pipe_client 
*cli,
                                                      struct policy_handle 
*_handle /* [in] [ref] */,
                                                      const char *_key_name /* 
[in] [charset(UTF16)] */,
-                                                     struct 
spoolss_StringArray2 *_key_buffer /* [out] [ref] */,
+                                                     uint32_t *__ndr_size /* 
[out] [ref] */,
+                                                     union spoolss_KeyNames 
*_key_buffer /* [out] 
[subcontext_size(*_ndr_size*2),ref,subcontext(0),switch_is(*_ndr_size)] */,
                                                      uint32_t _offered /* [in] 
 */,
                                                      uint32_t *_needed /* 
[out] [ref] */);
 NTSTATUS rpccli_spoolss_EnumPrinterKey_recv(struct tevent_req *req,
@@ -1272,7 +1273,8 @@ NTSTATUS rpccli_spoolss_EnumPrinterKey(struct 
rpc_pipe_client *cli,
                                       TALLOC_CTX *mem_ctx,
                                       struct policy_handle *handle /* [in] 
[ref] */,
                                       const char *key_name /* [in] 
[charset(UTF16)] */,
-                                      struct spoolss_StringArray2 *key_buffer 
/* [out] [ref] */,
+                                      uint32_t *_ndr_size /* [out] [ref] */,
+                                      union spoolss_KeyNames *key_buffer /* 
[out] [subcontext_size(*_ndr_size*2),ref,subcontext(0),switch_is(*_ndr_size)] 
*/,
                                       uint32_t offered /* [in]  */,
                                       uint32_t *needed /* [out] [ref] */,
                                       WERROR *werror);
diff --git a/librpc/gen_ndr/ndr_spoolss.c b/librpc/gen_ndr/ndr_spoolss.c
index 9a72dd3..79cabd8 100644
--- a/librpc/gen_ndr/ndr_spoolss.c
+++ b/librpc/gen_ndr/ndr_spoolss.c
@@ -8125,15 +8125,6 @@ _PUBLIC_ void ndr_print_spoolss_StringArray(struct 
ndr_print *ndr, const char *n
        ndr->depth--;
 }
 
-_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");
-       ndr->depth++;
-       ndr_print_uint32(ndr, "_ndr_size", (ndr->flags & 
LIBNDR_PRINT_SET_VALUES)?(ndr_size_spoolss_StringArray2(r, 
ndr->iconv_convenience, ndr->flags) - 4) / 2:r->_ndr_size);
-       ndr_print_string_array(ndr, "string", r->string);
-       ndr->depth--;
-}
-
 static enum ndr_err_code ndr_push_spoolss_AddDriverInfo1(struct ndr_push *ndr, 
int ndr_flags, const struct spoolss_AddDriverInfo1 *r)
 {
        if (ndr_flags & NDR_SCALARS) {
@@ -19613,6 +19604,105 @@ _PUBLIC_ size_t 
ndr_size_spoolss_PrinterEnumValues(const struct spoolss_PrinterE
        return ndr_size_struct(r, flags, 
(ndr_push_flags_fn_t)ndr_push_spoolss_PrinterEnumValues, ic);
 }
 
+static enum ndr_err_code ndr_push_spoolss_KeyNames(struct ndr_push *ndr, int 
ndr_flags, const union spoolss_KeyNames *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               int level = ndr_push_get_switch_value(ndr, r);
+               NDR_CHECK(ndr_push_union_align(ndr, 4));
+               switch (level) {
+                       case 0: {
+                       break; }
+
+                       case 1: {
+                       break; }
+
+                       default: {
+                               {
+                                       uint32_t _flags_save_string_array = 
ndr->flags;
+                                       ndr_set_flags(&ndr->flags, 
LIBNDR_FLAG_STR_NULLTERM);
+                                       NDR_CHECK(ndr_push_string_array(ndr, 
NDR_SCALARS, r->string_array));
+                                       ndr->flags = _flags_save_string_array;
+                               }
+                       break; }
+
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               int level = ndr_push_get_switch_value(ndr, r);
+               switch (level) {
+                       case 0:
+                       break;
+
+                       case 1:
+                       break;
+
+                       default:
+                       break;
+
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_spoolss_KeyNames(struct ndr_pull *ndr, int 
ndr_flags, union spoolss_KeyNames *r)
+{
+       int level;
+       level = ndr_pull_get_switch_value(ndr, r);
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_union_align(ndr, 4));
+               switch (level) {
+                       case 0: {
+                       break; }
+
+                       case 1: {
+                       break; }
+
+                       default: {
+                               {
+                                       uint32_t _flags_save_string_array = 
ndr->flags;
+                                       ndr_set_flags(&ndr->flags, 
LIBNDR_FLAG_STR_NULLTERM);
+                                       NDR_CHECK(ndr_pull_string_array(ndr, 
NDR_SCALARS, &r->string_array));
+                                       ndr->flags = _flags_save_string_array;
+                               }
+                       break; }
+
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               switch (level) {
+                       case 0:
+                       break;
+
+                       case 1:
+                       break;
+
+                       default:
+                       break;
+
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_spoolss_KeyNames(struct ndr_print *ndr, const char 
*name, const union spoolss_KeyNames *r)
+{
+       int level;
+       level = ndr_print_get_switch_value(ndr, r);
+       ndr_print_union(ndr, name, level, "spoolss_KeyNames");
+       switch (level) {
+               case 0:
+               break;
+
+               case 1:
+               break;
+
+               default:
+                       ndr_print_string_array(ndr, "string_array", 
r->string_array);
+               break;
+
+       }
+}
+
 _PUBLIC_ enum ndr_err_code ndr_push_spoolss_DeleteDriverFlags(struct ndr_push 
*ndr, int ndr_flags, uint32_t r)
 {
        NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
@@ -28139,10 +28229,20 @@ _PUBLIC_ enum ndr_err_code 
ndr_push_spoolss_EnumPrinterKey(struct ndr_push *ndr,
                NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.offered));
        }
        if (flags & NDR_OUT) {
+               if (r->out._ndr_size == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, 
"NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out._ndr_size));
                if (r->out.key_buffer == NULL) {
                        return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, 
"NULL [ref] pointer");
                }
-               NDR_CHECK(ndr_push_spoolss_StringArray2(ndr, NDR_SCALARS, 
r->out.key_buffer));
+               {
+                       struct ndr_push *_ndr_key_buffer;
+                       NDR_CHECK(ndr_push_subcontext_start(ndr, 
&_ndr_key_buffer, 0, *r->out._ndr_size * 2));
+                       NDR_CHECK(ndr_push_set_switch_value(_ndr_key_buffer, 
r->out.key_buffer, *r->out._ndr_size));
+                       NDR_CHECK(ndr_push_spoolss_KeyNames(_ndr_key_buffer, 
NDR_SCALARS|NDR_BUFFERS, r->out.key_buffer));
+                       NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_key_buffer, 
0, *r->out._ndr_size * 2));
+               }
                if (r->out.needed == NULL) {
                        return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, 
"NULL [ref] pointer");
                }
@@ -28155,6 +28255,7 @@ _PUBLIC_ enum ndr_err_code 
ndr_push_spoolss_EnumPrinterKey(struct ndr_push *ndr,
 _PUBLIC_ enum ndr_err_code ndr_pull_spoolss_EnumPrinterKey(struct ndr_pull 
*ndr, int flags, struct spoolss_EnumPrinterKey *r)
 {
        TALLOC_CTX *_mem_save_handle_0;
+       TALLOC_CTX *_mem_save__ndr_size_0;
        TALLOC_CTX *_mem_save_key_buffer_0;
        TALLOC_CTX *_mem_save_needed_0;
        if (flags & NDR_IN) {
@@ -28175,6 +28276,8 @@ _PUBLIC_ enum ndr_err_code 
ndr_pull_spoolss_EnumPrinterKey(struct ndr_pull *ndr,
                NDR_CHECK(ndr_check_string_terminator(ndr, 
ndr_get_array_length(ndr, &r->in.key_name), sizeof(uint16_t)));
                NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.key_name, 
ndr_get_array_length(ndr, &r->in.key_name), sizeof(uint16_t), CH_UTF16));
                NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.offered));
+               NDR_PULL_ALLOC(ndr, r->out._ndr_size);
+               ZERO_STRUCTP(r->out._ndr_size);
                NDR_PULL_ALLOC(ndr, r->out.key_buffer);
                ZERO_STRUCTP(r->out.key_buffer);
                NDR_PULL_ALLOC(ndr, r->out.needed);
@@ -28182,11 +28285,24 @@ _PUBLIC_ enum ndr_err_code 
ndr_pull_spoolss_EnumPrinterKey(struct ndr_pull *ndr,
        }
        if (flags & NDR_OUT) {
                if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out._ndr_size);
+               }
+               _mem_save__ndr_size_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out._ndr_size, 
LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out._ndr_size));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save__ndr_size_0, 
LIBNDR_FLAG_REF_ALLOC);
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
                        NDR_PULL_ALLOC(ndr, r->out.key_buffer);
                }
                _mem_save_key_buffer_0 = NDR_PULL_GET_MEM_CTX(ndr);
                NDR_PULL_SET_MEM_CTX(ndr, r->out.key_buffer, 
LIBNDR_FLAG_REF_ALLOC);
-               NDR_CHECK(ndr_pull_spoolss_StringArray2(ndr, NDR_SCALARS, 
r->out.key_buffer));
+               {
+                       struct ndr_pull *_ndr_key_buffer;
+                       NDR_CHECK(ndr_pull_subcontext_start(ndr, 
&_ndr_key_buffer, 0, *r->out._ndr_size * 2));
+                       NDR_CHECK(ndr_pull_set_switch_value(_ndr_key_buffer, 
r->out.key_buffer, *r->out._ndr_size));
+                       NDR_CHECK(ndr_pull_spoolss_KeyNames(_ndr_key_buffer, 
NDR_SCALARS|NDR_BUFFERS, r->out.key_buffer));
+                       NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_key_buffer, 
0, *r->out._ndr_size * 2));
+               }
                NDR_PULL_SET_MEM_CTX(ndr, _mem_save_key_buffer_0, 
LIBNDR_FLAG_REF_ALLOC);
                if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
                        NDR_PULL_ALLOC(ndr, r->out.needed);
@@ -28221,9 +28337,14 @@ _PUBLIC_ void ndr_print_spoolss_EnumPrinterKey(struct 
ndr_print *ndr, const char
        if (flags & NDR_OUT) {
                ndr_print_struct(ndr, "out", "spoolss_EnumPrinterKey");
                ndr->depth++;
+               ndr_print_ptr(ndr, "_ndr_size", r->out._ndr_size);
+               ndr->depth++;
+               ndr_print_uint32(ndr, "_ndr_size", *r->out._ndr_size);
+               ndr->depth--;
                ndr_print_ptr(ndr, "key_buffer", r->out.key_buffer);
                ndr->depth++;
-               ndr_print_spoolss_StringArray2(ndr, "key_buffer", 
r->out.key_buffer);
+               ndr_print_set_switch_value(ndr, r->out.key_buffer, 
*r->out._ndr_size);
+               ndr_print_spoolss_KeyNames(ndr, "key_buffer", 
r->out.key_buffer);
                ndr->depth--;
                ndr_print_ptr(ndr, "needed", r->out.needed);
                ndr->depth++;
diff --git a/librpc/gen_ndr/ndr_spoolss.h b/librpc/gen_ndr/ndr_spoolss.h
index 1c31a95..2fb6e9f 100644
--- a/librpc/gen_ndr/ndr_spoolss.h
+++ b/librpc/gen_ndr/ndr_spoolss.h
@@ -345,9 +345,6 @@ void ndr_print_spoolss_SetPrinterInfoCtr(struct ndr_print 
*ndr, const char *name
 enum ndr_err_code ndr_push_spoolss_StringArray(struct ndr_push *ndr, int 
ndr_flags, const struct spoolss_StringArray *r);
 enum ndr_err_code ndr_pull_spoolss_StringArray(struct ndr_pull *ndr, int 
ndr_flags, struct spoolss_StringArray *r);
 void ndr_print_spoolss_StringArray(struct ndr_print *ndr, const char *name, 
const struct spoolss_StringArray *r);
-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);
-void ndr_print_spoolss_StringArray2(struct ndr_print *ndr, const char *name, 
const struct spoolss_StringArray2 *r);
 void ndr_print_spoolss_AddDriverInfo1(struct ndr_print *ndr, const char *name, 
const struct spoolss_AddDriverInfo1 *r);
 enum ndr_err_code ndr_push_spoolss_DriverOSVersion(struct ndr_push *ndr, int 
ndr_flags, enum spoolss_DriverOSVersion r);
 enum ndr_err_code ndr_pull_spoolss_DriverOSVersion(struct ndr_pull *ndr, int 
ndr_flags, enum spoolss_DriverOSVersion *r);
@@ -525,6 +522,7 @@ enum ndr_err_code ndr_push_spoolss_PrinterEnumValues(struct 
ndr_push *ndr, int n
 enum ndr_err_code ndr_pull_spoolss_PrinterEnumValues(struct ndr_pull *ndr, int 
ndr_flags, struct spoolss_PrinterEnumValues *r);
 void ndr_print_spoolss_PrinterEnumValues(struct ndr_print *ndr, const char 
*name, const struct spoolss_PrinterEnumValues *r);
 size_t ndr_size_spoolss_PrinterEnumValues(const struct 
spoolss_PrinterEnumValues *r, struct smb_iconv_convenience *ic, int flags);
+void ndr_print_spoolss_KeyNames(struct ndr_print *ndr, const char *name, const 
union spoolss_KeyNames *r);
 enum ndr_err_code ndr_push_spoolss_DeleteDriverFlags(struct ndr_push *ndr, int 
ndr_flags, uint32_t r);
 enum ndr_err_code ndr_pull_spoolss_DeleteDriverFlags(struct ndr_pull *ndr, int 
ndr_flags, uint32_t *r);
 void ndr_print_spoolss_DeleteDriverFlags(struct ndr_print *ndr, const char 
*name, uint32_t r);
diff --git a/librpc/gen_ndr/spoolss.h b/librpc/gen_ndr/spoolss.h
index 2f2e8f2..77d7c52 100644
--- a/librpc/gen_ndr/spoolss.h
+++ b/librpc/gen_ndr/spoolss.h
@@ -1210,11 +1210,6 @@ struct spoolss_StringArray {
        const char ** string;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */
 }/* [public] */;
 
-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)] */
-}/* [nopush,public,nopull] */;
-
 struct spoolss_AddDriverInfo1 {
        const char *driver_name;/* [unique,charset(UTF16)] */
 };
@@ -2058,6 +2053,10 @@ struct spoolss_PrinterEnumValues {
        uint32_t data_length;/* 
[value(ndr_size_spoolss_PrinterData(data,type,ndr->iconv_convenience,ndr->flags))]
 */
 }/* [relative_base,gensize,public] */;
 
+union spoolss_KeyNames {
+       const char ** string_array;/* [default,flag(LIBNDR_FLAG_STR_NULLTERM)] 
*/
+}/* [nodiscriminant] */;
+
 /* bitmap spoolss_DeleteDriverFlags */
 #define DPD_DELETE_UNUSED_FILES ( 0x00000001 )
 #define DPD_DELETE_SPECIFIC_VERSION ( 0x00000002 )
@@ -3620,7 +3619,8 @@ struct spoolss_EnumPrinterKey {
        } in;
 
        struct {
-               struct spoolss_StringArray2 *key_buffer;/* [ref] */
+               uint32_t *_ndr_size;/* [ref] */
+               union spoolss_KeyNames *key_buffer;/* 
[subcontext_size(*_ndr_size*2),ref,subcontext(0),switch_is(*_ndr_size)] */
                uint32_t *needed;/* [ref] */
                WERROR result;
        } out;
diff --git a/librpc/gen_ndr/srv_spoolss.c b/librpc/gen_ndr/srv_spoolss.c
index bc50c0b..cc11d12 100644
--- a/librpc/gen_ndr/srv_spoolss.c
+++ b/librpc/gen_ndr/srv_spoolss.c
@@ -6325,7 +6325,13 @@ static bool api_spoolss_EnumPrinterKey(pipes_struct *p)
        }
 
        ZERO_STRUCT(r->out);
-       r->out.key_buffer = talloc_zero(r, struct spoolss_StringArray2);
+       r->out._ndr_size = talloc_zero(r, uint32_t);
+       if (r->out._ndr_size == NULL) {
+               talloc_free(r);
+               return false;
+       }
+
+       r->out.key_buffer = talloc_zero(r, union spoolss_KeyNames);
        if (r->out.key_buffer == NULL) {
                talloc_free(r);
                return false;
@@ -9504,7 +9510,12 @@ NTSTATUS rpc_spoolss_dispatch(struct rpc_pipe_client 
*cli, TALLOC_CTX *mem_ctx,
                case NDR_SPOOLSS_ENUMPRINTERKEY: {
                        struct spoolss_EnumPrinterKey *r = (struct 
spoolss_EnumPrinterKey *)_r;
                        ZERO_STRUCT(r->out);
-                       r->out.key_buffer = talloc_zero(mem_ctx, struct 
spoolss_StringArray2);
+                       r->out._ndr_size = talloc_zero(mem_ctx, uint32_t);
+                       if (r->out._ndr_size == NULL) {
+                       return NT_STATUS_NO_MEMORY;
+                       }
+
+                       r->out.key_buffer = talloc_zero(mem_ctx, union 
spoolss_KeyNames);
                        if (r->out.key_buffer == NULL) {
                        return NT_STATUS_NO_MEMORY;
                        }
diff --git a/librpc/idl/spoolss.idl b/librpc/idl/spoolss.idl
index 64b2676..ceff885 100644
--- a/librpc/idl/spoolss.idl
+++ b/librpc/idl/spoolss.idl
@@ -980,11 +980,6 @@ import "misc.idl", "security.idl", "winreg.idl";
                /*[subcontext(0),subcontext_size(_ndr_size*2)]*/ nstring_array 
string;
        } spoolss_StringArray;
 
-       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;
-
        typedef struct {
                [string,charset(UTF16)] uint16 *driver_name;
        } spoolss_AddDriverInfo1;
@@ -2607,12 +2602,19 @@ import "misc.idl", "security.idl", "winreg.idl";
                [out,ref] uint32 *needed
        );
 
+       typedef [nodiscriminant] union {
+               [case(0)];
+               [case(1)];
+               [default] nstring_array string_array;
+       } spoolss_KeyNames;
+
        /******************/
        /* Function: 0x50 */
        [public] WERROR spoolss_EnumPrinterKey(
                [in, ref] policy_handle *handle,
                [in] [string,charset(UTF16)] uint16 key_name[],
-               [out,ref] spoolss_StringArray2 *key_buffer,
+               [out,ref] uint32 *_ndr_size,
+               
[out,ref,subcontext(0),subcontext_size(*_ndr_size*2),switch_is(*_ndr_size)] 
spoolss_KeyNames *key_buffer,
                [in] uint32 offered,
                [out,ref] uint32 *needed
        );
diff --git a/librpc/ndr/ndr_spoolss_buf.c b/librpc/ndr/ndr_spoolss_buf.c
index 84d4305..853d9aa 100644
--- a/librpc/ndr/ndr_spoolss_buf.c
+++ b/librpc/ndr/ndr_spoolss_buf.c
@@ -855,71 +855,6 @@ _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)
-{
-       uint32_t i;
-
-       if (!r || !r->string) {
-               return 0;
-       }
-
-       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
  * structs */
 
diff --git a/librpc/ndr/ndr_spoolss_buf.h b/librpc/ndr/ndr_spoolss_buf.h
index 478931e..c0c553b 100644
--- a/librpc/ndr/ndr_spoolss_buf.h
+++ b/librpc/ndr/ndr_spoolss_buf.h
@@ -50,9 +50,6 @@ enum ndr_err_code ndr_pull_spoolss_GetPrinterDataEx(struct 
ndr_pull *ndr, int fl
 enum ndr_err_code ndr_push_spoolss_SetPrinterDataEx(struct ndr_push *ndr, int 
flags, const struct spoolss_SetPrinterDataEx *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);
 void ndr_print_spoolss_Field(struct ndr_print *ndr, const char *name, const 
union spoolss_Field *r);
diff --git a/source3/rpc_client/cli_spoolss.c b/source3/rpc_client/cli_spoolss.c
index 047cb70..d0781a0 100644


-- 
Samba Shared Repository

Reply via email to