File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -58,6 +58,8 @@ GS_EXPORT NSString * const GSTLSVerify;
5858
5959/* * Notification posted whenever a connection (handled by a [GSTLSSession]
6060 * instance) to a TLS server fails certificate or host name verification.
61+ * This is only sent if the option to turn off strict verification was not
62+ * set in the session options.
6163 */
6264GS_EXPORT NSString * const GSTLSVerifyFailedNotification;
6365
Original file line number Diff line number Diff line change @@ -2059,16 +2059,24 @@ - (BOOL) handshake
20592059 handle, gnutls_strerror (ret));
20602060 NSLog (@" %p failed verify:\n %@ " , handle, [self sessionInfo ]);
20612061 }
2062- if (outgoing)
2062+ if (requireVerified)
2063+ {
2064+ [self disconnect: NO ];
2065+ }
2066+ else if (outgoing && nil == [opts objectForKey: GSTLSVerify])
20632067 {
2068+ /* We notify about verification failure on outgoing connections
2069+ * if the failure was ignored, unless it was specifically turned
2070+ * off by the app (GSTLSVerify set to NO). That is to say, if
2071+ * strict verification was turned off by environment variable
2072+ * or user default. This is intended to allow an application
2073+ * to catch connection attempts which would have failed if the
2074+ * default setting had been to use strict verification.
2075+ */
20642076 [[NSNotificationCenter defaultCenter ]
20652077 postNotificationName: GSTLSVerifyFailedNotification
20662078 object: self ];
20672079 }
2068- if (requireVerified)
2069- {
2070- [self disconnect: NO ];
2071- }
20722080 }
20732081 else
20742082 {
You can’t perform that action at this time.
0 commit comments