s3-spoolss: use pidl for _spoolss_AddPrinterEx.
authorGünther Deschner <gd@samba.org>
Tue, 10 Feb 2009 22:35:19 +0000 (23:35 +0100)
committerGünther Deschner <gd@samba.org>
Sat, 14 Feb 2009 00:42:01 +0000 (01:42 +0100)
Guenther

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

index ed2c50af2ff3bcc537fdbbcd8ffd8c674852ba16..9f3c04e649886ffd5e47b20aa06224d377951375 100644 (file)
@@ -6251,7 +6251,6 @@ WERROR _spoolss_enumprinterdrivers( pipes_struct *p, SPOOL_Q_ENUMPRINTERDRIVERS
 WERROR _spoolss_enumforms(pipes_struct *p, SPOOL_Q_ENUMFORMS *q_u, SPOOL_R_ENUMFORMS *r_u);
 WERROR enumports_hook(TALLOC_CTX *ctx, int *count, char ***lines );
 WERROR _spoolss_enumports( pipes_struct *p, SPOOL_Q_ENUMPORTS *q_u, SPOOL_R_ENUMPORTS *r_u);
-WERROR _spoolss_addprinterex( pipes_struct *p, SPOOL_Q_ADDPRINTEREX *q_u, SPOOL_R_ADDPRINTEREX *r_u);
 WERROR _spoolss_addprinterdriver(pipes_struct *p, SPOOL_Q_ADDPRINTERDRIVER *q_u, SPOOL_R_ADDPRINTERDRIVER *r_u);
 WERROR _spoolss_addprinterdriverex(pipes_struct *p, SPOOL_Q_ADDPRINTERDRIVEREX *q_u, SPOOL_R_ADDPRINTERDRIVEREX *r_u);
 WERROR _spoolss_getprinterdriverdirectory(pipes_struct *p, SPOOL_Q_GETPRINTERDRIVERDIR *q_u, SPOOL_R_GETPRINTERDRIVERDIR *r_u);
index 68b7c3c4b9d6008cae2b029a96fda5e1a1ed1827..02b32203679115e9bc32692c880f7b19580cab98 100644 (file)
@@ -550,27 +550,7 @@ static bool api_spoolss_enumports(pipes_struct *p)
 
 static bool api_spoolss_addprinterex(pipes_struct *p)
 {
-       SPOOL_Q_ADDPRINTEREX q_u;
-       SPOOL_R_ADDPRINTEREX 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_addprinterex("", &q_u, data, 0)) {
-               DEBUG(0,("spoolss_io_q_addprinterex: unable to unmarshall SPOOL_Q_ADDPRINTEREX.\n"));
-               return False;
-       }
-       
-       r_u.status = _spoolss_addprinterex(p, &q_u, &r_u);
-                               
-       if(!spoolss_io_r_addprinterex("", &r_u, rdata, 0)) {
-               DEBUG(0,("spoolss_io_r_addprinterex: unable to marshall SPOOL_R_ADDPRINTEREX.\n"));
-               return False;
-       }
-       
-       return True;
+       return proxy_spoolss_call(p, NDR_SPOOLSS_ADDPRINTEREX);
 }
 
 /****************************************************************************
index aec5e66a1524bde1dcf02777df2d4d0839853d10..aeedf099d67440ac040b355f1590933c9ed0e98e 100644 (file)
@@ -7781,11 +7781,13 @@ WERROR _spoolss_enumports( pipes_struct *p, SPOOL_Q_ENUMPORTS *q_u, SPOOL_R_ENUM
 /****************************************************************************
 ****************************************************************************/
 
