diff --git a/config.h.in b/config.h.in index 729afa8fe..52ffd8b6c 100644 --- a/config.h.in +++ b/config.h.in @@ -262,6 +262,9 @@ /* Define to 1 if your Kerberos is Heimdal. */ #undef HAVE_HEIMDAL +/* Define to 1 if you have the `inet_ntoa' function. */ +#undef HAVE_INET_NTOA + /* Define to 1 if you have the `inet_pton' function. */ #undef HAVE_INET_PTON diff --git a/configure b/configure index 86728e24b..62716d837 100755 --- a/configure +++ b/configure @@ -636,10 +636,10 @@ ac_includes_default="\ ac_c_werror_flag= ac_subst_vars='LTLIBOBJS KRB5CONFIG -LIBOBJS FLEX YFLAGS YACC +LIBOBJS NROFFPROG MANDOCPROG TRPROG @@ -14262,7 +14262,20 @@ case "$host" in RTLD_PRELOAD_DELIM=" " # getcwd(3) opens a pipe to getpwd(1)!?! - BROKEN_GETCWD=1 + ac_fn_c_check_func "$LINENO" "getcwd" "ac_cv_func_getcwd" +if test "x$ac_cv_func_getcwd" = xyes; then : + $as_echo "#define HAVE_GETCWD 1" >>confdefs.h + +else + case " $LIBOBJS " in + *" getcwd.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS getcwd.$ac_objext" + ;; +esac + +fi + + # system headers lack prototypes but gcc helps... if test -n "$GCC"; then @@ -17804,22 +17817,6 @@ done fi done -fi -if test -z "$BROKEN_GETCWD"; then - ac_fn_c_check_func "$LINENO" "getcwd" "ac_cv_func_getcwd" -if test "x$ac_cv_func_getcwd" = xyes; then : - $as_echo "#define HAVE_GETCWD 1" >>confdefs.h - -else - case " $LIBOBJS " in - *" getcwd.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS getcwd.$ac_objext" - ;; -esac - -fi - - fi for ac_func in lockf flock do : @@ -18932,6 +18929,84 @@ $as_echo "no" >&6; } fi +ac_fn_c_check_func "$LINENO" "inet_ntoa" "ac_cv_func_inet_ntoa" +if test "x$ac_cv_func_inet_ntoa" = xyes; then : + $as_echo "#define HAVE_INET_NTOA 1" >>confdefs.h + +else + + for libs in "-lsocket" "-linet" "-lsocket -lnsl" "-lresolv"; do + _libs= + for lib in $libs; do + case "$NET_LIBS" in + *"$lib"*) ;; + *) _libs="$_libs $lib";; + esac + done + libs="${_libs# }" + test -z "$libs" && continue + lib="`echo \"$libs\"|sed -e 's/^-l//' -e 's/ .*$//'`" + extralibs="`echo \"$libs\"|sed 's/^-l[^ ]*//'`" + + _sudo_check_lib_extras=`echo "$extralibs"|sed -e 's/ *//g' -e 's/-l/_/g'` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inet_ntoa in -l$lib${5+ }$extralibs" >&5 +$as_echo_n "checking for inet_ntoa in -l$lib${5+ }$extralibs... " >&6; } + if { as_var=sudo_cv_lib_$lib''_inet_ntoa$_sudo_check_lib_extras; eval \${$as_var+:} false; }; then : + $as_echo_n "(cached) " >&6 +else + + SUDO_CHECK_LIB_OLIBS="$LIBS" + LIBS="$LIBS -l$lib${5+ }$extralibs" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char inet_ntoa (); +int +main () +{ +return inet_ntoa (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval sudo_cv_lib_$lib''_inet_ntoa$_sudo_check_lib_extras=yes +else + eval sudo_cv_lib_$lib''_inet_ntoa$_sudo_check_lib_extras=no + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LIBS="$SUDO_CHECK_LIB_OLIBS" + +fi + + if eval test \$sudo_cv_lib_$lib''_inet_ntoa$_sudo_check_lib_extras = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + + $as_echo "#define HAVE_INET_NTOA 1" >>confdefs.h + + NET_LIBS="${NET_LIBS} $libs" + LIBS="${LIBS} $libs" + break + + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + + fi + + done + +fi + ac_fn_c_check_func "$LINENO" "inet_pton" "ac_cv_func_inet_pton" if test "x$ac_cv_func_inet_pton" = xyes; then : $as_echo "#define HAVE_INET_PTON 1" >>confdefs.h @@ -24964,5 +25039,6 @@ fi + diff --git a/configure.ac b/configure.ac index c69eb531d..2972c5c3b 100644 --- a/configure.ac +++ b/configure.ac @@ -1637,7 +1637,7 @@ case "$host" in RTLD_PRELOAD_DELIM=" " # getcwd(3) opens a pipe to getpwd(1)!?! - BROKEN_GETCWD=1 + AC_REPLACE_FUNCS(getcwd) # system headers lack prototypes but gcc helps... if test -n "$GCC"; then @@ -2455,9 +2455,6 @@ AC_CHECK_FUNCS(seteuid) if test X"$with_interfaces" != X"no"; then AC_CHECK_FUNCS(getifaddrs, [AC_CHECK_FUNCS(freeifaddrs)]) fi -if test -z "$BROKEN_GETCWD"; then - AC_REPLACE_FUNCS(getcwd) -fi AC_CHECK_FUNCS(lockf flock, [break]) AC_CHECK_FUNCS(innetgr _innetgr, [AC_CHECK_FUNCS(getdomainname) [break]]) AC_CHECK_FUNCS(utimes, [AC_CHECK_FUNCS(futimes futimesat, [break])], [AC_CHECK_FUNCS(futime) AC_LIBOBJ(utimes)]) @@ -2597,6 +2594,32 @@ AC_CHECK_FUNC(socket, [], [ done ]) dnl +dnl If inet_ntoa(3) not in libc, check -lnsl and -linet +dnl May need to link with *both* -lnsl and -lsocket due to unresolved symbols +dnl Some systems may have inet_ntoa() in libresolv. +dnl +AC_CHECK_FUNC(inet_ntoa, [AC_DEFINE(HAVE_INET_NTOA)], [ + for libs in "-lsocket" "-linet" "-lsocket -lnsl" "-lresolv"; do + _libs= + for lib in $libs; do + case "$NET_LIBS" in + *"$lib"*) ;; + *) _libs="$_libs $lib";; + esac + done + libs="${_libs# }" + test -z "$libs" && continue + lib="`echo \"$libs\"|sed -e 's/^-l//' -e 's/ .*$//'`" + extralibs="`echo \"$libs\"|sed 's/^-l[[^ ]]*//'`" + SUDO_CHECK_LIB($lib, inet_ntoa, [ + AC_DEFINE(HAVE_INET_NTOA) + NET_LIBS="${NET_LIBS} $libs" + LIBS="${LIBS} $libs" + break + ], [], [$extralibs]) + done +]) +dnl dnl If inet_pton(3) not in libc, check -lnsl and -linet dnl May need to link with *both* -lnsl and -lsocket due to unresolved symbols dnl Some systems may have inet_pton() in libresolv. @@ -3923,6 +3946,7 @@ AH_TEMPLATE(HAVE_GETSPNAM, [Define to 1 if you have the `getspnam' function (SVR AH_TEMPLATE(HAVE_GETSPWUID, [Define to 1 if you have the `getspwuid' function. (HP-UX <= 9.X shadow passwords).]) AH_TEMPLATE(HAVE_GSS_KRB5_CCACHE_NAME, [Define to 1 if you have the `gss_krb5_ccache_name' function.]) AH_TEMPLATE(HAVE_HEIMDAL, [Define to 1 if your Kerberos is Heimdal.]) +AH_TEMPLATE(HAVE_INET_NTOA, [Define to 1 if you have the `inet_ntoa' function.]) AH_TEMPLATE(HAVE_INET_PTON, [Define to 1 if you have the `inet_pton' function.]) AH_TEMPLATE(HAVE_ISCOMSEC, [Define to 1 if you have the `iscomsec' function. (HP-UX >= 10.x check for shadow enabled).]) AH_TEMPLATE(HAVE_ISSECURE, [Define to 1 if you have the `issecure' function. (SunOS 4.x check for shadow enabled).]) diff --git a/plugins/sudoers/Makefile.in b/plugins/sudoers/Makefile.in index b0c67df6b..ec86342b9 100644 --- a/plugins/sudoers/Makefile.in +++ b/plugins/sudoers/Makefile.in @@ -53,7 +53,7 @@ LT_LIBS = $(top_builddir)/lib/util/libsudo_util.la LIBS = $(LT_LIBS) @LIBINTL@ NET_LIBS = @NET_LIBS@ SUDOERS_LIBS = @SUDOERS_LIBS@ @AFS_LIBS@ @GETGROUPS_LIB@ $(LIBS) $(NET_LIBS) @ZLIB@ @LIBMD@ -REPLAY_LIBS = @REPLAY_LIBS@ @ZLIB@ +REPLAY_LIBS = @REPLAY_LIBS@ $(NET_LIBS) @ZLIB@ VISUDO_LIBS = $(NET_LIBS) @LIBMD@ TESTSUDOERS_LIBS = $(NET_LIBS) @LIBMD@