Skip to content

Commit 8714465

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 9f8254c commit 8714465

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
@@ -10110,8 +10110,7 @@ done
1011010110

1011110111

1011210112

10113-
10114-
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
10113+
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
1011510114
do
1011610115
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
1011710116
if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
@@ -10262,7 +10261,7 @@ fi
1026210261
done
1026310262

1026410263

10265-
# On BSD, cpp test for net/if.h will fail unless sys/socket.h
10264+
# On BSD, test for net/if.h will fail unless sys/socket.h
1026610265
# is included first.
1026710266

1026810267
for ac_header in net/if.h
@@ -10331,7 +10330,74 @@ fi
1033110330
done
1033210331

1033310332

10334-
# At least on IRIX, cpp test for netinet/tcp.h will fail unless
10333+
# On OpenBSD, test for sys/ucred.h will fail unless sys/param.h
10334+
# is included first.
10335+
10336+
for ac_header in sys/ucred.h
10337+
do
10338+
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
10339+
{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
10340+
$as_echo_n "checking for $ac_header... " >&6; }
10341+
if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
10342+
$as_echo_n "(cached) " >&6
10343+
else
10344+
cat >conftest.$ac_ext <<_ACEOF
10345+
/* confdefs.h. */
10346+
_ACEOF
10347+
cat confdefs.h >>conftest.$ac_ext
10348+
cat >>conftest.$ac_ext <<_ACEOF
10349+
/* end confdefs.h. */
10350+
$ac_includes_default
10351+
#include <sys/param.h>
10352+
10353+
10354+
#include <$ac_header>
10355+
_ACEOF
10356+
rm -f conftest.$ac_objext
10357+
if { (ac_try="$ac_compile"
10358+
case "(($ac_try" in
10359+
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
10360+
*) ac_try_echo=$ac_try;;
10361+
esac
10362+
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
10363+
$as_echo "$ac_try_echo") >&5
10364+
(eval "$ac_compile") 2>conftest.er1
10365+
ac_status=$?
10366+
grep -v '^ *+' conftest.er1 >conftest.err
10367+
rm -f conftest.er1
10368+
cat conftest.err >&5
10369+
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
10370+
(exit $ac_status); } && {
10371+
test -z "$ac_c_werror_flag" ||
10372+
test ! -s conftest.err
10373+
} && test -s conftest.$ac_objext; then
10374+
eval "$as_ac_Header=yes"
10375+
else
10376+
$as_echo "$as_me: failed program was:" >&5
10377+
sed 's/^/| /' conftest.$ac_ext >&5
10378+
10379+
eval "$as_ac_Header=no"
10380+
fi
10381+
10382+
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
10383+
fi
10384+
ac_res=`eval 'as_val=${'$as_ac_Header'}
10385+
$as_echo "$as_val"'`
10386+
{ $as_echo "$as_me:$LINENO: result: $ac_res" >&5
10387+
$as_echo "$ac_res" >&6; }
10388+
as_val=`eval 'as_val=${'$as_ac_Header'}
10389+
$as_echo "$as_val"'`
10390+
if test "x$as_val" = x""yes; then
10391+
cat >>confdefs.h <<_ACEOF
10392+
#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
10393+
_ACEOF
10394+
10395+
fi
10396+
10397+
done
10398+
10399+
10400+
# At least on IRIX, test for netinet/tcp.h will fail unless
1033510401
# netinet/in.h is included first.
1033610402

1033710403
for ac_header in netinet/in.h
@@ -17277,6 +17343,7 @@ cat confdefs.h >>conftest.$ac_ext
1727717343
cat >>conftest.$ac_ext <<_ACEOF
1727817344
/* end confdefs.h. */
1727917345
#include <sys/socket.h>
17346+
#include <sys/param.h>
1728017347
#ifdef HAVE_SYS_UCRED_H
1728117348
#include <sys/ucred.h>
1728217349
#endif
@@ -17315,6 +17382,7 @@ cat confdefs.h >>conftest.$ac_ext
1731517382
cat >>conftest.$ac_ext <<_ACEOF
1731617383
/* end confdefs.h. */
1731717384
#include <sys/socket.h>
17385+
#include <sys/param.h>
1731817386
#ifdef HAVE_SYS_UCRED_H
1731917387
#include <sys/ucred.h>
1732017388
#endif

configure.in

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -969,9 +969,9 @@ AC_SUBST(OSSP_UUID_LIBS)
969969
##
970970

971971
dnl sys/socket.h is required by AC_FUNC_ACCEPT_ARGTYPES
972-
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])
972+
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])
973973

974-
# On BSD, cpp test for net/if.h will fail unless sys/socket.h
974+
# On BSD, test for net/if.h will fail unless sys/socket.h
975975
# is included first.
976976
AC_CHECK_HEADERS(net/if.h, [], [],
977977
[AC_INCLUDES_DEFAULT
@@ -980,7 +980,14 @@ AC_CHECK_HEADERS(net/if.h, [], [],
980980
#endif
981981
])
982982

983-
# At least on IRIX, cpp test for netinet/tcp.h will fail unless
983+
# On OpenBSD, test for sys/ucred.h will fail unless sys/param.h
984+
# is included first.
985+
AC_CHECK_HEADERS(sys/ucred.h, [], [],
986+
[AC_INCLUDES_DEFAULT
987+
#include <sys/param.h>
988+
])
989+
990+
# At least on IRIX, test for netinet/tcp.h will fail unless
984991
# netinet/in.h is included first.
985992
AC_CHECK_HEADERS(netinet/in.h)
986993
AC_CHECK_HEADERS(netinet/tcp.h, [], [],
@@ -1115,6 +1122,7 @@ PGAC_TYPE_LOCALE_T
11151122

11161123
AC_CHECK_TYPES([struct cmsgcred], [], [],
11171124
[#include <sys/socket.h>
1125+
#include <sys/param.h>
11181126
#ifdef HAVE_SYS_UCRED_H
11191127
#include <sys/ucred.h>
11201128
#endif])

0 commit comments

Comments
 (0)