diff --git a/src/dom/io/socket.cpp b/src/dom/io/socket.cpp
index 31eeb56bad3a0a0fd8ac9e2bb9af5ad79fc3d772..e39032040c5eea6f72efc6d68ec1f749dae193a6 100644 (file)
--- a/src/dom/io/socket.cpp
+++ b/src/dom/io/socket.cpp
* Authors:
* Bob Jamison
*
- * Copyright (C) 2005 Bob Jamison
+ * Copyright (C) 2005-2008 Bob Jamison
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
#include <sys/filio.h> // needed on Solaris 8
#endif
+#include <cstdio>
#include "socket.h"
#include "dom/util/thread.h"
#ifdef HAVE_SSL
#include <openssl/ssl.h>
#include <openssl/err.h>
+
+RELAYTOOL_SSL
#endif
WSAStartup( wVersionRequested, &wsaData );
#endif
#ifdef HAVE_SSL
- sslStream = NULL;
- sslContext = NULL;
- CRYPTO_set_locking_callback(cryptoLockCallback);
- CRYPTO_set_id_callback(cryptoIdCallback);
- SSL_library_init();
- SSL_load_error_strings();
+ if (libssl_is_present)
+ {
+ sslStream = NULL;
+ sslContext = NULL;
+ CRYPTO_set_locking_callback(cryptoLockCallback);
+ CRYPTO_set_id_callback(cryptoIdCallback);
+ SSL_library_init();
+ SSL_load_error_strings();
+ }
#endif
tcp_socket_inited = true;
}
bool TcpSocket::startTls()
{
#ifdef HAVE_SSL
+ if (libssl_is_present)
+ {
sslStream = NULL;
sslContext = NULL;
}
sslEnabled = true;
+ }
#endif /*HAVE_SSL*/
return true;
}
bool ret = true;
connected = false;
#ifdef HAVE_SSL
+ if (libssl_is_present)
+ {
if (sslEnabled)
{
if (sslStream)
}
sslStream = NULL;
sslContext = NULL;
+ }
#endif /*HAVE_SSL*/
#ifdef __WIN32__
if (count<=0 && sslEnabled)
{
#ifdef HAVE_SSL
- return SSL_pending(sslStream);
+ if (libssl_is_present)
+ {
+ return SSL_pending(sslStream);
+ }
#endif
}
return count;
if (sslEnabled)
{
#ifdef HAVE_SSL
- int r = SSL_write(sslStream, &c, 1);
- if (r<=0)
+ if (libssl_is_present)
{
- switch(SSL_get_error(sslStream, r))
+ int r = SSL_write(sslStream, &c, 1);
+ if (r<=0)
{
- default:
+ switch(SSL_get_error(sslStream, r))
+ {
+ default:
printf("SSL write problem");
return -1;
+ }
}
}
#endif
if (sslEnabled)
{
#ifdef HAVE_SSL
- int r = SSL_write(sslStream, (unsigned char *)str.c_str(), len);
- if (r<=0)
+ if (libssl_is_present)
{
- switch(SSL_get_error(sslStream, r))
+ int r = SSL_write(sslStream, (unsigned char *)str.c_str(), len);
+ if (r<=0)
{
- default:
- printf("SSL write problem");
- return -1;
+ switch(SSL_get_error(sslStream, r))
+ {
+ default:
+ printf("SSL write problem");
+ return -1;
+ }
}
}
#endif
if (sslEnabled)
{
#ifdef HAVE_SSL
- if (!sslStream)
- return -1;
- int r = SSL_read(sslStream, &ch, 1);
- unsigned long err = SSL_get_error(sslStream, r);
- switch (err)
+ if (libssl_is_present)
{
- case SSL_ERROR_NONE:
- break;
- case SSL_ERROR_ZERO_RETURN:
- return -1;
- case SSL_ERROR_SYSCALL:
- printf("SSL read problem(syscall) %s\n",
- ERR_error_string(ERR_get_error(), NULL));
- return -1;
- default:
- printf("SSL read problem %s\n",
- ERR_error_string(ERR_get_error(), NULL));
+ if (!sslStream)
return -1;
+ int r = SSL_read(sslStream, &ch, 1);
+ unsigned long err = SSL_get_error(sslStream, r);
+ switch (err)
+ {
+ case SSL_ERROR_NONE:
+ break;
+ case SSL_ERROR_ZERO_RETURN:
+ return -1;
+ case SSL_ERROR_SYSCALL:
+ printf("SSL read problem(syscall) %s\n",
+ ERR_error_string(ERR_get_error(), NULL));
+ return -1;
+ default:
+ printf("SSL read problem %s\n",
+ ERR_error_string(ERR_get_error(), NULL));
+ return -1;
+ }
}
#endif
}