summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-03-20 15:48:10 +0100
committerGünther Deschner <gd@samba.org>2009-03-20 17:20:33 +0100
commit6713244d465b0cf69f1bba15744e05795ec2fda9 (patch)
treeb5dafc750ab674ac69ac9cc20016ee58824a646d /source3
parent95f2913c7de2ac69421911ec2cb0fcbb8c4e8e93 (diff)
downloadsamba-6713244d465b0cf69f1bba15744e05795ec2fda9.tar.gz
samba-6713244d465b0cf69f1bba15744e05795ec2fda9.tar.bz2
samba-6713244d465b0cf69f1bba15744e05795ec2fda9.zip
s3-spoolss: use enum_all_printers_info_level for level 1 and 2.
Guenther
Diffstat (limited to 'source3')
-rw-r--r--source3/rpc_server/srv_spoolss_nt.c118
1 files changed, 8 insertions, 110 deletions
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index 6c8c942c05..61d4e69506 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -4281,67 +4281,17 @@ static WERROR enum_all_printers_info_level(TALLOC_CTX *mem_ctx,
return WERR_OK;
}
+/********************************************************************
+********************************************************************/
+
static WERROR enum_all_printers_info_1(TALLOC_CTX *mem_ctx,
uint32_t flags,
- union spoolss_PrinterInfo **info_p,
+ union spoolss_PrinterInfo **info,
uint32_t *count)
{
- int snum;
- int n_services = lp_numservices();
- union spoolss_PrinterInfo *info = NULL;
- WERROR result = WERR_OK;
-
DEBUG(4,("enum_all_printers_info_1\n"));
- *count = 0;
-
- for (snum=0; snum<n_services; snum++) {
-
- NT_PRINTER_INFO_LEVEL *ntprinter = NULL;
- struct spoolss_PrinterInfo1 info1;
-
- if (!snum_is_shared_printer(snum)) {
- continue;
- }
-
- DEBUG(4,("Found a printer in smb.conf: %s[%x]\n", lp_servicename(snum), snum));
-
- result = get_a_printer(NULL, &ntprinter, 2, lp_const_servicename(snum));
- if (!W_ERROR_IS_OK(result)) {
- continue;
- }
-
- result = construct_printer_info1(info, ntprinter, flags, &info1, snum);
- free_a_printer(&ntprinter,2);
- if (!W_ERROR_IS_OK(result)) {
- continue;
- }
-
- info = TALLOC_REALLOC_ARRAY(mem_ctx, info,
- union spoolss_PrinterInfo,
- *count + 1);
- if (!info) {
- DEBUG(2,("enum_all_printers_info_1: failed to enlarge printers buffer!\n"));
- result = WERR_NOMEM;
- goto out;
- }
-
- DEBUG(4,("ReAlloced memory for [%d] PRINTER_INFO_1\n", *count));
-
- info[*count].info1 = info1;
- (*count)++;
- }
-
- out:
- if (!W_ERROR_IS_OK(result)) {
- TALLOC_FREE(info);
- *count = 0;
- return result;
- }
-
- *info_p = info;
-
- return WERR_OK;
+ return enum_all_printers_info_level(mem_ctx, 1, flags, info, count);
}
/********************************************************************
@@ -4420,64 +4370,12 @@ static WERROR enum_all_printers_info_1_network(TALLOC_CTX *mem_ctx,
********************************************************************/
static WERROR enum_all_printers_info_2(TALLOC_CTX *mem_ctx,
- union spoolss_PrinterInfo **info_p,
+ union spoolss_PrinterInfo **info,
uint32_t *count)
{
- int snum;
- int n_services = lp_numservices();
- union spoolss_PrinterInfo *info = NULL;
- WERROR result = WERR_OK;
-
- *count = 0;
-
- for (snum=0; snum<n_services; snum++) {
-
- struct spoolss_PrinterInfo2 info2;
- NT_PRINTER_INFO_LEVEL *ntprinter = NULL;
+ DEBUG(4,("enum_all_printers_info_2\n"));
- if (!snum_is_shared_printer(snum)) {
- continue;
- }
-
- DEBUG(4,("Found a printer in smb.conf: %s[%x]\n", lp_servicename(snum), snum));
-
- result = get_a_printer(NULL, &ntprinter, 2, lp_const_servicename(snum));
- if (!W_ERROR_IS_OK(result)) {
- continue;
- }
-
- result = construct_printer_info2(info, ntprinter, &info2, snum);
- free_a_printer(&ntprinter, 2);
- if (!W_ERROR_IS_OK(result)) {
- continue;
- }
-
- info = TALLOC_REALLOC_ARRAY(mem_ctx, info,
- union spoolss_PrinterInfo,
- *count + 1);
- if (!info) {
- DEBUG(2,("enum_all_printers_info_2: failed to enlarge printers buffer!\n"));
- result = WERR_NOMEM;
- goto out;
- }
-
- DEBUG(4,("ReAlloced memory for [%d] PRINTER_INFO_2\n", *count + 1));
-
- info[*count].info2 = info2;
-
- (*count)++;
- }
-
- out:
- if (!W_ERROR_IS_OK(result)) {
- TALLOC_FREE(info);
- *count = 0;
- return result;
- }
-
- *info_p = info;
-
- return WERR_OK;
+ return enum_all_printers_info_level(mem_ctx, 2, 0, info, count);
}
/********************************************************************