]> granicus.if.org Git - sudo/commitdiff
Do check for inet_pton before inet_ntop since we may need to record
authorTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 30 Jun 2015 16:57:42 +0000 (10:57 -0600)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 30 Jun 2015 16:57:42 +0000 (10:57 -0600)
dependent libraries for inet_pton when linking our getaddrinfo
replacement.

configure
configure.ac

index 29d6ab2327ec62548ea0ed9c90e7566d62416250..f830f3b044ab32e060a140d076ea52649b0e2f2d 100755 (executable)
--- a/configure
+++ b/configure
@@ -20265,11 +20265,12 @@ LIBS="$OLIBS"
 OLIBS="$LIBS"
 LIBS="${LIBS} ${NET_LIBS}"
 found=false
-ac_fn_c_check_func "$LINENO" "inet_ntop" "ac_cv_func_inet_ntop"
-if test "x$ac_cv_func_inet_ntop" = xyes; then :
+INET_PTON_LIBS=
+ac_fn_c_check_func "$LINENO" "inet_pton" "ac_cv_func_inet_pton"
+if test "x$ac_cv_func_inet_pton" = xyes; then :
 
     found=true
-    $as_echo "#define HAVE_INET_NTOP 1" >>confdefs.h
+    $as_echo "#define HAVE_INET_PTON 1" >>confdefs.h
 
 
 else
@@ -20288,9 +20289,9 @@ else
        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_ntop in -l$lib${5+ }$extralibs" >&5
-$as_echo_n "checking for inet_ntop in -l$lib${5+ }$extralibs... " >&6; }
-    if { as_var=sudo_cv_lib_$lib''_inet_ntop$_sudo_check_lib_extras; eval \${$as_var+:} false; }; then :
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inet_pton in -l$lib${5+ }$extralibs" >&5
+$as_echo_n "checking for inet_pton in -l$lib${5+ }$extralibs... " >&6; }
+    if { as_var=sudo_cv_lib_$lib''_inet_pton$_sudo_check_lib_extras; eval \${$as_var+:} false; }; then :
   $as_echo_n "(cached) " >&6
 else
 
@@ -20305,19 +20306,19 @@ else
 #ifdef __cplusplus
 extern "C"
 #endif
-char inet_ntop ();
+char inet_pton ();
 int
 main ()
 {
-return inet_ntop ();
+return inet_pton ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  eval sudo_cv_lib_$lib''_inet_ntop$_sudo_check_lib_extras=yes
+  eval sudo_cv_lib_$lib''_inet_pton$_sudo_check_lib_extras=yes
 else
-  eval sudo_cv_lib_$lib''_inet_ntop$_sudo_check_lib_extras=no
+  eval sudo_cv_lib_$lib''_inet_pton$_sudo_check_lib_extras=no
 
 fi
 rm -f core conftest.err conftest.$ac_objext \
@@ -20326,14 +20327,15 @@ rm -f core conftest.err conftest.$ac_objext \
 
 fi
 
-    if eval test \$sudo_cv_lib_$lib''_inet_ntop$_sudo_check_lib_extras = "yes"; then
+    if eval test \$sudo_cv_lib_$lib''_inet_pton$_sudo_check_lib_extras = "yes"; then
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 
            found=true
-           $as_echo "#define HAVE_INET_NTOP 1" >>confdefs.h
+           $as_echo "#define HAVE_INET_PTON 1" >>confdefs.h
 
            NET_LIBS="${NET_LIBS} $libs"
+           INET_PTON_LIBS="$libs"
            break
 
     else
 LIBS="$OLIBS"
 if test X"$found" != X"true"; then
     case " $LIBOBJS " in
-  *" inet_ntop.$ac_objext "* ) ;;
-  *) LIBOBJS="$LIBOBJS inet_ntop.$ac_objext"
+  *" inet_pton.$ac_objext "* ) ;;
+  *) LIBOBJS="$LIBOBJS inet_pton.$ac_objext"
  ;;
 esac
 
 
