Skip to content

Commit

Permalink
rename *Raw parameters/methods to Use*
Browse files Browse the repository at this point in the history
sed -i \
  -e 's/m_pCertRaw/m_pUseCert/g' \
  -e 's/m_pKeyRaw/m_pUseKey/g'   \
  -e 's/m_pDHParamRaw/m_pUseDHParam/g' \
  Csocket.{cc,h}
  • Loading branch information
majuscule committed Nov 27, 2015
1 parent 295e736 commit 9c1cbf5
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 39 deletions.
42 changes: 21 additions & 21 deletions Csocket.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1044,9 +1044,9 @@ void Csock::Copy( const Csock & cCopy )
m_shostname = cCopy.m_shostname;
m_sbuffer = cCopy.m_sbuffer;
m_sSockName = cCopy.m_sSockName;
m_pKeyRaw = cCopy.m_pKeyRaw;
m_pCertRaw = cCopy.m_pCertRaw;
m_pDHParamRaw = cCopy.m_pDHParamRaw;
m_pUseKey = cCopy.m_pUseKey;
m_pUseCert = cCopy.m_pUseCert;
m_pUseDHParam = cCopy.m_pUseDHParam;
m_sKeyFile = cCopy.m_sKeyFile;
m_sDHParamFile = cCopy.m_sDHParamFile;
m_sPemFile = cCopy.m_sPemFile;
Expand Down Expand Up @@ -1578,14 +1578,14 @@ bool Csock::SSLClientSetup()
SSL_CTX_set_default_passwd_cb_userdata( m_ssl_ctx, ( void * )this );

