Bug 202977 - smbspool should percent-decode DEVICE_URI
smbspool should percent-decode DEVICE_URI
Product: Fedora
Classification: Fedora
Component: samba (Show other bugs)
All Linux
medium Severity high
: ---
: ---
Assigned To: Simo Sorce
David Lawrence
Depends On:
Blocks: FC6Target 203066
  Show dependency treegraph
Reported: 2006-08-17 12:33 EDT by ketan kothari
Modified: 2007-11-30 17:11 EST (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2007-11-23 15:03:23 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
samba-percent-decode.patch (771 bytes, patch)
2006-08-18 08:22 EDT, Tim Waugh
no flags Details | Diff

External Trackers
Tracker ID Priority Status Summary Last Updated
Samba Project 2319 None None None Never

  None (edit)
Description ketan kothari 2006-08-17 12:33:19 EDT
Description of problem:

When trying to print using cups to windows Print share (Password Protected),
backend smb fails with following message

backend smb failed.

ERROR: Tree connect failed (NT_STATUS_ACCESS_DENIED)
ERROR: Unable to connect to CIFS host, will retry in 60 seconds...

Password security is implemented at our side and we must use special characters
in the password. The password contains "#" at the end. For e.g. test123#

Here is the DeviceURI Line in printers.conf file.

DeviceURI smb://test:test123#@domain/printserver/printer

Insted of using smb linked to smbspool i created a shell script to display
DEVICE_URI and found that

CUPS is truncating the DEVICE_URI after # 

it shows

I have tried to use Hex character %23 for # however in that case samba can not
authenicate against windows printer share.

DeviceURI smb://test:test123%23@domain/printserver/printer

So to summarize the issue here is
1. Use of password protected Windows Print Share
2. Use of special characters # in the password
3. Use Samba
4. cups will truncate DeviceURI and only conains string before #. (printing
fails). Escaping it with \# also does not work.
5. if used %23 instead of #, samba will not authenticate against Printer share.

in either case printing will not work.

Only workaround is to write shell script and explicitly export DEVICE_URI
environment variable  and name it as smb.

export DEVICE_URI=smb://test:test123%23@domain/printserver/printer
smbpool $1 $2 $3 $4 \"$5\"

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

How reproducible:
Every time

Steps to Reproduce:
1. Configure CUPS to connect to Windows network printer share with password
containing # at the end.
2. Try printing to it using echo test | lp -d printername
3. check for error log in /var/log/cups/error_log
Actual results:
No print output

Expected results:
print output

Additional info:
Comment 1 Tim Waugh 2006-08-17 13:42:54 EDT
I've asked upstream about this:
Comment 2 Tim Waugh 2006-08-18 04:31:09 EDT
Upstream says:
  The # needs to be % encoded, as required by the URI spec...

Reassigning to samba because of above:
  "5. if used %23 instead of #, samba will not authenticate against Printer share."
Comment 3 Tim Waugh 2006-08-18 08:22:15 EDT
Created attachment 134439 [details]

Try this patch.
Comment 4 ketan kothari 2006-08-18 11:07:47 EDT
When this Patch will be incorporated in samba-client Package. Current version of
Samba-client package is : samba-client-3.0.23b-2. If i have to apply this patch
today, Will i have to download the source package myself, apply the patch and
recompile it to make it work again.
Comment 5 Matthew Miller 2007-04-06 12:11:10 EDT
Fedora Core 5 and Fedora Core 6 are, as we're sure you've noticed, no longer
test releases. We're cleaning up the bug database and making sure important bug
reports filed against these test releases don't get lost. It would be helpful if
you could test this issue with a released version of Fedora or with the latest
development / test release. Thanks for your help and for your patience.

[This is a bulk message for all open FC5/FC6 test release bugs. I'm adding
myself to the CC list for each bug, so I'll see any comments you make after this
and do my best to make sure every issue gets proper attention.]
Comment 6 Tim Waugh 2007-04-11 05:27:30 EDT
This patch is still needed.  See https://bugs.launchpad.net/bugs/105022 for
another instance of this.
Comment 7 Matthew Miller 2007-04-11 09:26:14 EDT
moving to FC6, then. Thanks.
Comment 8 Simo Sorce 2007-06-12 11:39:30 EDT
I am working on a patch
Comment 9 Simo Sorce 2007-06-12 11:45:33 EDT
See patch attached here: https://bugzilla.samba.org/show_bug.cgi?id-2319
Comment 10 Tim Waugh 2007-06-12 15:24:32 EDT
Patch works here.
Comment 11 Simo Sorce 2007-11-23 15:03:23 EST
This is fixed upstream and should be already fixed in F7/F8

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