diff options
author | monty@mysql.com <> | 2004-05-25 22:00:14 +0300 |
---|---|---|
committer | monty@mysql.com <> | 2004-05-25 22:00:14 +0300 |
commit | f2e1e3ce4c72d383f16fd8c525b28c4912e8f2de (patch) | |
tree | 2c56473da947b9807f0d1668171870a8e3dbc736 /vio | |
parent | d14e4eb57c92b987152b255ec961b1e9103d8f66 (diff) | |
download | mariadb-git-f2e1e3ce4c72d383f16fd8c525b28c4912e8f2de.tar.gz |
Added patches from Novell
Diffstat (limited to 'vio')
-rw-r--r-- | vio/test-ssl.c | 2 | ||||
-rw-r--r-- | vio/viossl.c | 25 | ||||
-rw-r--r-- | vio/viosslfactories.c | 41 |
3 files changed, 65 insertions, 3 deletions
diff --git a/vio/test-ssl.c b/vio/test-ssl.c index 84bae5fa0c7..88df6936a1f 100644 --- a/vio/test-ssl.c +++ b/vio/test-ssl.c @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <my_global.h> -#ifdef HAVE_OPENSSL +#if defined(HAVE_OPENSSL) && !defined(__NETWARE__) #include <my_sys.h> #include <m_string.h> #include <m_ctype.h> diff --git a/vio/viossl.c b/vio/viossl.c index fafe48b7a84..a489cb98f98 100644 --- a/vio/viossl.c +++ b/vio/viossl.c @@ -25,6 +25,31 @@ #ifdef HAVE_OPENSSL +#ifdef __NETWARE__ +/* + The default OpenSSL implementation on NetWare uses WinSock. + This code allows us to use the BSD sockets. +*/ + +static int SSL_set_fd_bsd(SSL *s, int fd) +{ + int result= -1; + BIO_METHOD *BIO_s_bsdsocket(); + BIO *bio; + + if ((bio= BIO_new(BIO_s_bsdsocket()))) + { + result= BIO_set_fd(bio, fd, BIO_NOCLOSE); + SSL_set_bio(s, bio, bio); + } + return result; +} + +#define SSL_set_fd(A, B) SSL_set_fd_bsd((A), (B)) + +#endif /* __NETWARE__ */ + + static void report_errors() { diff --git a/vio/viosslfactories.c b/vio/viosslfactories.c index 0997e3909db..498d10da0ee 100644 --- a/vio/viosslfactories.c +++ b/vio/viosslfactories.c @@ -172,6 +172,35 @@ vio_verify_callback(int ok, X509_STORE_CTX *ctx) } +#ifdef __NETWARE__ + +/* NetWare SSL cleanup */ +void netware_ssl_cleanup() +{ + /* free memory from SSL_library_init() */ + EVP_cleanup(); + + /* free global X509 method */ + X509_STORE_method_cleanup(); + + /* free the thread_hash error table */ + ERR_free_state_table(); +} + + +/* NetWare SSL initialization */ +static void netware_ssl_init() +{ + /* initialize OpenSSL library */ + SSL_library_init(); + + /* cleanup OpenSSL library */ + NXVmRegisterExitHandler(netware_ssl_cleanup, NULL); +} + +#endif /* __NETWARE__ */ + + /************************ VioSSLConnectorFd **********************************/ /* TODO: @@ -188,7 +217,7 @@ new_VioSSLConnectorFd(const char* key_file, int verify = SSL_VERIFY_NONE; struct st_VioSSLConnectorFd* ptr; int result; - DH *dh=NULL; + DH *dh; DBUG_ENTER("new_VioSSLConnectorFd"); DBUG_PRINT("enter", ("key_file=%s, cert_file=%s, ca_path=%s, ca_file=%s, cipher=%s", @@ -202,6 +231,10 @@ new_VioSSLConnectorFd(const char* key_file, ptr->ssl_method= 0; /* FIXME: constants! */ +#ifdef __NETWARE__ + netware_ssl_init(); +#endif + if (!ssl_algorithms_added) { DBUG_PRINT("info", ("todo: OpenSSL_add_all_algorithms()")); @@ -279,7 +312,7 @@ new_VioSSLAcceptorFd(const char *key_file, SSL_VERIFY_CLIENT_ONCE); struct st_VioSSLAcceptorFd* ptr; int result; - DH *dh=NULL; + DH *dh; DBUG_ENTER("new_VioSSLAcceptorFd"); DBUG_PRINT("enter", ("key_file=%s, cert_file=%s, ca_path=%s, ca_file=%s, cipher=%s", @@ -292,6 +325,10 @@ new_VioSSLAcceptorFd(const char *key_file, /* FIXME: constants! */ ptr->session_id_context= ptr; +#ifdef __NETWARE__ + netware_ssl_init(); +#endif + if (!ssl_algorithms_added) { DBUG_PRINT("info", ("todo: OpenSSL_add_all_algorithms()")); |