diff options
| author | Remko Tronçon <git@el-tramo.be> | 2010-06-03 18:11:02 (GMT) | 
|---|---|---|
| committer | Remko Tronçon <git@el-tramo.be> | 2010-06-03 18:11:02 (GMT) | 
| commit | c3fa606c7ac060c4929e7082e0e24531b093112f (patch) | |
| tree | 394cf72c0b43fa706319592dfdb1438335b6116a /Swiften/SASL/DIGESTMD5ClientAuthenticator.cpp | |
| parent | 8406d818fcb2a511b1e4264a10fd9069ec020d72 (diff) | |
| download | swift-contrib-c3fa606c7ac060c4929e7082e0e24531b093112f.zip swift-contrib-c3fa606c7ac060c4929e7082e0e24531b093112f.tar.bz2  | |
Distinguish an empty SASL message from no SASL message.
Diffstat (limited to 'Swiften/SASL/DIGESTMD5ClientAuthenticator.cpp')
| -rw-r--r-- | Swiften/SASL/DIGESTMD5ClientAuthenticator.cpp | 13 | 
1 files changed, 8 insertions, 5 deletions
diff --git a/Swiften/SASL/DIGESTMD5ClientAuthenticator.cpp b/Swiften/SASL/DIGESTMD5ClientAuthenticator.cpp index d22f295..050b73b 100644 --- a/Swiften/SASL/DIGESTMD5ClientAuthenticator.cpp +++ b/Swiften/SASL/DIGESTMD5ClientAuthenticator.cpp @@ -16,9 +16,9 @@ namespace Swift {  DIGESTMD5ClientAuthenticator::DIGESTMD5ClientAuthenticator(const String& host, const String& nonce) : ClientAuthenticator("DIGEST-MD5"), step(Initial), host(host), cnonce(nonce) {  } -ByteArray DIGESTMD5ClientAuthenticator::getResponse() const { +boost::optional<ByteArray> DIGESTMD5ClientAuthenticator::getResponse() const {  	if (step == Initial) { -		return ByteArray(); +		return boost::optional<ByteArray>();  	}  	else if (step == Response) {  		String realm; @@ -59,13 +59,16 @@ ByteArray DIGESTMD5ClientAuthenticator::getResponse() const {  		return response.serialize();  	}  	else { -		return ByteArray(); +		return boost::optional<ByteArray>();  	}  } -bool DIGESTMD5ClientAuthenticator::setChallenge(const ByteArray& challengeData) { +bool DIGESTMD5ClientAuthenticator::setChallenge(const boost::optional<ByteArray>& challengeData) {  	if (step == Initial) { -		challenge = DIGESTMD5Properties::parse(challengeData); +		if (!challengeData) { +			return false; +		} +		challenge = DIGESTMD5Properties::parse(*challengeData);  		// Sanity checks  		if (!challenge.getValue("nonce")) {  | 
 Swift