@@ -1,16 +1,22 @@
--- conn.c.orig 2010-07-27 18:38:31.000000000 +0200
-+++ conn.c 2010-07-28 23:16:15.637758225 +0200
-@@ -32,7 +32,7 @@
++++ conn.c 2010-07-29 00:05:56.005317177 +0200
+@@ -30,20 +30,21 @@
+ #include <netdb.h>
+ #include <errno.h>
- #ifdef HAVE_LIBGNUTLS
+-#ifdef HAVE_LIBGNUTLS
++#ifdef HAVE_LIBGNUTLS_OPENSSL
# include <gnutls/gnutls.h>
-# include <gnutls/x509.h>
+# include <gnutls/openssl.h>
#endif
int conn_fd_in = -1;
-@@ -42,8 +42,9 @@
- #ifdef HAVE_LIBGNUTLS
+ int conn_fd_out = -1;
+ int conn_clisok = 0;
+
+-#ifdef HAVE_LIBGNUTLS
++#ifdef HAVE_LIBGNUTLS_OPENSSL
int csync_conn_usessl = 0;
-static gnutls_session_t conn_tls_session;
@@ -21,9 +27,30 @@
#endif
-@@ -137,104 +138,41 @@
+@@ -108,7 +109,7 @@
+
+ conn_fd_out = conn_fd_in;
+ conn_clisok = 1;
+-#ifdef HAVE_LIBGNUTLS
++#ifdef HAVE_LIBGNUTLS_OPENSSL
+ csync_conn_usessl = 0;
+ #endif
+ return 0;
+@@ -121,7 +122,7 @@
+ conn_fd_in = infd;
+ conn_fd_out = outfd;
+ conn_clisok = 1;
+-#ifdef HAVE_LIBGNUTLS
++#ifdef HAVE_LIBGNUTLS_OPENSSL
+ csync_conn_usessl = 0;
+ #endif
+
+@@ -135,106 +136,43 @@
+ }
- #ifdef HAVE_LIBGNUTLS
+
+-#ifdef HAVE_LIBGNUTLS
++#ifdef HAVE_LIBGNUTLS_OPENSSL
-static void ssl_log(int level, const char* msg)
-{ csync_debug(level, "%s", msg); }
@@ -185,32 +212,40 @@
SQL_BEGIN("Checking peer x509 certificate.",
"SELECT certdata FROM x509_cert WHERE peername = '%s'",
-@@ -310,12 +248,7 @@
+@@ -309,13 +247,8 @@
+ {
if ( !conn_clisok ) return -1;
- #ifdef HAVE_LIBGNUTLS
+-#ifdef HAVE_LIBGNUTLS
- if ( csync_conn_usessl ) {
- gnutls_bye(conn_tls_session, GNUTLS_SHUT_RDWR);
- gnutls_deinit(conn_tls_session);
- gnutls_certificate_free_credentials(conn_x509_cred);
- gnutls_global_deinit();
- }
++#ifdef HAVE_LIBGNUTLS_OPENSSL
+ if ( csync_conn_usessl ) SSL_free(conn_ssl);
#endif
if ( conn_fd_in != conn_fd_out) close(conn_fd_in);
-@@ -332,7 +265,7 @@
+@@ -330,9 +263,9 @@
+
+ static inline int READ(void *buf, size_t count)
{
- #ifdef HAVE_LIBGNUTLS
+-#ifdef HAVE_LIBGNUTLS
++#ifdef HAVE_LIBGNUTLS_OPENSSL
if (csync_conn_usessl)
- return gnutls_record_recv(conn_tls_session, buf, count);
+ return SSL_read(conn_ssl, buf, count);
else
#endif
return read(conn_fd_in, buf, count);
-@@ -344,7 +277,7 @@
+@@ -342,9 +275,9 @@
+ {
+ static int n, total;
- #ifdef HAVE_LIBGNUTLS
+-#ifdef HAVE_LIBGNUTLS
++#ifdef HAVE_LIBGNUTLS_OPENSSL
if (csync_conn_usessl)
- return gnutls_record_send(conn_tls_session, buf, count);
+ return SSL_write(conn_ssl, buf, count);
|