The branch, v3-4-test has been updated
       via  cab93fe1a22bf6212384a0df48b8ed91d0fdc239 (commit)
       via  3ca6148da0d33073799e68e5a969d02c8d7b91d3 (commit)
       via  207f7180887456b8ed5ad07e50d3e6bcf5774d32 (commit)
       via  22411a7fe2459af77bcaab21b307698f0f5da1bd (commit)
       via  ce798967b603adb39fc1b612888713b3160b11c0 (commit)
       via  82b35cdcff42a66d200abd84af10b5f682dd66b6 (commit)
      from  2e91b3abbe9cb2451ed363d98e987f8ed89ed63b (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-4-test


- Log -----------------------------------------------------------------
commit cab93fe1a22bf6212384a0df48b8ed91d0fdc239
Author: Günther Deschner <g...@samba.org>
Date:   Sat Mar 14 01:31:00 2009 +0100

    s3-spoolss: remove old spoolss_GetPrinterData.
    
    Guenther
    (cherry picked from commit 6dca80518dda120753112204eaaae7961938bb9e)

commit 3ca6148da0d33073799e68e5a969d02c8d7b91d3
Author: Günther Deschner <g...@samba.org>
Date:   Sat Mar 14 01:29:56 2009 +0100

    s3-spoolss: use pidl for _spoolss_GetPrinterData.
    
    Guenther
    (cherry picked from commit aeba6381d3e0ee7f3983d8be4dcdfa0f1015d3ee)

commit 207f7180887456b8ed5ad07e50d3e6bcf5774d32
Author: Günther Deschner <g...@samba.org>
Date:   Sat Mar 14 01:28:25 2009 +0100

    s3-spoolss: remove old rpccli_spoolss_getprinterdata.
    
    Guenther
    (cherry picked from commit d77cc437841ea97d350898d36faa0ee2534eceaa)

commit 22411a7fe2459af77bcaab21b307698f0f5da1bd
Author: Günther Deschner <g...@samba.org>
Date:   Sat Mar 14 01:28:55 2009 +0100

    s3-rpcclient: use rpccli_spoolss_getprinterdata.
    
    Guenther
    (cherry picked from commit 704220c2a240498f1ac4be8854c5ea4fe8958a9f)

commit ce798967b603adb39fc1b612888713b3160b11c0
Author: Günther Deschner <g...@samba.org>
Date:   Sat Mar 14 01:26:27 2009 +0100

    s3-spoolss: add rpccli_spoolss_getprinterdata convenience wrapper.
    
    Guenther
    (cherry picked from commit 08d170abc12b72e027b80f22b11213346fb6cf7e)

commit 82b35cdcff42a66d200abd84af10b5f682dd66b6
Author: Günther Deschner <g...@samba.org>
Date:   Thu Feb 26 21:56:12 2009 +0100

    s3-spoolss: remove unused ADD_JOBINFO_1.
    
    Guenther
    (cherry picked from commit 754d136c32372cb9dd604375b98379d9696fb48f)

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

Summary of changes:
 source3/include/proto.h             |   16 +--
 source3/include/rpc_spoolss.h       |   28 ----
 source3/rpc_client/cli_spoolss.c    |   84 +++++-------
 source3/rpc_parse/parse_spoolss.c   |   88 ------------
 source3/rpc_server/srv_spoolss.c    |   23 +---
 source3/rpc_server/srv_spoolss_nt.c |  261 ++++++++++++++---------------------
 source3/rpcclient/cmd_spoolss.c     |   63 ++++++++-
 7 files changed, 206 insertions(+), 357 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/include/proto.h b/source3/include/proto.h
index efafcc1..52cab7c 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -5533,9 +5533,13 @@ WERROR rpccli_spoolss_enumprinters(struct 
rpc_pipe_client *cli,
                                   uint32_t offered,
                                   uint32_t *count,
                                   union spoolss_PrinterInfo **info);
-WERROR rpccli_spoolss_getprinterdata(struct rpc_pipe_client *cli, TALLOC_CTX 
*mem_ctx,
-                                 POLICY_HND *hnd, const char *valuename, 
-                                 REGISTRY_VALUE *value);
+WERROR rpccli_spoolss_getprinterdata(struct rpc_pipe_client *cli,
+                                    TALLOC_CTX *mem_ctx,
+                                    struct policy_handle *handle,
+                                    const char *value_name,
+                                    uint32_t offered,
+                                    enum winreg_Type *type,
+                                    union spoolss_PrinterData *data);
 WERROR rpccli_spoolss_setprinterdata(struct rpc_pipe_client *cli, TALLOC_CTX 
*mem_ctx,
                                  POLICY_HND *hnd, REGISTRY_VALUE *value);
 WERROR rpccli_spoolss_enumprinterdata(struct rpc_pipe_client *cli, TALLOC_CTX 
*mem_ctx,
@@ -5842,11 +5846,6 @@ bool sec_io_desc_buf(const char *desc, SEC_DESC_BUF 
**ppsdb, prs_struct *ps, int
 bool spoolss_io_system_time(const char *desc, prs_struct *ps, int depth, 
SYSTEMTIME *systime);
 bool make_systemtime(SYSTEMTIME *systime, struct tm *unixtime);
 bool spoolss_io_devmode(const char *desc, prs_struct *ps, int depth, 
DEVICEMODE *devmode);
-bool make_spoolss_q_getprinterdata(SPOOL_Q_GETPRINTERDATA *q_u,
-                                  const POLICY_HND *handle,
-                                  const char *valuename, uint32 size);
-bool spoolss_io_q_getprinterdata(const char *desc, SPOOL_Q_GETPRINTERDATA 
*q_u, prs_struct *ps, int depth);
-bool spoolss_io_r_getprinterdata(const char *desc, SPOOL_R_GETPRINTERDATA 
*r_u, prs_struct *ps, int depth);
 uint32 spoolss_size_printer_enum_values(PRINTER_ENUM_VALUES *p);
 bool make_spoolss_buffer5(TALLOC_CTX *mem_ctx, BUFFER5 *buf5, uint32 len, 
uint16 *src);
 bool spoolss_io_r_enumprinterdata(const char *desc, SPOOL_R_ENUMPRINTERDATA 
*r_u, prs_struct *ps, int depth);
@@ -5992,7 +5991,6 @@ bool convert_devicemode(const char *printername, const 
DEVICEMODE *devmode,
                                NT_DEVICEMODE **pp_nt_devmode);
 WERROR set_printer_dataex( NT_PRINTER_INFO_LEVEL *printer, const char *key, 
const char *value,
                                   uint32 type, uint8 *data, int real_len  );
-WERROR _spoolss_getprinterdata(pipes_struct *p, SPOOL_Q_GETPRINTERDATA *q_u, 
SPOOL_R_GETPRINTERDATA *r_u);
 void spoolss_notify_server_name(int snum,
                                       struct spoolss_Notify *data,
                                       print_queue_struct *queue,
diff --git a/source3/include/rpc_spoolss.h b/source3/include/rpc_spoolss.h
index 4530802..ef1cbd1 100644
--- a/source3/include/rpc_spoolss.h
+++ b/source3/include/rpc_spoolss.h
@@ -274,34 +274,6 @@ typedef struct devicemode
 }
 DEVICEMODE;
 
-/********************************************/
-
-typedef struct spool_q_getprinterdata
-{
-       POLICY_HND handle;
-       UNISTR2 valuename;
-       uint32 size;
-}
-SPOOL_Q_GETPRINTERDATA;
-
-typedef struct spool_r_getprinterdata
-{
-       uint32 type;
-       uint32 size;
-       uint8 *data;
-       uint32 needed;
-       WERROR status;
-}
-SPOOL_R_GETPRINTERDATA;
-
-typedef struct add_jobinfo_1
-{
-       UNISTR path;
-       uint32 job_number;
-}
-ADD_JOBINFO_1;
-
-
 /*
  * I'm really wondering how many different time formats
  * I will have to cope with
diff --git a/source3/rpc_client/cli_spoolss.c b/source3/rpc_client/cli_spoolss.c
index 76614c6..3f8e966 100644
--- a/source3/rpc_client/cli_spoolss.c
+++ b/source3/rpc_client/cli_spoolss.c
@@ -705,67 +705,51 @@ WERROR rpccli_spoolss_enumprinters(struct rpc_pipe_client 
*cli,
        return werror;
 }
 
-/*********************************************************************
- Decode various spoolss rpc's and info levels
- ********************************************************************/
-
 /**********************************************************************
+ convencience wrapper around rpccli_spoolss_GetPrinterData
 **********************************************************************/
 
-WERROR rpccli_spoolss_getprinterdata(struct rpc_pipe_client *cli, TALLOC_CTX 
*mem_ctx,
-                                 POLICY_HND *hnd, const char *valuename, 
-                                 REGISTRY_VALUE *value)
+WERROR rpccli_spoolss_getprinterdata(struct rpc_pipe_client *cli,
+                                    TALLOC_CTX *mem_ctx,
+                                    struct policy_handle *handle,
+                                    const char *value_name,
+                                    uint32_t offered,
+                                    enum winreg_Type *type,
+                                    union spoolss_PrinterData *data)
 {
-       prs_struct qbuf, rbuf;
-       SPOOL_Q_GETPRINTERDATA in;
-       SPOOL_R_GETPRINTERDATA out;
-       uint32 offered;
-
-       ZERO_STRUCT(in);
-       ZERO_STRUCT(out);
-
-       offered = 0;
-       make_spoolss_q_getprinterdata( &in, hnd, valuename, offered );
-
-       CLI_DO_RPC_WERR( cli, mem_ctx, &syntax_spoolss, SPOOLSS_GETPRINTERDATA,
-                   in, out, 
-                   qbuf, rbuf,
-                   spoolss_io_q_getprinterdata,
-                   spoolss_io_r_getprinterdata, 
-                   WERR_GENERAL_FAILURE );
-
-       if ( W_ERROR_EQUAL( out.status, WERR_MORE_DATA ) ) {
-               offered = out.needed;
-               
-               ZERO_STRUCT(in);
-               ZERO_STRUCT(out);
-               
-               make_spoolss_q_getprinterdata( &in, hnd, valuename, offered );
-
-               CLI_DO_RPC_WERR( cli, mem_ctx, &syntax_spoolss, 
SPOOLSS_GETPRINTERDATA,
-                           in, out, 
-                           qbuf, rbuf,
-                           spoolss_io_q_getprinterdata,
-                           spoolss_io_r_getprinterdata, 
-                           WERR_GENERAL_FAILURE );
-       }
+       NTSTATUS status;
+       WERROR werror;
+       uint32_t needed;
 
-       if (!W_ERROR_IS_OK(out.status))
-               return out.status;      
+       status = rpccli_spoolss_GetPrinterData(cli, mem_ctx,
+                                              handle,
+                                              value_name,
+                                              offered,
+                                              type,
+                                              data,
+                                              &needed,
+                                              &werror);
 
-       /* Return output parameters */
+       if (W_ERROR_EQUAL(werror, WERR_MORE_DATA)) {
+               offered = needed;
 
-       if (out.needed) {
-               value->data_p = (uint8 *)TALLOC_MEMDUP(mem_ctx, out.data, 
out.needed);
-       } else {
-               value->data_p = NULL;
+               status = rpccli_spoolss_GetPrinterData(cli, mem_ctx,
+                                                      handle,
+                                                      value_name,
+                                                      offered,
+                                                      type,
+                                                      data,
+                                                      &needed,
+                                                      &werror);
        }
-       value->type = out.type;
-       value->size = out.size;
 
-       return out.status;
+       return werror;
 }
 
+/*********************************************************************
+ Decode various spoolss rpc's and info levels
+ ********************************************************************/
+
 /**********************************************************************
 **********************************************************************/
 
diff --git a/source3/rpc_parse/parse_spoolss.c 
b/source3/rpc_parse/parse_spoolss.c
index e499607..a7d69f6 100644
--- a/source3/rpc_parse/parse_spoolss.c
+++ b/source3/rpc_parse/parse_spoolss.c
@@ -259,94 +259,6 @@ bool spoolss_io_devmode(const char *desc, prs_struct *ps, 
int depth, DEVICEMODE
 }
 
 /*******************************************************************
- * make a structure.
- ********************************************************************/
-
-bool make_spoolss_q_getprinterdata(SPOOL_Q_GETPRINTERDATA *q_u,
-                                  const POLICY_HND *handle,
-                                  const char *valuename, uint32 size)
-{
-        if (q_u == NULL) return False;
-
-        DEBUG(5,("make_spoolss_q_getprinterdata\n"));
-
-        q_u->handle = *handle;
-       init_unistr2(&q_u->valuename, valuename, UNI_STR_TERMINATE);
-        q_u->size = size;
-
-        return True;
-}
-
-/*******************************************************************
- * read a structure.
- * called from spoolss_q_getprinterdata (srv_spoolss.c)
- ********************************************************************/
-
-bool spoolss_io_q_getprinterdata(const char *desc, SPOOL_Q_GETPRINTERDATA 
*q_u, prs_struct *ps, int depth)
-{
-       if (q_u == NULL)
-               return False;
-
-       prs_debug(ps, depth, desc, "spoolss_io_q_getprinterdata");
-       depth++;
-
-       if (!prs_align(ps))
-               return False;
-       if (!smb_io_pol_hnd("printer handle",&q_u->handle,ps,depth))
-               return False;
-       if (!prs_align(ps))
-               return False;
-       if (!smb_io_unistr2("valuename", &q_u->valuename,True,ps,depth))
-               return False;
-       if (!prs_align(ps))
-               return False;
-       if (!prs_uint32("size", ps, depth, &q_u->size))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
- * write a structure.
- * called from spoolss_r_getprinterdata (srv_spoolss.c)
- ********************************************************************/
-
-bool spoolss_io_r_getprinterdata(const char *desc, SPOOL_R_GETPRINTERDATA 
*r_u, prs_struct *ps, int depth)
-{
-       if (r_u == NULL)
-               return False;
-
-       prs_debug(ps, depth, desc, "spoolss_io_r_getprinterdata");
-       depth++;
-
-       if (!prs_align(ps))
-               return False;
-       if (!prs_uint32("type", ps, depth, &r_u->type))
-               return False;
-       if (!prs_uint32("size", ps, depth, &r_u->size))
-               return False;
-       
-       if (UNMARSHALLING(ps) && r_u->size) {
-               r_u->data = PRS_ALLOC_MEM(ps, unsigned char, r_u->size);
-               if(!r_u->data)
-                       return False;
-       }
-
-       if (!prs_uint8s( False, "data", ps, depth, r_u->data, r_u->size ))
-               return False;
-               
-       if (!prs_align(ps))
-               return False;
-       
-       if (!prs_uint32("needed", ps, depth, &r_u->needed))
-               return False;
-       if (!prs_werror("status", ps, depth, &r_u->status))
-               return False;
-               
-       return True;
-}
-
-/*******************************************************************
  * return the length of a uint32 (obvious, but the code is clean)
  ********************************************************************/
 
diff --git a/source3/rpc_server/srv_spoolss.c b/source3/rpc_server/srv_spoolss.c
index da82202..c7ca223 100644
--- a/source3/rpc_server/srv_spoolss.c
+++ b/source3/rpc_server/srv_spoolss.c
@@ -74,28 +74,7 @@ static bool api_spoolss_open_printer_ex(pipes_struct *p)
 
 static bool api_spoolss_getprinterdata(pipes_struct *p)
 {
-       SPOOL_Q_GETPRINTERDATA q_u;
-       SPOOL_R_GETPRINTERDATA r_u;
-       prs_struct *data = &p->in_data.data;
-       prs_struct *rdata = &p->out_data.rdata;
-
-       ZERO_STRUCT(q_u);
-       ZERO_STRUCT(r_u);
-
-       /* read the stream and fill the struct */
-       if (!spoolss_io_q_getprinterdata("", &q_u, data, 0)) {
-               DEBUG(0,("spoolss_io_q_getprinterdata: unable to unmarshall 
SPOOL_Q_GETPRINTERDATA.\n"));
-               return False;
-       }
-       
-       r_u.status = _spoolss_getprinterdata( p, &q_u, &r_u);
-
-       if (!spoolss_io_r_getprinterdata("", &r_u, rdata, 0)) {
-               DEBUG(0,("spoolss_io_r_getprinterdata: unable to marshall 
SPOOL_R_GETPRINTERDATA.\n"));
-               return False;
-       }
-
-       return True;
+       return proxy_spoolss_call(p, NDR_SPOOLSS_GETPRINTERDATA);
 }
 
 /********************************************************************
diff --git a/source3/rpc_server/srv_spoolss_nt.c 
b/source3/rpc_server/srv_spoolss_nt.c
index 950dc01..aee9aa1 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -2465,74 +2465,58 @@ WERROR set_printer_dataex( NT_PRINTER_INFO_LEVEL 
*printer, const char *key, cons
  GetPrinterData on a printer server Handle.
 ********************************************************************/
 
-static WERROR getprinterdata_printer_server(TALLOC_CTX *ctx, fstring value, 
uint32 *type, uint8 **data, uint32 *needed, uint32 in_size)
+static WERROR getprinterdata_printer_server(TALLOC_CTX *mem_ctx,
+                                           const char *value,
+                                           enum winreg_Type *type,
+                                           union spoolss_PrinterData *data)
 {
-       int i;
-
        DEBUG(8,("getprinterdata_printer_server:%s\n", value));
 
        if (!StrCaseCmp(value, "W3SvcInstalled")) {
                *type = REG_DWORD;
-               if ( !(*data = TALLOC_ARRAY(ctx, uint8, sizeof(uint32) )) )
-                       return WERR_NOMEM;
-               SIVAL(*data, 0, 0x00);
-               *needed = 0x4;
+               data->value = 0x00;
                return WERR_OK;
        }
 
        if (!StrCaseCmp(value, "BeepEnabled")) {
                *type = REG_DWORD;
-               if ( !(*data = TALLOC_ARRAY(ctx, uint8, sizeof(uint32) )) )
-                       return WERR_NOMEM;
-               SIVAL(*data, 0, 0x00);
-               *needed = 0x4;
+               data->value = 0x00;
                return WERR_OK;
        }
 
        if (!StrCaseCmp(value, "EventLog")) {
                *type = REG_DWORD;
-               if ( !(*data = TALLOC_ARRAY(ctx, uint8, sizeof(uint32) )) )
-                       return WERR_NOMEM;
                /* formally was 0x1b */
-               SIVAL(*data, 0, 0x0);
-               *needed = 0x4;
+               data->value = 0x00;
                return WERR_OK;
        }
 
        if (!StrCaseCmp(value, "NetPopup")) {
                *type = REG_DWORD;
-               if ( !(*data = TALLOC_ARRAY(ctx, uint8, sizeof(uint32) )) )
-                       return WERR_NOMEM;
-               SIVAL(*data, 0, 0x00);
-               *needed = 0x4;
+               data->value = 0x00;
                return WERR_OK;
        }
 
        if (!StrCaseCmp(value, "MajorVersion")) {
                *type = REG_DWORD;
-               if ( !(*data = TALLOC_ARRAY(ctx, uint8, sizeof(uint32) )) )
-                       return WERR_NOMEM;
 
                /* Windows NT 4.0 seems to not allow uploading of drivers
                   to a server that reports 0x3 as the MajorVersion.
                   need to investigate more how Win2k gets around this .
                   -- jerry */
 
-               if ( RA_WINNT == get_remote_arch() )
-                       SIVAL(*data, 0, 2);
-               else
-                       SIVAL(*data, 0, 3);
+               if (RA_WINNT == get_remote_arch()) {
+                       data->value = 0x02;
+               } else {
+                       data->value = 0x03;
+               }
 
-               *needed = 0x4;
                return WERR_OK;
        }
 
        if (!StrCaseCmp(value, "MinorVersion")) {
                *type = REG_DWORD;
-               if ( !(*data = TALLOC_ARRAY(ctx, uint8, sizeof(uint32) )) )
-                       return WERR_NOMEM;
-               SIVAL(*data, 0, 0);
-               *needed = 0x4;
+               data->value = 0x00;
                return WERR_OK;
        }
 
@@ -2544,109 +2528,88 @@ static WERROR getprinterdata_printer_server(TALLOC_CTX 
*ctx, fstring value, uint
         *  extra unicode string = e.g. "Service Pack 3"
         */
        if (!StrCaseCmp(value, "OSVersion")) {
-               *type = REG_BINARY;
-               *needed = 0x114;
-
-               if ( !(*data = TALLOC_ZERO_ARRAY(ctx, uint8, (*needed > 
in_size) ? *needed:in_size )) )
-                       return WERR_NOMEM;
-
-               SIVAL(*data, 0, *needed);       /* size */
-               SIVAL(*data, 4, 5);             /* Windows 2000 == 5.0 */
-               SIVAL(*data, 8, 0);
-               SIVAL(*data, 12, 2195);         /* build */
+               DATA_BLOB blob;
+               enum ndr_err_code ndr_err;
+               struct spoolss_OSVersion os;
+
+               os.major                = 5;    /* Windows 2000 == 5.0 */
+               os.minor                = 0;
+               os.build                = 2195; /* build */
+               os.extra_string         = "";   /* leave extra string empty */
+
+               ndr_err = ndr_push_struct_blob(&blob, mem_ctx, NULL, &os,
+                       (ndr_push_flags_fn_t)ndr_push_spoolss_OSVersion);
+               if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+                       return WERR_GENERAL_FAILURE;
+               }
 
-               /* leave extra string empty */
+               *type = REG_BINARY;
+               data->binary = blob;
 
                return WERR_OK;
        }
 
 
        if (!StrCaseCmp(value, "DefaultSpoolDirectory")) {
-               const char *string="C:\\PRINTERS";
                *type = REG_SZ;
-               *needed = 2*(strlen(string)+1);
-               if((*data  = (uint8 *)TALLOC(ctx, (*needed > in_size) ? 
*needed:in_size )) == NULL)
-                       return WERR_NOMEM;
-               memset(*data, 0, (*needed > in_size) ? *needed:in_size);
 
-               /* it's done by hand ready to go on the wire */
-               for (i=0; i<strlen(string); i++) {
-                       (*data)[2*i]=string[i];
-                       (*data)[2*i+1]='\0';
-               }
+               data->string = talloc_strdup(mem_ctx, "C:\\PRINTERS");
+               W_ERROR_HAVE_NO_MEMORY(data->string);
+
                return WERR_OK;
        }
 
        if (!StrCaseCmp(value, "Architecture")) {
-               const char *string="Windows NT x86";
                *type = REG_SZ;
-               *needed = 2*(strlen(string)+1);
-               if((*data  = (uint8 *)TALLOC(ctx, (*needed > in_size) ? 
*needed:in_size )) == NULL)
-                       return WERR_NOMEM;
-               memset(*data, 0, (*needed > in_size) ? *needed:in_size);
-               for (i=0; i<strlen(string); i++) {
-                       (*data)[2*i]=string[i];
-                       (*data)[2*i+1]='\0';
-               }
+
+               data->string = talloc_strdup(mem_ctx, "Windows NT x86");
+               W_ERROR_HAVE_NO_MEMORY(data->string);
+
                return WERR_OK;
        }
 
        if (!StrCaseCmp(value, "DsPresent")) {
                *type = REG_DWORD;
-               if ( !(*data = TALLOC_ARRAY(ctx, uint8, sizeof(uint32) )) )
-                       return WERR_NOMEM;
 
                /* only show the publish check box if we are a
-                  memeber of a AD domain */
+                  member of a AD domain */
 
-               if ( lp_security() == SEC_ADS )
-                       SIVAL(*data, 0, 0x01);
-               else
-                       SIVAL(*data, 0, 0x00);
-


-- 
Samba Shared Repository

Reply via email to