The branch, master has been updated
       via  143a5b89eeb669640299e67d82decb38512d4f3c (commit)
       via  b156bd2124a7be375f21e3086629fffa83500032 (commit)
       via  cd5a314b51cb852dcfa452791c0cf857883f600f (commit)
       via  6f38fe3e66d1af1ed22dd8ddf88798d39c0f826b (commit)
       via  1ebd35e872a7ef4def2a835ecb371079020fa53d (commit)
       via  117d6d1686bbbd158f0c74836c0e173c02a1b77b (commit)
      from  ab6d6c7c131d6bf23251fe3fe84765cbe73934f7 (commit)

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


- Log -----------------------------------------------------------------
commit 143a5b89eeb669640299e67d82decb38512d4f3c
Author: Günther Deschner <[email protected]>
Date:   Fri Feb 6 18:34:04 2009 +0100

    s4-spoolss: fix dcesrv_spoolss_GetPrinterData.
    
    Guenther

commit b156bd2124a7be375f21e3086629fffa83500032
Author: Günther Deschner <[email protected]>
Date:   Fri Feb 6 18:33:34 2009 +0100

    s4-spoolss: fix sptr_GetPrintServerData.
    
    Guenther

commit cd5a314b51cb852dcfa452791c0cf857883f600f
Author: Günther Deschner <[email protected]>
Date:   Fri Feb 6 18:32:24 2009 +0100

    s4-smbtorture: fix test_GetPrinterData.
    
    Guenther

commit 6f38fe3e66d1af1ed22dd8ddf88798d39c0f826b
Author: Günther Deschner <[email protected]>
Date:   Fri Feb 6 18:35:01 2009 +0100

    s3: re-run make samba3-idl.
    
    Guenther

commit 1ebd35e872a7ef4def2a835ecb371079020fa53d
Author: Günther Deschner <[email protected]>
Date:   Fri Feb 6 18:32:44 2009 +0100

    spoolss: fix ndr_pull/push_spoolss_GetPrinterData.
    
    Guenther

commit 117d6d1686bbbd158f0c74836c0e173c02a1b77b
Author: Günther Deschner <[email protected]>
Date:   Fri Feb 6 18:31:46 2009 +0100

    spoolss: fix type pointer in spoolss_GetPrinterData and related functions.
    
    Guenther

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

Summary of changes:
 librpc/gen_ndr/cli_spoolss.c                |    6 +++---
 librpc/gen_ndr/cli_spoolss.h                |    4 ++--
 librpc/gen_ndr/ndr_spoolss.c                |   23 +++++++++++++++++++----
 librpc/gen_ndr/spoolss.h                    |    6 +++---
 librpc/idl/spoolss.idl                      |    6 +++---
 librpc/ndr/ndr_spoolss_buf.c                |    4 ++--
 source4/ntptr/simple_ldb/ntptr_simple_ldb.c |   26 +++++++++++++-------------
 source4/rpc_server/spoolss/dcesrv_spoolss.c |    4 ++--
 source4/torture/rpc/spoolss.c               |    2 ++
 source4/torture/rpc/spoolss_win.c           |    2 ++
 10 files changed, 51 insertions(+), 32 deletions(-)


Changeset truncated at 500 lines:

diff --git a/librpc/gen_ndr/cli_spoolss.c b/librpc/gen_ndr/cli_spoolss.c
index 04065c8..d8dc5a9 100644
--- a/librpc/gen_ndr/cli_spoolss.c
+++ b/librpc/gen_ndr/cli_spoolss.c
@@ -1269,8 +1269,8 @@ NTSTATUS rpccli_spoolss_GetPrinterData(struct 
rpc_pipe_client *cli,
                                       struct policy_handle *handle /* [in] 
[ref] */,
                                       const char *value_name /* [in] 
[charset(UTF16)] */,
                                       uint32_t offered /* [in]  */,
-                                      enum spoolss_PrinterDataType type /* 
[out]  */,
-                                      union spoolss_PrinterData data /* [out] 
[subcontext_size(offered),subcontext(4),switch_is(type)] */,
+                                      enum spoolss_PrinterDataType *type /* 
[out] [ref] */,
+                                      union spoolss_PrinterData data /* [out] 
[subcontext_size(offered),subcontext(4),switch_is(*type)] */,
                                       uint32_t *needed /* [out] [ref] */,
                                       WERROR *werror)
 {
@@ -1305,7 +1305,7 @@ NTSTATUS rpccli_spoolss_GetPrinterData(struct 
rpc_pipe_client *cli,
        }
 
        /* Return variables */
-       return NT_STATUS_NOT_SUPPORTED;
+       *type = *r.out.type;
        return NT_STATUS_NOT_SUPPORTED;
        *needed = *r.out.needed;
 
diff --git a/librpc/gen_ndr/cli_spoolss.h b/librpc/gen_ndr/cli_spoolss.h
index bea0440..6a4ffb0 100644
--- a/librpc/gen_ndr/cli_spoolss.h
+++ b/librpc/gen_ndr/cli_spoolss.h
@@ -173,8 +173,8 @@ NTSTATUS rpccli_spoolss_GetPrinterData(struct 
rpc_pipe_client *cli,
                                       struct policy_handle *handle /* [in] 
[ref] */,
                                       const char *value_name /* [in] 
[charset(UTF16)] */,
                                       uint32_t offered /* [in]  */,
-                                      enum spoolss_PrinterDataType type /* 
[out]  */,
-                                      union spoolss_PrinterData data /* [out] 
[subcontext_size(offered),subcontext(4),switch_is(type)] */,
+                                      enum spoolss_PrinterDataType *type /* 
[out] [ref] */,
+                                      union spoolss_PrinterData data /* [out] 
[subcontext_size(offered),subcontext(4),switch_is(*type)] */,
                                       uint32_t *needed /* [out] [ref] */,
                                       WERROR *werror);
 NTSTATUS rpccli_spoolss_SetPrinterData(struct rpc_pipe_client *cli,
diff --git a/librpc/gen_ndr/ndr_spoolss.c b/librpc/gen_ndr/ndr_spoolss.c
index 20d3255..3d2191a 100644
--- a/librpc/gen_ndr/ndr_spoolss.c
+++ b/librpc/gen_ndr/ndr_spoolss.c
@@ -11640,7 +11640,10 @@ _PUBLIC_ enum ndr_err_code 
ndr_push__spoolss_GetPrinterData(struct ndr_push *ndr
                NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.offered));
        }
        if (flags & NDR_OUT) {
-               NDR_CHECK(ndr_push_spoolss_PrinterDataType(ndr, NDR_SCALARS, 
r->out.type));
+               if (r->out.type == NULL) {
+                       return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, 
"NULL [ref] pointer");
+               }
+               NDR_CHECK(ndr_push_spoolss_PrinterDataType(ndr, NDR_SCALARS, 
*r->out.type));
                NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->out.data));
                if (r->out.needed == NULL) {
                        return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, 
"NULL [ref] pointer");
@@ -11654,6 +11657,7 @@ _PUBLIC_ enum ndr_err_code 
ndr_push__spoolss_GetPrinterData(struct ndr_push *ndr
 _PUBLIC_ enum ndr_err_code ndr_pull__spoolss_GetPrinterData(struct ndr_pull 
*ndr, int flags, struct _spoolss_GetPrinterData *r)
 {
        TALLOC_CTX *_mem_save_handle_0;
+       TALLOC_CTX *_mem_save_type_0;
        TALLOC_CTX *_mem_save_needed_0;
        if (flags & NDR_IN) {
                ZERO_STRUCT(r->out);
@@ -11673,11 +11677,19 @@ _PUBLIC_ enum ndr_err_code 
ndr_pull__spoolss_GetPrinterData(struct ndr_pull *ndr
                NDR_CHECK(ndr_check_string_terminator(ndr, 
ndr_get_array_length(ndr, &r->in.value_name), sizeof(uint16_t)));
                NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.value_name, 
ndr_get_array_length(ndr, &r->in.value_name), sizeof(uint16_t), CH_UTF16));
                NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.offered));
+               NDR_PULL_ALLOC(ndr, r->out.type);
+               ZERO_STRUCTP(r->out.type);
                NDR_PULL_ALLOC(ndr, r->out.needed);
                ZERO_STRUCTP(r->out.needed);
        }
        if (flags & NDR_OUT) {
-               NDR_CHECK(ndr_pull_spoolss_PrinterDataType(ndr, NDR_SCALARS, 
&r->out.type));
+               if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+                       NDR_PULL_ALLOC(ndr, r->out.type);
+               }
+               _mem_save_type_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->out.type, LIBNDR_FLAG_REF_ALLOC);
+               NDR_CHECK(ndr_pull_spoolss_PrinterDataType(ndr, NDR_SCALARS, 
r->out.type));
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_type_0, 
LIBNDR_FLAG_REF_ALLOC);
                NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->out.data));
                if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
                        NDR_PULL_ALLOC(ndr, r->out.needed);
