Bug 1574177 - Unable to print on smb share
Summary: Unable to print on smb share
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: samba
Version: 28
Hardware: x86_64
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Guenther Deschner
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 1574761 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-05-02 18:26 UTC by Luca Giuzzi
Modified: 2018-05-12 18:20 UTC (History)
17 users (show)

Fixed In Version: samba-4.8.1-1.fc28
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-05-12 18:20:55 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
output of journalctl -e -u cups (22.58 KB, text/plain)
2018-05-02 18:26 UTC, Luca Giuzzi
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Samba Project 13417 0 None None None 2019-07-31 21:46:09 UTC

Description Luca Giuzzi 2018-05-02 18:26:59 UTC
Created attachment 1430234 [details]
output of journalctl -e -u cups

Description of problem:

Ever since upgrading to fedora 28 I am unable to print on a smb share.


Version-Release number of selected component (if applicable):

samba-client: 4.8.1-0.fc28
cups: 2.2.6-14.fc28


How reproducible:

Upgrade from fedora 27; try to print something on a smb share.
Cups returns an error and the printer gets off line.

Steps to Reproduce:
1. try to print a file
2.
3.

Actual results:

The printer gets off line

Expected results:

The file is printed

Additional info:

Our set-up uses a samba share to access a centralized print system (uniflow).
If I send a file directly using smbspool

smbspool smb://USER:PASSWORD@domain/server/printer 1 1 0 1 1 filename.pdf

everything seems to work properly.

I have observed that smbspool in fedora 28 expects 6 or 7 parameters (7 in case we specify I file), while smbspool in centos 7.4.1708 expects either 5 or 6 parameters. In particular, if smbspool in fedora is given just 6 parameters, then it expects the file to be printed from STDIN; on the other hand smbspool in centos has the filename as 6th parameter.

I include the output of journalctl after setting logging with
cupsctl LogLevel=debug2

Comment 1 Zdenek Dohnal 2018-05-03 06:11:57 UTC
Hi Luca,

thank you for reporting this issue! AFAIK /usr/lib/cups/smb is symlink to /usr/libexec/samba/cups_backend_smb, but it isn't around anymore... Andreas, maybe you know more?
It seems like samba problem to me right now, because it is connected to smb backend, which is provided by samba.

Comment 2 Luca Giuzzi 2018-05-03 07:40:43 UTC
Hi Zdenek,

Actually, the smb backend is installed by samba-client.
It is a symlink to 
/usr/libexec/samba/cups_backend_smb
which is in turn a symlink to
/etc/alternatives/cups_backend_smb
which links to
/usr/bin/smbspool
or
/usr/libexec/samba/smbspool_krb5_wrapper
depending on whether 
samba-krb5-printing-4.8.1-0.fc28.x86_64
is installed.

This should not make a difference in my case as I do not use krb authentication and (in this case) smbspool_krb5_wrapper should just exec smbspool.

On the other hand, I suspect that the defaults of smbspool have changed and that is the reason of the problem.

Is there a cups config file to determine what parameters are being passed to a backend and/or change them?
[I have not been able to find it, but I did not go and check the source]

Comment 3 Daniel Uvehag 2018-05-03 08:11:35 UTC
I think there's something odd in the code here, causing the help screen: https://github.com/samba-team/samba/blob/8c833470fc52332c62220ec9cc38c8a4fd7721f1/source3/client/smbspool.c#L120

I get the same error on my side. Adding an empty DEVICE_URI argument to smbspool seems to make printing work again. This also makes argv[3] resolve to the print user's name, as expected in smb_connect() (see line 270 and 524.)

Comment 4 Zdenek Dohnal 2018-05-04 04:28:05 UTC
*** Bug 1574761 has been marked as a duplicate of this bug. ***

Comment 5 antofthy 2018-05-08 02:16:02 UTC
I have the exact same problem.

CUPs fails to print to a samba printer, with the cups log showing a "USAGE" report...

Usage: smbspool.orig [DEVICE_URI] job-id user title copies options [file]
       The DEVICE_URI environment variable can also contain the
       destination printer:

           smb://[username:password@][workgroup/]server[:port]/printer

After placing a wrapper around the "smbspool" command which the CUPs "/usr/lib/cups/backend/smb" command eventually reached via a series of symbolic links, extracting the call environment and playing around, I learned the following, using simplified test cases...


A command like...

  smbspool  "$SMB_PRINTER_URI"  7 root test 1 ''  <test_file.ps

works perfectly fine!

NOTE:  SMB_PRINTER_URL  is the correct smb://... URI, not published as it includes machines, username, and password identifiers)

However if I run the smpspool command like this...

  DEVICE_URL="$SMB_PRINTER_URI"  smbspool 7 root test 1 ''  <test_file.ps

It will NOT work and return the "USAGE" message seen in the CUP's logs.

This latter form is the form that CUPs uses and according to both the "smbspool" manpage, and the acual USAGE error report, should be an acceptable use case.   However it appears that is no longer the case in Fedora 28 release.

I do not it did work fine in Fedora 27

IN SUMMERY:  Samba "smbspool" command changed without any indication in manpages or the usage error report.

This appears to be the cause of the problem.

Please note: BOTH methods have a LOT to be desired when usernames and passwords are involved in terms of security!  But that is a different matter entirely!



TEMPORARY WORKAROUND...


For myself I have worked around the problem using a 'wrapper' script for "smbspool" to switch from one usage style to the other.

Specifically I moved "/bin/smbspool" to "/bin/smbspool.orig"
and added this script for "/bin/smbspool"

#!/bin/sh
exec smbspool.orig "$DEVICE_URI" "$@"


Anthony Thyssen  --  UNIX Administrator for 30+ years

Comment 6 Andreas Schneider 2018-05-08 06:09:11 UTC
I've already fixed it. Will have a backport probably by tomorrow.

Comment 7 Fedora Update System 2018-05-09 15:59:12 UTC
samba-4.8.1-1.fc28 has been submitted as an update to Fedora 28. https://bodhi.fedoraproject.org/updates/FEDORA-2018-48836bc2b8

Comment 8 Stephen So 2018-05-10 13:22:18 UTC
I can confirm that printing to the smb share now works for me after updating to the fixed version.

Comment 9 Fedora Update System 2018-05-11 01:58:50 UTC
samba-4.8.1-1.fc28 has been pushed to the Fedora 28 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-48836bc2b8

Comment 10 Fedora Update System 2018-05-12 18:20:55 UTC
samba-4.8.1-1.fc28 has been pushed to the Fedora 28 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.