-static WERROR spoolss_addprinterex_level_2( pipes_struct *p, const UNISTR2 *uni_srv_name,
-                               const SPOOL_PRINTER_INFO_LEVEL *info,
-                               DEVICEMODE *devmode, SEC_DESC_BUF *sec_desc_buf,
-                               uint32 user_switch, const SPOOL_USER_CTR *user,
-                               POLICY_HND *handle)
+static WERROR spoolss_addprinterex_level_2(pipes_struct *p,
+                                          const char *server,
+                                          struct spoolss_SetPrinterInfoCtr *info_ctr,
+                                          struct spoolss_DeviceMode *devmode,
+                                          struct security_descriptor *sec_desc,
+                                          struct spoolss_UserLevelCtr *user_ctr,
+                                          POLICY_HND *handle)
 {
        NT_PRINTER_INFO_LEVEL *printer = NULL;
        fstring name;
@@ -7798,7 +7800,7 @@ static WERROR spoolss_addprinterex_level_2( pipes_struct *p, const UNISTR2 *uni_
        }
 
        /* convert from UNICODE to ASCII - this allocates the info_2 struct inside *printer.*/
-       if (!convert_printer_info(info, printer, 2)) {
+       if (!convert_printer_info_new(info_ctr, printer)) {
                free_a_printer(&printer, 2);
                return WERR_NOMEM;
        }
@@ -7871,8 +7873,9 @@ static WERROR spoolss_addprinterex_level_2( pipes_struct *p, const UNISTR2 *uni_
                */
                DEBUGADD(10, ("spoolss_addprinterex_level_2: devmode included, converting\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))
                        return  WERR_NOMEM;
        }
 
@@ -7896,31 +7899,27 @@ static WERROR spoolss_addprinterex_level_2( pipes_struct *p, const UNISTR2 *uni_
        return WERR_OK;
 }
 
-/****************************************************************************
-****************************************************************************/
+/****************************************************************
+ _spoolss_AddPrinterEx
+****************************************************************/
 
-WERROR _spoolss_addprinterex( pipes_struct *p, SPOOL_Q_ADDPRINTEREX *q_u, SPOOL_R_ADDPRINTEREX *r_u)
+WERROR _spoolss_AddPrinterEx(pipes_struct *p,
+                            struct spoolss_AddPrinterEx *r)
 {
-       UNISTR2 *uni_srv_name = q_u->server_name;
-       uint32 level = q_u->level;
-       SPOOL_PRINTER_INFO_LEVEL *info = &q_u->info;
-       DEVICEMODE *devmode = q_u->devmode_ctr.devmode;
-       SEC_DESC_BUF *sdb = q_u->secdesc_ctr;
-       uint32 user_switch = q_u->user_switch;
-       SPOOL_USER_CTR *user = &q_u->user_ctr;
-       POLICY_HND *handle = &r_u->handle;
-
-       switch (level) {
-               case 1:
-                       /* we don't handle yet */
-                       /* but I know what to do ... */
-                       return WERR_UNKNOWN_LEVEL;
-               case 2:
-                       return spoolss_addprinterex_level_2(p, uni_srv_name, info,
-                                                           devmode, sdb,
-                                                           user_switch, user, handle);
-               default:
-                       return WERR_UNKNOWN_LEVEL;
+       switch (r->in.info_ctr->level) {
+       case 1:
+               /* we don't handle yet */
+               /* but I know what to do ... */
+               return WERR_UNKNOWN_LEVEL;
+       case 2:
+               return spoolss_addprinterex_level_2(p, r->in.server,
+                                                   r->in.info_ctr,
+                                                   r->in.devmode_ctr->devmode,
+                                                   r->in.secdesc_ctr->sd,
+                                                   r->in.userlevel_ctr,
+                                                   r->out.handle);
+       default:
+               return WERR_UNKNOWN_LEVEL;
        }
 }
 
@@ -10612,17 +10611,6 @@ WERROR _spoolss_44(pipes_struct *p,
        return WERR_NOT_SUPPORTED;
 }
 
-/****************************************************************
- _spoolss_AddPrinterEx
-****************************************************************/
-
-WERROR _spoolss_AddPrinterEx(pipes_struct *p,
-                            struct spoolss_AddPrinterEx *r)
-{
-       p->rng_fault_state = true;
-       return WERR_NOT_SUPPORTED;
-}
-
 /****************************************************************
  _spoolss_47
 ****************************************************************/