aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2010-08-03 14:35:56 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2010-08-03 14:35:56 +0300
commit7875612f049fa2fa39e3c7bbf2d82c2908052d77 (patch)
tree5a7d8f364a160723a3881045427c94b16621d55b
parent7c91506f668904d2e0a26940587bad8a623e2f55 (diff)
downloadanubis-7875612f049fa2fa39e3c7bbf2d82c2908052d77.tar.gz
anubis-7875612f049fa2fa39e3c7bbf2d82c2908052d77.tar.bz2
Fix detection of GNU TLS and the corresponding code.
* am/libgnutls.m4: Remove. * am/gnutls.m4: New file. * configure.ac: Set version number 4.1.91. Remove gnutls checking, use ANUBIS_CHECK_TLS instead. (TLS_COND): New condition. * src/Makefile.am [TLS_COND] (TLS_C): New variable. (libanubisdb_a_SOURCES): Use TLS_C. (INCLUDES): Replace LIBGNUTLS_CFLAGS with LIBGNUTLS_INCLUDES. * testsuite/Makefile.am (INCLUDES): Replace LIBGNUTLS_CFLAGS with LIBGNUTLS_INCLUDES. * testsuite/etc/Makefile.am: Add missing AM_V_GENs. * src/anubisusr.c: Uniformly use USE_GNUTLS to protect tls-specific parts of code. * src/anubisusr.h: Likewise. * src/headers.h: Likewise. * src/help.c: Likewise. * src/main.c: Likewise. * src/quit.c: Likewise. * src/rcfile.c: Likewise. * testsuite/mta.c: Likewise. * src/tls.c: Likewise. (print_x509_certificate_info): Use gnutls_fingerprint instead of the deprecated gnutls_x509_fingerprint. * src/smtprepl.c (smtp_reply_read): Fix coredump. * NEWS: Update.
-rw-r--r--NEWS2
-rw-r--r--am/gnutls.m450
-rw-r--r--am/libgnutls.m4161
-rw-r--r--configure.ac34
-rw-r--r--src/Makefile.am8
-rw-r--r--src/anubisusr.c12
-rw-r--r--src/anubisusr.h4
-rw-r--r--src/headers.h7
-rw-r--r--src/help.c4
-rw-r--r--src/main.c4
-rw-r--r--src/quit.c4
-rw-r--r--src/rcfile.c6
-rw-r--r--src/smtprepl.c8
-rw-r--r--src/tls.c5
-rw-r--r--testsuite/Makefile.am2
-rw-r--r--testsuite/etc/Makefile.am4
-rw-r--r--testsuite/mta.c23
17 files changed, 102 insertions, 236 deletions
diff --git a/NEWS b/NEWS
index eecf8bf..690151f 100644
--- a/NEWS
+++ b/NEWS
@@ -5,7 +5,7 @@ See the end of file for copying conditions.
Please send your bug reports to <bug-anubis@gnu.org>.
-* Version 4.1.90 (Git)
+* Version 4.1.91 (Git)
* New operation mode: proxy
diff --git a/am/gnutls.m4 b/am/gnutls.m4
new file mode 100644
index 0000000..1f65878
--- /dev/null
+++ b/am/gnutls.m4
@@ -0,0 +1,50 @@
+dnl This file is part of GNU Anubis.
+dnl Copyright (C) 2001,2002,2003,2004,2005,2006,2007,2008,2009,
+dnl 2010 The Anubis Team.
+dnl
+dnl GNU Anubis is free software; you can redistribute it and/or modify it
+dnl under the terms of the GNU General Public License as published by the
+dnl Free Software Foundation; either version 3 of the License, or (at your
+dnl option) any later version.
+dnl
+dnl GNU Anubis is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+dnl GNU General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License along
+dnl with GNU Anubis. If not, see <http://www.gnu.org/licenses/>.
+dnl
+AC_SUBST(LIBGNUTLS_LIBS)
+AC_SUBST(LIBGNUTLS_INCLUDES)
+AC_DEFUN([ANUBIS_CHECK_TLS],[
+ AC_ARG_WITH([gnutls],
+ AC_HELP_STRING([--with-gnutls],
+ [use GNU TLS library]),
+ [anubis_cv_gnutls=$withval],
+ [anubis_cv_gnutls=yes],
+ [anubis_cv_gnutls=yes])
+
+ if test "$anubis_cv_gnutls" != "no"; then
+ AC_CHECK_HEADER(gnutls/gnutls.h,
+ [:],
+ [anubis_cv_gnutls=no])
+ if test "$anubis_cv_gnutls" != "no"; then
+ saved_LIBS=$LIBS
+ AC_CHECK_LIB(gcrypt, main,
+ [LIBGNUTLS_LIBS="-lgcrypt"],
+ [anubis_cv_gnutls=no])
+ LIBS="$LIBS $LIBGNUTLS_LIBS"
+ AC_CHECK_LIB(gnutls, gnutls_global_init,
+ [LIBGNUTLS_LIBS="-lgnutls $LIBGNUTLS_LIBS"],
+ [anubis_cv_gnutls=no])
+ LIBS=$saved_LIBS
+ fi
+ fi
+
+ if test "$anubis_cv_gnutls" = "yes"; then
+ m4_if([$1],[],[:],[$1])
+ else
+ m4_if([$2],[],[:],[$2])
+ fi])
+
diff --git a/am/libgnutls.m4 b/am/libgnutls.m4
deleted file mode 100644
index 0fdbd5a..0000000
--- a/am/libgnutls.m4
+++ /dev/null
@@ -1,161 +0,0 @@
-dnl Autoconf macros for libgnutls
-dnl $id$
-
-# Modified for LIBGNUTLS -- nmav
-# Configure paths for LIBGCRYPT
-# Shamelessly stolen from the one of XDELTA by Owen Taylor
-# Werner Koch 99-12-09
-
-dnl AM_PATH_LIBGNUTLS([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
-dnl Test for libgnutls, and define LIBGNUTLS_CFLAGS and LIBGNUTLS_LIBS
-dnl
-AC_DEFUN([AM_PATH_LIBGNUTLS],
-[dnl
-dnl Get the cflags and libraries from the libgnutls-config script
-dnl
-AC_ARG_WITH(libgnutls-prefix,
- [ --with-libgnutls-prefix=PFX Prefix where libgnutls is installed (optional)],
- libgnutls_config_prefix="$withval", libgnutls_config_prefix="")
-
- if test x$libgnutls_config_prefix != x ; then
- libgnutls_config_args="$libgnutls_config_args --prefix=$libgnutls_config_prefix"
- if test x${LIBGNUTLS_CONFIG+set} != xset ; then
- LIBGNUTLS_CONFIG=$libgnutls_config_prefix/bin/libgnutls-config
- fi
- fi
-
- AC_PATH_PROG(LIBGNUTLS_CONFIG, libgnutls-config, no)
- min_libgnutls_version=ifelse([$1], ,0.1.0,$1)
- AC_MSG_CHECKING(for libgnutls - version >= $min_libgnutls_version)
- no_libgnutls=""
- if test "$LIBGNUTLS_CONFIG" = "no" ; then
- no_libgnutls=yes
- else
- LIBGNUTLS_CFLAGS=`$LIBGNUTLS_CONFIG $libgnutls_config_args --cflags`
- LIBGNUTLS_LIBS=`$LIBGNUTLS_CONFIG $libgnutls_config_args --libs`
- libgnutls_config_version=`$LIBGNUTLS_CONFIG $libgnutls_config_args --version`
-
-
- ac_save_CFLAGS="$CFLAGS"
- ac_save_LIBS="$LIBS"
- CFLAGS="$CFLAGS $LIBGNUTLS_CFLAGS"
- LIBS="$LIBS $LIBGNUTLS_LIBS"
-dnl
-dnl Now check if the installed libgnutls is sufficiently new. Also sanity
-dnl checks the results of libgnutls-config to some extent
-dnl
- rm -f conf.libgnutlstest
- AC_TRY_RUN([
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <gnutls/gnutls.h>
-
-int
-main ()
-{
- system ("touch conf.libgnutlstest");
-
- if( strcmp( gnutls_check_version(NULL), "$libgnutls_config_version" ) )
- {
- printf("\n*** 'libgnutls-config --version' returned %s, but LIBGNUTLS (%s)\n",
- "$libgnutls_config_version", gnutls_check_version(NULL) );
- printf("*** was found! If libgnutls-config was correct, then it is best\n");
- printf("*** to remove the old version of LIBGNUTLS. You may also be able to fix the error\n");
- printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
- printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
- printf("*** required on your system.\n");
- printf("*** If libgnutls-config was wrong, set the environment variable LIBGNUTLS_CONFIG\n");
- printf("*** to point to the correct copy of libgnutls-config, and remove the file config.cache\n");
- printf("*** before re-running configure\n");
- }
- else if ( strcmp(gnutls_check_version(NULL), LIBGNUTLS_VERSION ) )
- {
- printf("\n*** LIBGNUTLS header file (version %s) does not match\n", LIBGNUTLS_VERSION);
- printf("*** library (version %s)\n", gnutls_check_version(NULL) );
- }
- else
- {
- if ( gnutls_check_version( "$min_libgnutls_version" ) )
- {
- return 0;
- }
- else
- {
- printf("no\n*** An old version of LIBGNUTLS (%s) was found.\n",
- gnutls_check_version(NULL) );
- printf("*** You need a version of LIBGNUTLS newer than %s. The latest version of\n",
- "$min_libgnutls_version" );
- printf("*** LIBGNUTLS is always available from ftp://gnutls.hellug.gr/pub/gnutls.\n");
- printf("*** \n");
- printf("*** If you have already installed a sufficiently new version, this error\n");
- printf("*** probably means that the wrong copy of the libgnutls-config shell script is\n");
- printf("*** being found. The easiest way to fix this is to remove the old version\n");
- printf("*** of LIBGNUTLS, but you can also set the LIBGNUTLS_CONFIG environment to point to the\n");
- printf("*** correct copy of libgnutls-config. (In this case, you will have to\n");
- printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
- printf("*** so that the correct libraries are found at run-time))\n");
- }
- }
- return 1;
-}
-],, no_libgnutls=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
- CFLAGS="$ac_save_CFLAGS"
- LIBS="$ac_save_LIBS"
- fi
-
- if test "x$no_libgnutls" = x ; then
- AC_MSG_RESULT(yes)
- ifelse([$2], , :, [$2])
- else
- if test -f conf.libgnutlstest ; then
- :
- else
- AC_MSG_RESULT(no)
- fi
- if test "$LIBGNUTLS_CONFIG" = "no" ; then
- echo "*** The libgnutls-config script installed by LIBGNUTLS could not be found"
- echo "*** If LIBGNUTLS was installed in PREFIX, make sure PREFIX/bin is in"
- echo "*** your path, or set the LIBGNUTLS_CONFIG environment variable to the"
- echo "*** full path to libgnutls-config."
- else
- if test -f conf.libgnutlstest ; then
- :
- else
- echo "*** Could not run libgnutls test program, checking why..."
- CFLAGS="$CFLAGS $LIBGNUTLS_CFLAGS"
- LIBS="$LIBS $LIBGNUTLS_LIBS"
- AC_TRY_LINK([
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <gnutls/gnutls.h>
-], [ return !!gnutls_check_version(NULL); ],
- [ echo "*** The test program compiled, but did not run. This usually means"
- echo "*** that the run-time linker is not finding LIBGNUTLS or finding the wrong"
- echo "*** version of LIBGNUTLS. If it is not finding LIBGNUTLS, you'll need to set your"
- echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
- echo "*** to the installed location Also, make sure you have run ldconfig if that"
- echo "*** is required on your system"
- echo "***"
- echo "*** If you have an old version installed, it is best to remove it, although"
- echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
- echo "***" ],
- [ echo "*** The test program failed to compile or link. See the file config.log for the"
- echo "*** exact error that occured. This usually means LIBGNUTLS was incorrectly installed"
- echo "*** or that you have moved LIBGNUTLS since it was installed. In the latter case, you"
- echo "*** may want to edit the libgnutls-config script: $LIBGNUTLS_CONFIG" ])
- CFLAGS="$ac_save_CFLAGS"
- LIBS="$ac_save_LIBS"
- fi
- fi
- LIBGNUTLS_CFLAGS=""
- LIBGNUTLS_LIBS=""
- ifelse([$3], , :, [$3])
- fi
- rm -f conf.libgnutlstest
- AC_SUBST(LIBGNUTLS_CFLAGS)
- AC_SUBST(LIBGNUTLS_LIBS)
-])
-
-dnl *-*wedit:notab*-* Please keep this as the last line.
diff --git a/configure.ac b/configure.ac
index a86ba98..01340e2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -20,7 +20,7 @@ dnl with GNU Anubis. If not, see <http://www.gnu.org/licenses/>.
dnl
dnl Process this file with autoconf to produce a configure script.
-AC_INIT([GNU Anubis], [4.1.90], [bug-anubis@gnu.org])
+AC_INIT([GNU Anubis], [4.1.91], [bug-anubis@gnu.org])
AC_PREREQ([2.63])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_AUX_DIR([build])
@@ -248,32 +248,10 @@ MU_CHECK_GSASL(0.2.3, [
AC_LIBOBJ(lbuf)])
-dnl Use option --without-gnutls to NOT compile GnuTLS library support.
-AC_ARG_WITH(gnutls,
- AC_HELP_STRING([--without-gnutls],
- [without GnuTLS library support]),
- [with_gnutls=${withval}],
- [with_gnutls=yes])
-
-if test $with_gnutls = yes; then
- AC_CHECK_HEADERS(gnutls/gnutls.h)
- if test $ac_cv_header_gnutls_gnutls_h != no; then
- AM_PATH_LIBGNUTLS("1.0.0",
- [M4_DEFS="$M4_DEFS -DWITH_SSL -DWITH_GNUTLS"
- AC_DEFINE(USE_GNUTLS, 1,
- [Define to 1 if USE_GNUTLS is requested.])],
- [with_gnutls = no
- AC_MSG_RESULT([Disabling GnuTLS support...])])
- if test $with_gnutls = yes; then
- # Accomodate for incompatibilities of gnults 1.0.16 (and,
- # eventually, newer versions)
- AC_CHECK_FUNC(gnutls_x509_fingerprint,:
- [AH_BOTTOM([
-#define gnutls_x509_fingerprint gnutls_fingerprint
-])])
- fi
- fi
-fi
+ANUBIS_CHECK_TLS([
+ M4_DEFS="$M4_DEFS -DWITH_SSL -DWITH_GNUTLS"
+ AC_DEFINE(USE_GNUTLS, 1, [Define to 1 if USE_GNUTLS is requested.])])
+AM_CONDITIONAL([TLS_COND], [test $anubis_cv_gnutls = yes])
dnl Use option --with-socks-proxy to compile SOCKS v4/5 proxy support.
AC_ARG_WITH(socks-proxy,
@@ -380,7 +358,7 @@ WITH_SQL=$WITH_SQL
WITH_MYSQL=$WITH_MYSQL
WITH_POSTGRES=$WITH_POSTGRES
WITH_GSASL=$WITH_GSASL
-with_gnutls=$with_gnutls
+with_gnutls=$anubis_cv_gnutls
with_socks_proxy=$with_socks_proxy
with_pcre=$with_pcre
with_pam=$with_pam
diff --git a/src/Makefile.am b/src/Makefile.am
index 3ac2331..d28dea3 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -70,6 +70,10 @@ anubisadm_LDADD = ./libanubisdb.a $(top_builddir)/lib/libanubis.a @LIBINTL@
anubisusr_SOURCES = anubisusr.c anubisusr.h usr.c
anubisusr_LDADD = ./libanubisdb.a $(top_builddir)/lib/libanubis.a @LIBINTL@ @LIBGNUTLS_LIBS@ @GSASL_LIBS@
+if TLS_COND
+ TLS_C=tls.c
+endif
+
libanubisdb_a_SOURCES = \
anubisdb.c \
dbtext.c \
@@ -85,7 +89,7 @@ libanubisdb_a_SOURCES = \
smtprepl.c \
smtprepl.h \
stream.c \
- tls.c \
+ $(TLS_C) \
url.c
AM_YFLAGS = -dtv
@@ -96,7 +100,7 @@ BUILT_SOURCES = env.c
localedir = $(datadir)/locale
DEFS = @DEFS@ -DLOCALEDIR=\"$(localedir)\"
-INCLUDES = @ADD_INCLUDES@ @LIBGNUTLS_CFLAGS@ -I$(top_srcdir)/lib
+INCLUDES = @ADD_INCLUDES@ @LIBGNUTLS_INCLUDES@ -I$(top_srcdir)/lib
SUFFIXES=.opt .c
.opt.c:
diff --git a/src/anubisusr.c b/src/anubisusr.c
index 233cc6b..7c44619 100644
--- a/src/anubisusr.c
+++ b/src/anubisusr.c
@@ -19,10 +19,10 @@
#include <anubisusr.h>
-#ifdef HAVE_TLS
+#ifdef USE_GNUTLS
char *tls_cafile;
int enable_tls = 1;
-#endif /* HAVE_TLS */
+#endif /* USE_GNUTLS */
char *progname;
@@ -64,7 +64,7 @@ error (const char *fmt, ...)
NET_STREAM iostream;
-#ifdef HAVE_TLS
+#ifdef USE_GNUTLS
void
info (int mode, const char *fmt, ...)
@@ -115,7 +115,7 @@ starttls (void)
exit (1);
}
}
-#endif /* HAVE_TLS */
+#endif /* USE_GNUTLS */
/* Auxiliary functions */
@@ -857,7 +857,7 @@ synch (void)
char *rcname;
obstack_init (&input_stk);
-#ifdef HAVE_TLS
+#ifdef USE_GNUTLS
init_ssl_libs ();
#endif
@@ -894,7 +894,7 @@ synch (void)
smtp_ehlo (1);
-#ifdef HAVE_TLS
+#ifdef USE_GNUTLS
if (enable_tls && smtp_reply_has_capa (smtp_capa, "STARTTLS", NULL))
{
starttls ();
diff --git a/src/anubisusr.h b/src/anubisusr.h
index e2fc716..8ed5c5d 100644
--- a/src/anubisusr.h
+++ b/src/anubisusr.h
@@ -29,10 +29,10 @@
#define obstack_chunk_free free
#include <obstack.h>
-#if defined(USE_GNUTLS) && defined(HAVE_GNUTLS_GNUTLS_H)
+#if defined(USE_GNUTLS)
# include <gnutls/gnutls.h>
# define HAVE_TLS
-#endif /* USE_GNUTLS and HAVE_GNUTLS_GNUTLS_H */
+#endif /* USE_GNUTLS */
extern char *tls_cafile;
extern int enable_tls;
diff --git a/src/headers.h b/src/headers.h
index 09a4fde..3b19aac 100644
--- a/src/headers.h
+++ b/src/headers.h
@@ -36,9 +36,6 @@
# define ANUBIS_NORETURN __attribute__((__noreturn__))
#endif
-# if defined(HAVE_GNUTLS_GNUTLS_H)
-# define HAVE_GNUTLS
-# endif /* HAVE_GNUTLS_GNUTLS_H */
# if defined(HAVE_LIBGPGME) && defined(HAVE_GPGME_H) && !defined(NOGPG)
# define HAVE_GPG
# endif /* HAVE_LIBGPGME and HAVE_GPGME_H and not NOGPG */
@@ -101,11 +98,11 @@
# include <arpa/inet.h>
#endif /* HAVE_ARPA_INET_H */
-#if defined(USE_GNUTLS) && defined(HAVE_GNUTLS)
+#if defined(USE_GNUTLS)
# include <gnutls/gnutls.h>
# include <gnutls/x509.h>
# define HAVE_TLS
-#endif /* USE_GNUTLS and HAVE_GNUTLS */
+#endif /* USE_GNUTLS */
#if defined(HAVE_TLS) || defined(HAVE_SSL)
# define USE_SSL
diff --git a/src/help.c b/src/help.c
index 74bf8bc..714615c 100644
--- a/src/help.c
+++ b/src/help.c
@@ -40,9 +40,9 @@ static char *config_opts[] = {
#ifdef WITH_GUILE
"GUILE",
#endif /* WITH_GUILE */
-#ifdef HAVE_TLS
+#ifdef USE_GNUTLS
"GNUTLS",
-#endif /* HAVE_TLS */
+#endif /* USE_GNUTLS */
#ifdef HAVE_GPG
"GPG",
#endif /* HAVE_GPG */
diff --git a/src/main.c b/src/main.c
index af10436..325069b 100644
--- a/src/main.c
+++ b/src/main.c
@@ -25,9 +25,9 @@ const char version[] = "GNU Anubis v" VERSION;
struct options_struct options;
struct session_struct session;
-#if defined(HAVE_TLS) || defined(HAVE_SSL)
+#if defined(USE_GNUTLS)
struct secure_struct secure;
-#endif /* HAVE_TLS or HAVE_SSL */
+#endif /* USE_GNUTLS */
unsigned long topt;
NET_STREAM remote_client;
diff --git a/src/quit.c b/src/quit.c
index a4b5844..3b3b81c 100644
--- a/src/quit.c
+++ b/src/quit.c
@@ -38,11 +38,11 @@ sig_timeout (int code)
void
free_mem (void)
{
-#ifdef USE_SSL
+#ifdef USE_GNUTLS
xfree (secure.cafile);
xfree (secure.cert);
xfree (secure.key);
-#endif /* HAVE_TLS or HAVE_SSL */
+#endif /* USE_GNUTLS */
#ifdef HAVE_GPG
gpg_free ();
diff --git a/src/rcfile.c b/src/rcfile.c
index 5511296..84f739b 100644
--- a/src/rcfile.c
+++ b/src/rcfile.c
@@ -721,7 +721,7 @@ static struct rc_secdef_child control_sect_child = {
};
/* FIXME: This belongs to another file */
-#if defined(HAVE_TLS) || defined(HAVE_SSL)
+#if defined(USE_GNUTLS)
#define KW_SSL 1
#define KW_SSL_ONEWAY 2
#define KW_SSL_CERT 3
@@ -784,7 +784,7 @@ static struct rc_secdef_child tls_sect_child = {
tls_parser,
NULL
};
-#endif /* HAVE_TLS or HAVE_SSL */
+#endif /* USE_GNUTLS */
void
control_section_init (void)
@@ -795,7 +795,7 @@ control_section_init (void)
rc_secdef_add_child (sp, &init_supervisor_sect_child);
rc_secdef_add_child (sp, &client_sect_child);
rc_secdef_add_child (sp, &control_sect_child);
-#if defined(HAVE_TLS) || defined(HAVE_SSL)
+#if defined(USE_GNUTLS)
rc_secdef_add_child (sp, &tls_sect_child);
#endif
}
diff --git a/src/smtprepl.c b/src/smtprepl.c
index 5c0722c..b1fd037 100644
--- a/src/smtprepl.c
+++ b/src/smtprepl.c
@@ -133,11 +133,13 @@ smtp_reply_read (ANUBIS_SMTP_REPLY reply,
lc++;
}
while (line[3] == '-');
- reply->buffer[reply->reply_length] = 0;
-
free (line);
- smtp_reply_scan (reply, lc);
+ if (reply->reply_length)
+ {
+ reply->buffer[reply->reply_length] = 0;
+ smtp_reply_scan (reply, lc);
+ }
}
void
diff --git a/src/tls.c b/src/tls.c
index d6d53b3..79e0a11 100644
--- a/src/tls.c
+++ b/src/tls.c
@@ -25,7 +25,6 @@
#include "headers.h"
#include "extern.h"
-#ifdef HAVE_TLS
static gnutls_session initialize_tls_session (void);
static void generate_dh_params (void);
static void verify_certificate (gnutls_session);
@@ -430,7 +429,7 @@ print_x509_certificate_info (gnutls_session session)
ctime (&activet));
fprintf (stderr, _("- Certificate expires: %s"), ctime (&expiret));
- if (gnutls_x509_fingerprint (GNUTLS_DIG_MD5,
+ if (gnutls_fingerprint (GNUTLS_DIG_MD5,
&cert_list[0], digest, &digest_size) >= 0)
{
fprintf (stderr, _("- Certificate fingerprint: "));
@@ -481,6 +480,4 @@ print_x509_certificate_info (gnutls_session session)
}
}
-#endif /* HAVE_TLS */
-
/* EOF */
diff --git a/testsuite/Makefile.am b/testsuite/Makefile.am
index 18727db..ef5fba7 100644
--- a/testsuite/Makefile.am
+++ b/testsuite/Makefile.am
@@ -25,7 +25,7 @@ noinst_PROGRAMS = mta findport
SUBDIRS = . etc data
mta_LDADD = @LIBGNUTLS_LIBS@
-INCLUDES = @LIBGNUTLS_CFLAGS@
+INCLUDES = @LIBGNUTLS_INCLUDES@
dist-hook:
here=`cd $(top_builddir)/$(subdir) && pwd`; \
diff --git a/testsuite/etc/Makefile.am b/testsuite/etc/Makefile.am
index 69966de..af711c5 100644
--- a/testsuite/etc/Makefile.am
+++ b/testsuite/etc/Makefile.am
@@ -104,10 +104,10 @@ std.pat: std.pin
SUFFIXES=.in .rc .pin .pat
.in.rc:
- m4 -DTOP_SRCDIR=`cd $(top_srcdir); pwd` \
+ $(AM_V_GEN) m4 -DTOP_SRCDIR=`cd $(top_srcdir); pwd` \
-DTESTDIR=`cd ..; pwd` @M4_DEFS@ $< > $@
.pin.pat:
- m4 -DTOP_SRCDIR=`cd $(top_srcdir); pwd` \
+ $(AM_V_GEN) m4 -DTOP_SRCDIR=`cd $(top_srcdir); pwd` \
-DTESTDIR=`cd ..; pwd` \
@M4_DEFS@ $< > $@
diff --git a/testsuite/mta.c b/testsuite/mta.c
index 7698380..adfdb44 100644
--- a/testsuite/mta.c
+++ b/testsuite/mta.c
@@ -67,15 +67,14 @@
#include <sys/socket.h>
#include <netinet/in.h>
-#if defined(USE_GNUTLS) && defined(HAVE_GNUTLS_GNUTLS_H)
+#if defined(USE_GNUTLS)
# include <gnutls/gnutls.h>
-# define HAVE_TLS
-#endif /* USE_GNUTLS and HAVE_GNUTLS_GNUTLS_H */
+#endif /* USE_GNUTLS */
FILE *diag = NULL; /* diagnostic output */
int port = 0; /* Port number (for smtp mode) */
-#ifdef HAVE_TLS
+#ifdef USE_GNUTLS
char *tls_cert; /* TLS sertificate */
char *tls_key; /* TLS key */
char *tls_cafile;
@@ -86,7 +85,7 @@ void tls_init (void);
gnutls_dh_params dh_params;
static gnutls_certificate_server_credentials x509_cred;
-#endif /* HAVE_TLS */
+#endif /* USE_GNUTLS */
char *progname;
@@ -136,7 +135,7 @@ main (int argc, char **argv)
}
break;
-#ifdef HAVE_TLS
+#ifdef USE_GNUTLS
case 'c':
tls_cert = optarg;
break;
@@ -159,7 +158,7 @@ main (int argc, char **argv)
break;
default:
- error ("unknown option");
+ error ("unknown option: -%c", c);
exit (1);
}
}
@@ -187,7 +186,7 @@ main (int argc, char **argv)
exit (1);
}
-#ifdef HAVE_TLS
+#ifdef USE_GNUTLS
tls_init ();
#endif
status = mta_mode (argc, argv);
@@ -251,7 +250,7 @@ int (*_mta_write) (void *, char *, size_t, size_t *) = _def_write;
int (*_mta_close) (void *) = _def_close;
const char *(*_mta_strerror) (int) = _def_strerror;
-#ifdef HAVE_TLS
+#ifdef USE_GNUTLS
static void
_tls_cleanup_x509 (void)
@@ -418,7 +417,7 @@ smtp_starttls (void)
smtp_reply (530, "TLS negotiation failed");
}
-#endif /* HAVE_TLS */
+#endif /* USE_GNUTLS */
void
smtp_reply (int code, char *fmt, ...)
@@ -561,7 +560,7 @@ argcv_free (int argc, char **argv)
}
char *mta_capa[] = {
-#ifdef HAVE_TLS
+#ifdef USE_GNUTLS
"STARTTLS",
#endif
NULL
@@ -718,7 +717,7 @@ smtp (void)
smtp_reply (501, "Syntax error");
break;
-#ifdef HAVE_TLS
+#ifdef USE_GNUTLS
case KW_STARTTLS:
smtp_starttls ();
break;

Return to:

Send suggestions and report system problems to the System administrator.