-    for _sym in sudo_inet_ntop; do
+    for _sym in sudo_inet_pton; do
        COMPAT_EXP="${COMPAT_EXP}${_sym}
 "
     done
 OLIBS="$LIBS"
 LIBS="${LIBS} ${NET_LIBS}"
 found=false
-INET_PTON_LIBS=
-ac_fn_c_check_func "$LINENO" "inet_pton" "ac_cv_func_inet_pton"
-if test "x$ac_cv_func_inet_pton" = xyes; then :
+ac_fn_c_check_func "$LINENO" "inet_ntop" "ac_cv_func_inet_ntop"
+if test "x$ac_cv_func_inet_ntop" = xyes; then :
 
     found=true
-    $as_echo "#define HAVE_INET_PTON 1" >>confdefs.h
+    $as_echo "#define HAVE_INET_NTOP 1" >>confdefs.h
 
 
 else
@@ -20388,9 +20389,9 @@ else
        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_pton in -l$lib${5+ }$extralibs" >&5
-$as_echo_n "checking for inet_pton in -l$lib${5+ }$extralibs... " >&6; }
-    if { as_var=sudo_cv_lib_$lib''_inet_pton$_sudo_check_lib_extras; eval \${$as_var+:} false; }; then :
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inet_ntop in -l$lib${5+ }$extralibs" >&5
+$as_echo_n "checking for inet_ntop in -l$lib${5+ }$extralibs... " >&6; }
+    if { as_var=sudo_cv_lib_$lib''_inet_ntop$_sudo_check_lib_extras; eval \${$as_var+:} false; }; then :
   $as_echo_n "(cached) " >&6
 else
 
@@ -20405,19 +20406,19 @@ else
 #ifdef __cplusplus
 extern "C"
 #endif
-char inet_pton ();
+char inet_ntop ();
 int
 main ()
 {
-return inet_pton ();
+return inet_ntop ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  eval sudo_cv_lib_$lib''_inet_pton$_sudo_check_lib_extras=yes
+  eval sudo_cv_lib_$lib''_inet_ntop$_sudo_check_lib_extras=yes
 else
-  eval sudo_cv_lib_$lib''_inet_pton$_sudo_check_lib_extras=no
+  eval sudo_cv_lib_$lib''_inet_ntop$_sudo_check_lib_extras=no
 
 fi
 rm -f core conftest.err conftest.$ac_objext \
@@ -20426,15 +20427,14 @@ rm -f core conftest.err conftest.$ac_objext \
 
 fi
 
-    if eval test \$sudo_cv_lib_$lib''_inet_pton$_sudo_check_lib_extras = "yes"; then
+    if eval test \$sudo_cv_lib_$lib''_inet_ntop$_sudo_check_lib_extras = "yes"; then
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 
            found=true
-           $as_echo "#define HAVE_INET_PTON 1" >>confdefs.h
+           $as_echo "#define HAVE_INET_NTOP 1" >>confdefs.h
 
            NET_LIBS="${NET_LIBS} $libs"
-           INET_PTON_LIBS="$libs"
            break
 
     else
 LIBS="$OLIBS"
 if test X"$found" != X"true"; then
     case " $LIBOBJS " in
-  *" inet_pton.$ac_objext "* ) ;;
-  *) LIBOBJS="$LIBOBJS inet_pton.$ac_objext"
+  *" inet_ntop.$ac_objext "* ) ;;
+  *) LIBOBJS="$LIBOBJS inet_ntop.$ac_objext"
  ;;
 esac
 
 
-    for _sym in sudo_inet_pton; do
+    for _sym in sudo_inet_ntop; do
        COMPAT_EXP="${COMPAT_EXP}${_sym}
 "
     done
index 5298870b53aee7a6948ba1849ebcdc27bbe57f3a..f29c03cf4ec28ec8b17cd23d44e6f690f96d4cc0 100644 (file)
@@ -2761,16 +2761,17 @@ AC_CHECK_FUNC([socket], [], [
 ])
 LIBS="$OLIBS"
 dnl
