The Samba-Bugzilla – Attachment 7163 Details for
Bug 8554
New cups printer not added to registry
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
proposed fix for bug 8554 and 8612
fix-bug-8554-and-8612.patch (text/plain), 4.18 KB, created by
Björn Baumbach
on 2011-12-07 12:50:56 UTC
(
hide
)
Description:
proposed fix for bug 8554 and 8612
Filename:
MIME Type:
Creator:
Björn Baumbach
Created:
2011-12-07 12:50:56 UTC
Size:
4.18 KB
patch
obsolete
>From cc3ef6579242299265a9b201dddbd4250e4b1b85 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Bj=C3=B6rn=20Baumbach?= <bb@sernet.de> >Date: Fri, 28 Oct 2011 05:43:05 +0200 >Subject: [PATCH] s3-printing: Add new printers to registry (bug 8554 and 8612). > >Pair-Programmed-With: Stefan Metzmacher <metze@samba.org> >--- > source3/include/nt_printing.h | 4 ++++ > source3/printing/nt_printing.c | 19 +++++++++++++++++-- > source3/smbd/server_reload.c | 36 +++++++++++++++++++++++++----------- > 3 files changed, 46 insertions(+), 13 deletions(-) > >diff --git a/source3/include/nt_printing.h b/source3/include/nt_printing.h >index 4f85159..16c4658 100644 >--- a/source3/include/nt_printing.h >+++ b/source3/include/nt_printing.h >@@ -176,5 +176,9 @@ void nt_printer_remove(TALLOC_CTX *mem_ctx, > const struct auth_serversupplied_info *server_info, > struct messaging_context *msg_ctx, > const char *printer); >+void nt_printer_add(TALLOC_CTX *mem_ctx, >+ const struct auth_serversupplied_info *server_info, >+ struct messaging_context *msg_ctx, >+ const char *printer); > > #endif /* NT_PRINTING_H_ */ >diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c >index d6b8bb1..c2d2fb8 100644 >--- a/source3/printing/nt_printing.c >+++ b/source3/printing/nt_printing.c >@@ -1870,7 +1870,22 @@ void nt_printer_remove(TALLOC_CTX *mem_ctx, > result = winreg_delete_printer_key_internal(mem_ctx, session_info, msg_ctx, > printer, ""); > if (!W_ERROR_IS_OK(result)) { >- DEBUG(0, ("nt_printer_remove: failed to remove rpinter %s", >- printer)); >+ DEBUG(0, ("nt_printer_remove: failed to remove printer %s: " >+ "%s\n", printer, win_errstr(result))); >+ } >+} >+ >+void nt_printer_add(TALLOC_CTX *mem_ctx, >+ const struct auth_serversupplied_info *session_info, >+ struct messaging_context *msg_ctx, >+ const char *printer) >+{ >+ WERROR result; >+ >+ result = winreg_create_printer_internal(mem_ctx, session_info, msg_ctx, >+ printer); >+ if (!W_ERROR_IS_OK(result)) { >+ DEBUG(0, ("nt_printer_add: failed to add printer %s: %s\n", >+ printer, win_errstr(result))); > } > } >diff --git a/source3/smbd/server_reload.c b/source3/smbd/server_reload.c >index 82b0cb0..381dce3 100644 >--- a/source3/smbd/server_reload.c >+++ b/source3/smbd/server_reload.c >@@ -39,13 +39,16 @@ void reload_printers(struct tevent_context *ev, > struct auth_serversupplied_info *session_info = NULL; > struct spoolss_PrinterInfo2 *pinfo2 = NULL; > int snum; >- int n_services = lp_numservices(); >- int pnum = lp_servicenumber(PRINTERS_NAME); >+ int n_services; >+ int pnum; > const char *pname; > NTSTATUS status; >- bool skip = false; > >- SMB_ASSERT(pcap_cache_loaded()); >+ load_printers(ev, msg_ctx); >+ >+ n_services = lp_numservices(); >+ pnum = lp_servicenumber(PRINTERS_NAME); >+ > DEBUG(10, ("reloading printer services from pcap cache\n")); > > status = make_session_info_system(talloc_tos(), &session_info); >@@ -54,18 +57,28 @@ void reload_printers(struct tevent_context *ev, > "Could not create system session_info\n")); > /* can't remove stale printers before we > * are fully initilized */ >- skip = true; >+ return; > } > > /* remove stale printers */ >- for (snum = 0; skip == false && snum < n_services; snum++) { >- /* avoid removing PRINTERS_NAME or non-autoloaded printers */ >- if (snum == pnum || !(lp_snum_ok(snum) && lp_print_ok(snum) && >- lp_autoloaded(snum))) >+ for (snum = 0; snum < n_services; snum++) { >+ /* avoid removing PRINTERS_NAME */ >+ if (snum == pnum) { > continue; >+ } >+ >+ /* skip no-printer services */ >+ if (!(lp_snum_ok(snum) && lp_print_ok(snum))) { >+ continue; >+ } > > pname = lp_printername(snum); > if (!pcap_printername_ok(pname)) { >+ /* avoid removing non-autoloaded printers */ >+ if (!lp_autoloaded(snum)) { >+ continue; >+ } >+ > DEBUG(3, ("removing stale printer %s\n", pname)); > > if (is_printer_published(session_info, session_info, >@@ -82,11 +95,12 @@ void reload_printers(struct tevent_context *ev, > nt_printer_remove(session_info, session_info, msg_ctx, > pname); > lp_killservice(snum); >+ } else { >+ nt_printer_add(session_info, session_info, msg_ctx, >+ pname); > } > } > >- load_printers(ev, msg_ctx); >- > TALLOC_FREE(session_info); > } > >-- >1.7.3.4 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 8554
:
7059
|
7163
|
7164
|
7195
|
7203
|
7297
|
7300
|
7301
|
7303
|
7311