summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-03-11 00:28:18 +0100
committerGünther Deschner <gd@samba.org>2009-03-13 09:25:24 +0100
commit7e753b28ea6be2ceaef61c4377812a348b650955 (patch)
tree0bb1e944c45b84565d9145ddd6a8791b0af4ea62
parent0174d4d3b2a682710ee4ab15c9af67910de53344 (diff)
downloadsamba-7e753b28ea6be2ceaef61c4377812a348b650955.tar.gz
samba-7e753b28ea6be2ceaef61c4377812a348b650955.tar.bz2
samba-7e753b28ea6be2ceaef61c4377812a348b650955.zip
s3-spoolss: use snum_is_shared_printer (allows to make code a little easier to
read). Guenther
-rw-r--r--source3/rpc_server/srv_spoolss_nt.c104
1 files changed, 54 insertions, 50 deletions
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index f323ca9599..78d3bd6bbe 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -4616,38 +4616,40 @@ static WERROR enum_all_printers_info_1(TALLOC_CTX *mem_ctx,
*count = 0;
for (snum=0; snum<n_services; snum++) {
- if (lp_browseable(snum) && lp_snum_ok(snum) && lp_print_ok(snum) ) {
- NT_PRINTER_INFO_LEVEL *ntprinter = NULL;
- struct spoolss_PrinterInfo1 info1;
+ NT_PRINTER_INFO_LEVEL *ntprinter = NULL;
+ struct spoolss_PrinterInfo1 info1;
- 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;
- }
+ if (!snum_is_shared_printer(snum)) {
+ continue;
+ }
- result = construct_printer_info1(info, ntprinter, flags, &info1, snum);
- free_a_printer(&ntprinter,2);
- if (!W_ERROR_IS_OK(result)) {
- continue;
- }
+ DEBUG(4,("Found a printer in smb.conf: %s[%x]\n", lp_servicename(snum), snum));
- 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;
- }
+ result = get_a_printer(NULL, &ntprinter, 2, lp_const_servicename(snum));
+ if (!W_ERROR_IS_OK(result)) {
+ continue;
+ }
- DEBUG(4,("ReAlloced memory for [%d] PRINTER_INFO_1\n", *count));
+ result = construct_printer_info1(info, ntprinter, flags, &info1, snum);
+ free_a_printer(&ntprinter,2);
+ if (!W_ERROR_IS_OK(result)) {
+ continue;
+ }
- info[*count].info1 = info1;
- (*count)++;
+ 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:
@@ -4813,39 +4815,41 @@ static WERROR enum_all_printers_info_2(TALLOC_CTX *mem_ctx,
*count = 0;
for (snum=0; snum<n_services; snum++) {
- if (lp_browseable(snum) && lp_snum_ok(snum) && lp_print_ok(snum)) {
- struct spoolss_PrinterInfo2 info2;
- NT_PRINTER_INFO_LEVEL *ntprinter = NULL;
+ struct spoolss_PrinterInfo2 info2;
+ NT_PRINTER_INFO_LEVEL *ntprinter = NULL;
- DEBUG(4,("Found a printer in smb.conf: %s[%x]\n", lp_servicename(snum), snum));
+ if (!snum_is_shared_printer(snum)) {
+ continue;
+ }
- result = get_a_printer(NULL, &ntprinter, 2, lp_const_servicename(snum));
- if (!W_ERROR_IS_OK(result)) {
- continue;
- }
+ DEBUG(4,("Found a printer in smb.conf: %s[%x]\n", lp_servicename(snum), snum));
- result = construct_printer_info2(info, ntprinter, &info2, snum);
- free_a_printer(&ntprinter, 2);
- if (!W_ERROR_IS_OK(result)) {
- continue;
- }
+ result = get_a_printer(NULL, &ntprinter, 2, lp_const_servicename(snum));
+ 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;
- }
+ result = construct_printer_info2(info, ntprinter, &info2, snum);
+ free_a_printer(&ntprinter, 2);
+ if (!W_ERROR_IS_OK(result)) {
+ continue;
+ }
- DEBUG(4,("ReAlloced memory for [%d] PRINTER_INFO_2\n", *count + 1));
+ 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;
+ }
- info[*count].info2 = info2;
+ DEBUG(4,("ReAlloced memory for [%d] PRINTER_INFO_2\n", *count + 1));
- (*count)++;
- }
+ info[*count].info2 = info2;
+
+ (*count)++;
}
out: