Permalink
Browse files

Merge branch 'master' of github.com:znc/znc

  • Loading branch information...
2 parents 6db563f + 5e90bc3 commit 8064bda3d87e65349b7e7b4c707f25348ce871d0 @DarthGandalf DarthGandalf committed Apr 20, 2014
Showing with 55 additions and 9 deletions.
  1. +3 −1 include/znc/Csocket.h
  2. +11 −7 modules/chansaver.cpp
  3. +41 −1 src/Csocket.cpp
View
@@ -591,7 +591,9 @@ class Csock : public CSockCommon
SSL23 = 0,
SSL2 = 2,
SSL3 = 3,
- TLS1 = 4
+ TLS1 = 4,
+ TLS1_1 = 5,
+ TLS1_2 = 6
};
enum ECONState
View
@@ -25,12 +25,16 @@ class CChanSaverMod : public CModule {
MODCONSTRUCTOR(CChanSaverMod) {
m_bWriteConf = false;
- if (GetNetwork()) {
- LoadNetwork(*GetNetwork());
- } else if (GetUser()) {
- LoadUser(*GetUser());
- } else {
- LoadUsers();
+ switch (GetType()) {
+ case CModInfo::GlobalModule:
+ LoadUsers();
+ break;
+ case CModInfo::UserModule:
+ LoadUser(*GetUser());
+ break;
+ case CModInfo::NetworkModule:
+ LoadNetwork(*GetNetwork());
+ break;
}
}
@@ -108,7 +112,7 @@ class CChanSaverMod : public CModule {
template<> void TModInfo<CChanSaverMod>(CModInfo& Info) {
Info.SetWikiPage("chansaver");
Info.AddType(CModInfo::NetworkModule);
- Info.AddType(CModInfo::UserModule);
+ Info.AddType(CModInfo::GlobalModule);
}
USERMODULEDEFS(CChanSaverMod, "Keep config up-to-date when user joins/parts")
View
@@ -1355,6 +1355,26 @@ bool Csock::SSLClientSetup()
return( false );
}
break;
+ case TLS1_2:
+#ifdef TLS1_2_VERSION
+ m_ssl_ctx = SSL_CTX_new( TLSv1_2_client_method() );
+ if( !m_ssl_ctx )
+ {
+ CS_DEBUG( "WARNING: MakeConnection .... TLSv1_2_client_method failed!" );
+ return( false );
+ }
+ break;
+#endif
+ case TLS1_1:
+#ifdef TLS1_1_VERSION
+ m_ssl_ctx = SSL_CTX_new( TLSv1_1_client_method() );
+ if( !m_ssl_ctx )
+ {
+ CS_DEBUG( "WARNING: MakeConnection .... TLSv1_1_client_method failed!" );
+ return( false );
+ }
+ break;
+#endif
case TLS1:
m_ssl_ctx = SSL_CTX_new( TLSv1_client_method() );
if( !m_ssl_ctx )
@@ -1452,6 +1472,26 @@ bool Csock::SSLServerSetup()
return( false );
}
break;
+ case TLS1_2:
+#ifdef TLS1_2_VERSION
+ m_ssl_ctx = SSL_CTX_new( TLSv1_2_server_method() );
+ if( !m_ssl_ctx )
+ {
+ CS_DEBUG( "WARNING: MakeConnection .... TLSv1_2_server_method failed!" );
+ return( false );
+ }
+ break;
+#endif
+ case TLS1_1:
+#ifdef TLS1_1_VERSION
+ m_ssl_ctx = SSL_CTX_new( TLSv1_1_server_method() );
+ if( !m_ssl_ctx )
+ {
+ CS_DEBUG( "WARNING: MakeConnection .... TLSv1_1_server_method failed!" );
+ return( false );
+ }
+ break;
+#endif
case TLS1:
m_ssl_ctx = SSL_CTX_new( TLSv1_server_method() );
if( !m_ssl_ctx )
@@ -2711,7 +2751,7 @@ void Csock::Init( const CS_STRING & sHostname, uint16_t uPort, int iTimeout )
m_shostname = sHostname;
m_sbuffer.clear();
m_eCloseType = CLT_DONT;
- m_iMethod = SSL23;
+ m_iMethod = TLS1_2; // Falls though TLSv1.1 and TLSv1 if not available
m_sCipherType = "ALL";
m_iMaxBytes = 0;
m_iMaxMilliSeconds = 0;

0 comments on commit 8064bda

Please sign in to comment.