From: Todd C. Miller Date: Thu, 9 Jul 2015 16:11:25 +0000 (-0600) Subject: Solaris 2.6 has the prototypes for inet_pton() and inet_ntop() in X-Git-Tag: SUDO_1_8_14^2~14 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=43a57126ea3cb2d16f908824094937543daf3c81;p=sudo Solaris 2.6 has the prototypes for inet_pton() and inet_ntop() in resolv.h. --- diff --git a/config.h.in b/config.h.in index c9b6c64c1..196cfa254 100644 --- a/config.h.in +++ b/config.h.in @@ -975,6 +975,10 @@ */ #undef MAX_UID_T_LEN +/* Define to 1 if resolv.h must be included to get the `inet_ntop' or + `inet_pton' function prototypes. */ +#undef NEED_RESOLV_H + /* Define to 1 if you don't want sudo to prompt for a password by default. */ #undef NO_AUTHENTICATION diff --git a/configure b/configure index 199a544fb..e1929fc19 100755 --- a/configure +++ b/configure @@ -20349,6 +20349,12 @@ $as_echo "yes" >&6; } NET_LIBS="${NET_LIBS} $libs" INET_PTON_LIBS="$libs" + case "$libs" in + *-lresolv*) + $as_echo "#define NEED_RESOLV_H 1" >>confdefs.h + + ;; + esac break else @@ -26790,5 +26796,6 @@ fi + diff --git a/configure.ac b/configure.ac index 062d73c2c..025df9cc1 100644 --- a/configure.ac +++ b/configure.ac @@ -2790,6 +2790,11 @@ AC_CHECK_FUNC([inet_pton], [ AC_DEFINE(HAVE_INET_PTON) NET_LIBS="${NET_LIBS} $libs" INET_PTON_LIBS="$libs" + case "$libs" in + *-lresolv*) + AC_DEFINE(NEED_RESOLV_H) + ;; + esac break ], [], [$extralibs]) done @@ -4336,6 +4341,7 @@ AH_TEMPLATE(HAVE__NSS_INITF_GROUP, [Define to 1 if you have the `_nss_initf_grou AH_TEMPLATE(HAVE___NSS_INITF_GROUP, [Define to 1 if you have the `__nss_initf_group' function.]) AH_TEMPLATE(HAVE__NSS_XBYY_BUF_ALLOC, [Define to 1 if you have the `_nss_XbyY_buf_alloc' function.]) AH_TEMPLATE(HAVE___NSS_XBYY_BUF_ALLOC, [Define to 1 if you have the `__nss_XbyY_buf_alloc' function.]) +AH_TEMPLATE(NEED_RESOLV_H, [Define to 1 if resolv.h must be included to get the `inet_ntop' or `inet_pton' function prototypes.]) AH_TEMPLATE(HAVE_STRNLEN, [Define to 1 if you have the `strnlen' function.]) dnl diff --git a/lib/util/getaddrinfo.c b/lib/util/getaddrinfo.c index 1a24d9d8f..b63640534 100644 --- a/lib/util/getaddrinfo.c +++ b/lib/util/getaddrinfo.c @@ -51,6 +51,10 @@ #include #include +#ifdef NEED_RESOLV_H +# include +# include +#endif /* NEED_RESOLV_H */ #include "sudo_compat.h" #include "compat/getaddrinfo.h" diff --git a/plugins/sudoers/interfaces.c b/plugins/sudoers/interfaces.c index 45019a4c8..8643e3146 100644 --- a/plugins/sudoers/interfaces.c +++ b/plugins/sudoers/interfaces.c @@ -29,6 +29,10 @@ #include #include #include +#ifdef NEED_RESOLV_H +# include +# include +#endif /* NEED_RESOLV_H */ #include #include diff --git a/plugins/sudoers/match_addr.c b/plugins/sudoers/match_addr.c index 91ffa857f..671b39f73 100644 --- a/plugins/sudoers/match_addr.c +++ b/plugins/sudoers/match_addr.c @@ -36,6 +36,10 @@ #include #include #include +#ifdef NEED_RESOLV_H +# include +# include +#endif /* NEED_RESOLV_H */ #include "sudoers.h" #include "interfaces.h" diff --git a/src/net_ifs.c b/src/net_ifs.c index 12961adf9..3f9fe6db2 100644 --- a/src/net_ifs.c +++ b/src/net_ifs.c @@ -67,6 +67,10 @@ struct rtentry; #endif /* _MIPS */ #include #include +#ifdef NEED_RESOLV_H +# include +# include +#endif /* NEED_RESOLV_H */ #include #ifdef HAVE_GETIFADDRS # include