summaryrefslogtreecommitdiff
path: root/source3/utils
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2004-09-21 13:31:57 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:52:45 -0500
commitd25aba1d144eef4fb400b730ffde308120440d17 (patch)
treebd021bdceb27d5025621a94bb1ad64240a3df6d5 /source3/utils
parent3de9b11601fb85209fd3a799da2f3a4a6cd41624 (diff)
downloadsamba-d25aba1d144eef4fb400b730ffde308120440d17.tar.gz
samba-d25aba1d144eef4fb400b730ffde308120440d17.tar.bz2
samba-d25aba1d144eef4fb400b730ffde308120440d17.zip
r2476: now that PRINTER_ATTRIBUTE_PUBLISHED does not get reset anymore, migrate
the publishing-state for migrated printers as well. Therefor added client-side-support for setprinter level 7. Next will be a "net rpc printer publish"-command (just for completeness). Guenther (This used to be commit 224920738fdc65ef170152062177421cfed85bbf)
Diffstat (limited to 'source3/utils')
-rw-r--r--source3/utils/net_rpc_printer.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/source3/utils/net_rpc_printer.c b/source3/utils/net_rpc_printer.c
index 11f9c0ba2f..51f4df7b05 100644
--- a/source3/utils/net_rpc_printer.c
+++ b/source3/utils/net_rpc_printer.c
@@ -2011,7 +2011,7 @@ NTSTATUS rpc_printer_migrate_settings_internals(const DOM_SID *domain_sid, const
BOOL got_hnd_dst = False;
BOOL got_dst_spoolss_pipe = False;
POLICY_HND hnd_src, hnd_dst;
- PRINTER_INFO_CTR ctr_enum, ctr_dst;
+ PRINTER_INFO_CTR ctr_enum, ctr_dst, ctr_dst_publish;
REGVAL_CTR reg_ctr;
struct cli_state *cli_dst = NULL;
char *devicename = NULL, *unc_name = NULL, *url = NULL;
@@ -2095,10 +2095,19 @@ NTSTATUS rpc_printer_migrate_settings_internals(const DOM_SID *domain_sid, const
is correctly installed (incl. driver ???) */
init_unistr( &ctr_dst.printers_2->portname, SAMBA_PRINTER_PORT_NAME);
- /* check if printer is published -> no publish-migration for the moment */
+ /* check if printer is published */
if (ctr_enum.printers_2[i].attributes & PRINTER_ATTRIBUTE_PUBLISHED) {
- printf("printer on originating server was published, ignoring that\n");
- ctr_dst.printers_2->attributes = PRINTER_ATTRIBUTE_SAMBA;
+
+ /* check for existing dst printer */
+ if (!net_spoolss_getprinter(cli_dst, mem_ctx, &hnd_dst, 7, &ctr_dst_publish))
+ goto done;
+
+ ctr_dst_publish.printers_7->action = SPOOL_DS_PUBLISH;
+
+ /* ignore False from setprinter due to WERR_IO_PENDING */
+ net_spoolss_setprinter(cli_dst, mem_ctx, &hnd_dst, 7, &ctr_dst_publish);
+
+ DEBUG(3,("republished printer\n"));
}
/* copy devmode (info level 2) */