Bug 202977

Summary: smbspool should percent-decode DEVICE_URI
Product: [Fedora] Fedora Reporter: ketan kothari <ket000>
Component: sambaAssignee: Simo Sorce <ssorce>
Status: CLOSED UPSTREAM QA Contact: David Lawrence <dkl>
Severity: high Docs Contact:
Priority: medium    
Version: 6CC: jplans, ket000, mattdm, pcfe, samba-bugs-list
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-11-23 20:03:23 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 150223, 203066    
Attachments:
Description Flags
samba-percent-decode.patch none

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
smb://test:test123

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):
cups-1.2.2-11
samba-3.0.23b-2



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:
  http://cups.org/newsgroups.php?s9804+gcups.general+v9813+T1

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]
samba-percent-decode.patch

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 https://bugs.launchpad.net/bugs/105022 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: https://bugzilla.samba.org/show_bug.cgi?id-2319

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