s3-spoolss: use pidl for _spoolss_SetPrinter.
authorGünther Deschner <gd@samba.org>
Thu, 12 Feb 2009 23:10:10 +0000 (00:10 +0100)
committerGünther Deschner <gd@samba.org>
Sat, 14 Feb 2009 00:42:07 +0000 (01:42 +0100)
Guenther

source3/include/proto.h
source3/rpc_server/srv_spoolss.c
source3/rpc_server/srv_spoolss_nt.c

index 9f3c04e649886ffd5e47b20aa06224d377951375..bfbf972be703bf7c6879bc2afa389dd1359e6790 100644 (file)
@@ -6245,7 +6245,6 @@ WERROR _spoolss_getprinter(pipes_struct *p, SPOOL_Q_GETPRINTER *q_u, SPOOL_R_GET
 WERROR _spoolss_getprinterdriver2(pipes_struct *p, SPOOL_Q_GETPRINTERDRIVER2 *q_u, SPOOL_R_GETPRINTERDRIVER2 *r_u);
 WERROR add_port_hook(TALLOC_CTX *ctx, NT_USER_TOKEN *token, const char *portname, const char *uri );
 bool add_printer_hook(TALLOC_CTX *ctx, NT_USER_TOKEN *token, NT_PRINTER_INFO_LEVEL *printer);
-WERROR _spoolss_setprinter(pipes_struct *p, SPOOL_Q_SETPRINTER *q_u, SPOOL_R_SETPRINTER *r_u);
 WERROR _spoolss_enumjobs( pipes_struct *p, SPOOL_Q_ENUMJOBS *q_u, SPOOL_R_ENUMJOBS *r_u);
 WERROR _spoolss_enumprinterdrivers( pipes_struct *p, SPOOL_Q_ENUMPRINTERDRIVERS *q_u, SPOOL_R_ENUMPRINTERDRIVERS *r_u);
 WERROR _spoolss_enumforms(pipes_struct *p, SPOOL_Q_ENUMFORMS *q_u, SPOOL_R_ENUMFORMS *r_u);
index 02b32203679115e9bc32692c880f7b19580cab98..4a29e1963bd048aec3cfffea33f78aa56026fdf0 100644 (file)
@@ -370,27 +370,7 @@ static bool api_spoolss_writeprinter(pipes_struct *p)
 
 static bool api_spoolss_setprinter(pipes_struct *p)
 {
-       SPOOL_Q_SETPRINTER q_u;
-       SPOOL_R_SETPRINTER r_u;
-       prs_struct *data = &p->in_data.data;
-       prs_struct *rdata = &p->out_data.rdata;
-
-       ZERO_STRUCT(q_u);
-       ZERO_STRUCT(r_u);
-
-       if(!spoolss_io_q_setprinter("", &q_u, data, 0)) {
-               DEBUG(0,("spoolss_io_q_setprinter: unable to unmarshall SPOOL_Q_SETPRINTER.\n"));
-               return False;
-       }
-       
-       r_u.status = _spoolss_setprinter(p, &q_u, &r_u);
-       
-       if(!spoolss_io_r_setprinter("",&r_u,rdata,0)) {
-               DEBUG(0,("spoolss_io_r_setprinter: unable to marshall SPOOL_R_SETPRINTER.\n"));
-               return False;
-       }
-
-       return True;
+       return proxy_spoolss_call(p, NDR_SPOOLSS_SETPRINTER);
 }
 
 /****************************************************************************
index aeedf099d67440ac040b355f1590933c9ed0e98e..a43d9dff647c647fb39f8bfe5594983a6b8c5e4e 100644 (file)
@@ -6061,8 +6061,7 @@ WERROR _spoolss_AbortPrinter(pipes_struct *p,
  * when updating a printer description
  ********************************************************************/
 
-static WERROR update_printer_sec(POLICY_HND *handle, uint32 level,
-                                const SPOOL_PRINTER_INFO_LEVEL *info,
+static WERROR update_printer_sec(POLICY_HND *handle,
                                 pipes_struct *p, SEC_DESC_BUF *secdesc_ctr)
 {
        SEC_DESC_BUF *new_secdesc_ctr = NULL, *old_secdesc_ctr = NULL;
@@ -6348,9 +6347,9 @@ bool add_printer_hook(TALLOC_CTX *ctx, NT_USER_TOKEN *token, NT_PRINTER_INFO_LEV
  * when updating a printer description.
  ********************************************************************/
 
-static WERROR update_printer(pipes_struct *p, POLICY_HND *handle, uint32 level,
-                           const SPOOL_PRINTER_INFO_LEVEL *info,
-                           DEVICEMODE *devmode)
+static WERROR update_printer(pipes_struct *p, POLICY_HND *handle,
+                            struct spoolss_SetPrinterInfoCtr *info_ctr,
+                            struct spoolss_DeviceMode *devmode)
 {
        int snum;
        NT_PRINTER_INFO_LEVEL *printer = NULL, *old_printer = NULL;
@@ -6387,7 +6386,7 @@ static WERROR update_printer(pipes_struct *p, POLICY_HND *handle, uint32 level,
         * just read from the tdb in the pointer 'printer'.
         */
 
-       if (!convert_printer_info(info, printer, level)) {
+       if (!convert_printer_info_new(info_ctr, printer)) {
                result =  WERR_NOMEM;
                goto done;
        }
@@ -6397,8 +6396,9 @@ static WERROR update_printer(pipes_struct *p, POLICY_HND *handle, uint32 level,
                   convert it and link it*/
 
                DEBUGADD(8,("update_printer: Converting the devicemode struct\n"));
-               if (!convert_devicemode(printer->info_2->printername, devmode,
-                               &printer->info_2->devmode)) {
+               if (!convert_devicemode_new(printer->info_2->printername,
+                                           devmode,
+                                           &printer->info_2->devmode)) {
                        result =  WERR_NOMEM;
                        goto done;
                }
@@ -6542,10 +6542,9 @@ done:
 /****************************************************************************
 ****************************************************************************/
 static WERROR publish_or_unpublish_printer(pipes_struct *p, POLICY_HND *handle,
-                                  const SPOOL_PRINTER_INFO_LEVEL *info)
+                                          struct spoolss_SetPrinterInfo7 *info7)
 {
 #ifdef HAVE_ADS
-       SPOOL_PRINTER_INFO_LEVEL_7 *info7 = info->info_7;
        int snum;
        Printer_entry *Printer;
 
@@ -6570,42 +6569,45 @@ static WERROR publish_or_unpublish_printer(pipes_struct *p, POLICY_HND *handle,
        return WERR_UNKNOWN_LEVEL;
 #endif
 }
-/****************************************************************************
-****************************************************************************/
 
-WERROR _spoolss_setprinter(pipes_struct *p, SPOOL_Q_SETPRINTER *q_u, SPOOL_R_SETPRINTER *r_u)
+/****************************************************************
+ _spoolss_SetPrinter
+****************************************************************/
+
+WERROR _spoolss_SetPrinter(pipes_struct *p,
+                          struct spoolss_SetPrinter *r)
 {
-       POLICY_HND *handle = &q_u->handle;
-       uint32 level = q_u->level;
-       SPOOL_PRINTER_INFO_LEVEL *info = &q_u->info;
-       DEVMODE_CTR devmode_ctr = q_u->devmode_ctr;
-       SEC_DESC_BUF *secdesc_ctr = q_u->secdesc_ctr;
-       uint32 command = q_u->command;
+       POLICY_HND *handle = r->in.handle;
        WERROR result;
 
        Printer_entry *Printer = find_printer_index_by_hnd(p, handle);
 
        if (!Printer) {
-               DEBUG(2,("_spoolss_setprinter: Invalid handle (%s:%u:%u)\n", OUR_HANDLE(handle)));
+               DEBUG(2,("_spoolss_SetPrinter: Invalid handle (%s:%u:%u)\n",
+                       OUR_HANDLE(handle)));
                return WERR_BADFID;
        }
 
        /* check the level */
-       switch (level) {
+       switch (r->in.info_ctr->level) {
                case 0:
-                       return control_printer(handle, command, p);
+                       return control_printer(handle, r->in.command, p);
                case 2:
-                       result = update_printer(p, handle, level, info, devmode_ctr.devmode);
+                       result = update_printer(p, handle,
+                                               r->in.info_ctr,
+                                               r->in.devmode_ctr->devmode);
                        if (!W_ERROR_IS_OK(result))
                                return result;
-                       if (secdesc_ctr)
-                               result = update_printer_sec(handle, level, info, p, secdesc_ctr);
+                       if (r->in.secdesc_ctr->sd)
+                               result = update_printer_sec(handle, p,
+                                                           r->in.secdesc_ctr);
                        return result;
                case 3:
-                       return update_printer_sec(handle, level, info, p,
-                                                 secdesc_ctr);
+                       return update_printer_sec(handle, p,
+                                                 r->in.secdesc_ctr);
                case 7:
-                       return publish_or_unpublish_printer(p, handle, info);
+                       return publish_or_unpublish_printer(p, handle,
+                                                           r->in.info_ctr->info.info7);
                default:
                        return WERR_UNKNOWN_LEVEL;
        }
@@ -10105,17 +10107,6 @@ WERROR _spoolss_AddPrinter(pipes_struct *p,
        return WERR_NOT_SUPPORTED;
 }
 
-/****************************************************************
- _spoolss_SetPrinter
-****************************************************************/
-
-WERROR _spoolss_SetPrinter(pipes_struct *p,
-                          struct spoolss_SetPrinter *r)
-{
-       p->rng_fault_state = true;
-       return WERR_NOT_SUPPORTED;
-}
-
 /****************************************************************
  _spoolss_GetPrinter
 ****************************************************************/