Bug 11665 - When connecting to printers with "List in Directory" set but aren't in the directory fails
When connecting to printers with "List in Directory" set but aren't in the di...
Status: NEW
Product: Samba 4.0
Classification: Unclassified
Component: printing
unspecified
All All
: P5 regression
: ---
Assigned To: Andreas Schneider
Samba QA Contact
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2016-01-08 14:28 UTC by Colin Simpson
Modified: 2016-11-08 17:22 UTC (History)
4 users (show)

See Also:


Attachments
Proposed patch for master (2.45 KB, patch)
2016-11-08 14:17 UTC, Andreas Schneider
no flags Details
patch for 4.5 (2.51 KB, patch)
2016-11-08 17:21 UTC, Andreas Schneider
asn: review? (gd)
Details
patch for 4.4 (2.51 KB, patch)
2016-11-08 17:22 UTC, Andreas Schneider
asn: review? (gd)
Details
patch for 3.6 (2.48 KB, patch)
2016-11-08 17:22 UTC, Andreas Schneider
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Colin Simpson 2016-01-08 14:28:03 UTC
This is a change in behaviour i.e. if "List in Directory" was ticked but it isn't published really in AD (removed by some other means etc), it will no longer allow you to "Connect" to it. It used to. 

But you also cannot untick "List in Director" in the GUI as Samba can't find the printer in AD (funally enough as it isn't published). But maybe it should still allow this to be unticked, even if not in AD?  Not sure...

This is possibly related to Bug #11018 - "smbd can't find the GUID for a printer in the registry and fails to publish printers" and the fix for this.


To reproduce:

1/ Ensure you have a printer that isn't published in AD, and "List in Directory" is unticked. And ensure you can install drivers for it. 

2/ Stop Samba

3/ net registry export HKLM /root/samba.reg

3/ Then edit /root/samba.reg and look for the keys like:

HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Printers\Printername

Where Printername is the name of your printer.

For example I have a key.

[HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Printers\dell3130cn1]

my printer is called "dell3130cn1".

4/ Under here there is an entry "Attributes".  From my case:

"Attributes"=dword:00001848"

The "List in Directory" setting appears to be controlled by bit 14
 (counting from least significant)

In practice we have the same value (presumably all other settings
represented by this key are common to all our printers) so it was easy
i.e. I have
List in Directory NOT set - 01100001001000 - 6216(decimal) - 1848 (hex)

List in Directory set - 11100001001000 - 14408 (decimal) - 3848 (hex)

Put in a new value with this bit 14 flipped to 1 (and the rest of the
values as before) and convert back into hex. Then this is your new
value for this attributes key. For my case change to: 

"Attributes"=dword:00003848"

6/ Import this edited  registry back into Samba.

net registry import /root/samba.reg

7/ Start Samba and see if from a Windows machine this "List in
Directory" is now set.

8/ Trying to install the drivers should now fail (if you cleared out Windows of the driver installs). Windows machine returns "Windows cannot connect to the printer" "Operation failed with error 0x00000002". And the log has an entry "Failed to get GUID for printer"

9/ Also observe that the "List in Directory" tick box cannot be unticked.
Comment 1 Andreas Schneider 2016-11-08 14:17:17 UTC
Created attachment 12633 [details]
Proposed patch for master
Comment 2 Andreas Schneider 2016-11-08 17:21:18 UTC
Created attachment 12634 [details]
patch for 4.5
Comment 3 Andreas Schneider 2016-11-08 17:22:07 UTC
Created attachment 12635 [details]
patch for 4.4
Comment 4 Andreas Schneider 2016-11-08 17:22:55 UTC
Created attachment 12636 [details]
patch for 3.6