Created attachment 10200 [details] Level 10 debug log of the try renaming a printer I wanted to change the Wiki Printer Howto, so that it describes the better way to manage the print server via the Printer Management Console. But there renaming of a printer fails. Steps to reproduce (done on W7 64Bit): - Open printermanagement.msc - Go to Printers - Expand your print server - Click Printers - Try renaming a printer via [F2] -> Fails with "The selected printer cannot be renamed. Operation could not be completed (error 0x0000007c). Renaming via the following still works: - Go to \\servername - Click button "view remote printers" - Rename printer via [F2] But this way is not available on Win8 any more! That's why I wanted to change the HowTo, to provide the official way, that is usable on all supported Windows version. What made this bug annoying is, that when you associate the first time a driver with a printer, then Windows renames the printer to the name of the driver. And in a corporate environment you typically have multiple of the same printers and want the to have the name you choosed and configured in your smb.conf. So it's neccessary to rename the printer after the driver association.
Created attachment 10201 [details] Error Screenshot
It's possible to rename the printer via the Printer Management Console, too, if you do it by opening the printers properties and edit the name there. It's only not possible in the Printer Management Console, if done via [F2]. Reducing the importance of this bug report to minor.
It looks like _spoolss_SetPrinter simply doesn't handle info level 4 which is what the F2 is sending, as opposed to info level 2 which is implemented and occurs with the properties dialog. I'll try to write up a patch I guess.
Created attachment 10557 [details] Simple fix for set info level 4 Basically everything down below below the update_printer call takes struct info level 2, which has a lot more information. Instead of rewriting it entirely and likely getting it wrong, the old printer is retrieved and just filled in. There's some code that could probably be factored out, but the simple fix seems to work. I made some attempt to prevent as many duplications of memory, but got into too much trouble with talloc and some parts apparently freeing unexpectedly.
Thanks Garming for looking at this issue. Your _patch works_ with 4.1.13 and 4.2rc3. But I could not try it with master, because with and without your patch, "Printers" stay empty in the printmanagment.msc. But this seems to be a different issue. Should I open a new bug report for that?
(In reply to Marc Muehlfeld from comment #5) Please raise a new bug for the issue you encountered in master. @Garming, please add memory allocation failure checks to your patch and send it to samba-technical for review.
Created attachment 11373 [details] Adds some allocation checks Apparently I wasn't CC'd on this. Adds the missing allocation checks.
(In reply to Garming Sam from comment #7) Garming, can you please send your patch to samba-technical for review, with link to this bug report, to get this in fixed in the next release? Thanks.
(In reply to Marc Muehlfeld from comment #8) Hi Marc. It went into master in September, with the link to the bugzilla (although the patch was tweaked from the one attached here).