-dnl If inet_ntop(3) not in libc, check -lnsl and -linet
+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_ntop() in libresolv.
+dnl Some systems may have inet_pton() in libresolv.
 dnl
 OLIBS="$LIBS"
 LIBS="${LIBS} ${NET_LIBS}"
 found=false
-AC_CHECK_FUNC([inet_ntop], [
+INET_PTON_LIBS=
+AC_CHECK_FUNC([inet_pton], [
     found=true
-    AC_DEFINE(HAVE_INET_NTOP)
+    AC_DEFINE(HAVE_INET_PTON)
 ], [
     for libs in "-lsocket" "-linet" "-lsocket -lnsl" "-lresolv"; do
        _libs=
@@ -2784,31 +2785,31 @@ AC_CHECK_FUNC([inet_ntop], [
        test -z "$libs" && continue
        lib="`echo \"$libs\"|sed -e 's/^-l//' -e 's/ .*$//'`"
        extralibs="`echo \"$libs\"|sed 's/^-l[[^ ]]*//'`"
-       SUDO_CHECK_LIB($lib, inet_ntop, [
+       SUDO_CHECK_LIB($lib, inet_pton, [
            found=true
-           AC_DEFINE(HAVE_INET_NTOP)
+           AC_DEFINE(HAVE_INET_PTON)
            NET_LIBS="${NET_LIBS} $libs"
+           INET_PTON_LIBS="$libs"
            break
        ], [], [$extralibs])
     done
 ])
 LIBS="$OLIBS"
 if test X"$found" != X"true"; then
-    AC_LIBOBJ(inet_ntop)
-    SUDO_APPEND_COMPAT_EXP(sudo_inet_ntop)
+    AC_LIBOBJ(inet_pton)
+    SUDO_APPEND_COMPAT_EXP(sudo_inet_pton)
 fi
 dnl
-dnl If inet_pton(3) not in libc, check -lnsl and -linet
+dnl If inet_ntop(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.
+dnl Some systems may have inet_ntop() in libresolv.
 dnl
 OLIBS="$LIBS"
 LIBS="${LIBS} ${NET_LIBS}"
 found=false
-INET_PTON_LIBS=
-AC_CHECK_FUNC([inet_pton], [
+AC_CHECK_FUNC([inet_ntop], [
     found=true
-    AC_DEFINE(HAVE_INET_PTON)
+    AC_DEFINE(HAVE_INET_NTOP)
 ], [
     for libs in "-lsocket" "-linet" "-lsocket -lnsl" "-lresolv"; do
        _libs=
@@ -2822,19 +2823,18 @@ AC_CHECK_FUNC([inet_pton], [
        test -z "$libs" && continue
        lib="`echo \"$libs\"|sed -e 's/^-l//' -e 's/ .*$//'`"
        extralibs="`echo \"$libs\"|sed 's/^-l[[^ ]]*//'`"
-       SUDO_CHECK_LIB($lib, inet_pton, [
+       SUDO_CHECK_LIB($lib, inet_ntop, [
            found=true
-           AC_DEFINE(HAVE_INET_PTON)
+           AC_DEFINE(HAVE_INET_NTOP)
            NET_LIBS="${NET_LIBS} $libs"
-           INET_PTON_LIBS="$libs"
            break
        ], [], [$extralibs])
     done
 ])
 LIBS="$OLIBS"
 if test X"$found" != X"true"; then
-    AC_LIBOBJ(inet_pton)
-    SUDO_APPEND_COMPAT_EXP(sudo_inet_pton)
+    AC_LIBOBJ(inet_ntop)
+    SUDO_APPEND_COMPAT_EXP(sudo_inet_ntop)
 fi
 dnl
 dnl If syslog(3) not in libc, check -lsocket, -lnsl and -linet