Bug 12182 - SPOOLSS_ENUMPRINTERS fails with certain printer names
Summary: SPOOLSS_ENUMPRINTERS fails with certain printer names
Status: RESOLVED WORKSFORME
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Printing (show other bugs)
Version: 4.4.5
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: printing-maintainers
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-08-26 15:36 UTC by Mario Lipinski
Modified: 2021-01-11 12:48 UTC (History)
1 user (show)

See Also:


Attachments
Log (setdriver failing) (2.62 MB, text/plain)
2016-11-10 14:06 UTC, Mario Lipinski
no flags Details
Log (setdriver successful) (2.93 MB, text/plain)
2016-11-10 14:10 UTC, Mario Lipinski
no flags Details
testparm output (7.00 KB, text/plain)
2016-11-10 14:12 UTC, Mario Lipinski
no flags Details
Test 2 smbd.log (1.05 MB, text/x-log)
2016-11-10 17:56 UTC, Mario Lipinski
no flags Details
Test 2 (173.35 KB, application/x-bzip2)
2016-11-10 17:59 UTC, Mario Lipinski
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mario Lipinski 2016-08-26 15:36:34 UTC
I already reported this issue a while ago at https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=822574
The issue is still present in current Samba 4.4.5.

I am experiencing problems with RPC printer management 
(SPOOLSS_ENUMPRINTERS ) with certain printer names.

It looks like the problem is caused if the printer name contains an 
umlaut (non-ASCII character) as the 23rd character.

Thus

aaaaaaaaaaaaaaaaaaaaaaä

causes problems, while

aaaaaaaaaaaaaaaaaaaaaä and
aaaaaaaaaaaaaaaaaaaaaaaä

work(*). I tried dozens other examples that lead me to track down and 
limit the problem as described above.

The problem is observed while using setdriver on the mentioned printer 
with rpcclient or acessing the "Remote Printers" view on Windows 7 - the 
window is blank then and no printers are displayed at all.

From the logs:

Apr 25 14:10:26 iserv smbd[12856]: ndr_push_error(5): Bad character 
conversion
Apr 25 14:10:26 iserv smbd[12856]: ndr_push_error(11): SPOOLSS Buffer: 
*r->out.info but there's no r->in.buffer
Apr 25 14:10:26 iserv smbd[12856]: api_rpcTNP: spoolss: 
SPOOLSS_ENUMPRINTERS failed.

(*) They do not really work, I reported this as #822571 since I do not 
think that these issues are related.
Comment 1 Andreas Schneider 2016-11-10 11:08:28 UTC
I'm not able to reproduce this.

rpcclient //SAMBA-PRINT01 -UEARTH+administrator%Secret007! -c "enumprinters"
        flags:[0x800000]
        name:[\\SAMBA-PRINT01\aaaaaaaaaaaaaaaaaaaaaaä]
        description:[\\SAMBA-PRINT01\aaaaaaaaaaaaaaaaaaaaaaä,,]
        comment:[]

Also there are no useful logs or details how to reproduce this, see:

https://www.samba.org/~asn/reporting_samba_bugs.txt
Comment 2 Mario Lipinski 2016-11-10 12:07:53 UTC
enumprinters in rpcclient seems to work for me too.
setdriver seems to crash.

rpcclient $> setdriver 'aaaaaaaaaaaaaaaaaaaaaaä' 'HP Universal Printing PS'
Unable to retrieve printer information!
result was WERR_WRITE_FAULT

Also the "Remote Printers" view on Windows 7 crashes. Open \\servername in explorer, click remote printers, the list is empty.

I still can reproduce this bug. I will try to compile more useful debugging information.
Comment 3 Andreas Schneider 2016-11-10 12:13:25 UTC
rpcclient $> setdriver 'aaaaaaaaaaaaaaaaaaaaaaä' 'HP LaserJet Professional P 1102w'
Successfully set aaaaaaaaaaaaaaaaaaaaaaä to driver HP LaserJet Professional P 1102w.

Are you using CUPS? I've just fixed a bug with CUPS and umlauts. Patch is on samba-technical mailinglist ...
Comment 4 Mario Lipinski 2016-11-10 13:14:19 UTC
The posted patch fixes #12183 for me. However, this bug is still present with the patch applied. Will produce some more logs now.
Comment 5 Mario Lipinski 2016-11-10 14:06:07 UTC
Created attachment 12640 [details]
Log (setdriver failing)
Comment 6 Mario Lipinski 2016-11-10 14:10:08 UTC
Created attachment 12641 [details]
Log (setdriver successful)

I attached two debug log files from two rpcclient sessions:

dev2.iserv.eu ~ # date
Do 10. Nov 14:51:10 CET 2016
dev2.iserv.eu ~ # rpcclient_root iserv
rpcclient $> setdriver aaaaaaaaaaaaaaaaaaaaaaä 'HP Universal Print Driver PS'
Unable to retrieve printer information!
result was WERR_WRITE_FAULT
rpcclient $> quit
dev2.iserv.eu ~ # date
Do 10. Nov 14:51:18 CET 2016

dev2.iserv.eu ~ # rpcclient_root iserv
rpcclient $> setdriver aaaaaaaaaaaaaaaaaaaaaä 'HP Universal Print Driver PS'
Successfully set aaaaaaaaaaaaaaaaaaaaaä to driver HP Universal Print Driver PS.
rpcclient $> quit
dev2.iserv.eu ~ # date
Do 10. Nov 14:56:35 CET 2016
dev2.iserv.eu ~ # 

