| Return Type | Function name | Arguments |
|---|---|---|
| int | SNI_Callback | (SSL*,int*,void*,) |
Declared and defined in file: hzIpServer.cpp
Function Logic:
Function body:
int SNI_Callback (SSL* pSSL, int* al, void* arg)
{
_hzfunc("SNI_Callback") ;
_hz_SSL_Regime* pSSL_Regime ;
hzString svrName ;
int32_t type ;
type = SSL_get_servername_type(pSSL);
svrName = SSL_get_servername(pSSL, type) ;
if (!svrName)
{
threadLog("Server name req by client: NULL (type %d)\n", type) ;
return SSL_TLSEXT_ERR_OK ;
}
threadLog("Server name req by client: %s (type %d)\n", *svrName, type) ;
pSSL_Regime = s_mapSSLDoms[svrName] ;
if (!pSSL_Regime)
{
threadLog("Server name %s not found\n", *svrName) ;
return SSL_TLSEXT_ERR_OK ;
}
if (pSSL_Regime == s_SSL_svrRegime)
{
threadLog("Selecting default\n") ;
return SSL_TLSEXT_ERR_OK ;
}
threadLog("Swaping CTX to %s\n", *pSSL_Regime->m_Domain) ;
SSL_set_tlsext_host_name(pSSL, *pSSL_Regime->m_Domain);
SSL_set_SSL_CTX(pSSL, pSSL_Regime->m_svrCTX);
return SSL_TLSEXT_ERR_OK ;
}