Commit 74e21b53 authored by unknown's avatar unknown

Merge neptunus.(none):/home/msvensson/mysql/yassl_import/my50-yassl_import

into  neptunus.(none):/home/msvensson/mysql/mysql-5.0-maint
parents b916f0d7 a1ce9e96
...@@ -23,6 +23,18 @@ ...@@ -23,6 +23,18 @@
#endif // NO_MAIN_DRIVER #endif // NO_MAIN_DRIVER
void EchoError(SSL_CTX* ctx, SSL* ssl, SOCKET_T& s1, SOCKET_T& s2,
const char* msg)
{
SSL_CTX_free(ctx);
SSL_free(ssl);
tcp_close(s1);
tcp_close(s2);
err_sys(msg);
}
THREAD_RETURN YASSL_API echoserver_test(void* args) THREAD_RETURN YASSL_API echoserver_test(void* args)
{ {
#ifdef _WIN32 #ifdef _WIN32
...@@ -65,10 +77,9 @@ THREAD_RETURN YASSL_API echoserver_test(void* args) ...@@ -65,10 +77,9 @@ THREAD_RETURN YASSL_API echoserver_test(void* args)
while (!shutdown) { while (!shutdown) {
sockaddr_in client; sockaddr_in client;
socklen_t client_len = sizeof(client); socklen_t client_len = sizeof(client);
int clientfd = accept(sockfd, (sockaddr*)&client, SOCKET_T clientfd = accept(sockfd, (sockaddr*)&client,
(ACCEPT_THIRD_T)&client_len); (ACCEPT_THIRD_T)&client_len);
if (clientfd == -1) if (clientfd == -1) {
{
SSL_CTX_free(ctx); SSL_CTX_free(ctx);
tcp_close(sockfd); tcp_close(sockfd);
err_sys("tcp accept failed"); err_sys("tcp accept failed");
...@@ -77,13 +88,7 @@ THREAD_RETURN YASSL_API echoserver_test(void* args) ...@@ -77,13 +88,7 @@ THREAD_RETURN YASSL_API echoserver_test(void* args)
SSL* ssl = SSL_new(ctx); SSL* ssl = SSL_new(ctx);
SSL_set_fd(ssl, clientfd); SSL_set_fd(ssl, clientfd);
if (SSL_accept(ssl) != SSL_SUCCESS) if (SSL_accept(ssl) != SSL_SUCCESS)
{ EchoError(ctx, ssl, sockfd, clientfd, "SSL_accept failed");
SSL_CTX_free(ctx);
SSL_free(ssl);
tcp_close(sockfd);
tcp_close(clientfd);
err_sys("SSL_accept failed");
}
char command[1024]; char command[1024];
int echoSz(0); int echoSz(0);
...@@ -112,13 +117,7 @@ THREAD_RETURN YASSL_API echoserver_test(void* args) ...@@ -112,13 +117,7 @@ THREAD_RETURN YASSL_API echoserver_test(void* args)
echoSz += sizeof(footer); echoSz += sizeof(footer);
if (SSL_write(ssl, command, echoSz) != echoSz) if (SSL_write(ssl, command, echoSz) != echoSz)
{ EchoError(ctx, ssl, sockfd, clientfd, "SSL_write failed");
SSL_CTX_free(ctx);
SSL_free(ssl);
tcp_close(sockfd);
tcp_close(clientfd);
err_sys("SSL_write failed");
}
break; break;
} }
...@@ -129,13 +128,7 @@ THREAD_RETURN YASSL_API echoserver_test(void* args) ...@@ -129,13 +128,7 @@ THREAD_RETURN YASSL_API echoserver_test(void* args)
#endif #endif
if (SSL_write(ssl, command, echoSz) != echoSz) if (SSL_write(ssl, command, echoSz) != echoSz)
{ EchoError(ctx, ssl, sockfd, clientfd, "SSL_write failed");
SSL_CTX_free(ctx);
SSL_free(ssl);
tcp_close(sockfd);
tcp_close(clientfd);
err_sys("SSL_write failed");
}
} }
SSL_free(ssl); SSL_free(ssl);
tcp_close(clientfd); tcp_close(clientfd);
......
...@@ -4,6 +4,15 @@ ...@@ -4,6 +4,15 @@
#include "../../testsuite/test.hpp" #include "../../testsuite/test.hpp"
void ServerError(SSL_CTX* ctx, SSL* ssl, SOCKET_T& sockfd, const char* msg)
{
SSL_CTX_free(ctx);
SSL_free(ssl);
tcp_close(sockfd);
err_sys(msg);
}
THREAD_RETURN YASSL_API server_test(void* args) THREAD_RETURN YASSL_API server_test(void* args)
{ {
#ifdef _WIN32 #ifdef _WIN32
...@@ -12,7 +21,7 @@ THREAD_RETURN YASSL_API server_test(void* args) ...@@ -12,7 +21,7 @@ THREAD_RETURN YASSL_API server_test(void* args)
#endif #endif
SOCKET_T sockfd = 0; SOCKET_T sockfd = 0;
int clientfd = 0; SOCKET_T clientfd = 0;
int argc = 0; int argc = 0;
char** argv = 0; char** argv = 0;
...@@ -33,13 +42,7 @@ THREAD_RETURN YASSL_API server_test(void* args) ...@@ -33,13 +42,7 @@ THREAD_RETURN YASSL_API server_test(void* args)
SSL_set_fd(ssl, clientfd); SSL_set_fd(ssl, clientfd);
if (SSL_accept(ssl) != SSL_SUCCESS) if (SSL_accept(ssl) != SSL_SUCCESS)
{ ServerError(ctx, ssl, clientfd, "SSL_accept failed");
SSL_CTX_free(ctx);
SSL_free(ssl);
tcp_close(sockfd);
tcp_close(clientfd);
err_sys("SSL_accept failed");
}
showPeer(ssl); showPeer(ssl);
printf("Using Cipher Suite: %s\n", SSL_get_cipher(ssl)); printf("Using Cipher Suite: %s\n", SSL_get_cipher(ssl));
...@@ -50,13 +53,7 @@ THREAD_RETURN YASSL_API server_test(void* args) ...@@ -50,13 +53,7 @@ THREAD_RETURN YASSL_API server_test(void* args)
char msg[] = "I hear you, fa shizzle!"; char msg[] = "I hear you, fa shizzle!";
if (SSL_write(ssl, msg, sizeof(msg)) != sizeof(msg)) if (SSL_write(ssl, msg, sizeof(msg)) != sizeof(msg))
{ ServerError(ctx, ssl, clientfd, "SSL_write failed");
SSL_CTX_free(ctx);
SSL_free(ssl);
tcp_close(sockfd);
tcp_close(clientfd);
err_sys("SSL_write failed");
}
DH_free(dh); DH_free(dh);
SSL_CTX_free(ctx); SSL_CTX_free(ctx);
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
#include "rsa.h" #include "rsa.h"
#define YASSL_VERSION "1.4.2" #define YASSL_VERSION "1.4.3"
#if defined(__cplusplus) #if defined(__cplusplus)
......
...@@ -109,6 +109,7 @@ template void ysArrayDelete<char>(char*); ...@@ -109,6 +109,7 @@ template void ysArrayDelete<char>(char*);
template int min<int>(int, int); template int min<int>(int, int);
template unsigned int min<unsigned int>(unsigned int, unsigned int); template unsigned int min<unsigned int>(unsigned int, unsigned int);
template unsigned long min<unsigned long>(unsigned long, unsigned long);
} }
#endif // HAVE_EXPLICIT_TEMPLATE_INSTANTIATION #endif // HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
......
/* crypto.cpp
*
* Copyright (C) 2003 Sawtooth Consulting Ltd.
*
* This file is part of yaSSL.
*
* yaSSL is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* There are special exceptions to the terms and conditions of the GPL as it
* is applied to yaSSL. View the full text of the exception in the file
* FLOSS-EXCEPTIONS in the directory of this software distribution.
*
* yaSSL is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
/* put features that other apps expect from OpenSSL type crypto */
extern "C" {
// for libcurl configure test, these are the signatures they use
// locking handled internally by library
char CRYPTO_lock() { return 0;}
char CRYPTO_add_lock() { return 0;}
} // extern "C"
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "runtime.hpp" #include "runtime.hpp"
#include "misc.hpp" #include "misc.hpp"
#ifdef YASSL_PURE_C #ifdef YASSL_PURE_C
void* operator new(size_t sz, TaoCrypt::new_t) void* operator new(size_t sz, TaoCrypt::new_t)
......
...@@ -312,7 +312,7 @@ inline void tcp_listen(SOCKET_T& sockfd) ...@@ -312,7 +312,7 @@ inline void tcp_listen(SOCKET_T& sockfd)
} }
inline void tcp_accept(SOCKET_T& sockfd, int& clientfd, func_args& args) inline void tcp_accept(SOCKET_T& sockfd, SOCKET_T& clientfd, func_args& args)
{ {
tcp_listen(sockfd); tcp_listen(sockfd);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment