summaryrefslogtreecommitdiff
path: root/source3/rpc_server
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-03-06 21:51:12 +0100
committerGünther Deschner <gd@samba.org>2009-03-07 00:49:51 +0100
commit3cf22a88562ccbab79c2a4a389fa6559cda71319 (patch)
treeedd26b40290395363f77f9817c5f7e9efa6c5910 /source3/rpc_server
parenta58e59fc6ed0ee91c8761cbda62c34e35e6dd153 (diff)
downloadsamba-3cf22a88562ccbab79c2a4a389fa6559cda71319.tar.gz
samba-3cf22a88562ccbab79c2a4a389fa6559cda71319.tar.bz2
samba-3cf22a88562ccbab79c2a4a389fa6559cda71319.zip
s3-spoolss: use pidl for _spoolss_EnumPrintProcDataTypes.
Guenther
Diffstat (limited to 'source3/rpc_server')
-rw-r--r--source3/rpc_server/srv_spoolss.c22
-rw-r--r--source3/rpc_server/srv_spoolss_nt.c102
2 files changed, 51 insertions, 73 deletions
diff --git a/source3/rpc_server/srv_spoolss.c b/source3/rpc_server/srv_spoolss.c
index 9b83377bfe..5f6e7d8a2a 100644
--- a/source3/rpc_server/srv_spoolss.c
+++ b/source3/rpc_server/srv_spoolss.c
@@ -593,27 +593,7 @@ static bool api_spoolss_addprintprocessor(pipes_struct *p)
static bool api_spoolss_enumprintprocdatatypes(pipes_struct *p)
{
- SPOOL_Q_ENUMPRINTPROCDATATYPES q_u;
- SPOOL_R_ENUMPRINTPROCDATATYPES 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_enumprintprocdatatypes("", &q_u, data, 0)) {
- DEBUG(0,("spoolss_io_q_enumprintprocdatatypes: unable to unmarshall SPOOL_Q_ENUMPRINTPROCDATATYPES.\n"));
- return False;
- }
-
- r_u.status = _spoolss_enumprintprocdatatypes(p, &q_u, &r_u);
-
- if(!spoolss_io_r_enumprintprocdatatypes("", &r_u, rdata, 0)) {
- DEBUG(0,("spoolss_io_r_enumprintprocdatatypes: unable to marshall SPOOL_R_ENUMPRINTPROCDATATYPES.\n"));
- return False;
- }
-
- return True;
+ return proxy_spoolss_call(p, NDR_SPOOLSS_ENUMPRINTPROCDATATYPES);
}
/****************************************************************************
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index 5ded5aeadc..419e178389 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -8823,76 +8823,85 @@ WERROR _spoolss_EnumPrintProcessors(pipes_struct *p,
}
/****************************************************************************
+ fill_printprocdatatype1
+****************************************************************************/
+
+static WERROR fill_printprocdatatype1(TALLOC_CTX *mem_ctx,
+ struct spoolss_PrintProcDataTypesInfo1 *r,
+ const char *name_array)
+{
+ r->name_array = talloc_strdup(mem_ctx, name_array);
+ W_ERROR_HAVE_NO_MEMORY(r->name_array);
+
+ return WERR_OK;
+}
+
+/****************************************************************************
enumprintprocdatatypes level 1.
****************************************************************************/
-static WERROR enumprintprocdatatypes_level_1(RPC_BUFFER *buffer, uint32 offered, uint32 *needed, uint32 *returned)
+static WERROR enumprintprocdatatypes_level_1(TALLOC_CTX *mem_ctx,
+ union spoolss_PrintProcDataTypesInfo **info_p,
+ uint32_t offered,
+ uint32_t *needed,
+ uint32_t *count)
{
- PRINTPROCDATATYPE_1 *info_1=NULL;
- WERROR result = WERR_OK;
+ WERROR result;
+ union spoolss_PrintProcDataTypesInfo *info;
- if((info_1 = SMB_MALLOC_P(PRINTPROCDATATYPE_1)) == NULL)
- return WERR_NOMEM;
+ info = TALLOC_ARRAY(mem_ctx, union spoolss_PrintProcDataTypesInfo, 1);
+ W_ERROR_HAVE_NO_MEMORY(info);
- (*returned) = 0x1;
+ *count = 1;
- init_unistr(&info_1->name, "RAW");
+ result = fill_printprocdatatype1(info, &info[0].info1, "RAW");
+ if (!W_ERROR_IS_OK(result)) {
+ goto out;
+ }
- *needed += spoolss_size_printprocdatatype_info_1(info_1);
+ *needed += ndr_size_spoolss_PrintProcDataTypesInfo1(&info[0].info1, NULL, 0);
if (*needed > offered) {
result = WERR_INSUFFICIENT_BUFFER;
goto out;
}
- if (!rpcbuf_alloc_size(buffer, *needed)) {
- result = WERR_NOMEM;
- goto out;
+ out:
+ if (!W_ERROR_IS_OK(result)) {
+ TALLOC_FREE(info);
+ *count = 0;
+ return result;
}
- smb_io_printprocdatatype_info_1("", buffer, info_1, 0);
-
-out:
- SAFE_FREE(info_1);
-
- if ( !W_ERROR_IS_OK(result) )
- *returned = 0;
+ *info_p = info;
- return result;
+ return WERR_OK;
}
-/****************************************************************************
-****************************************************************************/
+/****************************************************************
+ _spoolss_EnumPrintProcDataTypes
+****************************************************************/
-WERROR _spoolss_enumprintprocdatatypes(pipes_struct *p, SPOOL_Q_ENUMPRINTPROCDATATYPES *q_u, SPOOL_R_ENUMPRINTPROCDATATYPES *r_u)
+WERROR _spoolss_EnumPrintProcDataTypes(pipes_struct *p,
+ struct spoolss_EnumPrintProcDataTypes *r)
{
- uint32 level = q_u->level;
- RPC_BUFFER *buffer = NULL;
- uint32 offered = q_u->offered;
- uint32 *needed = &r_u->needed;
- uint32 *returned = &r_u->returned;
-
/* that's an [in out] buffer */
- if (!q_u->buffer && (offered!=0)) {
- return WERR_INVALID_PARAM;
- }
-
- if (offered > MAX_RPC_DATA_SIZE) {
+ if (!r->in.buffer && (r->in.offered != 0)) {
return WERR_INVALID_PARAM;
}
- rpcbuf_move(q_u->buffer, &r_u->buffer);
- buffer = r_u->buffer;
-
- DEBUG(5,("_spoolss_enumprintprocdatatypes\n"));
+ DEBUG(5,("_spoolss_EnumPrintProcDataTypes\n"));
- *returned=0;
- *needed=0;
+ *r->out.count = 0;
+ *r->out.needed = 0;
+ *r->out.info = NULL;
- switch (level) {
+ switch (r->in.level) {
case 1:
- return enumprintprocdatatypes_level_1(buffer, offered, needed, returned);
+ return enumprintprocdatatypes_level_1(p->mem_ctx, r->out.info,
+ r->in.offered, r->out.needed,
+ r->out.count);
default:
return WERR_UNKNOWN_LEVEL;
}
@@ -10448,17 +10457,6 @@ WERROR _spoolss_DeletePrintProvidor(pipes_struct *p,
}
/****************************************************************
- _spoolss_EnumPrintProcDataTypes
-****************************************************************/
-
-WERROR _spoolss_EnumPrintProcDataTypes(pipes_struct *p,
- struct spoolss_EnumPrintProcDataTypes *r)
-{
- p->rng_fault_state = true;
- return WERR_NOT_SUPPORTED;
-}
-
-/****************************************************************
_spoolss_GetPrinterDriver2
****************************************************************/