Commit 9f7b589d authored by msvensson@neptunus.(none)'s avatar msvensson@neptunus.(none)

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

into  neptunus.(none):/home/msvensson/mysql/mysql-5.1-new-maint
parents dc1ec664 980268df
......@@ -23,6 +23,18 @@
#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)
{
#ifdef _WIN32
......@@ -65,10 +77,9 @@ THREAD_RETURN YASSL_API echoserver_test(void* args)
while (!shutdown) {
sockaddr_in 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);
if (clientfd == -1)
{
if (clientfd == -1) {
SSL_CTX_free(ctx);
tcp_close(sockfd);
err_sys("tcp accept failed");
......@@ -77,13 +88,7 @@ THREAD_RETURN YASSL_API echoserver_test(void* args)
SSL* ssl = SSL_new(ctx);
SSL_set_fd(ssl, clientfd);
if (SSL_accept(ssl) != SSL_SUCCESS)
{
SSL_CTX_free(ctx);
SSL_free(ssl);
tcp_close(sockfd);
tcp_close(clientfd);
err_sys("SSL_accept failed");
}
EchoError(ctx, ssl, sockfd, clientfd, "SSL_accept failed");
char command[1024];
int echoSz(0);
......@@ -112,13 +117,7 @@ THREAD_RETURN YASSL_API echoserver_test(void* args)
echoSz += sizeof(footer);
if (SSL_write(ssl, command, echoSz) != echoSz)
{
SSL_CTX_free(ctx);
SSL_free(ssl);
tcp_close(sockfd);
tcp_close(clientfd);
err_sys("SSL_write failed");
}
EchoError(ctx, ssl, sockfd, clientfd, "SSL_write failed");
break;
}
......@@ -129,13 +128,7 @@ THREAD_RETURN YASSL_API echoserver_test(void* args)
#endif
if (SSL_write(ssl, command, echoSz) != echoSz)
{
SSL_CTX_free(ctx);
SSL_free(ssl);
tcp_close(sockfd);
tcp_close(clientfd);
err_sys("SSL_write failed");
}
EchoError(ctx, ssl, sockfd, clientfd, "SSL_write failed");
}
SSL_free(ssl);
tcp_close(clientfd);
......
......@@ -4,6 +4,15 @@
#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)
{
#ifdef _WIN32
......@@ -12,7 +21,7 @@ THREAD_RETURN YASSL_API server_test(void* args)
#endif
SOCKET_T sockfd = 0;
int clientfd = 0;
SOCKET_T clientfd = 0;
int argc = 0;
char** argv = 0;
......@@ -33,13 +42,7 @@ THREAD_RETURN YASSL_API server_test(void* args)
SSL_set_fd(ssl, clientfd);
if (SSL_accept(ssl) != SSL_SUCCESS)
{
SSL_CTX_free(ctx);
SSL_free(ssl);
tcp_close(sockfd);
tcp_close(clientfd);
err_sys("SSL_accept failed");
}
ServerError(ctx, ssl, clientfd, "SSL_accept failed");
showPeer(ssl);
printf("Using Cipher Suite: %s\n", SSL_get_cipher(ssl));
......@@ -50,13 +53,7 @@ THREAD_RETURN YASSL_API server_test(void* args)
char msg[] = "I hear you, fa shizzle!";
if (SSL_write(ssl, msg, sizeof(msg)) != sizeof(msg))
{
SSL_CTX_free(ctx);
SSL_free(ssl);
tcp_close(sockfd);
tcp_close(clientfd);
err_sys("SSL_write failed");
}
ServerError(ctx, ssl, clientfd, "SSL_write failed");
DH_free(dh);
SSL_CTX_free(ctx);
......
......@@ -41,7 +41,7 @@
#include "rsa.h"
#define YASSL_VERSION "1.4.2"
#define YASSL_VERSION "1.4.3"
#if defined(__cplusplus)
......
......@@ -109,6 +109,7 @@ template void ysArrayDelete<char>(char*);
template int min<int>(int, 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
......
/* 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 @@
#include "runtime.hpp"
#include "misc.hpp"
#ifdef YASSL_PURE_C
void* operator new(size_t sz, TaoCrypt::new_t)
......
......@@ -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);
......
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