Bug 1099891

Summary: Client.start should return None initial response for CRAM-MD5 method
Product: Red Hat Enterprise Linux 6 Reporter: Pavel Moravec <pmoravec>
Component: saslwrapperAssignee: Mike Cressman <mcressma>
Status: CLOSED WONTFIX QA Contact: MRG Quality Engineering <mrgqe-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.4CC: cww, jbuchta
Target Milestone: rcKeywords: TestCaseProvided
Target Release: ---   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-05-15 18:24:22 UTC Type: Bug
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: 804616, 1075802, 1089627, 1172231, 1269194    

Description Pavel Moravec 2014-05-21 12:20:28 UTC
Description of problem:
bz804616 is caused by the fact that:

    status, mech, initial = self._cli.start(str(mechanisms))

returns to "initial" an empty string also for CRAM-MD5 (and DIGEST-MD5) mechanisms. While it has to return None there. See https://issues.apache.org/jira/browse/QPID-3522 for some more background.


Version-Release number of selected component (if applicable):
0.22-5.el6


How reproducible:
100%


Steps to Reproduce:
1) Execute simple python script:

from saslwrapper import Client as _Client
_cli = _Client()

mechanisms = ['CRAM-MD5', 'PLAIN']
print "supplied mechs=%s" %mechanisms
_cli.setAttr('username', 'guest')
_cli.setAttr('externaluser', 'guest')
_cli.setAttr('password', 'guest')
_cli.setAttr('host', 'localhost')
_cli.setAttr('service', 'qpidd')
status = _cli.init()
print "saslwrapper.init: status='%s'" %status
status, mech, initial = _cli.start(str(mechanisms))
print "saslwrapper.start: mech='%s', status='%s', initial='%s'" %(mech, status, initial)


Actual results:
Latest line of output is:
saslwrapper.start: mech='CRAM-MD5', status='True', initial=''


Expected results:
Latest line of output should be:
saslwrapper.start: mech='CRAM-MD5', status='True', initial='None'


Additional info:
Another reproducer: once this is fixed, python-qpid will support CRAM-MD5 mechanism, so you can test it e.g. by:

qpid-stat -q -b guest/guest@localhost:5672 --sasl-mechanism=CRAM-MD5


Be aware, EXTERNAL mechanism still requires empty string initial response

Comment 1 Pavel Moravec 2014-05-22 13:47:10 UTC
Trivial necessary change that does not suffice:

in saslwrapper-0.22/src/cyrus/saslwrapper.cpp, ClientImpl::start:


    if (resp)
        initialResponse = string(resp, len);

BUT if resp==null, we need to set pointer to initialResponse to null - this cant be done with current interface of the method.

Comment 4 Justin Ross 2014-06-23 18:49:41 UTC
*** Bug 1089627 has been marked as a duplicate of this bug. ***