summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2001-02-28 02:38:09 +0000
committerJeremy Allison <jra@samba.org>2001-02-28 02:38:09 +0000
commitacc06fc7a83f1bdd28bddec7fcf47319d4c35b2b (patch)
tree0f21b48c94835253073de79046568646bc8a86af
parent2a258f7a64873fe4be213f974e21e6f0f596d0cd (diff)
downloadsamba-acc06fc7a83f1bdd28bddec7fcf47319d4c35b2b.tar.gz
samba-acc06fc7a83f1bdd28bddec7fcf47319d4c35b2b.tar.bz2
samba-acc06fc7a83f1bdd28bddec7fcf47319d4c35b2b.zip
More converted to canonical format. Home now - do the rest tomorrow...
Jeremy. (This used to be commit 9d5979f51ec7b2a62fb9b290eb0393594cfa6224)
-rw-r--r--source3/include/proto.h32
-rwxr-xr-xsource3/rpc_server/srv_spoolss.c52
-rw-r--r--source3/rpc_server/srv_spoolss_nt.c136
3 files changed, 122 insertions, 98 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 091796c412..5789341390 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -3423,30 +3423,16 @@ uint32 _spoolss_getprinterdriver2(pipes_struct *p, SPOOL_Q_GETPRINTERDRIVER2 *q_
uint32 _spoolss_startpageprinter(pipes_struct *p, SPOOL_Q_STARTPAGEPRINTER *q_u, SPOOL_R_STARTPAGEPRINTER *r_u);
uint32 _spoolss_endpageprinter(pipes_struct *p, SPOOL_Q_ENDPAGEPRINTER *q_u, SPOOL_R_ENDPAGEPRINTER *r_u);
uint32 _spoolss_startdocprinter(pipes_struct *p, SPOOL_Q_STARTDOCPRINTER *q_u, SPOOL_R_STARTDOCPRINTER *r_u);
-uint32 _spoolss_enddocprinter(POLICY_HND *handle);
-uint32 _spoolss_writeprinter( POLICY_HND *handle,
- uint32 buffer_size,
- uint8 *buffer,
- uint32 *buffer_written);
+uint32 _spoolss_enddocprinter(pipes_struct *p, SPOOL_Q_ENDDOCPRINTER *q_u, SPOOL_R_ENDDOCPRINTER *r_u);
+uint32 _spoolss_writeprinter(pipes_struct *p, SPOOL_Q_WRITEPRINTER *q_u, SPOOL_R_WRITEPRINTER *r_u);
uint32 _spoolss_abortprinter(pipes_struct *p, SPOOL_Q_ABORTPRINTER *q_u, SPOOL_R_ABORTPRINTER *r_u);
-uint32 _spoolss_setprinter(POLICY_HND *handle, uint32 level,
- const SPOOL_PRINTER_INFO_LEVEL *info,
- DEVMODE_CTR devmode_ctr,
- SEC_DESC_BUF *secdesc_ctr,
- uint32 command, pipes_struct *p);
-uint32 _spoolss_fcpn(POLICY_HND *handle);
-uint32 _spoolss_addjob(POLICY_HND *handle, uint32 level,
- NEW_BUFFER *buffer, uint32 offered,
- uint32 *needed);
-uint32 _spoolss_enumjobs( POLICY_HND *handle, uint32 firstjob, uint32 numofjobs, uint32 level,
- NEW_BUFFER *buffer, uint32 offered,
- uint32 *needed, uint32 *returned);
-uint32 _spoolss_schedulejob( POLICY_HND *handle, uint32 jobid);
-uint32 _spoolss_setjob(POLICY_HND *handle, uint32 jobid, uint32 level,
- pipes_struct *p, JOB_INFO *ctr, uint32 command);
-uint32 _spoolss_enumprinterdrivers( UNISTR2 *name, UNISTR2 *environment, uint32 level,
- NEW_BUFFER *buffer, uint32 offered,
- uint32 *needed, uint32 *returned);
+uint32 _spoolss_setprinter(pipes_struct *p, SPOOL_Q_SETPRINTER *q_u, SPOOL_R_SETPRINTER *r_u);
+uint32 _spoolss_fcpn(pipes_struct *p, SPOOL_Q_FCPN *q_u, SPOOL_R_FCPN *r_u);
+uint32 _spoolss_addjob(pipes_struct *p, SPOOL_Q_ADDJOB *q_u, SPOOL_R_ADDJOB *r_u);
+uint32 _spoolss_enumjobs( pipes_struct *p, SPOOL_Q_ENUMJOBS *q_u, SPOOL_R_ENUMJOBS *r_u);
+uint32 _spoolss_schedulejob( pipes_struct *p, SPOOL_Q_SCHEDULEJOB *q_u, SPOOL_R_SCHEDULEJOB *r_u);
+uint32 _spoolss_setjob(pipes_struct *p, SPOOL_Q_SETJOB *q_u, SPOOL_R_SETJOB *r_u);
+uint32 _spoolss_enumprinterdrivers( pipes_struct *p, SPOOL_Q_ENUMPRINTERDRIVERS *q_u, SPOOL_R_ENUMPRINTERDRIVERS *r_u);
uint32 _new_spoolss_enumforms( POLICY_HND *handle, uint32 level,
NEW_BUFFER *buffer, uint32 offered,
uint32 *needed, uint32 *numofforms);
diff --git a/source3/rpc_server/srv_spoolss.c b/source3/rpc_server/srv_spoolss.c
index d8eaab2714..685deba2fa 100755
--- a/source3/rpc_server/srv_spoolss.c
+++ b/source3/rpc_server/srv_spoolss.c
@@ -463,6 +463,7 @@ static BOOL api_spoolss_startdocprinter(pipes_struct *p)
/********************************************************************
********************************************************************/
+
static BOOL api_spoolss_enddocprinter(pipes_struct *p)
{
SPOOL_Q_ENDDOCPRINTER q_u;
@@ -478,7 +479,7 @@ static BOOL api_spoolss_enddocprinter(pipes_struct *p)
return False;
}
- r_u.status = _spoolss_enddocprinter(&q_u.handle);
+ r_u.status = _spoolss_enddocprinter(p, &q_u, &r_u);
if(!spoolss_io_r_enddocprinter("",&r_u,rdata,0)) {
DEBUG(0,("spoolss_io_r_enddocprinter: unable to marshall SPOOL_R_ENDDOCPRINTER.\n"));
@@ -488,9 +489,9 @@ static BOOL api_spoolss_enddocprinter(pipes_struct *p)
return True;
}
-
/********************************************************************
********************************************************************/
+
static BOOL api_spoolss_writeprinter(pipes_struct *p)
{
SPOOL_Q_WRITEPRINTER q_u;
@@ -506,11 +507,7 @@ static BOOL api_spoolss_writeprinter(pipes_struct *p)
return False;
}
- r_u.status = _spoolss_writeprinter(&q_u.handle,
- q_u.buffer_size,
- q_u.buffer,
- &q_u.buffer_size2);
- r_u.buffer_written = q_u.buffer_size2;
+ r_u.status = _spoolss_writeprinter(p, &q_u, &r_u);
if(!spoolss_io_r_writeprinter("",&r_u,rdata,0)) {
DEBUG(0,("spoolss_io_r_writeprinter: unable to marshall SPOOL_R_WRITEPRINTER.\n"));
@@ -523,6 +520,7 @@ static BOOL api_spoolss_writeprinter(pipes_struct *p)
/****************************************************************************
****************************************************************************/
+
static BOOL api_spoolss_setprinter(pipes_struct *p)
{
SPOOL_Q_SETPRINTER q_u;
@@ -538,9 +536,7 @@ static BOOL api_spoolss_setprinter(pipes_struct *p)
return False;
}
- r_u.status = _spoolss_setprinter(&q_u.handle, q_u.level, &q_u.info,
- q_u.devmode_ctr, q_u.secdesc_ctr,
- q_u.command, p);
+ 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"));
@@ -552,6 +548,7 @@ static BOOL api_spoolss_setprinter(pipes_struct *p)
/****************************************************************************
****************************************************************************/
+
static BOOL api_spoolss_fcpn(pipes_struct *p)
{
SPOOL_Q_FCPN q_u;
@@ -567,7 +564,7 @@ static BOOL api_spoolss_fcpn(pipes_struct *p)
return False;
}
- r_u.status = _spoolss_fcpn(&q_u.handle);
+ r_u.status = _spoolss_fcpn(p, &q_u, &r_u);
if(!spoolss_io_r_fcpn("",&r_u,rdata,0)) {
DEBUG(0,("spoolss_io_r_fcpn: unable to marshall SPOOL_R_FCPN.\n"));
@@ -577,9 +574,9 @@ static BOOL api_spoolss_fcpn(pipes_struct *p)
return True;
}
-
/****************************************************************************
****************************************************************************/
+
static BOOL api_spoolss_addjob(pipes_struct *p)
{
SPOOL_Q_ADDJOB q_u;
@@ -595,11 +592,7 @@ static BOOL api_spoolss_addjob(pipes_struct *p)
return False;
}
- /* that's an [in out] buffer (despite appearences to the contrary) */
- new_spoolss_move_buffer(q_u.buffer, &r_u.buffer);
-
- r_u.status = _spoolss_addjob(&q_u.handle, q_u.level,
- r_u.buffer, q_u.offered, &r_u.needed);
+ r_u.status = _spoolss_addjob(p, &q_u, &r_u);
if(!spoolss_io_r_addjob("",&r_u,rdata,0)) {
DEBUG(0,("spoolss_io_r_addjob: unable to marshall SPOOL_R_ADDJOB.\n"));
@@ -609,9 +602,9 @@ static BOOL api_spoolss_addjob(pipes_struct *p)
return True;
}
-
/****************************************************************************
****************************************************************************/
+
static BOOL api_spoolss_enumjobs(pipes_struct *p)
{
SPOOL_Q_ENUMJOBS q_u;
@@ -627,12 +620,7 @@ static BOOL api_spoolss_enumjobs(pipes_struct *p)
return False;
}
- /* that's an [in out] buffer */
- new_spoolss_move_buffer(q_u.buffer, &r_u.buffer);
-
- r_u.status = _spoolss_enumjobs(&q_u.handle, q_u.firstjob, q_u.numofjobs, q_u.level,
- r_u.buffer, q_u.offered,
- &r_u.needed, &r_u.returned);
+ r_u.status = _spoolss_enumjobs(p, &q_u, &r_u);
if (!spoolss_io_r_enumjobs("",&r_u,rdata,0)) {
DEBUG(0,("spoolss_io_r_enumjobs: unable to marshall SPOOL_R_ENUMJOBS.\n"));
@@ -642,9 +630,9 @@ static BOOL api_spoolss_enumjobs(pipes_struct *p)
return True;
}
-
/****************************************************************************
****************************************************************************/
+
static BOOL api_spoolss_schedulejob(pipes_struct *p)
{
SPOOL_Q_SCHEDULEJOB q_u;
@@ -660,7 +648,7 @@ static BOOL api_spoolss_schedulejob(pipes_struct *p)
return False;
}
- r_u.status = _spoolss_schedulejob(&q_u.handle, q_u.jobid);
+ r_u.status = _spoolss_schedulejob(p, &q_u, &r_u);
if(!spoolss_io_r_schedulejob("",&r_u,rdata,0)) {
DEBUG(0,("spoolss_io_r_schedulejob: unable to marshall SPOOL_R_SCHEDULEJOB.\n"));
@@ -672,6 +660,7 @@ static BOOL api_spoolss_schedulejob(pipes_struct *p)
/****************************************************************************
****************************************************************************/
+
static BOOL api_spoolss_setjob(pipes_struct *p)
{
SPOOL_Q_SETJOB q_u;
@@ -687,8 +676,7 @@ static BOOL api_spoolss_setjob(pipes_struct *p)
return False;
}
- r_u.status = _spoolss_setjob(&q_u.handle, q_u.jobid,
- q_u.level, p, &q_u.ctr, q_u.command);
+ r_u.status = _spoolss_setjob(p, &q_u, &r_u);
if(!spoolss_io_r_setjob("",&r_u,rdata,0)) {
DEBUG(0,("spoolss_io_r_setjob: unable to marshall SPOOL_R_SETJOB.\n"));
@@ -716,12 +704,7 @@ static BOOL api_spoolss_enumprinterdrivers(pipes_struct *p)
return False;
}
- /* that's an [in out] buffer */
- new_spoolss_move_buffer(q_u.buffer, &r_u.buffer);
-
- r_u.status = _spoolss_enumprinterdrivers(&q_u.name, &q_u.environment, q_u.level,
- r_u.buffer, q_u.offered,
- &r_u.needed, &r_u.returned);
+ r_u.status = _spoolss_enumprinterdrivers(p, &q_u, &r_u);
if (!new_spoolss_io_r_enumprinterdrivers("",&r_u,rdata,0)) {
DEBUG(0,("new_spoolss_io_r_enumprinterdrivers: unable to marshall SPOOL_R_ENUMPRINTERDRIVERS.\n"));
@@ -731,7 +714,6 @@ static BOOL api_spoolss_enumprinterdrivers(pipes_struct *p)
return True;
}
-
/****************************************************************************
****************************************************************************/
static BOOL api_spoolss_getform(pipes_struct *p)
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index 4b5d27d002..1f179a9b1d 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -992,6 +992,26 @@ BOOL convert_devicemode(char *printername, const DEVICEMODE *devmode,
}
/********************************************************************
+ * _spoolss_enddocprinter_internal.
+ ********************************************************************/
+
+static uint32 _spoolss_enddocprinter_internal(POLICY_HND *handle)
+{
+ Printer_entry *Printer=find_printer_index_by_hnd(handle);
+
+ if (!OPEN_HANDLE(Printer)) {
+ DEBUG(0,("_spoolss_enddocprinter_internal: Invalid handle (%s)\n", OUR_HANDLE(handle)));
+ return ERROR_INVALID_HANDLE;
+ }
+
+ Printer->document_started=False;
+ print_job_end(Printer->jobid,True);
+ /* error codes unhandled so far ... */
+
+ return 0x0;
+}
+
+/********************************************************************
* api_spoolss_closeprinter
********************************************************************/
@@ -1002,7 +1022,7 @@ uint32 _spoolss_closeprinter(pipes_struct *p, SPOOL_Q_CLOSEPRINTER *q_u, SPOOL_R
Printer_entry *Printer=find_printer_index_by_hnd(handle);
if (Printer && Printer->document_started)
- _spoolss_enddocprinter(handle); /* print job was not closed */
+ _spoolss_enddocprinter_internal(handle); /* print job was not closed */
memcpy(&r_u->handle, &q_u->handle, sizeof(r_u->handle));
@@ -1025,7 +1045,7 @@ uint32 _spoolss_deleteprinter(pipes_struct *p, SPOOL_Q_DELETEPRINTER *q_u, SPOOL
uint32 result;
if (Printer && Printer->document_started)
- _spoolss_enddocprinter(handle); /* print job was not closed */
+ _spoolss_enddocprinter_internal(handle); /* print job was not closed */
memcpy(&r_u->handle, &q_u->handle, sizeof(r_u->handle));
@@ -3898,38 +3918,36 @@ uint32 _spoolss_startdocprinter(pipes_struct *p, SPOOL_Q_STARTDOCPRINTER *q_u, S
* called from the spoolss dispatcher
*
********************************************************************/
-uint32 _spoolss_enddocprinter(POLICY_HND *handle)
+
+uint32 _spoolss_enddocprinter(pipes_struct *p, SPOOL_Q_ENDDOCPRINTER *q_u, SPOOL_R_ENDDOCPRINTER *r_u)
{
- Printer_entry *Printer=find_printer_index_by_hnd(handle);
-
- if (!OPEN_HANDLE(Printer)) {
- DEBUG(0,("_spoolss_enddocprinter: Invalid handle (%s)\n", OUR_HANDLE(handle)));
- return ERROR_INVALID_HANDLE;
- }
-
- Printer->document_started=False;
- print_job_end(Printer->jobid,True);
- /* error codes unhandled so far ... */
+ POLICY_HND *handle = &q_u->handle;
- return 0x0;
+ return _spoolss_enddocprinter_internal(handle);
}
/****************************************************************************
****************************************************************************/
-uint32 _spoolss_writeprinter( POLICY_HND *handle,
- uint32 buffer_size,
- uint8 *buffer,
- uint32 *buffer_written)
+
+uint32 _spoolss_writeprinter(pipes_struct *p, SPOOL_Q_WRITEPRINTER *q_u, SPOOL_R_WRITEPRINTER *r_u)
{
+ POLICY_HND *handle = &q_u->handle;
+ uint32 buffer_size = q_u->buffer_size;
+ uint8 *buffer = q_u->buffer;
+ uint32 *buffer_written = &q_u->buffer_size2;
+
Printer_entry *Printer = find_printer_index_by_hnd(handle);
if (!OPEN_HANDLE(Printer)) {
DEBUG(0,("_spoolss_writeprinter: Invalid handle (%s)\n",OUR_HANDLE(handle)));
+ r_u->buffer_written = q_u->buffer_size2;
return ERROR_INVALID_HANDLE;
}
- (*buffer_written) = print_job_write(Printer->jobid, (char *)buffer,
- buffer_size);
+ (*buffer_written) = print_job_write(Printer->jobid, (char *)buffer, buffer_size);
+
+
+ r_u->buffer_written = q_u->buffer_size2;
return 0x0;
}
@@ -4530,12 +4548,16 @@ static uint32 update_printer(POLICY_HND *handle, uint32 level,
/****************************************************************************
****************************************************************************/
-uint32 _spoolss_setprinter(POLICY_HND *handle, uint32 level,
- const SPOOL_PRINTER_INFO_LEVEL *info,
- DEVMODE_CTR devmode_ctr,
- SEC_DESC_BUF *secdesc_ctr,
- uint32 command, pipes_struct *p)
+
+uint32 _spoolss_setprinter(pipes_struct *p, SPOOL_Q_SETPRINTER *q_u, SPOOL_R_SETPRINTER *r_u)
{
+ 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;
+
Printer_entry *Printer = find_printer_index_by_hnd(handle);
if (!OPEN_HANDLE(Printer)) {
@@ -4559,8 +4581,11 @@ uint32 _spoolss_setprinter(POLICY_HND *handle, uint32 level,
/****************************************************************************
****************************************************************************/
-uint32 _spoolss_fcpn(POLICY_HND *handle)
+
+uint32 _spoolss_fcpn(pipes_struct *p, SPOOL_Q_FCPN *q_u, SPOOL_R_FCPN *r_u)
{
+ POLICY_HND *handle = &q_u->handle;
+
Printer_entry *Printer= find_printer_index_by_hnd(handle);
if (!OPEN_HANDLE(Printer)) {
@@ -4587,11 +4612,13 @@ uint32 _spoolss_fcpn(POLICY_HND *handle)
/****************************************************************************
****************************************************************************/
-uint32 _spoolss_addjob(POLICY_HND *handle, uint32 level,
- NEW_BUFFER *buffer, uint32 offered,
- uint32 *needed)
+
+uint32 _spoolss_addjob(pipes_struct *p, SPOOL_Q_ADDJOB *q_u, SPOOL_R_ADDJOB *r_u)
{
- *needed = 0;
+ /* that's an [in out] buffer (despite appearences to the contrary) */
+ new_spoolss_move_buffer(q_u->buffer, &r_u->buffer);
+
+ r_u->needed = 0;
return ERROR_INVALID_PARAMETER; /* this is what a NT server
returns for AddJob. AddJob
must fail on non-local
@@ -4779,14 +4806,26 @@ static uint32 enumjobs_level2(print_queue_struct *queue, int snum,
/****************************************************************************
Enumjobs.
****************************************************************************/
-uint32 _spoolss_enumjobs( POLICY_HND *handle, uint32 firstjob, uint32 numofjobs, uint32 level,
- NEW_BUFFER *buffer, uint32 offered,
- uint32 *needed, uint32 *returned)
+
+uint32 _spoolss_enumjobs( pipes_struct *p, SPOOL_Q_ENUMJOBS *q_u, SPOOL_R_ENUMJOBS *r_u)
{
+ POLICY_HND *handle = &q_u->handle;
+/* uint32 firstjob = q_u->firstjob; - notused. */
+/* uint32 numofjobs = q_u->numofjobs; - notused. */
+ uint32 level = q_u->level;
+ NEW_BUFFER *buffer = NULL;
+ uint32 offered = q_u->offered;
+ uint32 *needed = &r_u->needed;
+ uint32 *returned = &r_u->returned;
+
int snum;
print_queue_struct *queue=NULL;
print_status_struct prt_status;
+ /* that's an [in out] buffer */
+ new_spoolss_move_buffer(q_u->buffer, &r_u->buffer);
+ buffer = r_u->buffer;
+
DEBUG(4,("_spoolss_enumjobs\n"));
ZERO_STRUCT(prt_status);
@@ -4817,19 +4856,25 @@ uint32 _spoolss_enumjobs( POLICY_HND *handle, uint32 firstjob, uint32 numofjobs,
}
}
-
/****************************************************************************
****************************************************************************/
-uint32 _spoolss_schedulejob( POLICY_HND *handle, uint32 jobid)
+
+uint32 _spoolss_schedulejob( pipes_struct *p, SPOOL_Q_SCHEDULEJOB *q_u, SPOOL_R_SCHEDULEJOB *r_u)
{
return 0x0;
}
/****************************************************************************
****************************************************************************/
-uint32 _spoolss_setjob(POLICY_HND *handle, uint32 jobid, uint32 level,
- pipes_struct *p, JOB_INFO *ctr, uint32 command)
+
+uint32 _spoolss_setjob(pipes_struct *p, SPOOL_Q_SETJOB *q_u, SPOOL_R_SETJOB *r_u)
{
+ POLICY_HND *handle = &q_u->handle;
+ uint32 jobid = q_u->jobid;
+/* uint32 level = q_u->level; - notused. */
+/* JOB_INFO *ctr = &q_u->ctr; - notused. */
+ uint32 command = q_u->command;
+
struct current_user user;
print_status_struct prt_status;
int snum, errcode = ERROR_INVALID_FUNCTION;
@@ -5104,14 +5149,25 @@ static uint32 enumprinterdrivers_level3(fstring servername, fstring architecture
/****************************************************************************
Enumerates all printer drivers.
****************************************************************************/
-uint32 _spoolss_enumprinterdrivers( UNISTR2 *name, UNISTR2 *environment, uint32 level,
- NEW_BUFFER *buffer, uint32 offered,
- uint32 *needed, uint32 *returned)
+
+uint32 _spoolss_enumprinterdrivers( pipes_struct *p, SPOOL_Q_ENUMPRINTERDRIVERS *q_u, SPOOL_R_ENUMPRINTERDRIVERS *r_u)
{
+/* UNISTR2 *name = &q_u->name; - notused. */
+ UNISTR2 *environment = &q_u->environment;
+ uint32 level = q_u->level;
+ NEW_BUFFER *buffer = NULL;
+ uint32 offered = q_u->offered;
+ uint32 *needed = &r_u->needed;
+ uint32 *returned = &r_u->returned;
+
fstring *list = NULL;
fstring servername;
fstring architecture;
+ /* that's an [in out] buffer */
+ new_spoolss_move_buffer(q_u->buffer, &r_u->buffer);
+ buffer = r_u->buffer;
+
DEBUG(4,("_spoolss_enumprinterdrivers\n"));
fstrcpy(servername, global_myname);
*needed=0;