Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 1b09630

Browse files
committed
Fix configure probe for sys/ucred.h.
The configure script's test for <sys/ucred.h> did not work on OpenBSD, because on that platform <sys/param.h> has to be included first. As a result, socket peer authentication was disabled on that platform. Problem introduced in commit be4585b. Andres Freund, slightly simplified by me.
1 parent 76a7650 commit 1b09630

File tree

2 files changed

+83
-7
lines changed

2 files changed

+83
-7
lines changed

configure

Lines changed: 72 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10351,8 +10351,7 @@ done
1035110351

1035210352

1035310353

10354-
10355-
for ac_header in crypt.h dld.h fp_class.h getopt.h ieeefp.h ifaddrs.h langinfo.h poll.h pwd.h sys/ioctl.h sys/ipc.h sys/poll.h sys/pstat.h sys/resource.h sys/select.h sys/sem.h sys/shm.h sys/socket.h sys/sockio.h sys/tas.h sys/time.h sys/ucred.h sys/un.h termios.h ucred.h utime.h wchar.h wctype.h
10354+
for ac_header in crypt.h dld.h fp_class.h getopt.h ieeefp.h ifaddrs.h langinfo.h poll.h pwd.h sys/ioctl.h sys/ipc.h sys/poll.h sys/pstat.h sys/resource.h sys/select.h sys/sem.h sys/shm.h sys/socket.h sys/sockio.h sys/tas.h sys/time.h sys/un.h termios.h ucred.h utime.h wchar.h wctype.h
1035610355
do
1035710356
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
1035810357
if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
@@ -10503,7 +10502,7 @@ fi
1050310502
done
1050410503

1050510504

10506-
# On BSD, cpp test for net/if.h will fail unless sys/socket.h
10505+
# On BSD, test for net/if.h will fail unless sys/socket.h
1050710506
# is included first.
1050810507

1050910508
for ac_header in net/if.h
@@ -10572,7 +10571,74 @@ fi
1057210571
done
1057310572

1057410573

10575-
# At least on IRIX, cpp test for netinet/tcp.h will fail unless
10574+
# On OpenBSD, test for sys/ucred.h will fail unless sys/param.h
10575+
# is included first.
10576+
10577+
for ac_header in sys/ucred.h
10578+
do
10579+
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
10580+
{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
10581+
$as_echo_n "checking for $ac_header... " >&6; }
10582+
if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
10583+
$as_echo_n "(cached) " >&6
10584+
else
10585+
cat >conftest.$ac_ext <<_ACEOF
10586+
/* confdefs.h. */
10587+
_ACEOF
10588+
cat confdefs.h >>conftest.$ac_ext
10589+
cat >>conftest.$ac_ext <<_ACEOF
10590+
/* end confdefs.h. */
10591+
$ac_includes_default
10592+
#include <sys/param.h>
10593+
10594+
10595+
#include <$ac_header>
10596+
_ACEOF
10597+
rm -f conftest.$ac_objext
10598+
if { (ac_try="$ac_compile"
10599+
case "(($ac_try" in
10600+
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
10601+
*) ac_try_echo=$ac_try;;
10602+
esac
10603+
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
10604+
$as_echo "$ac_try_echo") >&5
10605+
(eval "$ac_compile") 2>conftest.er1
10606+
ac_status=$?
10607+
grep -v '^ *+' conftest.er1 >conftest.err
10608+
rm -f conftest.er1
10609+
cat conftest.err >&5
10610+
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
10611+
(exit $ac_status); } && {
10612+
test -z "$ac_c_werror_flag" ||
10613+
test ! -s conftest.err
10614+
} && test -s conftest.$ac_objext; then
10615+
eval "$as_ac_Header=yes"
10616+
else
10617+
$as_echo "$as_me: failed program was:" >&5
10618+
sed 's/^/| /' conftest.$ac_ext >&5
10619+
10620+
eval "$as_ac_Header=no"
10621+
fi
10622+
10623+
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
10624+
fi
10625+
ac_res=`eval 'as_val=${'$as_ac_Header'}
10626+
$as_echo "$as_val"'`
10627+
{ $as_echo "$as_me:$LINENO: result: $ac_res" >&5
10628+
$as_echo "$ac_res" >&6; }
10629+
as_val=`eval 'as_val=${'$as_ac_Header'}
10630+
$as_echo "$as_val"'`
10631+
if test "x$as_val" = x""yes; then
10632+
cat >>confdefs.h <<_ACEOF
10633+
#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
10634+
_ACEOF
10635+
10636+
fi
10637+
10638+
done
10639+
10640+
10641+
# At least on IRIX, test for netinet/tcp.h will fail unless
1057610642
# netinet/in.h is included first.
1057710643

