summaryrefslogtreecommitdiff
path: root/source4/rpc_server/spoolss
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2005-05-30 22:44:17 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:17:19 -0500
commit62480f12529326d174d2c53376765e88ca03754f (patch)
treec6e81592ee390fa7c597f5838a548a12fa392c11 /source4/rpc_server/spoolss
parent46e5fda0ad956c1b6524d89b9317b8ad35043c69 (diff)
downloadsamba-62480f12529326d174d2c53376765e88ca03754f.tar.gz
samba-62480f12529326d174d2c53376765e88ca03754f.tar.bz2
samba-62480f12529326d174d2c53376765e88ca03754f.zip
r7120: make use of the new 'noopnum' property and get rid of handwritten
parsing code for the spoolss_Enum* functions, there still same handwritten code needed but just to stack the autogenerated code into the correct way metze (This used to be commit 155d18e8b78afebfb4a84e43e3b4d8fc6c9cc4e2)
Diffstat (limited to 'source4/rpc_server/spoolss')
-rw-r--r--source4/rpc_server/spoolss/dcesrv_spoolss.c26
1 files changed, 8 insertions, 18 deletions
diff --git a/source4/rpc_server/spoolss/dcesrv_spoolss.c b/source4/rpc_server/spoolss/dcesrv_spoolss.c
index ab70035f28..4e81e5188c 100644
--- a/source4/rpc_server/spoolss/dcesrv_spoolss.c
+++ b/source4/rpc_server/spoolss/dcesrv_spoolss.c
@@ -36,7 +36,7 @@ static WERROR spoolss_EnumPrinters(struct dcesrv_call_state *dce_call, TALLOC_CT
struct ldb_message **msgs;
int count;
int i;
- union spoolss_PrinterInfo *info, **info_ptr;
+ union spoolss_PrinterInfo *info;
r->out.info = NULL;
*r->out.buf_size = 0;
@@ -52,14 +52,9 @@ static WERROR spoolss_EnumPrinters(struct dcesrv_call_state *dce_call, TALLOC_CT
if (count == 0) return WERR_OK;
if (count < 0) return WERR_GENERAL_FAILURE;
- info_ptr = talloc(mem_ctx, union spoolss_PrinterInfo *);
- W_ERROR_HAVE_NO_MEMORY(info_ptr);
-
info = talloc_array(mem_ctx, union spoolss_PrinterInfo, count);
W_ERROR_HAVE_NO_MEMORY(info);
- *info_ptr = info;
-
switch(r->in.level) {
case 1:
for (i = 0; i < count; i++) {
@@ -73,7 +68,7 @@ static WERROR spoolss_EnumPrinters(struct dcesrv_call_state *dce_call, TALLOC_CT
info[i].info1.comment = samdb_result_string(msgs[i], "comment", NULL);
}
- r->out.info = info_ptr;
+ r->out.info = info;
r->out.count = count;
return WERR_OK;
case 2:
@@ -120,7 +115,7 @@ static WERROR spoolss_EnumPrinters(struct dcesrv_call_state *dce_call, TALLOC_CT
info[i].info2.cjobs = samdb_result_uint(msgs[i], "cjobs", 0);
info[i].info2.averageppm = samdb_result_uint(msgs[i], "averageppm", 0);
}
- r->out.info = info_ptr;
+ r->out.info = info;
r->out.count = count;
return WERR_OK;
case 4:
@@ -133,7 +128,7 @@ static WERROR spoolss_EnumPrinters(struct dcesrv_call_state *dce_call, TALLOC_CT
info[i].info4.attributes = samdb_result_uint(msgs[i], "attributes", 0);
}
- r->out.info = info_ptr;
+ r->out.info = info;
r->out.count = count;
return WERR_OK;
case 5:
@@ -148,7 +143,7 @@ static WERROR spoolss_EnumPrinters(struct dcesrv_call_state *dce_call, TALLOC_CT
info[i].info5.device_not_selected_timeout = samdb_result_uint(msgs[i], "device_not_selected_timeout", 0);
info[i].info5.transmission_retry_timeout = samdb_result_uint(msgs[i], "transmission_retry_timeout", 0);
}
- r->out.info = info_ptr;
+ r->out.info = info;
r->out.count = count;
return WERR_OK;
}
@@ -536,7 +531,7 @@ static WERROR spoolss_EnumForms(struct dcesrv_call_state *dce_call, TALLOC_CTX *
static WERROR spoolss_EnumPorts(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
struct spoolss_EnumPorts *r)
{
- union spoolss_PortInfo *info, **info_ptr;
+ union spoolss_PortInfo *info;
int count;
int i;
@@ -549,21 +544,16 @@ static WERROR spoolss_EnumPorts(struct dcesrv_call_state *dce_call, TALLOC_CTX *
if (count == 0) return WERR_OK;
if (count < 0) return WERR_GENERAL_FAILURE;
- info_ptr = talloc(mem_ctx, union spoolss_PortInfo *);
- W_ERROR_HAVE_NO_MEMORY(info_ptr);
-
info = talloc_array(mem_ctx, union spoolss_PortInfo, count);
W_ERROR_HAVE_NO_MEMORY(info);
- *info_ptr = info;
-
switch (r->in.level) {
case 1:
for (i=0; i < count; i++) {
info[i].info1.port_name = talloc_strdup(mem_ctx, "Samba Printer Port");
W_ERROR_HAVE_NO_MEMORY(info[i].info1.port_name);
}
- r->out.info = info_ptr;
+ r->out.info = info;
r->out.count = count;
return WERR_OK;
case 2:
@@ -580,7 +570,7 @@ static WERROR spoolss_EnumPorts(struct dcesrv_call_state *dce_call, TALLOC_CTX *
info[i].info2.port_type = SPOOLSS_PORT_TYPE_WRITE;
info[i].info2.reserved = 0;
}
- r->out.info = info_ptr;
+ r->out.info = info;
r->out.count = count;
return WERR_OK;
}