(rpcclient_root = exec rpcclient -A /var/lib/iserv/pwd/samba.auth "$@")

The only difference is one missing 'a' in the printer name.

Let me know what further information would be useful.
Comment 7 Mario Lipinski 2016-11-10 14:12:59 UTC
Created attachment 12642 [details]
testparm output
Comment 8 Andreas Schneider 2016-11-10 15:02:40 UTC
b) Is your system using UTF-8?
b) Are you using CUPS?
c) Is the printer name coming form /etc/printcap
Comment 9 Andreas Schneider 2016-11-10 15:11:41 UTC
I don't know your system, but the encoding in the log file doesn't seem to be utf-8.

printername              : '\\ISERV\AAAAAAAAAAAAAAAAAAAAAAÃ<84>'


This looks really strange ...
Comment 10 Mario Lipinski 2016-11-10 15:17:01 UTC
(In reply to Andreas Schneider from comment #8)
> a) Is your system using UTF-8?

Yes. Everything should be UTF-8, not sure how to verify here.

> b) Are you using CUPS?

Yes.

> c) Is the printer name coming form /etc/printcap

No, /etc/printcap exists, possibly created by an installed Brother driver, nothing else regarding any other printer in CUPS. Same error occurs with /etc/printcap removed.
Comment 11 Mario Lipinski 2016-11-10 15:22:37 UTC
(In reply to Andreas Schneider from comment #9)
> I don't know your system, but the encoding in the log file doesn't seem to be utf-8.

The two log files were created with identical system configuration on the same system.
I can delete and recreate the printers and am able to reproduce the issue.
Comment 12 Andreas Schneider 2016-11-10 15:31:17 UTC
Then I would say that CUPS gives you garbage. It works just fine on my system. And the printer name has strange characters on your system.
Comment 13 Andreas Schneider 2016-11-10 16:06:47 UTC
My current test machine:

[2016/11/10 17:01:29.174065,  3, pid=19772, effective(0, 0), real(0, 0)] ../source3/param/loadparm.c:1622(lp_add_printer)
  adding printer service Flüwatüt

You machiner:

[2016/11/10 14:51:16.577938,  3, pid=18327, effective(0, 0), real(0, 0)] ../source3/param/loadparm.c:1626(lp_add_printer)
  adding printer service aaaaaaaaaaaaaaaaaaaaaaaä

So it looks like CUPS is sending the name not UTF-8 encoded.
Comment 14 Mario Lipinski 2016-11-10 17:56:15 UTC
(In reply to Andreas Schneider from comment #13)

This sounds like this could be a bug in CUPS.

I set 'cups server = localhost' and ran a second test.
I am attaching the server log smbd.log the session log iserv.log and a packet dump for CUPS (port 631).

So far I could not see anything strange coming from CUPS.

dev2.iserv.eu /var/log/samba # date
Do 10. Nov 18:49:51 CET 2016
dev2.iserv.eu /var/log/samba # #service smbd start
dev2.iserv.eu /var/log/samba # service smbd start
dev2.iserv.eu /var/log/samba # rpcclient_root iserv
rpcclient $> setdriver aaaaaaaaaaaaaaaaaaaaaä 'HP Universal Print Driver PS'
Successfully set aaaaaaaaaaaaaaaaaaaaaä to driver HP Universal Print Driver PS.
rpcclient $> setdriver aaaaaaaaaaaaaaaaaaaaaaä 'HP Universal Print Driver PS'
Unable to retrieve printer information!
result was WERR_WRITE_FAULT
rpcclient $> quit
dev2.iserv.eu /var/log/samba # date
Do 10. Nov 18:50:25 CET 2016
Comment 15 Mario Lipinski 2016-11-10 17:56:44 UTC
Created attachment 12645 [details]
Test 2 smbd.log
Comment 16 Mario Lipinski 2016-11-10 17:59:37 UTC
Created attachment 12646 [details]
Test 2
Comment 17 Andreas Schneider 2016-11-11 10:53:36 UTC
I've created a cups printer with the name [aaaaaaaaaaaaaaaaaaaaaaä] and then assigned it a driver.

rpcclient $> setdriver aaaaaaaaaaaaaaaaaaaaaaä "HP LaserJet Professional P 1102w]"
Successfully set aaaaaaaaaaaaaaaaaaaaaaä to driver HP LaserJet Professional P 1102w].

I'm sorry but I can't reproduce your issue.

I guess you get it working, if you remove the printer from Samba and the registry (see samba-regedit). And then apply the patch:

https://bugzilla.samba.org/show_bug.cgi?id=12183

As soon as Samba starts up again it should create the registry values with the correct name and you should be able to set the printer driver.
Comment 18 Mario Lipinski 2016-11-11 14:02:52 UTC
Cleaning up the registry did not change anything.
Also choosing a different printer name that was not used before patching samba did not help. It still breaks with (different) umlaut as 23rd character.

I works on amd64.

I also tested on another i386 production system and I could also reproduce the issue there.

Kernel is always 64 bit if that matters.

Next step for me would be to try a fresh Debian i386 installation.

Are you testing and 32 or 64 Bit?
Does anyone else have a Debian stable 32 bit system to test this issue?
Comment 19 Andreas Schneider 2016-11-11 16:26:44 UTC
I'm testing on Fedora 23 64bit.

So it works on a 64bit system but fails on a 32bit system?


If you can try with a clean 32bit system, that would be great.
Comment 20 Björn Jacke 2021-01-11 12:48:09 UTC
no feedback from bug reporter, I assume it was a config error. Feel free to reopen and provide more new information