aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Andree <matthias.andree@gmx.de>2007-12-26 14:37:09 +0000
committerMatthias Andree <matthias.andree@gmx.de>2007-12-26 14:37:09 +0000
commite7189017e19dd5162f40a91050a730c5de982d9a (patch)
tree678ce6efc0e26688e0686d8dbe7bab7a3fcb9b77
parentd723cc008d7793334260e6ac0d7412ce13e1cf29 (diff)
downloadfetchmail-e7189017e19dd5162f40a91050a730c5de982d9a.tar.gz
fetchmail-e7189017e19dd5162f40a91050a730c5de982d9a.tar.bz2
fetchmail-e7189017e19dd5162f40a91050a730c5de982d9a.zip
Merge portability patch from Peter O'Gorman, fetchmail-devel 2007-10-31.
This requires some minor fixes though. svn path=/branches/BRANCH_6-3/; revision=5145
-rw-r--r--KAME/getnameinfo.c7
-rw-r--r--Makefile.am4
-rw-r--r--NEWS17
-rw-r--r--TODO.txt1
-rw-r--r--configure.ac118
-rw-r--r--libesmtp/gethostbyname.c2
-rw-r--r--m4/gethostbyname_r.m46
-rw-r--r--smbencrypt.c2
8 files changed, 105 insertions, 52 deletions
diff --git a/KAME/getnameinfo.c b/KAME/getnameinfo.c
index fb97530e..62dee36b 100644
--- a/KAME/getnameinfo.c
+++ b/KAME/getnameinfo.c
@@ -291,8 +291,11 @@ getnameinfo(sa, salen, host, hostlen, serv, servlen, flags)
hostlen) == NULL)
return EAI_SYSTEM;
#else
- if (afd->a_af == AF_INET)
- strlcpy(host, inet_ntoa(addr), hostlen);
+ if (afd->a_af == AF_INET) {
+ struct in_addr addr_tmp;
+ addr_tmp.s_addr = addr;
+ strlcpy(host, inet_ntoa(addr_tmp), hostlen);
+ }
else
return EAI_FAMILY;
#endif
diff --git a/Makefile.am b/Makefile.am
index f67e8343..ef087e0f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3,9 +3,7 @@
SUBDIRS= m4 po
AUTOMAKE_OPTIONS= 1.8 foreign no-dist-gzip dist-bzip2
-AM_CFLAGS= @CEFLAGS@
-AM_CPPFLAGS= @CPFLAGS@ -I$(srcdir)/libesmtp
-AM_LDFLAGS= @LDEFLAGS@
+AM_CPPFLAGS= -I$(srcdir)/libesmtp
ACLOCAL_AMFLAGS= -I m4 -I m4-local
AM_YFLAGS= -d
BUILT_SOURCES= rcfile_y.h
diff --git a/NEWS b/NEWS
index ac45db7d..bbdf2180 100644
--- a/NEWS
+++ b/NEWS
@@ -75,6 +75,21 @@ fetchmail 6.3.9 (not yet released):
default with no switches in configure to enable it. However, the macro would
have been prone to a symlink attack. Found by Nico Golde.
+* Include the typedef for int16 in the #ifndef _AIX in smbencrypt.c (Peter
+ O'Gorman)
+* Correct check for u_int32_t in configure.ac (seems to be typedef'ed in
+ namser.h on some platforms.) (Peter O'Gorman)
+* In configure.ac change all CPFLAGS to CPPFLAGS, CEFLAGS to CFLAGS and LDEFLAGS
+ to LDFLAGS otherwise the results of some tests (additional -L and -I flags) do
+ not get used for later tests causing incorrect configure results. Makefile.am
+ was also changed to reflect this. (Peter O'Gorman)
+* m4/gethostbyname_r.m4 does AC_TRY_COMPILE, which unfortunately can pass even
+ if there is no gethostbyname_r. Changed to AC_TRY_LINK. (Peter O'Gorman)
+* __attribute__ ((unused)) is a gccism, removed from libesmtp/gethostbyname.c.
+ (Peter O'Gorman)
+* In KAME/getnameinfo.c it's best to use the correct argument to inet_ntoa.
+ (Peter O'Gorman)
+
# DOCUMENTATION:
* Add fetchmail-SA-2007-02.txt
* Re-add two lines to the manual page that had accidentally become comments
@@ -89,6 +104,8 @@ fetchmail 6.3.9 (not yet released):
* Spanish (Javier Fernández-Sanguino Peña, Matthias Andree)
* Vietnamese (Clytie Siddall)
+
+
fetchmail 6.3.8 (released 2007-04-06):
# SECURITY STRENGTHENING:
diff --git a/TODO.txt b/TODO.txt
index 4be71f67..7ff1f69a 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -5,7 +5,6 @@ soon - MUST:
- report multiline SMTP errors properly (sample in private mail from
Earl Chew, 2007-07-30T02:28)
- publish SA-2007-02 after release
-- Peter O'Gorman 2007-10-31 fetchmail-6.3.8 portability patches [-devel list]
soon - SHOULD:
- BerliOS Bug #11576, thread on fetchmail users "Invalid SSL certificate" by
diff --git a/configure.ac b/configure.ac
index 6e06ba16..3433a5c6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -49,11 +49,17 @@ AC_HEADER_TIME
AC_TYPE_SIZE_T
AC_TYPE_PID_T
AC_TYPE_SIGNAL
-AC_CHECK_TYPE(u_int32_t,unsigned int)
AC_CHECK_HEADERS([unistd.h termios.h termio.h sgtty.h stdarg.h \
sys/itimer.h fcntl.h sys/fcntl.h memory.h sys/wait.h \
- arpa/inet.h arpa/nameser.h netinet/in.h net/socket.h \
+ arpa/inet.h arpa/nameser.h netinet/in.h net/socket.h netdb.h \
sys/select.h sys/socket.h sys/time.h langinfo.h])
+AC_CHECK_TYPE(u_int32_t,,
+ AC_DEFINE(u_int32_t,unsigned int,
+ [Define to unsigned int if <sys/types.h> does not define.]),
+ [AC_INCLUDES_DEFAULT
+#ifdef HAVE_ARPA_NAMESER_H
+#include <arpa/nameser.h>
+#endif])
AC_CHECK_HEADERS([resolv.h],,,[
#include <sys/types.h>
#ifdef HAVE_NETINET_IN_H
@@ -74,7 +80,7 @@ AC_PROG_YACC
case $target_os in
darwin*)
AC_MSG_NOTICE(found Darwin - Adding -DBIND_8_COMPAT to CFLAGS)
- CPFLAGS="-DBIND_8_COMPAT"
+ CPPFLAGS="$CPPFLAGS -DBIND_8_COMPAT"
;;
# Check for FreeBSD special case: more libs needed
freebsd*)
@@ -88,7 +94,7 @@ lynxos*)
LIBS="$LIBS -lbsd"
LDFLAGS=`echo $LDFLAGS | sed "s/-s //"`
AC_MSG_NOTICE(found LynxOS - Prepending standard include path to gcc flags)
- CPFLAGS="-I/usr/include"
+ CPPFLAGS="$CPPFLAGS -I/usr/include"
;;
# Check for Rhapsody special case: it doesn't like -s
rhapsody*)
@@ -431,13 +437,47 @@ AC_ARG_ENABLE(opie,
[with_opie=no])
test "$with_opie" = "yes" && AC_DEFINE(OPIE_ENABLE,1,Define if you want OPIE support compiled in)
-AC_SEARCH_LIBS(getaddrinfo, inet6, [AC_DEFINE(HAVE_GETADDRINFO,1,[define to 1 if you have the getaddrinfo function])])
-AC_CHECK_FUNCS(getnameinfo inet_ntop)
-AM_CONDITIONAL(NEED_GETADDRINFO, test "$ac_cv_search_getaddrinfo" != "none required")
-AM_CONDITIONAL(NEED_GETNAMEINFO, test "$ac_cv_func_getnameinfo" != yes)
+dnl Mostly stolen from gnulib's getaddrinfo.m4
+AC_SEARCH_LIBS(getaddrinfo, [nsl socket])
+AC_CACHE_CHECK([for getaddrinfo],[fm_cv_getaddrinfo],[
+ AC_TRY_LINK([
+#include <sys/types.h>
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifdef HAVE_NETDB_H
+#include <netdb.h>
+#endif
+ ], [getaddrinfo(0, 0, 0, 0);],
+ [ fm_cv_getaddrinfo=yes],
+ [ fm_cv_getaddrinfo=no ])
+])
+
+if test x"$fm_cv_getaddrinfo" = "xyes"; then
+ AC_DEFINE(HAVE_GETADDRINFO, 1,
+ [Define to 1 if you have the getaddrinfo function.])
+fi
+AC_CACHE_CHECK([for getnameinfo],[fm_cv_getnameinfo],[
+ AC_TRY_LINK([
+#include <sys/types.h>
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifdef HAVE_NETDB_H
+#include <netdb.h>
+#endif
+ ], [getnameinfo(NULL,0, NULL,0, NULL, 0, 0);],
+ [ fm_cv_getnameinfo=yes],
+ [ fm_cv_getnameinfo=no ])
+])
+
+AM_CONDITIONAL(NEED_GETADDRINFO, test "$fm_cv_getaddrinfo" != yes)
+AM_CONDITIONAL(NEED_GETNAMEINFO, test "$fm_cv_getnameinfo" != yes)
+
+AC_CHECK_FUNCS(inet_ntop)
dnl Check if getaddrinfo is async-signal-safe - most implementations aren't
-if test "$ac_cv_search_getaddrinfo" = "none required" ; then
+if test "$fm_cv_getaddrinfo" = yes ; then
AC_MSG_CHECKING(if your getaddrinfo is async-signal-safe)
gai_ts=no
dnl we have getaddrinfo() - check if the OS is known to have a async-signal-safe implementation
@@ -481,23 +521,23 @@ then
AS_MESSAGE(checking kerberosV for OpenBSD...)
AC_DEFINE(HEIMDAL,1,Define if you have HEIMDAL kerberos 5)
AC_DEFINE(KERBEROS_V5,1,Define if you have Kerberos V5)
- CEFLAGS="$CEFLAGS -I/usr/include/kerberosV"
+ CFLAGS="$CFLAGS -I/usr/include/kerberosV"
LIBS="$LIBS -lasn1 -lkrb5 -lcom_err -lkafs"
elif krb5-config 2> /dev/null >/dev/null ; then
krb5_prefix=`krb5-config --prefix krb5`
AC_MSG_RESULT([krb5-config points to kerberosV under $krb5_prefix])
if test -f ${krb5_prefix}/include/et/com_err.h && \
! test -f ${krb5_prefix}/include/com_err.h ; then
- CEFLAGS="$CEFLAGS -I${krb5_prefix}/include/et"
+ CFLAGS="$CFLAGS -I${krb5_prefix}/include/et"
fi
unset krb5_prefix
- CEFLAGS="$CEFLAGS `krb5-config --cflags krb5`"
+ CFLAGS="$CFLAGS `krb5-config --cflags krb5`"
LIBS="$LIBS `krb5-config --libs krb5`"
AC_DEFINE(KERBEROS_V5)
else
if test "$with_kerberos5" != "yes"
then
- LDEFLAGS="$LDEFLAGS -L${with_kerberos5}/lib"
+ LDFLAGS="$LDFLAGS -L${with_kerberos5}/lib"
searchdirs="$with_kerberos5"
else
searchdirs="/usr/kerberos /usr/local/krb5 /usr/athena /usr"
@@ -507,7 +547,7 @@ else
do AC_MSG_CHECKING([for Kerberos V in $dir])
if test -f "$dir/include/krb5.h" || test -f "$dir/include/krb5/krb5.h"
then
- if test -d "$dir/include/krb5" ; then CPFLAGS="$CPFLAGS -I$dir/include/krb5" ; fi
+ if test -d "$dir/include/krb5" ; then CPPFLAGS="$CPPFLAGS -I$dir/include/krb5" ; fi
ac_krblibs=
if test -f "$dir/include/roken.h" || test -f "$dir/include/krb5/roken.h"
then
@@ -516,12 +556,12 @@ else
dnl Attempt to detect if we need to -ldb2 to link Heimdal
dnl we assume we do if it is available
AC_CHECK_LIB(db2, db_open, ac_krblibs="$ac_krblibs -ldb2", [],
- ${LDEFLAGS})
+ ${LDFLAGS})
AC_CHECK_LIB(des, des_string_to_key, libk5crypto=-ldes,
AC_CHECK_LIB(ssl, MD5_Init, [],
AC_MSG_ERROR([DES libraries not found. Try adding --with-ssl to enable OpenSSL support]),
- ${LDEFLAGS} ${ac_krblibs}),
- ${LDEFLAGS} ${ac_krblibs})
+ ${LDFLAGS} ${ac_krblibs}),
+ ${LDFLAGS} ${ac_krblibs})
AC_DEFINE(HEIMDAL)
else
AC_MSG_RESULT([found])
@@ -533,15 +573,15 @@ else
krb5_des_string_to_key,
libk5crypto=-lk5crypto,
AC_MSG_ERROR([Kerberos 5 DES libraries not found]),
- ${LDEFLAGS} ${ac_krblibs}),
- ${LDEFLAGS} ${ac_krblibs})
+ ${LDFLAGS} ${ac_krblibs}),
+ ${LDFLAGS} ${ac_krblibs})
fi
AC_CHECK_LIB(krb5, krb5_init_context,[],
continue,
- ${LDEFLAGS} ${ac_krblibs})
+ ${LDFLAGS} ${ac_krblibs})
AC_DEFINE(KERBEROS_V5)
- test "$dir" != "/usr" && CEFLAGS="$CEFLAGS -I$dir/include"
- LDEFLAGS="$LDEFLAGS -L$dir/lib"
+ test "$dir" != "/usr" && CFLAGS="$CFLAGS -I$dir/include"
+ LDFLAGS="$LDFLAGS -L$dir/lib"
LIBS="$LIBS $ac_krblibs $libk5crypto"
with_kerberos5=$dir
break
@@ -569,7 +609,7 @@ if test "$with_kerberos" = "yes" && ( test `uname` = "NetBSD" || test `uname` =
then
AS_MESSAGE(checking kerberosIV for `uname`...)
KERBEROS_V4=1
- CEFLAGS="$CEFLAGS -I/usr/include/kerberosIV"
+ CFLAGS="$CFLAGS -I/usr/include/kerberosIV"
case `uname` in
NetBSD) LIBS="$LIBS -lkrb -ldes -lroken -lcom_err" ;;
OpenBSD) LIBS="$LIBS -lkrb -ldes" ;;
@@ -578,7 +618,7 @@ elif krb4-config 2> /dev/null >/dev/null ; then
krb4_prefix=`krb4-config --prefix`
AC_MSG_RESULT([krb4-config points to kerberosIV under $krb4_prefix])
unset krb4_prefix
- CEFLAGS="$CEFLAGS `krb4-config --cflags`"
+ CFLAGS="$CFLAGS `krb4-config --cflags`"
LIBS="$LIBS `krb4-config --libs`"
KERBEROS_V4=1
elif krb5-config 2> /dev/null >/dev/null ; then
@@ -588,7 +628,7 @@ elif krb5-config 2> /dev/null >/dev/null ; then
AC_DEFINE(KERBEROS_V4_V5,1,Define if you have Kerberos V4 headers under a kerberosIV directory)
fi
unset krb4_prefix
- CEFLAGS="$CEFLAGS `krb5-config --cflags krb4`"
+ CFLAGS="$CFLAGS `krb5-config --cflags krb4`"
LIBS="$LIBS `krb5-config --libs krb4`"
KERBEROS_V4=1
else
@@ -631,8 +671,8 @@ else
fi
KERBEROS_V4=1
test -f "$with_kerberos5/roken.h" && AC_DEFINE(HEIMDAL)
- test "$dir" != "/usr/include" && CEFLAGS="$CEFLAGS -I$dir"
- LDEFLAGS="$LDEFLAGS -L$with_kerberos/lib"
+ test "$dir" != "/usr/include" && CFLAGS="$CFLAGS -I$dir"
+ LDFLAGS="$LDFLAGS -L$with_kerberos/lib"
break
done
if test -z "$with_kerberos" ; then
@@ -695,22 +735,22 @@ then
then
### ssl.h found under openssl. Use openssl configuration preferentially,
AC_MSG_NOTICE(Enabling OpenSSL support in $with_ssl.)
- test "$with_ssl" != "/usr" && CEFLAGS="$CEFLAGS -I$with_ssl/include"
+ test "$with_ssl" != "/usr" && CFLAGS="$CFLAGS -I$with_ssl/include"
### In Red Hat 9, this file includes a reference to <krb5.h>, so we
### force the Kerberos direcory onto the include path so it will build.
- CEFLAGS="$CEFLAGS -I/usr/kerberos/include"
+ CFLAGS="$CFLAGS -I/usr/kerberos/include"
### OpenBSD comes with ssl headers
else
AC_MSG_ERROR([SSL support enabled, but OpenSSL not found])
fi
- LDEFLAGS="$LDEFLAGS -L$with_ssl/lib"
+ LDFLAGS="$LDFLAGS -L$with_ssl/lib"
LIBS="$LIBS -lssl -lcrypto"
dnl check if -ldl is needed
AC_MSG_CHECKING([for additional library dependencies of SSL])
found=0
save_LIBS="$LIBS"
for i in "" "-ldl" ; do
- LIBS="$LDEFLAGS $save_LIBS $i"
+ LIBS="$LDFLAGS $save_LIBS $i"
AC_LINK_IFELSE([AC_LANG_PROGRAM(,[SSL_library_init()])],[found=1; break])
done
if test $found = 0 ; then
@@ -734,13 +774,13 @@ if test "$with_socks" != no
then
if test "$with_socks" != yes
then
- LDEFLAGS="$LDEFLAGS -L$with_socks"
+ LDFLAGS="$LDFLAGS -L$with_socks"
else
AC_CHECK_LIB(socks, Rconnect,,
AC_MSG_ERROR([could not find libsocks which is needed for built-in SOCKS support]))
fi
AC_DEFINE(HAVE_SOCKS,1,Define if you want built-in SOCKS support)
- CEFLAGS="$CEFLAGS -Dconnect=Rconnect -Dgetsockname=Rgetsockname -Dbind=Rbind -Daccept=Raccept -Dlisten=Rlisten -Dselect=Rselect"
+ CFLAGS="$CFLAGS -Dconnect=Rconnect -Dgetsockname=Rgetsockname -Dbind=Rbind -Daccept=Raccept -Dlisten=Rlisten -Dselect=Rselect"
LIBS="-lsocks $LIBS"
fi])
@@ -752,14 +792,14 @@ if test "$with_socks5" != no
then
if test "$with_socks5" != yes
then
- LDEFLAGS="$LDEFLAGS -L$with_socks5"
+ LDFLAGS="$LDFLAGS -L$with_socks5"
fi
ac_savedLDFLAGS="$LDFLAGS"
- LDFLAGS="$LDEFLAGS $LDFLAGS"
+ LDFLAGS="$LDFLAGS $LDFLAGS"
AC_CHECK_LIB(socks5, SOCKSconnect,,
AC_MSG_ERROR([could not find libsocks5 which is needed for built-in SOCKS5 support]))
AC_DEFINE(HAVE_SOCKS)
- CEFLAGS="$CEFLAGS -Dconnect=SOCKSconnect -Dgetsockname=SOCKSgetsockname -Dbind=SOCKSbind -Daccept=SOCKSaccept -Dlisten=SOCKSlisten -Dselect=SOCKSselect -Drecvfrom=SOCKSrecvfrom -Dsendto=SOCKSsendto -Drecv=SOCKSrecv -Dsend=SOCKSsend -Dread=SOCKSread -Dwrite=SOCKSwrite -Drresvport=SOCKSrresvport -Dshutdown=SOCKSshutdown -Dlisten=SOCKSlisten -Dclose=SOCKSclose -Ddup=SOCKSdup -Ddup2=SOCKSdup2 -Dgethostbyname=SOCKSgethostbyname"
+ CFLAGS="$CFLAGS -Dconnect=SOCKSconnect -Dgetsockname=SOCKSgetsockname -Dbind=SOCKSbind -Daccept=SOCKSaccept -Dlisten=SOCKSlisten -Dselect=SOCKSselect -Drecvfrom=SOCKSrecvfrom -Dsendto=SOCKSsendto -Drecv=SOCKSrecv -Dsend=SOCKSsend -Dread=SOCKSread -Dwrite=SOCKSwrite -Drresvport=SOCKSrresvport -Dshutdown=SOCKSshutdown -Dlisten=SOCKSlisten -Dclose=SOCKSclose -Ddup=SOCKSdup -Ddup2=SOCKSdup2 -Dgethostbyname=SOCKSgethostbyname"
AC_CHECK_FUNC(SOCKSfclose, [CFLAGS="$CFLAGS -Dfclose=SOCKSfclose"])
LDFLAGS="$ac_savedLDFLAGS"
fi])
@@ -816,7 +856,7 @@ then
fi
AC_DEFINE(GSSAPI,1,Define if you want GSSAPI authentication)
if test "$with_gssapi" != yes ; then
- CPPFLAGS="-I$with_gssapi/include"
+ CPPFLAGS="$CPPFLAGS-I$with_gssapi/include"
fi
AC_CHECK_HEADERS(gss.h gssapi.h gssapi/gssapi.h gssapi/gssapi_generic.h)
if test "$ac_cv_header_gssapi_h" = "yes"; then
@@ -826,10 +866,6 @@ then
fi
fi])
-AC_SUBST(CPFLAGS)
-AC_SUBST(CEFLAGS)
-AC_SUBST(LDEFLAGS)
-
dnl ,------------------------------------------------------------------
dnl Check if we need TRIO
needtrio=0
diff --git a/libesmtp/gethostbyname.c b/libesmtp/gethostbyname.c
index 2e3beefc..cd74ec0a 100644
--- a/libesmtp/gethostbyname.c
+++ b/libesmtp/gethostbyname.c
@@ -201,7 +201,7 @@ h_error_ctx (struct ghbnctx *ctx)
#else
void
-free_ghbnctx (struct ghbnctx *ctx __attribute__ ((unused)))
+free_ghbnctx (struct ghbnctx *ctx )
{
assert (ctx != NULL);
}
diff --git a/m4/gethostbyname_r.m4 b/m4/gethostbyname_r.m4
index 18fb325d..94f36dba 100644
--- a/m4/gethostbyname_r.m4
+++ b/m4/gethostbyname_r.m4
@@ -17,7 +17,7 @@ dnl
AC_DEFUN([ACX_WHICH_GETHOSTBYNAME_R],
[AC_CACHE_CHECK(number of arguments to gethostbyname_r,
acx_which_gethostbyname_r, [
- AC_TRY_COMPILE([
+ AC_TRY_LINK([
# include <netdb.h>
], [
@@ -29,7 +29,7 @@ AC_DEFUN([ACX_WHICH_GETHOSTBYNAME_R],
],acx_which_gethostbyname_r=3,
[
dnl acx_which_gethostbyname_r=0
- AC_TRY_COMPILE([
+ AC_TRY_LINK([
# include <netdb.h>
], [
char *name;
@@ -42,7 +42,7 @@ dnl acx_which_gethostbyname_r=0
[
dnl acx_which_gethostbyname_r=0
- AC_TRY_COMPILE([
+ AC_TRY_LINK([
# include <netdb.h>
], [
char *name;
diff --git a/smbencrypt.c b/smbencrypt.c
index b596587d..8d12f0ca 100644
--- a/smbencrypt.c
+++ b/smbencrypt.c
@@ -35,8 +35,8 @@ extern int DEBUGLEVEL;
#ifndef _AIX
typedef unsigned char uchar;
-#endif
typedef signed short int16;
+#endif
typedef int BOOL;
#define False 0
#define True 1