Make it possible to require TLS.
This commit is contained in:
parent
7c35be965c
commit
616aa8b9cd
2 changed files with 28 additions and 1 deletions
|
@ -73,7 +73,7 @@
|
|||
id <XMPPConnectionDelegate, OFObject> delegate;
|
||||
XMPPAuthenticator *authModule;
|
||||
BOOL needsSession;
|
||||
BOOL encrypted;
|
||||
BOOL encryptionRequired, encrypted;
|
||||
unsigned int lastID;
|
||||
OFString *bindID, *sessionID;
|
||||
XMPPRoster *roster;
|
||||
|
@ -86,6 +86,7 @@
|
|||
@property (retain) id <XMPPConnectionDelegate> delegate;
|
||||
@property (readonly, retain) XMPPRoster *roster;
|
||||
@property (readonly, retain, getter=socket) OFTCPSocket *sock;
|
||||
@property (assign) BOOL encryptionRequired;
|
||||
@property (readonly) BOOL encrypted;
|
||||
#endif
|
||||
|
||||
|
@ -121,6 +122,18 @@
|
|||
*/
|
||||
- (OFTCPSocket*)socket;
|
||||
|
||||
/**
|
||||
* \return Whether encryption is encrypted
|
||||
*/
|
||||
- (BOOL)encryptionRequired;
|
||||
|
||||
/**
|
||||
* Sets whether encryption is required.
|
||||
*
|
||||
* \param required Whether encryption is required
|
||||
*/
|
||||
- (void)setEncryptionRequired: (BOOL)required;
|
||||
|
||||
/**
|
||||
* \return Whether the connection is encrypted
|
||||
*/
|
||||
|
|
|
@ -329,6 +329,16 @@
|
|||
return [[sock retain] autorelease];
|
||||
}
|
||||
|
||||
- (BOOL)encryptionRequired
|
||||
{
|
||||
return encryptionRequired;
|
||||
}
|
||||
|
||||
- (void)setEncryptionRequired: (BOOL)required
|
||||
{
|
||||
encryptionRequired = required;
|
||||
}
|
||||
|
||||
- (BOOL)encrypted
|
||||
{
|
||||
return encrypted;
|
||||
|
@ -711,6 +721,10 @@
|
|||
return;
|
||||
}
|
||||
|
||||
if (encryptionRequired && !encrypted)
|
||||
/* TODO: Find/create an exception to throw here */
|
||||
@throw [OFException newWithClass: isa];
|
||||
|
||||
if (mechs != nil) {
|
||||
OFEnumerator *enumerator;
|
||||
OFXMLElement *mech;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue