Check for hes_getmailhost before trying to call it. It's not in the libc

hesiod, and it looks as if it's a deprecated feature.

This in turn will make the mail notify tool not understand Hesiod
mailserver records on NetBSD and probably anyone else with a builtin
hesiod. If anyone really really wants that functionality, set
PREFER.hesiod=pkgsrc and let it build and link to the pkgsrc hesiod
library...

Fixes the build of zephyr.
This commit is contained in:
dholland 2011-10-08 06:17:40 +00:00
parent 62152fa16b
commit 19e2797c0e
5 changed files with 126 additions and 8 deletions

View file

@ -1,10 +1,11 @@
$NetBSD: distinfo,v 1.7 2011/10/08 05:56:00 dholland Exp $
$NetBSD: distinfo,v 1.8 2011/10/08 06:17:40 dholland Exp $
SHA1 (zephyr-20010518.tar.gz) = cd2fca9c2f0bfaa8e69c94813bedc87d66d3ac1c
RMD160 (zephyr-20010518.tar.gz) = 1082db0df40e4ac1007e4b2b4f8adc15cf8a8ab0
Size (zephyr-20010518.tar.gz) = 342259 bytes
SHA1 (patch-aa) = f4338f0da9085e1780c52c9b2be2366b7a0f22c2
SHA1 (patch-ab) = 61cbadf511806c1c16e489ac6d14de347b09277a
SHA1 (patch-acconfig_h) = 7cbee0e8cd977fcb714b58bb0e9fb99b52cc5637
SHA1 (patch-aclocal_m4) = 5414d637ec7de322cbf27c211345df241a914df1
SHA1 (patch-ad) = b0f8c408afc2e7fe9a673a5f2ec562a3e34e225c
SHA1 (patch-ae) = e0d0776b891db5b8542285899e22c886337cc6c7
@ -16,5 +17,6 @@ SHA1 (patch-aj) = 3ec4b1624e2eecefe129ac53e870ce2fb2bce236
SHA1 (patch-ak) = 7c2084aac1e4b30124c380fbc369cb6a6b41eb17
SHA1 (patch-al) = d61151a84bb9a55c21b2d757650064390127f8c8
SHA1 (patch-am) = 40fc00c67f78485b0d45a86ab97aa8ae662dda40
SHA1 (patch-an) = 94556f92c2d00b4a9d26a230259e28d72b70a1f4
SHA1 (patch-configure) = bc6604cfa9aa8f652336165e0bbe0e02686e1a88
SHA1 (patch-an) = b7e52657c77435fe7f263ecb36546dce55ca3504
SHA1 (patch-configure) = 92bd3d15eda54a0eea48af347acabf32bbb92564
SHA1 (patch-configure_in) = 7080333e26de0ce0d7cf3fb802b0a42ffeece118

View file

@ -0,0 +1,16 @@
$NetBSD: patch-acconfig_h,v 1.1 2011/10/08 06:17:40 dholland Exp $
Check for HES_GETMAILHOST before using it.
--- acconfig.h~ 1998-12-01 16:48:27.000000000 +0000
+++ acconfig.h
@@ -1,6 +1,9 @@
/* Define to compile with Hesiod support. */
#undef HAVE_HESIOD
+/* Define if Hesiod has hes_getmailhost. */
+#undef HAVE_HES_GETMAILHOST
+
/* Define to compile with Kerberos support. */
#undef HAVE_KRB4

View file

@ -1,7 +1,28 @@
$NetBSD: patch-an,v 1.1 2009/09/23 13:31:32 tnn Exp $
$NetBSD: patch-an,v 1.2 2011/10/08 06:17:40 dholland Exp $
--- clients/zmailnotify/zmailnotify.c.orig 1997-10-25 23:47:11.000000000 +0200
- check for hes_getmailhost before using it
- avoid conflict with POSIX getline
--- clients/zmailnotify/zmailnotify.c.orig 1997-10-25 21:47:11.000000000 +0000
+++ clients/zmailnotify/zmailnotify.c
@@ -72,7 +72,7 @@ main(argc, argv)
int i,nbytes,retval,uselock;
struct passwd *pwd;
struct _mail mymail;
-#ifdef HAVE_HESIOD
+#ifdef HAVE_HES_GETMAILHOST
struct hes_postoffice *p;
#endif
@@ -104,7 +104,7 @@ main(argc, argv)
(void) sprintf(lockfile,"%s/.maillock",dir);
host = (char *)getenv("MAILHOST");
-#ifdef HAVE_HESIOD
+#ifdef HAVE_HES_GETMAILHOST
if (host == NULL) {
p = hes_getmailhost(user);
if (p != NULL && strcmp(p->po_type, "POP") == 0)
@@ -144,7 +144,7 @@ main(argc, argv)
exit(1);
}

View file

@ -1,6 +1,6 @@
$NetBSD: patch-configure,v 1.1 2011/10/08 05:56:00 dholland Exp $
$NetBSD: patch-configure,v 1.2 2011/10/08 06:17:40 dholland Exp $
Regenerate after patching aclocal.m4.
Regenerate after patching aclocal.m4 and configure.in.
--- configure.orig 2001-05-18 20:41:38.000000000 +0000
+++ configure
@ -60,7 +60,7 @@ Regenerate after patching aclocal.m4.
ac_lib_var=`echo hesiod'_'hes_resolve | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -3389,13 +3435,15 @@ LIBS="$ac_save_LIBS"
@@ -3389,19 +3435,78 @@ LIBS="$ac_save_LIBS"
fi
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
@ -78,3 +78,66 @@ Regenerate after patching aclocal.m4.
cat >> confdefs.h <<\EOF
#define HAVE_HESIOD 1
EOF
fi
+if test "$hesiod" != "no"; then
+ for ac_func in hes_getmailhost
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:3458: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3463 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:3486: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+fi
# Check whether --with-regex or --without-regex was given.
if test "${with_regex+set}" = set; then
withval="$with_regex"

View file

@ -0,0 +1,16 @@
$NetBSD: patch-configure_in,v 1.1 2011/10/08 06:17:40 dholland Exp $
Check for hes_getmailhost before trying to use it.
--- configure.in~ 2000-04-05 14:51:31.000000000 +0000
+++ configure.in
@@ -85,6 +85,9 @@ AC_SUBST(SLIB)
ATHENA_KRB4
ATHENA_HESIOD
+if test "$hesiod" != "no"; then
+ AC_CHECK_FUNCS(hes_getmailhost)
+fi
ATHENA_REGEXP
ATHENA_ARES
ATHENA_UTIL_COM_ERR