From: discomfitor Date: Wed, 27 Oct 2010 20:51:09 +0000 (+0000) Subject: fix potential crash when someone specifies a weird/nonexistent ssl type X-Git-Tag: accepted/2.0/20130306.224007~195^2~464 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=daf898a4c694bf3d23eb422e15f1e571a4bb9428;p=profile%2Fivi%2Fecore.git fix potential crash when someone specifies a weird/nonexistent ssl type git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/ecore@53936 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- diff --git a/src/lib/ecore_con/ecore_con_ssl.c b/src/lib/ecore_con/ecore_con_ssl.c index ebc70ad..20ca2fd 100644 --- a/src/lib/ecore_con/ecore_con_ssl.c +++ b/src/lib/ecore_con/ecore_con_ssl.c @@ -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)