Skip to content

Commit 3ba763b

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 13f11c8 commit 3ba763b

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
@@ -10080,8 +10080,7 @@ done
1008010080

1008110081

1008210082

10083-
10084-
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 kernel/OS.h kernel/image.h SupportDefs.h
10083+
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 kernel/OS.h kernel/image.h SupportDefs.h
1008510084
do
1008610085
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
1008710086
if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
@@ -10232,7 +10231,7 @@ fi
1023210231
done
1023310232

1023410233

10235-
# On BSD, cpp test for net/if.h will fail unless sys/socket.h
10234+
# On BSD, test for net/if.h will fail unless sys/socket.h
1023610235
# is included first.
1023710236

1023810237
for ac_header in net/if.h
@@ -10301,7 +10300,74 @@ fi
1030110300
done
1030210301

1030310302

10304-
# At least on IRIX, cpp test for netinet/tcp.h will fail unless
10303+
# On OpenBSD, test for sys/ucred.h will fail unless sys/param.h
10304+
# is included first.
10305+
10306+
for ac_header in sys/ucred.h
10307+
do
10308+
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
10309+
{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
10310+
$as_echo_n "checking for $ac_header... " >&6; }
10311+
if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
10312+
$as_echo_n "(cached) " >&6
10313+
else
10314+
cat >conftest.$ac_ext <<_ACEOF
10315+
/* confdefs.h. */
10316+
_ACEOF
10317+
cat confdefs.h >>conftest.$ac_ext
10318+
cat >>conftest.$ac_ext <<_ACEOF
10319+
/* end confdefs.h. */
10320+
$ac_includes_default
10321+
#include <sys/param.h>
10322+
10323+
10324+
#include <$ac_header>
10325+
_ACEOF
10326+
rm -f conftest.$ac_objext
10327+
if { (ac_try="$ac_compile"
10328+
case "(($ac_try" in
10329+
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
10330+
*) ac_try_echo=$ac_try;;
10331+
esac
10332+
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
10333+
$as_echo "$ac_try_echo") >&5
10334+
(eval "$ac_compile") 2>conftest.er1
10335+
ac_status=$?
10336+
grep -v '^ *+' conftest.er1 >conftest.err
10337+
rm -f conftest.er1
10338+
cat conftest.err >&5
10339+
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
10340+
(exit $ac_status); } && {
10341+
test -z "$ac_c_werror_flag" ||
10342+
test ! -s conftest.err
10343+
} && test -s conftest.$ac_objext; then
10344+
eval "$as_ac_Header=yes"
10345+
else
10346+
$as_echo "$as_me: failed program was:" >&5
10347+
sed 's/^/| /' conftest.$ac_ext >&5
10348+
10349+
eval "$as_ac_Header=no"
10350+
fi
10351+
10352+
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
10353+
fi
10354+
ac_res=`eval 'as_val=${'$as_ac_Header'}
10355+
$as_echo "$as_val"'`
10356+
{ $as_echo "$as_me:$LINENO: result: $ac_res" >&5
10357+
$as_echo "$ac_res" >&6; }
10358+
as_val=`eval 'as_val=${'$as_ac_Header'}
10359+
$as_echo "$as_val"'`
10360+
if test "x$as_val" = x""yes; then
10361+
cat >>confdefs.h <<_ACEOF
10362+
#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
10363+
_ACEOF
10364+
10365+
fi
10366+
10367+
done
10368+
10369+
10370+
# At least on IRIX, test for netinet/tcp.h will fail unless
1030510371
# netinet/in.h is included first.
1030610372

1030710373
for ac_header in netinet/in.h
@@ -17129,6 +17195,7 @@ cat confdefs.h >>conftest.$ac_ext
1712917195
cat >>conftest.$ac_ext <<_ACEOF
1713017196
/* end confdefs.h. */
1713117197
#include <sys/socket.h>
17198+
#include <sys/param.h>
1713217199
#ifdef HAVE_SYS_UCRED_H
1713317200
#include <sys/ucred.h>
1713417201
#endif
@@ -17167,6 +17234,7 @@ cat confdefs.h >>conftest.$ac_ext
1716717234
cat >>conftest.$ac_ext <<_ACEOF
1716817235
/* end confdefs.h. */
1716917236
#include <sys/socket.h>
17237+
#include <sys/param.h>
1717017238
#ifdef HAVE_SYS_UCRED_H
1717117239
#include <sys/ucred.h>
1717217240
#endif

configure.in

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -986,9 +986,9 @@ AC_SUBST(OSSP_UUID_LIBS)
986986
##
987987

988988
dnl sys/socket.h is required by AC_FUNC_ACCEPT_ARGTYPES
989-
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 kernel/OS.h kernel/image.h SupportDefs.h])
989+
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 kernel/OS.h kernel/image.h SupportDefs.h])
990990

991-
# On BSD, cpp test for net/if.h will fail unless sys/socket.h
991+
# On BSD, test for net/if.h will fail unless sys/socket.h
992992
# is included first.
993993
AC_CHECK_HEADERS(net/if.h, [], [],
994994
[AC_INCLUDES_DEFAULT
@@ -997,7 +997,14 @@ AC_CHECK_HEADERS(net/if.h, [], [],
997997
#endif
998998
])
999999

1000-
# At least on IRIX, cpp test for netinet/tcp.h will fail unless
1000+
# On OpenBSD, test for sys/ucred.h will fail unless sys/param.h
1001+
# is included first.
1002+
AC_CHECK_HEADERS(sys/ucred.h, [], [],
1003+
[AC_INCLUDES_DEFAULT
1004+
#include <sys/param.h>
1005+
])
1006+
1007+
# At least on IRIX, test for netinet/tcp.h will fail unless
10011008
# netinet/in.h is included first.
10021009
AC_CHECK_HEADERS(netinet/in.h)
10031010
AC_CHECK_HEADERS(netinet/tcp.h, [], [],
@@ -1129,6 +1136,7 @@ PGAC_TYPE_LOCALE_T
11291136

11301137
AC_CHECK_TYPES([struct cmsgcred], [], [],
11311138
[#include <sys/socket.h>
1139+
#include <sys/param.h>
11321140
#ifdef HAVE_SYS_UCRED_H
11331141
#include <sys/ucred.h>
11341142
#endif])

0 commit comments

Comments
 (0)