fix potential crash when someone specifies a weird/nonexistent ssl type

SVN revision: 53936
This commit is contained in:
Mike Blumenkrantz 2010-10-27 20:51:09 +00:00
parent d5c4e58535
commit d9d3d63f42
1 changed files with 19 additions and 2 deletions

View File

@ -402,10 +402,27 @@ _ecore_con_ssl_shutdown_gnutls(void)
}
static Ecore_Con_Ssl_Error
_ecore_con_ssl_server_prepare_gnutls(Ecore_Con_Server *svr, int ssl_type __UNUSED__)
_ecore_con_ssl_server_prepare_gnutls(Ecore_Con_Server *svr, int ssl_type)
{
int ret;
if (ssl_type & ECORE_CON_USE_SSL2)
return ECORE_CON_SSL_ERROR_SSL2_NOT_SUPPORTED;
switch (ssl_type)
{
case ECORE_CON_USE_SSL3:
case ECORE_CON_USE_SSL3 | ECORE_CON_LOAD_CERT:
case ECORE_CON_USE_TLS:
case ECORE_CON_USE_TLS | ECORE_CON_LOAD_CERT:
case ECORE_CON_USE_MIXED:
case ECORE_CON_USE_MIXED | ECORE_CON_LOAD_CERT:
break;
default:
return ECORE_CON_SSL_ERROR_INIT_FAILED;
}
SSL_ERROR_CHECK_GOTO_ERROR(ret = gnutls_certificate_allocate_credentials(&svr->cert));
if (svr->created)
@ -953,7 +970,7 @@ _ecore_con_ssl_server_prepare_openssl(Ecore_Con_Server *svr, int ssl_type)
break;
default:
break;
return ECORE_CON_SSL_ERROR_INIT_FAILED;
}
if ((!svr->use_cert) && svr->created)