On Tue, Jun 19, 2012 at 07:32:17PM -0400, Sam Varshavchik wrote:
> Some additional work will be needed, here, for the code to work with both  
> versions of gnutls.

Yes sure.  Please see below.

-- 
Eray Aslan

---

--- tcpd/configure.in   2011-09-29 12:13:27.000000000 +0000
+++ tcpd/configure.in   2012-06-20 10:07:15.000000000 +0000
@@ -356,7 +357,7 @@
 
                CPPFLAGS="$save_CPPFLAGS"
        else
-               have_gnutls="no: pkgconfig --modeversion gnutls failed"
+               have_gnutls="no: pkgconfig --modversion gnutls failed"
        fi
 else
        have_gnutls="no: pkg-config not found"
@@ -368,7 +369,15 @@
 then
        LIBCOURIERTLSGNUTLS="libcouriertlsgnutls.la"
        CPPFLAGS="$CPPFLAGS `$PKGCONFIG --cflags gnutls`"
-       gnutlsdep="`$PKGCONFIG --libs gnutls` -lgnutls-extra"
+       have_gnutls3=no
+       PKG_CHECK_EXISTS([gnutls >= 3.0], [have_gnutls3=yes])
+       if test "x$have_gnutls3" = "xno"
+       then
+               gnutlsdep="`$PKGCONFIG --libs gnutls` -lgnutls-extra"
+       else
+               gnutlsdep="`$PKGCONFIG --libs gnutls`"
+               AC_DEFINE([HAVE_GNUTLS3], [1], [Use GnuTLS3])
+       fi
 fi
 
 AC_CHECK_SIZEOF(gnutls_transport_ptr_t,0, [
--- tcpd/libcouriergnutls.c     2011-04-04 15:03:59.000000000 +0000
+++ tcpd/libcouriergnutls.c     2012-06-20 09:36:41.000000000 +0000
@@ -9,7 +9,9 @@
 #include       "tlscache.h"
 #include       "soxwrap/soxwrap.h"
 #include       <gnutls/gnutls.h>
+#ifndef HAVE_GNUTLS3
 #include       <gnutls/extra.h>
+#endif
 #include       <gnutls/x509.h>
 #include       <gnutls/openpgp.h>
 #include       <stdio.h>
@@ -146,7 +148,11 @@
                { NULL, 0}
        }, all_comps[]={
                { "DEFLATE", GNUTLS_COMP_DEFLATE},
+#ifndef HAVE_GNUTLS3
                { "LZO", GNUTLS_COMP_LZO},
+#else
+               { "ZLIB", GNUTLS_COMP_ZLIB},
+#endif
                { "NULL", GNUTLS_COMP_NULL},
                { NULL, 0}
        }, all_certs[]={
@@ -408,6 +414,7 @@
                        return (NULL);
                }
 
+#ifndef HAVE_GNUTLS3
                if (gnutls_global_init_extra() < 0)
                {
                        gnutls_global_deinit();
@@ -416,6 +423,7 @@
                        errno=EINVAL;
                        return (NULL);
                }
+#endif
        }
 
        if (!(words=splitwords(safe_getenv(p, "TLS_PROTOCOL",
--- imap/imapd-ssl.dist.in      2011-04-13 16:39:29.000000000 +0000
+++ imap/imapd-ssl.dist.in      2012-06-20 10:13:02.000000000 +0000
@@ -196,7 +196,9 @@
 #
 # Optional compression. "ALL" selects all available compression methods.
 #
-# Available compression methods: DEFLATE, LZO, NULL
+# Available compression methods:
+#   GnuTLS-2: DEFLATE, LZO, NULL
+#   GnuTLS-3: DEFLATE, ZLIB, NULL
 
 TLS_COMPRESSION=ALL
 
--- imap/pop3d-ssl.dist.in      2011-04-13 16:39:29.000000000 +0000
+++ imap/pop3d-ssl.dist.in      2012-06-20 10:12:13.000000000 +0000
@@ -184,7 +184,9 @@
 #
 # Optional compression. "ALL" selects all available compression methods.
 #
-# Available compression methods: DEFLATE, LZO, NULL
+# Available compression methods: 
+#   GnuTLS-2: DEFLATE, LZO, NULL
+#   GnuTLS-3: DEFLATE, ZLIB, NULL
 
 TLS_COMPRESSION=ALL
 

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Courier-imap mailing list
[email protected]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-imap

Reply via email to