Bug 5080 - Access to cups-printers via samba broken with cups 1.3.4, Unsupported character set
Summary: Access to cups-printers via samba broken with cups 1.3.4, Unsupported charact...
Status: RESOLVED FIXED
Alias: None
Product: Samba 3.0
Classification: Unclassified
Component: Printing (show other bugs)
Version: 3.0.26a
Hardware: x64 Linux
: P3 normal
Target Milestone: none
Assignee: Gerald (Jerry) Carter (dead mail address)
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-11-13 23:02 UTC by Alexander Bruns
Modified: 2009-01-31 12:55 UTC (History)
2 users (show)

See Also:


Attachments
log.nmbd (285.20 KB, application/octet-stream)
2007-12-02 06:57 UTC, Alexander Bruns
no flags Details
log.192.168.2.11 (17.57 KB, application/octet-stream)
2007-12-02 06:57 UTC, Alexander Bruns
no flags Details
log.smbd (108.74 KB, application/octet-stream)
2007-12-02 06:58 UTC, Alexander Bruns
no flags Details
log.softeis (391.73 KB, application/octet-stream)
2007-12-02 06:59 UTC, Alexander Bruns
no flags Details
cupsd error_log (1.71 KB, application/octet-stream)
2007-12-02 06:59 UTC, Alexander Bruns
no flags Details
smb.conf (5.78 KB, application/octet-stream)
2007-12-02 07:02 UTC, Alexander Bruns
no flags Details
Proposed patch (25.39 KB, patch)
2008-10-01 18:06 UTC, Jeremy Allison
no flags Details
Patch for 3.3.x. (27.12 KB, patch)
2008-10-01 18:27 UTC, Jeremy Allison
no flags Details
Replacement patch for 3.2.x (25.39 KB, patch)
2008-10-02 15:52 UTC, Jeremy Allison
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Bruns 2007-11-13 23:02:32 UTC
Hi,

I tried to upgrade to cups 1.3.4 from cups 1.2.22-r2

I can print local on my linux-gentoo-box with cups. Printer works with cups 1.3.4!


But I do not see the Printer by samba as a samba-share from my other windows-computers. My Samba-Version is 3.0.26a

It works only by a downgrade to cups-1.2.22-r2

With cups-1.3.4 in the cups-logfile at /var/log/cups/error_log I get tese errors when I browse the samba-shares by a windows xp-client:

E [08/Nov/2007:22:17:28 +0100] Unsupported character set "iso-8859-15"!
E [08/Nov/2007:22:17:28 +0100] Unsupported character set "iso-8859-15"!
E [08/Nov/2007:22:17:29 +0100] Unsupported character set "iso-8859-15"!

This is the answer I got at the cups-general-mailinglist, where I ask for
a solution first:

File a bug with Samba - they need to use UTF-8 for all requests.

Now my question. Is this a bug? I need to use iso-8859-15 or iso-8859-1
to get the german umlauts work in linux and samba.


Here is my smb.conf:

[global]
workgroup = ENTERPRISE
netbios name = HOLODECK
server string = Server der Enterprise-WG
socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
encrypt passwords = Yes
map to guest = Bad User
log file = /var/log/samba/log.%m
smb passwd file = /etc/samba/private/smbpasswd
# max log size = 50
load printers = Yes
printing = cups
printcap name = cups
# printer admin = @wgusers
dos charset=CP850
unix charset=ISO8859-1
display charset=ISO8859-1
# os level = 33
# preferred master = True
# wins proxy = Yes
oplocks = true
kernel oplocks = yes
level2 oplocks = true
read raw = yes
write raw = yes
log level = 2
veto files = /lost+found/ /.keep*/ /.*/

[printers]
comment = All Printers
path = /var/spool/samba
printer = HPLaserJet6P
browseable = yes
# to allow user 'guest account' to print.
guest ok = yes
writable = no
printable = yes


Here is my cups.conf:

#
# "$Id: cupsd.conf.in 6720 2007-07-25 00:40:03Z mike $"
#
# Sample configuration file for the Common UNIX Printing System (CUPS)
# scheduler. See "man cupsd.conf" for a complete description of this
# file.
#

# Log general information in error_log - change "info" to "debug" for
# troubleshooting...
LogLevel info

# Administrator user group...
SystemGroup lpadmin


# Only listen for connections from the local machine.
Listen localhost:631
Listen 192.168.2.254:631
Listen /var/run/cups/cups.sock

# Show shared printers on the local network.
Browsing On
BrowseOrder allow,deny
#BrowseAllow @LOCAL
BrowseAllow all

# Default authentication type, when authentication is required...
DefaultAuthType Basic

# Restrict access to the server...
<Location />
Order allow,deny
Allow localhost
</Location>

# Restrict access to the admin pages...

# Restrict access to the admin pages...
<Location /admin>
Encryption Required
Order allow,deny
Allow localhost
</Location>

# Restrict access to configuration files...
<Location /admin/conf>
#AuthType Default
AuthType Basic
Require user @SYSTEM
Order allow,deny
Allow localhost
</Location>

# Set the default printer/job policies...
<Policy default>
# Job-related operations must be done by the owner or an administrator...
<Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs Set-Job-Attributes Create-Job-Subscription Renew-Subscription Cancel-Subscription Get-Notifications Reprocess-Job Cancel-Current-Job Suspend-Current-Job Resume-Job CUPS-Move-Job>
Require user @OWNER @SYSTEM
Order deny,allow
</Limit>

# All administration operations require an administrator to authenticate...
<Limit CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class CUPS-Delete-Class CUPS-Set-Default>
AuthType Default
Require user @SYSTEM
Order deny,allow
</Limit>

# All printer operations require a printer operator to authenticate...
<Limit Pause-Printer Resume-Printer Enable-Printer Disable-Printer Pause-Printer-After-Current-Job Hold-New-Jobs Release-Held-New-Jobs Deactivate-Printer Activate-Printer Restart-Printer Shutdown-Printer Startup-Printer Promote-Job Schedule-Job-After CUPS-Accept-Jobs CUPS-Reject-Jobs>
AuthType Default
Require user @SYSTEM
Order deny,allow
</Limit>

# Only the owner or an administrator can cancel or authenticate a job...
<Limit Cancel-Job CUPS-Authenticate-Job>
Require user @OWNER @SYSTEM
Order deny,allow
</Limit>

<Limit All>
Order deny,allow
</Limit>
</Policy>

#
# End of "$Id: cupsd.conf.in 6720 2007-07-25 00:40:03Z mike $".
#


Any suggestions whats wrong?

Alex
Comment 1 Jeremy Allison 2007-11-14 11:58:04 UTC
> I need to use iso-8859-15 or iso-8859-1
> to get the german umlauts work in linux and samba.

Actually no you don't. This is a misconfiguration on your part.
You need to make sure the files on disk are named in utf8, not iso8859-15,
then set :

unix charset=utf8

and all will work.
Jeremy.
Comment 2 Horst 2007-11-17 14:23:02 UTC
I have the same problem, i can print locally but not from my windows box via samba/cups:

D [17/Nov/2007:21:15:46 +0100] cupsdAcceptClient: skipping getpeercon()
D [17/Nov/2007:21:15:46 +0100] cupsdAcceptClient: 10 from localhost (Domain)
D [17/Nov/2007:21:15:46 +0100] cupsdReadClient: 10 POST / HTTP/1.1
D [17/Nov/2007:21:15:46 +0100] cupsdAuthorize: No authentication data provided.
E [17/Nov/2007:21:15:46 +0100] Unsupported character set "iso-8859-1"!
D [17/Nov/2007:21:15:46 +0100] Discarding unused server-audit event...
D [17/Nov/2007:21:15:46 +0100] Get-Jobs client-error-bad-request: Unsupported character set "iso-8859-1"!
D [17/Nov/2007:21:15:46 +0100] cupsdProcessIPPRequest: 10 status_code=400 (client-error-bad-request)
D [17/Nov/2007:21:15:46 +0100] cupsdCloseClient: 10

