summaryrefslogtreecommitdiff
path: root/source3/rpc_server
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-02-12 19:42:57 +0100
committerGünther Deschner <gd@samba.org>2009-02-12 22:51:29 +0100
commit97f15fcd68b142b5d304b9fec0a09c6361ee4ec0 (patch)
tree165dd108db1e85040ecbedda54187c177ea12b7d /source3/rpc_server
parent09b3016a1a17fabbef3e87c2ef51eb8d903b19a4 (diff)
downloadsamba-97f15fcd68b142b5d304b9fec0a09c6361ee4ec0.tar.gz
samba-97f15fcd68b142b5d304b9fec0a09c6361ee4ec0.tar.bz2
samba-97f15fcd68b142b5d304b9fec0a09c6361ee4ec0.zip
s3-spoolss: use pidl for _spoolss_GetPrinterDataEx.
Guenther
Diffstat (limited to 'source3/rpc_server')
-rw-r--r--source3/rpc_server/srv_spoolss.c23
-rw-r--r--source3/rpc_server/srv_spoolss_nt.c78
2 files changed, 28 insertions, 73 deletions
diff --git a/source3/rpc_server/srv_spoolss.c b/source3/rpc_server/srv_spoolss.c
index a006031595..df4b74eded 100644
--- a/source3/rpc_server/srv_spoolss.c
+++ b/source3/rpc_server/srv_spoolss.c
@@ -872,28 +872,7 @@ static bool api_spoolss_getjob(pipes_struct *p)
static bool api_spoolss_getprinterdataex(pipes_struct *p)
{
- SPOOL_Q_GETPRINTERDATAEX q_u;
- SPOOL_R_GETPRINTERDATAEX 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_getprinterdataex("", &q_u, data, 0)) {
- DEBUG(0,("spoolss_io_q_getprinterdataex: unable to unmarshall SPOOL_Q_GETPRINTERDATAEX.\n"));
- return False;
- }
-
- r_u.status = _spoolss_getprinterdataex( p, &q_u, &r_u);
-
- if (!spoolss_io_r_getprinterdataex("", &r_u, rdata, 0)) {
- DEBUG(0,("spoolss_io_r_getprinterdataex: unable to marshall SPOOL_R_GETPRINTERDATAEX.\n"));
- return False;
- }
-
- return True;
+ return proxy_spoolss_call(p, NDR_SPOOLSS_GETPRINTERDATAEX);
}
/****************************************************************************
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index 5c4ff61b17..fed7a1b404 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -9132,22 +9132,20 @@ WERROR _spoolss_getjob( pipes_struct *p, SPOOL_Q_GETJOB *q_u, SPOOL_R_GETJOB *r_
return wstatus;
}
-/********************************************************************
- spoolss_getprinterdataex
+/****************************************************************
+ _spoolss_GetPrinterDataEx
From MSDN documentation of GetPrinterDataEx: pass request
to GetPrinterData if key is "PrinterDriverData".
- ********************************************************************/
+****************************************************************/
-WERROR _spoolss_getprinterdataex(pipes_struct *p, SPOOL_Q_GETPRINTERDATAEX *q_u, SPOOL_R_GETPRINTERDATAEX *r_u)
+WERROR _spoolss_GetPrinterDataEx(pipes_struct *p,
+ struct spoolss_GetPrinterDataEx *r)
{
- POLICY_HND *handle = &q_u->handle;
- uint32 in_size = q_u->size;
- uint32 *type = &r_u->type;
- uint32 *out_size = &r_u->size;
- uint8 **data = &r_u->data;
- uint32 *needed = &r_u->needed;
- fstring keyname, valuename;
+ POLICY_HND *handle = r->in.handle;
+ uint8 *data = NULL;
+ const char *keyname = r->in.key_name;
+ const char *valuename = r->in.value_name;
Printer_entry *Printer = find_printer_index_by_hnd(p, handle);
@@ -9155,22 +9153,19 @@ WERROR _spoolss_getprinterdataex(pipes_struct *p, SPOOL_Q_GETPRINTERDATAEX *q_u,
int snum = 0;
WERROR status = WERR_OK;
- DEBUG(4,("_spoolss_getprinterdataex\n"));
-
- unistr2_to_ascii(keyname, &q_u->keyname, sizeof(keyname));
- unistr2_to_ascii(valuename, &q_u->valuename, sizeof(valuename));
+ DEBUG(4,("_spoolss_GetPrinterDataEx\n"));
- DEBUG(10, ("_spoolss_getprinterdataex: key => [%s], value => [%s]\n",
+ DEBUG(10, ("_spoolss_GetPrinterDataEx: key => [%s], value => [%s]\n",
keyname, valuename));
/* in case of problem, return some default values */
- *needed = 0;
- *type = 0;
- *out_size = in_size;
+ *r->out.needed = 0;
+ *r->out.type = 0;
if (!Printer) {
- DEBUG(2,("_spoolss_getprinterdataex: Invalid handle (%s:%u:%u).\n", OUR_HANDLE(handle)));
+ DEBUG(2,("_spoolss_GetPrinterDataEx: "
+ "Invalid handle (%s:%u:%u).\n", OUR_HANDLE(handle)));
status = WERR_BADFID;
goto done;
}
@@ -9178,7 +9173,8 @@ WERROR _spoolss_getprinterdataex(pipes_struct *p, SPOOL_Q_GETPRINTERDATAEX *q_u,
/* Is the handle to a printer or to the server? */
if (Printer->printer_type == SPLHND_SERVER) {
- DEBUG(10,("_spoolss_getprinterdataex: Not implemented for server handles yet\n"));
+ DEBUG(10,("_spoolss_GetPrinterDataEx: "
+ "Not implemented for server handles yet\n"));
status = WERR_INVALID_PARAM;
goto done;
}
@@ -9197,7 +9193,8 @@ WERROR _spoolss_getprinterdataex(pipes_struct *p, SPOOL_Q_GETPRINTERDATAEX *q_u,
}
if ( lookup_printerkey( printer->info_2->data, keyname ) == -1 ) {
- DEBUG(4,("_spoolss_getprinterdataex: Invalid keyname [%s]\n", keyname ));
+ DEBUG(4,("_spoolss_GetPrinterDataEx: "
+ "Invalid keyname [%s]\n", keyname ));
free_a_printer( &printer, 2 );
status = WERR_BADFILE;
goto done;
@@ -9205,29 +9202,19 @@ WERROR _spoolss_getprinterdataex(pipes_struct *p, SPOOL_Q_GETPRINTERDATAEX *q_u,
/* When given a new keyname, we should just create it */
- status = get_printer_dataex( p->mem_ctx, printer, keyname, valuename, type, data, needed, in_size );
+ status = get_printer_dataex( p->mem_ctx, printer, keyname, valuename,
+ r->out.type, &data, r->out.needed,
+ r->in.offered );
- if (*needed > *out_size)
+ if (*r->out.needed > r->in.offered) {
status = WERR_MORE_DATA;
+ }
-done:
- if ( !W_ERROR_IS_OK(status) )
- {
- DEBUG(5, ("error: allocating %d\n", *out_size));
-
- /* reply this param doesn't exist */
-
- if ( *out_size )
- {
- if( (*data=(uint8 *)TALLOC_ZERO(p->mem_ctx, *out_size*sizeof(uint8))) == NULL ) {
- status = WERR_NOMEM;
- goto done;
- }
- } else {
- *data = NULL;
- }
+ if (W_ERROR_IS_OK(status)) {
+ memcpy(r->out.buffer, data, r->in.offered);
}
+done:
if ( printer )
free_a_printer( &printer, 2 );
@@ -10585,17 +10572,6 @@ WERROR _spoolss_SetPrinterDataEx(pipes_struct *p,
}
/****************************************************************
- _spoolss_GetPrinterDataEx
-****************************************************************/
-
-WERROR _spoolss_GetPrinterDataEx(pipes_struct *p,
- struct spoolss_GetPrinterDataEx *r)
-{
- p->rng_fault_state = true;
- return WERR_NOT_SUPPORTED;
-}
-
-/****************************************************************
_spoolss_EnumPrinterDataEx
****************************************************************/