svn commit: samba r6488 - in branches/SAMBA_3_0/source/utils: .
vlendec at samba.org
vlendec at samba.org
Tue Apr 26 12:26:33 GMT 2005
Author: vlendec
Date: 2005-04-26 12:26:32 +0000 (Tue, 26 Apr 2005)
New Revision: 6488
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=6488
Log:
net rpc printer migrate should not try to set stuff that's not there. This
fixes two segfaults. Thanks to Karolin Segger <ks at sernet.de> to find the bug
and test the patch.
Volker
Modified:
branches/SAMBA_3_0/source/utils/net_rpc_printer.c
Changeset:
Modified: branches/SAMBA_3_0/source/utils/net_rpc_printer.c
===================================================================
--- branches/SAMBA_3_0/source/utils/net_rpc_printer.c 2005-04-26 11:10:55 UTC (rev 6487)
+++ branches/SAMBA_3_0/source/utils/net_rpc_printer.c 2005-04-26 12:26:32 UTC (rev 6488)
@@ -1960,6 +1960,12 @@
}
+ if (strlen(drivername) == 0) {
+ DEBUGADD(1,("Did not get driver for printer %s\n",
+ printername));
+ goto done;
+ }
+
/* setdriver dst */
init_unistr(&info_ctr_dst.printers_2->drivername, drivername);
@@ -2297,29 +2303,35 @@
DEBUG(3,("republished printer\n"));
}
- /* copy devmode (info level 2) */
- ctr_dst.printers_2->devmode = TALLOC_MEMDUP(mem_ctx,
- ctr_enum.printers_2[i].devmode, sizeof(DEVICEMODE));
+ if (ctr_enum.printers_2[i].devmode != NULL) {
- /* do not copy security descriptor (we have another command for that) */
- ctr_dst.printers_2->secdesc = NULL;
+ /* copy devmode (info level 2) */
+ ctr_dst.printers_2->devmode =
+ TALLOC_MEMDUP(mem_ctx,
+ ctr_enum.printers_2[i].devmode,
+ sizeof(DEVICEMODE));
+ /* do not copy security descriptor (we have another
+ * command for that) */
+ ctr_dst.printers_2->secdesc = NULL;
+
#if 0
- if (asprintf(&devicename, "\\\\%s\\%s", longname, printername) < 0) {
- nt_status = NT_STATUS_NO_MEMORY;
- goto done;
- }
+ if (asprintf(&devicename, "\\\\%s\\%s", longname,
+ printername) < 0) {
+ nt_status = NT_STATUS_NO_MEMORY;
+ goto done;
+ }
- init_unistr(&ctr_dst.printers_2->devmode->devicename, devicename);
+ init_unistr(&ctr_dst.printers_2->devmode->devicename,
+ devicename);
#endif
- if (!net_spoolss_setprinter(cli_dst, mem_ctx, &hnd_dst,
- level, &ctr_dst))
- goto done;
+ if (!net_spoolss_setprinter(cli_dst, mem_ctx, &hnd_dst,
+ level, &ctr_dst))
+ goto done;
- DEBUGADD(1,("\tSetPrinter of DEVICEMODE succeeded\n"));
+ DEBUGADD(1,("\tSetPrinter of DEVICEMODE succeeded\n"));
+ }
-
-
/* STEP 2: COPY REGISTRY VALUES */
/* please keep in mind that samba parse_spools gives horribly
More information about the samba-cvs
mailing list