@@ -11738,8 +11750,11 @@ _PUBLIC_ void ndr_print_spoolss_GetPrinterData(struct 
ndr_print *ndr, const char
        if (flags & NDR_OUT) {
                ndr_print_struct(ndr, "out", "spoolss_GetPrinterData");
                ndr->depth++;
-               ndr_print_spoolss_PrinterDataType(ndr, "type", r->out.type);
-               ndr_print_set_switch_value(ndr, &r->out.data, r->out.type);
+               ndr_print_ptr(ndr, "type", r->out.type);
+               ndr->depth++;
+               ndr_print_spoolss_PrinterDataType(ndr, "type", *r->out.type);
+               ndr->depth--;
+               ndr_print_set_switch_value(ndr, &r->out.data, *r->out.type);
                ndr_print_spoolss_PrinterData(ndr, "data", &r->out.data);
                ndr_print_ptr(ndr, "needed", r->out.needed);
                ndr->depth++;
diff --git a/librpc/gen_ndr/spoolss.h b/librpc/gen_ndr/spoolss.h
index fc32177..692e9a9 100644
--- a/librpc/gen_ndr/spoolss.h
+++ b/librpc/gen_ndr/spoolss.h
@@ -1240,7 +1240,7 @@ struct _spoolss_GetPrinterData {
        } in;
 
        struct {
-               enum spoolss_PrinterDataType type;
+               enum spoolss_PrinterDataType *type;/* [ref] */
                DATA_BLOB data;
                uint32_t *needed;/* [ref] */
                WERROR result;
@@ -1269,8 +1269,8 @@ struct spoolss_GetPrinterData {
        } in;
 
        struct {
-               enum spoolss_PrinterDataType type;
-               union spoolss_PrinterData data;/* 
[subcontext_size(offered),subcontext(4),switch_is(type)] */
+               enum spoolss_PrinterDataType *type;/* [ref] */
+               union spoolss_PrinterData data;/* 
[subcontext_size(offered),subcontext(4),switch_is(*type)] */
                uint32_t *needed;/* [ref] */
                WERROR result;
        } out;
diff --git a/librpc/idl/spoolss.idl b/librpc/idl/spoolss.idl
index 2709f6c..5bac2d8 100644
--- a/librpc/idl/spoolss.idl
+++ b/librpc/idl/spoolss.idl
@@ -767,7 +767,7 @@ import "misc.idl", "security.idl", "winreg.idl";
                [in,ref] policy_handle *handle,
                [in]     [string,charset(UTF16)] uint16 value_name[],
                [in]     uint32 offered,
-               [out]    spoolss_PrinterDataType type,
+               [out,ref] spoolss_PrinterDataType *type,
                [out]    DATA_BLOB data,
                [out,ref] uint32 *needed
        );
@@ -779,8 +779,8 @@ import "misc.idl", "security.idl", "winreg.idl";
                [in,ref] policy_handle *handle,
                [in]     [string,charset(UTF16)] uint16 value_name[],
                [in]     uint32 offered,
-               [out]    spoolss_PrinterDataType type,
-               [out,subcontext(4),subcontext_size(offered),switch_is(type)] 
spoolss_PrinterData data,
+               [out,ref] spoolss_PrinterDataType *type,
+               [out,subcontext(4),subcontext_size(offered),switch_is(*type)] 
spoolss_PrinterData data,
                [out,ref] uint32 *needed
        );
 
diff --git a/librpc/ndr/ndr_spoolss_buf.c b/librpc/ndr/ndr_spoolss_buf.c
index 501ddff..c18f31a 100644
--- a/librpc/ndr/ndr_spoolss_buf.c
+++ b/librpc/ndr/ndr_spoolss_buf.c
@@ -421,7 +421,7 @@ enum ndr_err_code ndr_push_spoolss_GetPrinterData(struct 
ndr_push *ndr, int flag
                        _ndr_info = ndr_push_init_ctx(ndr, 
ndr->iconv_convenience);
                        NDR_ERR_HAVE_NO_MEMORY(_ndr_info);
                        _ndr_info->flags= ndr->flags;
-                       __r.in.type     = r->out.type;
+                       __r.in.type     = *r->out.type;
                        __r.out.data    = r->out.data;
                        NDR_CHECK(ndr_push___spoolss_GetPrinterData(_ndr_info, 
flags, &__r));
                        if (r->in.offered > _ndr_info->offset) {
@@ -476,7 +476,7 @@ enum ndr_err_code ndr_pull_spoolss_GetPrinterData(struct 
ndr_pull *ndr, int flag
                        struct ndr_pull *_ndr_data = 
ndr_pull_init_blob(&_r.out.data, ndr, ndr->iconv_convenience);
                        NDR_ERR_HAVE_NO_MEMORY(_ndr_data);
                        _ndr_data->flags= ndr->flags;
-                       __r.in.type     = r->out.type;
+                       __r.in.type     = *r->out.type;
                        __r.out.data    = r->out.data;
                        NDR_CHECK(ndr_pull___spoolss_GetPrinterData(_ndr_data, 
flags, &__r));
                        r->out.data     = __r.out.data;
diff --git a/source4/ntptr/simple_ldb/ntptr_simple_ldb.c 
b/source4/ntptr/simple_ldb/ntptr_simple_ldb.c
index 134897e..073fd99 100644
--- a/source4/ntptr/simple_ldb/ntptr_simple_ldb.c
+++ b/source4/ntptr/simple_ldb/ntptr_simple_ldb.c
@@ -127,43 +127,43 @@ static WERROR sptr_GetPrintServerData(struct 
ntptr_GenericHandle *server, TALLOC
 {
        struct dcerpc_server_info *server_info = lp_dcerpc_server_info(mem_ctx, 
server->ntptr->lp_ctx);
        if (strcmp("W3SvcInstalled", r->in.value_name) == 0) {
-               r->out.type             = SPOOLSS_PRINTER_DATA_TYPE_UINT32;
+               *r->out.type            = SPOOLSS_PRINTER_DATA_TYPE_UINT32;
                r->out.data.value       = 0;
                return WERR_OK;
        } else if (strcmp("BeepEnabled", r->in.value_name) == 0) {
-               r->out.type             = SPOOLSS_PRINTER_DATA_TYPE_UINT32;
+               *r->out.type            = SPOOLSS_PRINTER_DATA_TYPE_UINT32;
                r->out.data.value       = 0;
                return WERR_OK;
        } else if (strcmp("EventLog", r->in.value_name) == 0) {
-               r->out.type             = SPOOLSS_PRINTER_DATA_TYPE_UINT32;
+               *r->out.type            = SPOOLSS_PRINTER_DATA_TYPE_UINT32;
                r->out.data.value       = 0;
                return WERR_OK;
        } else if (strcmp("NetPopup", r->in.value_name) == 0) {
-               r->out.type             = SPOOLSS_PRINTER_DATA_TYPE_UINT32;
+               *r->out.type            = SPOOLSS_PRINTER_DATA_TYPE_UINT32;
                r->out.data.value       = 0;
                return WERR_OK;
        } else if (strcmp("NetPopupToComputer", r->in.value_name) == 0) {
-               r->out.type             = SPOOLSS_PRINTER_DATA_TYPE_UINT32;
+               *r->out.type            = SPOOLSS_PRINTER_DATA_TYPE_UINT32;
                r->out.data.value       = 0;
                return  WERR_OK;
        } else if (strcmp("MajorVersion", r->in.value_name) == 0) {
-               r->out.type             = SPOOLSS_PRINTER_DATA_TYPE_UINT32;
+               *r->out.type            = SPOOLSS_PRINTER_DATA_TYPE_UINT32;
                r->out.data.value       = 3;
                return WERR_OK;
        } else if (strcmp("MinorVersion", r->in.value_name) == 0) {
-               r->out.type             = SPOOLSS_PRINTER_DATA_TYPE_UINT32;
+               *r->out.type            = SPOOLSS_PRINTER_DATA_TYPE_UINT32;
                r->out.data.value       = 0;
                return WERR_OK;
        } else if (strcmp("DefaultSpoolDirectory", r->in.value_name) == 0) {
-               r->out.type             = SPOOLSS_PRINTER_DATA_TYPE_STRING;
+               *r->out.type            = SPOOLSS_PRINTER_DATA_TYPE_STRING;
                r->out.data.string      = "C:\\PRINTERS";
                return  WERR_OK;
        } else if (strcmp("Architecture", r->in.value_name) == 0) {
-               r->out.type             = SPOOLSS_PRINTER_DATA_TYPE_STRING;
+               *r->out.type            = SPOOLSS_PRINTER_DATA_TYPE_STRING;
                r->out.data.string      = SPOOLSS_ARCHITECTURE_NT_X86;
                return  WERR_OK;
        } else if (strcmp("DsPresent", r->in.value_name) == 0) {
-               r->out.type             = SPOOLSS_PRINTER_DATA_TYPE_UINT32;
+               *r->out.type            = SPOOLSS_PRINTER_DATA_TYPE_UINT32;
                r->out.data.value       = 1;
                return WERR_OK;
        } else if (strcmp("OSVersion", r->in.value_name) == 0) {
@@ -181,7 +181,7 @@ static WERROR sptr_GetPrintServerData(struct 
ntptr_GenericHandle *server, TALLOC
                        return WERR_GENERAL_FAILURE;
                }
 
-               r->out.type             = SPOOLSS_PRINTER_DATA_TYPE_BINARY;
+               *r->out.type            = SPOOLSS_PRINTER_DATA_TYPE_BINARY;
                r->out.data.binary      = blob;
                return WERR_OK;
        } else if (strcmp("OSVersionEx", r->in.value_name) == 0) {
@@ -201,13 +201,13 @@ static WERROR sptr_GetPrintServerData(struct 
ntptr_GenericHandle *server, TALLOC
                        return WERR_GENERAL_FAILURE;
                }
 
-               r->out.type             = SPOOLSS_PRINTER_DATA_TYPE_BINARY;
+               *r->out.type            = SPOOLSS_PRINTER_DATA_TYPE_BINARY;
                r->out.data.binary      = blob;
                return WERR_OK;
        } else if (strcmp("DNSMachineName", r->in.value_name) == 0) {
                if (!lp_realm(server->ntptr->lp_ctx)) return WERR_INVALID_PARAM;
 
-               r->out.type             = SPOOLSS_PRINTER_DATA_TYPE_STRING;
+               *r->out.type            = SPOOLSS_PRINTER_DATA_TYPE_STRING;
                r->out.data.string      = talloc_asprintf(mem_ctx, "%s.%s",
                                                                   
lp_netbios_name(server->ntptr->lp_ctx),
                                                                   
lp_realm(server->ntptr->lp_ctx));
diff --git a/source4/rpc_server/spoolss/dcesrv_spoolss.c 
b/source4/rpc_server/spoolss/dcesrv_spoolss.c
index 21f9cfb..2ba1a65 100644
--- a/source4/rpc_server/spoolss/dcesrv_spoolss.c
+++ b/source4/rpc_server/spoolss/dcesrv_spoolss.c
@@ -575,8 +575,8 @@ static WERROR dcesrv_spoolss_GetPrinterData(struct 
dcesrv_call_state *dce_call,
 
        W_ERROR_NOT_OK_RETURN(status);
 
-       *r->out.needed  = ndr_size_spoolss_PrinterData(&r->out.data, 
r->out.type, ic, 0);
-       r->out.type     = SPOOLSS_BUFFER_OK(r->out.type, 
SPOOLSS_PRINTER_DATA_TYPE_NULL);
+       *r->out.needed  = ndr_size_spoolss_PrinterData(&r->out.data, 
*r->out.type, ic, 0);
+       *r->out.type    = SPOOLSS_BUFFER_OK(*r->out.type, 
SPOOLSS_PRINTER_DATA_TYPE_NULL);
        r->out.data     = SPOOLSS_BUFFER_OK(r->out.data, r->out.data);
        return SPOOLSS_BUFFER_OK(WERR_OK, WERR_MORE_DATA);
 }
diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c
index 2592cc3..7da3209 100644
--- a/source4/torture/rpc/spoolss.c
+++ b/source4/torture/rpc/spoolss.c
@@ -1139,11 +1139,13 @@ static bool test_GetPrinterData(struct torture_context 
*tctx,
        NTSTATUS status;
        struct spoolss_GetPrinterData r;
        uint32_t needed;
+       enum spoolss_PrinterDataType type;
 
        r.in.handle = handle;
        r.in.value_name = value_name;
        r.in.offered = 0;
        r.out.needed = &needed;
+       r.out.type = &type;
 
        torture_comment(tctx, "Testing GetPrinterData\n");
 
diff --git a/source4/torture/rpc/spoolss_win.c 
b/source4/torture/rpc/spoolss_win.c
index cddba3d..ed2bdc7 100644
--- a/source4/torture/rpc/spoolss_win.c
+++ b/source4/torture/rpc/spoolss_win.c
@@ -156,12 +156,14 @@ static bool test_GetPrinterData(struct torture_context 
*tctx,
        NTSTATUS status;
        struct spoolss_GetPrinterData gpd;
        uint32_t needed;
+       enum spoolss_PrinterDataType type;
 
        torture_comment(tctx, "Testing GetPrinterData(%s).\n", value_name);
        gpd.in.handle = handle;
        gpd.in.value_name = value_name;
        gpd.in.offered = 4;
        gpd.out.needed = &needed;
+       gpd.out.type = &type;
 
        status = dcerpc_spoolss_GetPrinterData(p, tctx, &gpd);
        torture_assert_ntstatus_ok(tctx, status, "GetPrinterData failed.");


-- 
Samba Shared Repository

Reply via email to