summaryrefslogtreecommitdiff
path: root/source3/rpc_server
diff options
context:
space:
mode:
Diffstat (limited to 'source3/rpc_server')
-rwxr-xr-xsource3/rpc_server/srv_spoolss.c31
-rw-r--r--source3/rpc_server/srv_spoolss_nt.c32
2 files changed, 63 insertions, 0 deletions
diff --git a/source3/rpc_server/srv_spoolss.c b/source3/rpc_server/srv_spoolss.c
index da7db8e557..db4cab662b 100755
--- a/source3/rpc_server/srv_spoolss.c
+++ b/source3/rpc_server/srv_spoolss.c
@@ -124,6 +124,36 @@ static BOOL api_spoolss_closeprinter(prs_struct *data, prs_struct *rdata)
}
/********************************************************************
+ * api_spoolss_deleteprinter
+ *
+ * called from the spoolss dispatcher
+ ********************************************************************/
+static BOOL api_spoolss_deleteprinter(prs_struct *data, prs_struct *rdata)
+{
+ SPOOL_Q_DELETEPRINTER q_u;
+ SPOOL_R_DELETEPRINTER r_u;
+
+ ZERO_STRUCT(q_u);
+ ZERO_STRUCT(r_u);
+
+ if (!spoolss_io_q_deleteprinter("", &q_u, data, 0)) {
+ DEBUG(0,("spoolss_io_q_deleteprinter: unable to unmarshall SPOOL_Q_DELETEPRINTER.\n"));
+ return False;
+ }
+
+ r_u.status = _spoolss_deleteprinter(&q_u.handle);
+ memcpy(&r_u.handle, &q_u.handle, sizeof(r_u.handle));
+
+ if (!spoolss_io_r_deleteprinter("",&r_u,rdata,0)) {
+ DEBUG(0,("spoolss_io_r_deleteprinter: unable to marshall SPOOL_R_DELETEPRINTER.\n"));
+ return False;
+ }
+
+ return True;
+}
+
+
+/********************************************************************
* api_spoolss_rffpcnex
* ReplyFindFirstPrinterChangeNotifyEx
********************************************************************/
@@ -1104,6 +1134,7 @@ struct api_struct api_spoolss_cmds[] =
{"SPOOLSS_OPENPRINTEREX", SPOOLSS_OPENPRINTEREX, api_spoolss_open_printer_ex },
{"SPOOLSS_GETPRINTERDATA", SPOOLSS_GETPRINTERDATA, api_spoolss_getprinterdata },
{"SPOOLSS_CLOSEPRINTER", SPOOLSS_CLOSEPRINTER, api_spoolss_closeprinter },
+ {"SPOOLSS_DELETEPRINTER", SPOOLSS_DELETEPRINTER, api_spoolss_deleteprinter },
{"SPOOLSS_RFFPCNEX", SPOOLSS_RFFPCNEX, api_spoolss_rffpcnex },
{"SPOOLSS_RFNPCNEX", SPOOLSS_RFNPCNEX, api_spoolss_rfnpcnex },
{"SPOOLSS_ENUMPRINTERS", SPOOLSS_ENUMPRINTERS, api_spoolss_enumprinters },
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index 6a0323f850..43f0c94987 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -201,6 +201,27 @@ static BOOL close_printer_handle(POLICY_HND *hnd)
}
/****************************************************************************
+ delete a printer given a handle
+****************************************************************************/
+static BOOL delete_printer_handle(POLICY_HND *hnd)
+{
+ Printer_entry *Printer = find_printer_index_by_hnd(hnd);
+
+ if (!OPEN_HANDLE(Printer))
+ {
+ DEBUG(3,("Error closing printer handle\n"));
+ return False;
+ }
+
+ if (del_a_printer(Printer->dev.printername) != 0) {
+ DEBUG(3,("Error deleting printer %s\n", Printer->dev.printername));
+ return False;
+ }
+
+ return True;
+}
+
+/****************************************************************************
return the snum of a printer corresponding to an handle
****************************************************************************/
static BOOL get_printer_snum(const POLICY_HND *hnd, int *number)
@@ -623,6 +644,17 @@ uint32 _spoolss_closeprinter(POLICY_HND *handle)
}
/********************************************************************
+ * api_spoolss_deleteprinter
+ ********************************************************************/
+uint32 _spoolss_deleteprinter(POLICY_HND *handle)
+{
+ if (!delete_printer_handle(handle))
+ return ERROR_INVALID_HANDLE;
+
+ return NT_STATUS_NO_PROBLEMO;
+}
+
+/********************************************************************
GetPrinterData on a printer server Handle.
********************************************************************/
static BOOL getprinterdata_printer_server(fstring value, uint32 *type, uint8 **data, uint32 *needed, uint32 in_size)