Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 202977 - smbspool should percent-decode DEVICE_URI
Summary: smbspool should percent-decode DEVICE_URI
Alias: None
Product: Fedora
Classification: Fedora
Component: samba
Version: 6
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Simo Sorce
QA Contact: David Lawrence
Depends On:
Blocks: FC6Target 203066
TreeView+ depends on / blocked
Reported: 2006-08-17 16:33 UTC by ketan kothari
Modified: 2007-11-30 22:11 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2007-11-23 20:03:23 UTC

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

System ID Priority Status Summary Last Updated
Samba Project 2319 None None None Never

Description ketan kothari 2006-08-17 16:33:19 UTC
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 17:42:54 UTC
I've asked upstream about this:

Comment 2 Tim Waugh 2006-08-18 08:31:09 UTC
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 12:22:15 UTC
Created attachment 134439 [details]

Try this patch.

Comment 4 ketan kothari 2006-08-18 15:07:47 UTC
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 16:11:10 UTC
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 09:27:30 UTC
This patch is still needed.  See for
another instance of this.

Comment 7 Matthew Miller 2007-04-11 13:26:14 UTC
moving to FC6, then. Thanks.

Comment 8 Simo Sorce 2007-06-12 15:39:30 UTC
I am working on a patch

Comment 9 Simo Sorce 2007-06-12 15:45:33 UTC
See patch attached here:

Comment 10 Tim Waugh 2007-06-12 19:24:32 UTC
Patch works here.

Comment 11 Simo Sorce 2007-11-23 20:03:23 UTC
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.