1057810644
for ac_header in netinet/in.h
@@ -17815,6 +17881,7 @@ cat confdefs.h >>conftest.$ac_ext
1781517881
cat >>conftest.$ac_ext <<_ACEOF
1781617882
/* end confdefs.h. */
1781717883
#include <sys/socket.h>
17884+
#include <sys/param.h>
1781817885
#ifdef HAVE_SYS_UCRED_H
1781917886
#include <sys/ucred.h>
1782017887
#endif
@@ -17853,6 +17920,7 @@ cat confdefs.h >>conftest.$ac_ext
1785317920
cat >>conftest.$ac_ext <<_ACEOF
1785417921
/* end confdefs.h. */
1785517922
#include <sys/socket.h>
17923+
#include <sys/param.h>
1785617924
#ifdef HAVE_SYS_UCRED_H
1785717925
#include <sys/ucred.h>
1785817926
#endif

configure.in

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -982,9 +982,9 @@ AC_SUBST(OSSP_UUID_LIBS)
982982
##
983983

984984
dnl sys/socket.h is required by AC_FUNC_ACCEPT_ARGTYPES
985-
AC_CHECK_HEADERS([crypt.h dld.h fp_class.h getopt.h ieeefp.h ifaddrs.h langinfo.h poll.h pwd.h sys/ioctl.h sys/ipc.h sys/poll.h sys/pstat.h sys/resource.h sys/select.h sys/sem.h sys/shm.h sys/socket.h sys/sockio.h sys/tas.h sys/time.h sys/ucred.h sys/un.h termios.h ucred.h utime.h wchar.h wctype.h])
985+
AC_CHECK_HEADERS([crypt.h dld.h fp_class.h getopt.h ieeefp.h ifaddrs.h langinfo.h poll.h pwd.h sys/ioctl.h sys/ipc.h sys/poll.h sys/pstat.h sys/resource.h sys/select.h sys/sem.h sys/shm.h sys/socket.h sys/sockio.h sys/tas.h sys/time.h sys/un.h termios.h ucred.h utime.h wchar.h wctype.h])
986986

987-
# On BSD, cpp test for net/if.h will fail unless sys/socket.h
987+
# On BSD, test for net/if.h will fail unless sys/socket.h
988988
# is included first.
989989
AC_CHECK_HEADERS(net/if.h, [], [],
990990
[AC_INCLUDES_DEFAULT
@@ -993,7 +993,14 @@ AC_CHECK_HEADERS(net/if.h, [], [],
993993
#endif
994994
])
995995

996-
# At least on IRIX, cpp test for netinet/tcp.h will fail unless
996+
# On OpenBSD, test for sys/ucred.h will fail unless sys/param.h
997+
# is included first.
998+
AC_CHECK_HEADERS(sys/ucred.h, [], [],
999+
[AC_INCLUDES_DEFAULT
1000+
#include <sys/param.h>
1001+
])
1002+
1003+
# At least on IRIX, test for netinet/tcp.h will fail unless
9971004
# netinet/in.h is included first.
9981005
AC_CHECK_HEADERS(netinet/in.h)
9991006
AC_CHECK_HEADERS(netinet/tcp.h, [], [],
@@ -1133,6 +1140,7 @@ PGAC_TYPE_LOCALE_T
11331140

11341141
AC_CHECK_TYPES([struct cmsgcred], [], [],
11351142
[#include <sys/socket.h>
1143+
#include <sys/param.h>
11361144
#ifdef HAVE_SYS_UCRED_H
11371145
#include <sys/ucred.h>
11381146
#endif])

0 commit comments

Comments
 (0)