I tried to add

unix charset=utf8

to my smb.conf, restarted both services but the result is the same. also I wonder where the changes happened that lead to this, i.e. which package do I have to downgrade to make it work again, samba or cups? (For me it stopped working after the upgrade from fedora7 to fedora8).

I'm thankful for any workaround as I'm currently printing to ps-files on my windows box, upload the files to the print server and print them via lpr commandline. this isn't that efficient ;)
Comment 3 Tillmann Krauss 2007-11-18 10:44:52 UTC
I have the same problem on Debian.
Linux Q7Router 2.6.14.3 #18 PREEMPT Tue Jun 27 14:25:21 CEST 2006 i686 GNU/Linux

cups-log:
E [18/Nov/2007:17:32:13 +0100] Unsupported character set "iso-8859-15"!
E [18/Nov/2007:17:32:13 +0100] Unsupported character set "iso-8859-15"!

samba-log (smb.conf with unix charset = utf8):
Nov 18 17:27:33 Q7Router smbd[8129]: [2007/11/18 17:27:33, 0] param/loadparm.c:process_usershare_file(4567)
Nov 18 17:27:33 Q7Router smbd[8129]:   process_usershare_file: share name ::{2227a280-3aea-1069-a2de-08002b30309d} contains invalid characters (any of %<>*?|/\+=;:",)

samba-log (smb.conf WITHOUT unix charset = utf8):
Nov 18 16:12:04 Q7Router smbd[7436]:   Unable to get jobs for ipp://localhost/printers/ALC900 - client-error-bad-request

Downgrading to stable 1.2.7 cups and it works again.
Comment 4 Bartlomiej Solarz-Niesluchowski 2007-11-28 10:23:48 UTC
(In reply to comment #1)
> then set :
> unix charset=utf8
> and all will work.
nope this is not this parameter!
tonight I update release of samba from 3.0.27 to 3.0.27a and found weird problem....

if in my config was:
dos charset = CP852

printing via CUPS was unsuccesfull!
D [28/Nov/2007:09:15:48 +0100] cupsdProcessIPPRequest: 115 status_code=400 (client-error-bad-request)
D [28/Nov/2007:09:15:48 +0100] cupsdCloseClient: 115
D [28/Nov/2007:09:15:48 +0100] cupsdAcceptClient: skipping getpeercon()
D [28/Nov/2007:09:15:48 +0100] cupsdAcceptClient: 115 from localhost (Domain)
D [28/Nov/2007:09:15:48 +0100] cupsdReadClient: 115 POST / HTTP/1.1
D [28/Nov/2007:09:15:48 +0100] cupsdAuthorize: No authentication data provided.
E [28/Nov/2007:09:15:48 +0100] Unsupported character set "iso-8859-2"!
D [28/Nov/2007:09:15:48 +0100] Discarding unused server-audit event...
D [28/Nov/2007:09:15:48 +0100] CUPS-Get-Printers client-error-bad-request: Unsupported character set "iso-8859-2"!
D [28/Nov/2007:09:15:48 +0100] cupsdProcessIPPRequest: 115 status_code=400 (client-error-bad-request)
D [28/Nov/2007:09:15:48 +0100] cupsdReadClient: 115 POST / HTTP/1.1
D [28/Nov/2007:09:15:48 +0100] cupsdAuthorize: No authentication data provided.
E [28/Nov/2007:09:15:48 +0100] Unsupported character set "iso-8859-2"!
D [28/Nov/2007:09:15:48 +0100] Discarding unused server-audit event...
D [28/Nov/2007:09:15:48 +0100] CUPS-Get-Classes client-error-bad-request: Unsupported character set "iso-8859-2"!
D [28/Nov/2007:09:15:48 +0100] cupsdProcessIPPRequest: 115 status_code=400 (client-error-bad-request)
D [28/Nov/2007:09:15:48 +0100] cupsdCloseClient: 115 

Comment 5 Jeremy Allison 2007-11-28 11:56:51 UTC
I need a full debug level 10 log, and your smb.conf file, and also the name of the printer you're trying to print to. Posting snippets of logs doesn't help at all.
Looks like a new cups binary (1.3.4) may have changed something. It might be we need to charset convert a string we're not currently doing. Have you reported this to the cups people ?
Jeremy.
Comment 6 Jeremy Allison 2007-11-28 13:34:19 UTC
Inside the Samba code it does the following :

        language = cupsLangDefault();

        ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
                     "attributes-charset", NULL, cupsLangEncoding(language));

This is in code given to us by the Cups maintainer. I think this is actually incorrect, as we pass in strings to cups that are in our "unix charset" value. These may be ISO8859-2, if unix charset is set that way. I'm guessing that cupsLangDefault() on your box is utf8. The "unix charset" and value returned from cupsLangDefault() need to match for correct printing. You can configure them this way - the safest path is to convert filenames on disk to utf8 and make sure both CUPS and Samba are set to utf8. Setting things otherwise is fixable, but low priority.

Jeremy.
Comment 7 Alexander Bruns 2007-12-02 06:57:14 UTC
Created attachment 3015 [details]
log.nmbd
Comment 8 Alexander Bruns 2007-12-02 06:57:54 UTC
Created attachment 3016 [details]
log.192.168.2.11
Comment 9 Alexander Bruns 2007-12-02 06:58:16 UTC
Created attachment 3017 [details]
log.smbd
Comment 10 Alexander Bruns 2007-12-02 06:59:28 UTC
Created attachment 3018 [details]
log.softeis
Comment 11 Alexander Bruns 2007-12-02 06:59:50 UTC
Created attachment 3019 [details]
cupsd error_log
Comment 12 Alexander Bruns 2007-12-02 07:02:58 UTC
Created attachment 3020 [details]
smb.conf
Comment 13 Alexander Bruns 2007-12-02 07:03:16 UTC
Hi,

I upgraded (emerged) cups to 1.3.4-r4. Samba is 3.0.27a

I turned on log level = 10 in smb.conf and deleted all old log-files.

The Windows-Box is called softeis (192.168.2.10),
The linux-box running cups and samba is called holodeck (192.168.2.254).
The printer is calles HPLaserJet6P

Then I browsed the samba-shares with my windows-box. Before I deleted all log-Files.

Attached to this bug are now the log-Files in the following path: /var/log/samba/*
And the cupsd-error_log-file.

I also added my smb.conf

Hope this helps.

Because my Box is very old (I Upgraded to new hardware, but some files are several years old) All file-Names are in ISO8859-15. I do not want to switch completely to UTF-8.

I hope I do not have to and samba will be able to talk to cupsd via UTF-8 while the file-Handyling could be done by ISO8859-15

Greetings

Alexander Bruns
Comment 14 Volker Lendecke 2007-12-02 07:12:07 UTC
Are you aware of http://www.j3e.de/linux/convmv/ ? This tool allows you to easily convert file names from one encoding to another. I doubt we will introduce another charset just to talk to cups.

BTW, have you tried to play with the DefaultCharset setting in cupsd.conf?

Volker
Comment 15 Alexander Bruns 2007-12-19 09:17:45 UTC
(In reply to comment #14)
Hi,

I tried DefaultCharacter in cupsd.conf. No Chage. Stille the Error-log-entry and no printers via samba.

For me, I decided to use cups 1.2.x Where I do not have to change anything. Perhaps, one day I will migrate to UTF. But now, I do not see any andvantage but only work and problems.

Thanks for your reply. Samba is a great software!

Greetings

Alexander

Comment 16 Hilko Meyer 2008-01-12 10:06:51 UTC
(In reply to comment #6)
> Inside the Samba code it does the following :
> 
>         language = cupsLangDefault();
> 
>         ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
>                      "attributes-charset", NULL, cupsLangEncoding(language));
> 
> This is in code given to us by the Cups maintainer. I think this is actually
> incorrect, as we pass in strings to cups that are in our "unix charset" value.

You are right. I've bitten by this recently too. Some research led me to http://www.cups.org/str.php?L2537. Since that change in 1.3.4 requests with charsets other than US-ASCII or UTF-8 are rejected by cups.

>I'm guessing that cupsLangDefault() on your box is utf8. The "unix charset"
>and value returned from cupsLangDefault() need to match for correct printing.

The change (http://www.cups.org/strfiles/2537/str2537.patch) in cups added a check
      if (charset &&
          strcasecmp(charset->values[0].string.text, "us-ascii") &&
          strcasecmp(charset->values[0].string.text, "utf-8"))
to the definition of ippAddString in scheduler/ipp.c.

>You can configure them this way - the safest path is to convert filenames on
>disk to utf8 and make sure both CUPS and Samba are set to utf8. Setting things
>otherwise is fixable, but low priority.

It would be nice, if you can raise the priority. Downgrading cups to 1.3.3 and manual apply of the security patches is much less work for me then your suggestion.
Comment 17 Jeremy Allison 2008-01-13 00:23:32 UTC
I know how to fix this - use push_utf8_talloc/pull_utf8_talloc on pushing all strings to/from cups in printing/cups.c and use cupsLangGet() to set the language to utf8 on all calls. I'll try and get to this for 3.2.0, but it might have to wait until the first patch (3.2.1). This won't get back-ported to 3.0.x.

Jeremy.
Comment 18 Hilko Meyer 2008-10-01 16:33:05 UTC
(In reply to comment #17)
> I know how to fix this - use push_utf8_talloc/pull_utf8_talloc on pushing all
> strings to/from cups in printing/cups.c and use cupsLangGet() to set the
> language to utf8 on all calls. I'll try and get to this for 3.2.0, but it might
> have to wait until the first patch (3.2.1). This won't get back-ported to
> 3.0.x.

Hi,

3.2.4 is already out and it seems that this bug is not fixed yet. Could you try to make a fix for 3.2.5?
Comment 19 Jeremy Allison 2008-10-01 18:06:03 UTC
Created attachment 3650 [details]
Proposed patch

Ok, you beat me into it. Can you apply this patch to the 3.2.x tree (should also apply cleanly to 3.3) and see if it fixes the problem ?
Thanks,
Jeremy.
Comment 20 Jeremy Allison 2008-10-01 18:27:58 UTC
Created attachment 3651 [details]
Patch for 3.3.x.

I spoke too soon. This is the patch for 3.3.x.
Jeremy.
Comment 21 Jeremy Allison 2008-10-02 15:52:29 UTC
Created attachment 3654 [details]
Replacement patch for 3.2.x

I had a bool test reversed. This version should work. Make the same change to the 3.3.x version also.
Jeremy.
Comment 22 Ustinov Vladimir 2008-11-08 01:51:07 UTC
(In reply to comment #21)
> Created an attachment (id=3654) [edit]
> Replacement patch for 3.2.x
> 
> I had a bool test reversed. This version should work. Make the same change to
> the 3.3.x version also.
> Jeremy.
> 

This diff cannot be applied to 3.2.3 or 3.2.4
can you attach a proper diff?
Comment 23 Volker Lendecke 2008-11-08 03:43:02 UTC
http://git.samba.org/?p=samba.git;a=commitdiff;h=a1323951a is what went into 3.2 upstream.

Volker
Comment 24 Karolin Seeger 2009-01-31 12:55:05 UTC
Closing out bug report.
Please re-open if it's still an issue.

Thanks for reporting!