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;
|
id <XMPPConnectionDelegate, OFObject> delegate;
|
||||||
XMPPAuthenticator *authModule;
|
XMPPAuthenticator *authModule;
|
||||||
BOOL needsSession;
|
BOOL needsSession;
|
||||||
BOOL encrypted;
|
BOOL encryptionRequired, encrypted;
|
||||||
unsigned int lastID;
|
unsigned int lastID;
|
||||||
OFString *bindID, *sessionID;
|
OFString *bindID, *sessionID;
|
||||||
XMPPRoster *roster;
|
XMPPRoster *roster;
|
||||||
|
@ -86,6 +86,7 @@
|
||||||
@property (retain) id <XMPPConnectionDelegate> delegate;
|
@property (retain) id <XMPPConnectionDelegate> delegate;
|
||||||
@property (readonly, retain) XMPPRoster *roster;
|
@property (readonly, retain) XMPPRoster *roster;
|
||||||
@property (readonly, retain, getter=socket) OFTCPSocket *sock;
|
@property (readonly, retain, getter=socket) OFTCPSocket *sock;
|
||||||
|
@property (assign) BOOL encryptionRequired;
|
||||||
@property (readonly) BOOL encrypted;
|
@property (readonly) BOOL encrypted;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -121,6 +122,18 @@
|
||||||
*/
|
*/
|
||||||
- (OFTCPSocket*)socket;
|
- (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
|
* \return Whether the connection is encrypted
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -329,6 +329,16 @@
|
||||||
return [[sock retain] autorelease];
|
return [[sock retain] autorelease];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (BOOL)encryptionRequired
|
||||||
|
{
|
||||||
|
return encryptionRequired;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setEncryptionRequired: (BOOL)required
|
||||||
|
{
|
||||||
|
encryptionRequired = required;
|
||||||
|
}
|
||||||
|
|
||||||
- (BOOL)encrypted
|
- (BOOL)encrypted
|
||||||
{
|
{
|
||||||
return encrypted;
|
return encrypted;
|
||||||
|
@ -711,6 +721,10 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (encryptionRequired && !encrypted)
|
||||||
|
/* TODO: Find/create an exception to throw here */
|
||||||
|
@throw [OFException newWithClass: isa];
|
||||||
|
|
||||||
if (mechs != nil) {
|
if (mechs != nil) {
|
||||||
OFEnumerator *enumerator;
|
OFEnumerator *enumerator;
|
||||||
OFXMLElement *mech;
|
OFXMLElement *mech;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue