Upgrading from Samba 3.4.3 to Samba 3.6.0rc2 (with patch for bug 8214), migrate_printer() fails to open a printer handle for an existing printer. migrate_printer() is called for each printer listed in the pre Samba 3.6.0 ntprinters.tdb database. The registry tdb migration process involves opening the printer via spoolss OpenPrinter, then storing the existing (ntprinters.tdb) information in the Samba registry via calls to SetPrinter(DataEx). The _spoolss_OpenPrinterEx() path of execution goes on to call set_printer_hnd_name(), this function walks through all currently exported services and fails to find the share associated with the given printer name. The existing printer is called "dummy10": duck:/var/lib/samba # tdbdump ntprinters.tdb ... { key(17) = "PRINTERS/dummy10\00" data(2459) = "H8\00\00\01\00\00\00\01\00\00\00\00\00\00\00\00\00\00\00\00\00\00 ... Relevant log excerpt: [2011/06/10 01:03:44.926950, 2] printing/nt_printing_migrate.c:245(migrate_printer) Migrating Printer: dummy10 [2011/06/10 01:03:44.927008, 1] ../librpc/ndr/ndr.c:284(ndr_print_function_debug) spoolss_OpenPrinter: struct spoolss_OpenPrinter in: struct spoolss_OpenPrinter printername : * printername : 'dummy10' datatype : NULL devmode_ctr: struct spoolss_DevmodeContainer _ndr_size : 0x00000000 (0) devmode : NULL access_mask : 0x02000000 (33554432) 0: SERVER_ACCESS_ADMINISTER 0: SERVER_ACCESS_ENUMERATE 0: PRINTER_ACCESS_ADMINISTER 0: PRINTER_ACCESS_USE 0: JOB_ACCESS_ADMINISTER 0: JOB_ACCESS_READ checking name: dummy10 [2011/06/10 01:03:44.927190, 10] rpc_server/spoolss/srv_spoolss_nt.c:750(open_printer_hnd) open_printer_hnd: name [dummy10] [2011/06/10 01:03:44.927217, 4] rpc_server/rpc_handles.c:197(create_rpc_handle_internal) Opened policy hnd[1] [0000] 00 00 00 00 05 00 00 00 00 00 00 00 F1 4D 50 51 ........ .....MPQ [0010] 8F 62 00 00 .b.. [2011/06/10 01:03:44.927265, 3] rpc_server/spoolss/srv_spoolss_nt.c:519(set_printer_hnd_printertype) Setting printer type=dummy10 Printer is a printer [2011/06/10 01:03:44.927297, 4] rpc_server/spoolss/srv_spoolss_nt.c:579(set_printer_hnd_name) Setting printer name=dummy10 (len=7) searching for [dummy10] [2011/06/10 01:03:44.927349, 10] lib/gencache.c:183(gencache_set_data_blob) Adding cache entry with key = PRINTERNAME/dummy10 and timeout = Fri Jun 10 01:08:44 2011 (300 seconds ahead) Printer not found [2011/06/10 01:03:44.927422, 4] rpc_server/rpc_handles.c:232(find_policy_by_hnd_internal) Found policy hnd[0] [0000] 00 00 00 00 05 00 00 00 00 00 00 00 F1 4D 50 51 ........ .....MPQ [0010] 8F 62 00 00 .b.. [2011/06/10 01:03:44.927471, 4] rpc_server/rpc_handles.c:232(find_policy_by_hnd_internal) Found policy hnd[0] [0000] 00 00 00 00 05 00 00 00 00 00 00 00 F1 4D 50 51 ........ .....MPQ [0010] 8F 62 00 00 .b.. [2011/06/10 01:03:44.927517, 3] rpc_server/rpc_handles.c:281(close_policy_hnd) Closed policy [2011/06/10 01:03:44.927540, 0] rpc_server/spoolss/srv_spoolss_nt.c:1737(_spoolss_OpenPrinterEx) _spoolss_OpenPrinterEx: Cannot open a printer handle for printer dummy10 [2011/06/10 01:03:44.927777, 1] ../librpc/ndr/ndr.c:284(ndr_print_function_debug) spoolss_OpenPrinter: struct spoolss_OpenPrinter out: struct spoolss_OpenPrinter handle : * handle: struct policy_handle handle_type : 0x00000000 (0) uuid : 00000000-0000-0000-0000-000000000000 result : WERR_INVALID_PRINTER_NAME [2011/06/10 01:03:44.927880, 2] printing/nt_printing_migrate.c:264(migrate_printer) OpenPrinter(dummy10) failed: WERR_INVALID_PRINTER_NAME [2011/06/10 01:03:44.927917, 0] printing/nt_printing_migrate.c:682(nt_printing_tdb_migrate) Couldn't migrate printers tdb file: NT code 0xc0000709 [2011/06/10 01:03:44.927975, 10] rpc_server/rpc_handles.c:307(close_policy_by_pipe) close_policy_by_pipe: deleted handle list for pipe \spoolss [2011/06/10 01:03:44.928007, 0] rpc_server/srv_pipe_register.c:222(rpc_srv_register) rpc_srv_register: Failed to call the spoolss init function!
As I see it there are two underlying issues: 1) migrate_printer() requires (re)load_printers() be called beforehand to provide _spoolss_OpenPrinterEx() with printer services. 2) migrate_printer() requires any printer listed in the old ntprinters.tdb exist on start-up of smbd version 3.6. AFAICT this means smbd will fail to start if a printer is removed while samba is stopped prior to upgrading to 3.6.
Patches sent to samba-technical for review along with bug 8214 change: http://lists.samba.org/archive/samba-technical/2011-June/078137.html
Günther, is there any chance for a patch review?
Please note that the freeze date for v3-6-test is June 29 and this is currently a showstopper. Thanks!
(In reply to comment #4) > Please note that the freeze date for v3-6-test is June 29 and this is currently > a showstopper. > > Thanks! Freezing date was June 28 (today) - my fault. Please note that we need to delay 3.6.0 again if this bug won't be addressed until tomorrow (if this is really a blocker)!
(In reply to comment #5) > (In reply to comment #4) > > Please note that the freeze date for v3-6-test is June 29 and this is currently > > a showstopper. > > > > Thanks! > > Freezing date was June 28 (today) - my fault. June 29 was right, sorry for the confusion!
Günther, please comment if this bug is still a blocker for the next 3.6 release. Thanks!
Günthers winreg based printing tdb migration changes are now in the tree - see master commits leading up to cfc3b6e5f79f253e83dfbd13d47b671deb5801b3. This bug can now be closed.
Hang on a minute - the changes are in master, but can you specify which commits need to be in v3-6-test ? Only when they're in v3-6-test can the bug be closed. Jeremy.
(In reply to comment #9) > Hang on a minute - the changes are in master, but can you specify which commits > need to be in v3-6-test ? > A bit preemptive, sorry. The master commits are: e595590 s3-printing: remove tdb migration invalid printer name checks cfc3b6e s3-printing: make sure to first migrate the printers then the security descriptor. 5dd8185 s3-printing: fill info2_mask in printer migration 57bbb32 s3-printing: remove spoolss pipe from migration library, only using winreg finally. 8f3d5f5 s3-printing: use winreg interface for migration, instead of spoolss. 72b1f8b s3-printing: safe a ton of roundtrips by reusing existing winreg binding_handles. 0a1ec73 s3-printing: use winreg_internal functions. ada5380 s3-printing: add winreg_internal functions. a762eda s3-printing: add winreg_printer_binding_handle and remove most of srv_spoolss_util.c. f2be837 s3-printing: add rpc_client/cli_winreg_spoolss.c a0fc64a s3-waf: make LIBCLI_SPOOLSS a shared library 43cf3a2 s3-printing: move spoolss_create_default_devmode/secdesc to init_spoolss.h 74e4160 s3-printing: move driver_info_ctr_to_info8 to init_spoolss.h dd5375b s3-printing: move os2 related functions to printing/nt_printing_os2.c. 1caa7a8 s3-waf: Fix linking bugs causing segfaults. ff94539 s3-printing: open up a winreg pipe handle for the migration code. bafd721 s3-net: use printing_migrate library, and eliminate duplicate code. e02abd6 s3-printing: split out printing migration code into a smaller library. c9e3f6a s3-printing: skip migration of non-existent printers a36ce07 s3-printing: fill devicemode size in migrate_printer() The same set of commits cover bug 8214.
Sorry, I do need a review from a second core developer before pushing these patches to v3-6-test. Jeremy, could you review the patches or re-assign the bug report to another possible reviewer? Thanks!
I don't have time to review this whilst I'm on the trip. As Guenther has been working on this with David I'll re-assign to gd. Guenther, please review David's patch list and then re-assign back to Karolin for inclusion in 3.6.0rc3. Cheers, Jeremy.
Closing out bug report as I am pretty sure it's fixed with the patches attached to bug #8214. Günther, please verify and re-open if needed.