Differences From Artifact [0cbf475a00]:
- File src/XMPPConnection.m — part of check-in [44237d2647] at 2011-09-14 20:09:46 on branch trunk — Make it possible to require TLS. (user: js, size: 22751) [annotate] [blame] [check-ins using]
To Artifact [abf53f803c]:
- File
src/XMPPConnection.m
— part of check-in
[0aab2fde67]
at
2011-09-18 19:33:19
on branch trunk
— Fix XMPPAuthenticator to support non-optimized message flow
While RFC6120 allows and encourages sending data with the success
message it is also legal to send the same data as a challenge and
await an empty response. This rework honors that fact. (user: florob@babelmonkeys.de, size: 23068) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
615 616 617 618 619 620 621 | - (void)XMPP_handleSASL: (OFXMLElement*)element { if ([[element name] isEqual: @"challenge"]) { OFXMLElement *responseTag; OFDataArray *challenge = [OFDataArray dataArrayWithBase64EncodedString: [element stringValue]]; OFDataArray *response = [authModule | | > > | > > > > | > | | 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 | - (void)XMPP_handleSASL: (OFXMLElement*)element { if ([[element name] isEqual: @"challenge"]) { OFXMLElement *responseTag; OFDataArray *challenge = [OFDataArray dataArrayWithBase64EncodedString: [element stringValue]]; OFDataArray *response = [authModule continueWithData: challenge]; responseTag = [OFXMLElement elementWithName: @"response" namespace: XMPP_NS_SASL]; if (response) { if ([response count] == 0) [responseTag addChild: [OFXMLElement elementWithCharacters: @"="]]; else [responseTag addChild: [OFXMLElement elementWithCharacters: [response stringByBase64Encoding]]]; } [self sendStanza: responseTag]; return; } if ([[element name] isEqual: @"success"]) { [authModule continueWithData: [OFDataArray dataArrayWithBase64EncodedString: [element stringValue]]]; if ([delegate respondsToSelector: @selector(connectionWasAuthenticated:)]) [delegate connectionWasAuthenticated: self]; /* Stream restart */ |
︙ | ︙ | |||
776 777 778 779 780 781 782 783 784 785 786 787 | assert(0); } - (void)XMPP_sendAuth: (OFString*)authName { OFXMLElement *authTag; authTag = [OFXMLElement elementWithName: @"auth" namespace: XMPP_NS_SASL]; [authTag addAttributeWithName: @"mechanism" stringValue: authName]; | > > > > > > | | > | 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 | assert(0); } - (void)XMPP_sendAuth: (OFString*)authName { OFXMLElement *authTag; OFDataArray *initialMessage = [authModule initialMessage]; authTag = [OFXMLElement elementWithName: @"auth" namespace: XMPP_NS_SASL]; [authTag addAttributeWithName: @"mechanism" stringValue: authName]; if (initialMessage) { if ([initialMessage count] == 0) [authTag addChild: [OFXMLElement elementWithCharacters: @"="]]; else [authTag addChild: [OFXMLElement elementWithCharacters: [initialMessage stringByBase64Encoding]]]; } [self sendStanza: authTag]; } - (void)XMPP_sendResourceBind { XMPPIQ *iq; |
︙ | ︙ |