// set up the CTX
if( m_pCertRaw && m_pKeyRaw )
if( m_pUseCert && m_pUseKey )
{
if( SSL_CTX_use_certificate( m_ssl_ctx, m_pCertRaw ) <= 0 )
if( SSL_CTX_use_certificate( m_ssl_ctx, m_pUseCert ) <= 0 )
{
CS_DEBUG( "Error with SSLCert file [" << m_sPemFile << "]" );
SSLErrors( __FILE__, __LINE__ );
}
if( SSL_CTX_use_PrivateKey( m_ssl_ctx, m_pKeyRaw ) <= 0 )
if( SSL_CTX_use_PrivateKey( m_ssl_ctx, m_pUseKey ) <= 0 )
{
CS_DEBUG( "Error with SSLCert file [" << m_sPemFile << "]" );
SSLErrors( __FILE__, __LINE__ );
Expand Down Expand Up @@ -1719,7 +1719,7 @@ SSL_CTX * Csock::SetupServerCTX()
SSL_CTX_set_default_passwd_cb( pCTX, _PemPassCB );
SSL_CTX_set_default_passwd_cb_userdata( pCTX, ( void * )this );

if( !m_pCertRaw )
if( !m_pUseCert )
{
if( m_sPemFile.empty() || access( m_sPemFile.c_str(), R_OK ) != 0 )
{
Expand All @@ -1742,15 +1742,15 @@ SSL_CTX * Csock::SetupServerCTX()
}
else
{
if( SSL_CTX_use_certificate( pCTX, m_pCertRaw ) <= 0 )
if( SSL_CTX_use_certificate( pCTX, m_pUseCert ) <= 0 )
{
CS_DEBUG( "Error with SSLCert file [" << m_sPemFile << "]" );
SSLErrors( __FILE__, __LINE__ );
}
}


if( !m_pKeyRaw )
if( !m_pUseKey )
{
if( ! m_sKeyFile.empty() && access( m_sKeyFile.c_str(), R_OK ) != 0 )
{
Expand All @@ -1772,7 +1772,7 @@ SSL_CTX * Csock::SetupServerCTX()
}
else
{
if( SSL_CTX_use_PrivateKey( pCTX, m_pKeyRaw ) <= 0 )
if( SSL_CTX_use_PrivateKey( pCTX, m_pUseKey ) <= 0 )
{
CS_DEBUG( "Error with SSLCert file [" << m_sPemFile << "]" );
SSLErrors( __FILE__, __LINE__ );
Expand All @@ -1782,7 +1782,7 @@ SSL_CTX * Csock::SetupServerCTX()
// check to see if this pem file contains a DH structure for use with DH key exchange
// https://github.com/znc/znc/pull/46
DH * pDHParam;
if( !m_pDHParamRaw )
if( !m_pUseDHParam )
{
CS_STRING sDHParamFile = m_sDHParamFile.empty() ? m_sPemFile : m_sDHParamFile;
FILE *pDHParamsFile = fopen( sDHParamFile.c_str(), "r" );
Expand All @@ -1797,7 +1797,7 @@ SSL_CTX * Csock::SetupServerCTX()
}
else
{
pDHParam = m_pDHParamRaw;
pDHParam = m_pUseDHParam;
}
if( pDHParam )
{
Expand Down Expand Up @@ -2598,14 +2598,14 @@ void Csock::SetSSL( bool b ) { m_bUseSSL = b; }
void Csock::SetCipher( const CS_STRING & sCipher ) { m_sCipherType = sCipher; }
const CS_STRING & Csock::GetCipher() const { return( m_sCipherType ); }

void Csock::SetKeyRaw( EVP_PKEY * sKeyRaw ) { m_pKeyRaw = sKeyRaw; }
EVP_PKEY * Csock::GetKeyRaw() const { return( m_pKeyRaw ); }
void Csock::SetKeyRaw( EVP_PKEY * sKeyRaw ) { m_pUseKey = sKeyRaw; }
EVP_PKEY * Csock::GetKeyRaw() const { return( m_pUseKey ); }

void Csock::SetCertRaw( X509 * sCertRaw ) { m_pCertRaw = sCertRaw; }
X509 * Csock::GetCertRaw() const { return( m_pCertRaw ); }
void Csock::SetCertRaw( X509 * sCertRaw ) { m_pUseCert = sCertRaw; }
X509 * Csock::GetCertRaw() const { return( m_pUseCert ); }

void Csock::SetDHParamRaw( DH * sDHParamRaw ) { m_pDHParamRaw = sDHParamRaw; }
DH * Csock::GetDHParamRaw() const { return( m_pDHParamRaw ); }
void Csock::SetDHParamRaw( DH * sDHParamRaw ) { m_pUseDHParam = sDHParamRaw; }
DH * Csock::GetDHParamRaw() const { return( m_pUseDHParam ); }

void Csock::SetDHParamLocation( const CS_STRING & sDHParamFile ) { m_sDHParamFile = sDHParamFile; }
const CS_STRING & Csock::GetDHParamLocation() const { return( m_sDHParamFile ); }
Expand Down Expand Up @@ -3127,9 +3127,9 @@ void Csock::Init( const CS_STRING & sHostname, uint16_t uPort, int iTimeout )
m_uDisableProtocols = 0;
m_bNoSSLCompression = false;
m_bSSLCipherServerPreference = false;
m_pCertRaw = NULL;
m_pKeyRaw = NULL;
m_pDHParamRaw = NULL;
m_pUseCert = NULL;
m_pUseKey = NULL;
m_pUseDHParam = NULL;
#endif /* HAVE_LIBSSL */
m_iTcount = 0;
m_iReadSock = CS_INVALID_SOCK;
Expand Down
36 changes: 18 additions & 18 deletions Csocket.h
Original file line number Diff line number Diff line change
Expand Up @@ -1180,9 +1180,9 @@ class CS_EXPORT Csock : public CSockCommon
bool m_bUseSSL, m_bIsConnected;
bool m_bsslEstablished, m_bEnableReadLine, m_bPauseRead;
CS_STRING m_shostname, m_sbuffer, m_sSockName, m_sDHParamFile, m_sKeyFile, m_sPemFile, m_sCipherType, m_sParentName;
X509* m_pCertRaw;
EVP_PKEY* m_pKeyRaw;
DH* m_pDHParamRaw;
X509* m_pUseCert;
EVP_PKEY* m_pUseKey;
DH* m_pUseDHParam;
CS_STRING m_sSend, m_sPemPass;
ECloseType m_eCloseType;

Expand Down Expand Up @@ -1275,9 +1275,9 @@ class CS_EXPORT CSConnection

#ifdef HAVE_LIBSSL
const CS_STRING & GetCipher() const { return( m_sCipher ); }
const X509 * GetCertRaw() const { return( m_pCertRaw ); }
const EVP_PKEY * GetKeyRaw() const { return( m_pKeyRaw ); }
const DH * GetDHParamRaw() const { return( m_pDHParamRaw ); }
const X509 * GetCertRaw() const { return( m_pUseCert ); }
const EVP_PKEY * GetKeyRaw() const { return( m_pUseKey ); }
const DH * GetDHParamRaw() const { return( m_pUseDHParam ); }
const CS_STRING & GetPemLocation() const { return( m_sPemLocation ); }
const CS_STRING & GetKeyLocation() const { return( m_sKeyLocation ); }
const CS_STRING & GetDHParamLocation() const { return( m_sDHParamLocation ); }
Expand Down Expand Up @@ -1316,9 +1316,9 @@ class CS_EXPORT CSConnection
CSSockAddr::EAFRequire m_iAFrequire;
#ifdef HAVE_LIBSSL
CS_STRING m_sDHParamLocation, m_sKeyLocation, m_sPemLocation, m_sPemPass, m_sCipher;
X509* m_pCertRaw;
EVP_PKEY* m_pKeyRaw;
DH* m_pDHParamRaw;
X509* m_pUseCert;
EVP_PKEY* m_pUseKey;
DH* m_pUseDHParam;
#endif /* HAVE_LIBSSL */
};

Expand Down Expand Up @@ -1373,9 +1373,9 @@ class CS_EXPORT CSListener
#ifdef HAVE_LIBSSL
const CS_STRING & GetCipher() const { return( m_sCipher ); }
const CS_STRING & GetDHParamLocation() const { return( m_sDHParamLocation ); }
const EVP_PKEY * GetKeyRaw() const { return( m_pKeyRaw ); }
const X509 * GetCertRaw() const { return( m_pCertRaw ); }
const DH * GetDHParamRaw() const { return( m_pDHParamRaw ); }
const EVP_PKEY * GetKeyRaw() const { return( m_pUseKey ); }
const X509 * GetCertRaw() const { return( m_pUseCert ); }
const DH * GetDHParamRaw() const { return( m_pUseDHParam ); }
const CS_STRING & GetKeyLocation() const { return( m_sKeyLocation ); }
const CS_STRING & GetPemLocation() const { return( m_sPemLocation ); }
const CS_STRING & GetPemPass() const { return( m_sPemPass ); }
Expand All @@ -1401,11 +1401,11 @@ class CS_EXPORT CSListener
//! set the cipher strength to use, default is HIGH
void SetCipher( const CS_STRING & s ) { m_sCipher = s; }
//! set the raw cert data
void SetCertRaw( X509 * s ) { m_pCertRaw = s; }
void SetCertRaw( X509 * s ) { m_pUseCert = s; }
//! set the raw key data
void SetKeyRaw( EVP_PKEY * s ) { m_pKeyRaw = s; }
void SetKeyRaw( EVP_PKEY * s ) { m_pUseKey = s; }
//! set the raw dhparam data
void SetDHParamRaw( DH * s ) { m_pDHParamRaw = s; }
void SetDHParamRaw( DH * s ) { m_pUseDHParam = s; }
//! set the location of the pemfile
void SetPemLocation( const CS_STRING & s ) { m_sPemLocation = s; }
//! set the location of the keyfile
Expand All @@ -1430,9 +1430,9 @@ class CS_EXPORT CSListener

#ifdef HAVE_LIBSSL
CS_STRING m_sDHParamLocation, m_sKeyLocation, m_sPemLocation, m_sPemPass, m_sCipher;
X509* m_pCertRaw;
EVP_PKEY* m_pKeyRaw;
DH* m_pDHParamRaw;
X509* m_pUseCert;
EVP_PKEY* m_pUseKey;
DH* m_pUseDHParam;
uint32_t m_iRequireCertFlags;
#endif /* HAVE_LIBSSL */
};
Expand Down

0 comments on commit 9c1cbf5

Please sign in to comment.