Bug 10446 - Samba shouldn't allow renaming of a printer if a printer with the same name exists
Samba shouldn't allow renaming of a printer if a printer with the same name e...
Status: NEW
Product: Samba 3.6
Classification: Unclassified
Component: Printing
3.6.22
All All
: P5 normal
: ---
Assigned To: printing-maintainers
Samba QA Contact
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-02-14 20:31 UTC by Alex K
Modified: 2014-02-18 15:41 UTC (History)
0 users

See Also:


Attachments
registry-dump-before.txt (35.80 KB, text/plain)
2014-02-14 20:32 UTC, Alex K
no flags Details
registry-dump-after.txt (35.80 KB, text/plain)
2014-02-14 20:32 UTC, Alex K
no flags Details
rpcclient_enumprinters_2-output.txt (4.42 KB, text/plain)
2014-02-14 20:36 UTC, Alex K
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alex K 2014-02-14 20:31:29 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:

	flags:[0x800000]
	name:[\\LOCALHOST\wooster]
	description:[\\LOCALHOST\wooster,wooster,Wooster]
	comment:[Wooster]

	flags:[0x800000]
	name:[\\LOCALHOST\wooster]
	description:[\\LOCALHOST\wooster,jeeves,Jeeves]
	comment:[Jeeves]

I'm attaching tdb dump of the registry.tdb before and after the rename.
Comment 1 Alex K 2014-02-14 20:32:19 UTC
Created attachment 9682 [details]
registry-dump-before.txt

tdbdump output of registry.tdb before renaming of the jeeves into wooster.
Comment 2 Alex K 2014-02-14 20:32:55 UTC
Created attachment 9683 [details]
registry-dump-after.txt

tdbdump of registry.tdb after jeeves is renamed into wooster.
Comment 3 Alex K 2014-02-14 20:36:07 UTC
Created attachment 9684 [details]
rpcclient_enumprinters_2-output.txt

Output of rpcclient 'enumprinters 2' command after the rename.
Comment 4 David Disseldorp 2014-02-18 11:16:18 UTC
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.
Comment 5 Alex K 2014-02-18 15:41:00 UTC
> 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."