The Samba-Bugzilla – Bug 10446
Samba shouldn't allow renaming of a printer if a printer with the same name exists
Last modified: 2014-02-18 15:41:00 UTC
This happens on a printserver that serves Windows clients via Samba. It would be nice if Samba would just report an error when such a rename is attempted.
Steps to reproduce:
1. Register two printers in CUPS, say jeeves and wooster:
lpadmin -p jeeves -m drv:///sample.drv/generic.ppd -u allow:all -D Jeeves -L UK -o printer-is-shared=true -v socket://jeeves
lpadmin -p wooster -m drv:///sample.drv/generic.ppd -u allow:all -D Wooster -L US -o printer-is-shared=true -v socket://wooster
2. Wait 60s for Samba to see them, export drivers to Samba:
cupsaddsmb -v -h localhost jeeves wooster
3. In Windows Explorer, navigate to the \\printserver
4. Click "Remote Printers" button (available in Windows XP, Vista, 7, but not 8).
5. Highlight jeeves, press F2 and rename it into wooster.
Printer admins have to rename printers when manufacturer-provided Windows drivers are uploaded to Samba. Name of the printer changes to the model of the driver in this case, and admins have to change the name back to the original one. It is easy to make mistake and highlight wrong printer.
6. Refresh Explorer window by pressing F5. Two printers will collapse into one, wooster.
7. Now you have no way to fix it, unless you poke around tdb and cache files.
Here is how the rpcclient 'enumprinter' output looks like after such a rename:
I'm attaching tdb dump of the registry.tdb before and after the rename.
Created attachment 9682 [details]
tdbdump output of registry.tdb before renaming of the jeeves into wooster.
Created attachment 9683 [details]
tdbdump of registry.tdb after jeeves is renamed into wooster.
Created attachment 9684 [details]
Output of rpcclient 'enumprinters 2' command after the rename.
Thanks for the report Alex.
(In reply to comment #0)
> This happens on a printserver that serves Windows clients via Samba. It would
> be nice if Samba would just report an error when such a rename is attempted.
How does a Windows print server behave in such a case? If Windows returns an error in response to the rename request, then yes we should definitely try to match it.
> How does a Windows print server behave in such a case? If Windows returns an
> error in response to the rename request, then yes we should definitely try to
> match it.
Windows (7 x64) would say "Operation could not be completed (error 0x0000070a). Another printer or printer share with this name already exists. Please use another name for the printer."