summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>1999-01-04 21:53:51 +0000
committerJeremy Allison <jra@samba.org>1999-01-04 21:53:51 +0000
commit953a15ba1a3d59253f6abe0c86b7b09ea1cc303b (patch)
treed784cdb0a38cf627e237cf71c29b5c9a91ad6e52
parent0258a4e63b9c1ee47cb492f52e86119fb2671ab2 (diff)
downloadsamba-953a15ba1a3d59253f6abe0c86b7b09ea1cc303b.tar.gz
samba-953a15ba1a3d59253f6abe0c86b7b09ea1cc303b.tar.xz
samba-953a15ba1a3d59253f6abe0c86b7b09ea1cc303b.zip
Added autoconf test for FTRUNCATE_NEEDS_ROOT.
Fixed <rpc/rpc.h> include bug for SCO. Test for <arpa/inet.h> include for HPUX7.x. Jeremy.
-rw-r--r--source/acconfig.h2
-rwxr-xr-xsource/configure262
-rw-r--r--source/configure.in33
-rw-r--r--source/include/config.h.in5
-rw-r--r--source/include/includes.h6
-rw-r--r--source/tests/ftruncroot.c64
6 files changed, 280 insertions, 92 deletions
diff --git a/source/acconfig.h b/source/acconfig.h
index 6dd7ed63348..4181bfb8041 100644
--- a/source/acconfig.h
+++ b/source/acconfig.h
@@ -36,6 +36,7 @@
#undef HAVE_SYSV_IPC
#undef HAVE_FCNTL_LOCK
#undef HAVE_FTRUNCATE_EXTEND
+#undef FTRUNCATE_NEEDS_ROOT
#undef HAVE_TRAPDOOR_UID
#undef HAVE_ROOT
#undef HAVE_UNION_SEMUN
@@ -103,3 +104,4 @@
#undef HAVE_STRUCT_DIRENT64
#undef HAVE_TRUNCATED_SALT
#undef BROKEN_NISPLUS_INCLUDE_FILES
+#undef HAVE_RPC_AUTH_ERROR_CONFLICT
diff --git a/source/configure b/source/configure
index 99a977fd706..a0d04ec1860 100755
--- a/source/configure
+++ b/source/configure
@@ -1659,7 +1659,7 @@ EOF
fi
-for ac_hdr in sys/fcntl.h sys/select.h fcntl.h sys/time.h sys/unistd.h
+for ac_hdr in arpa/inet.h sys/fcntl.h sys/select.h fcntl.h sys/time.h sys/unistd.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
@@ -7898,17 +7898,59 @@ EOF
fi
+
+echo $ac_n "checking for conflicting AUTH_ERROR define in rpc/rpc.h""... $ac_c" 1>&6
+echo "configure:7904: checking for conflicting AUTH_ERROR define in rpc/rpc.h" >&5
+if eval "test \"`echo '$''{'samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+
+cat > conftest.$ac_ext <<EOF
+#line 7910 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#ifdef HAVE_SYS_SECURITY_H
+#include <sys/security.h>
+#include <prot.h>
+#endif /* HAVE_SYS_SECURITY_H */
+#if defined(HAVE_RPC_RPC_H)
+#include <rpc/rpc.h>
+#endif
+int main() {
+int testvar;
+; return 0; }
+EOF
+if { (eval echo configure:7924: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT=no
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT=yes
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT" 1>&6
+if test x"$samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT" = x"yes"; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_RPC_AUTH_ERROR_CONFLICT 1
+EOF
+
+fi
+
echo $ac_n "checking for test routines""... $ac_c" 1>&6
-echo "configure:7903: checking for test routines" >&5
+echo "configure:7945: checking for test routines" >&5
if test "$cross_compiling" = yes; then
echo "configure: warning: cannot run when cross-compiling" 1>&2
else
cat > conftest.$ac_ext <<EOF
-#line 7908 "configure"
+#line 7950 "configure"
#include "confdefs.h"
#include "${srcdir-.}/tests/trivial.c"
EOF
-if { (eval echo configure:7912: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:7954: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
echo "$ac_t""yes" 1>&6
else
@@ -7922,7 +7964,7 @@ fi
echo $ac_n "checking for ftruncate extend""... $ac_c" 1>&6
-echo "configure:7926: checking for ftruncate extend" >&5
+echo "configure:7968: checking for ftruncate extend" >&5
if eval "test \"`echo '$''{'samba_cv_HAVE_FTRUNCATE_EXTEND'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -7931,11 +7973,11 @@ if test "$cross_compiling" = yes; then
samba_cv_HAVE_FTRUNCATE_EXTEND=cross
else
cat > conftest.$ac_ext <<EOF
-#line 7935 "configure"
+#line 7977 "configure"
#include "confdefs.h"
#include "${srcdir-.}/tests/ftruncate.c"
EOF
-if { (eval echo configure:7939: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:7981: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
samba_cv_HAVE_FTRUNCATE_EXTEND=yes
else
@@ -7958,7 +8000,7 @@ EOF
fi
echo $ac_n "checking for broken getgroups""... $ac_c" 1>&6
-echo "configure:7962: checking for broken getgroups" >&5
+echo "configure:8004: checking for broken getgroups" >&5
if eval "test \"`echo '$''{'samba_cv_HAVE_BROKEN_GETGROUPS'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -7967,11 +8009,11 @@ if test "$cross_compiling" = yes; then
samba_cv_HAVE_BROKEN_GETGROUPS=cross
else
cat > conftest.$ac_ext <<EOF
-#line 7971 "configure"
+#line 8013 "configure"
#include "confdefs.h"
#include "${srcdir-.}/tests/getgroups.c"
EOF
-if { (eval echo configure:7975: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:8017: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
samba_cv_HAVE_BROKEN_GETGROUPS=yes
else
@@ -7994,7 +8036,7 @@ EOF
fi
echo $ac_n "checking whether getpass should be replaced""... $ac_c" 1>&6
-echo "configure:7998: checking whether getpass should be replaced" >&5
+echo "configure:8040: checking whether getpass should be replaced" >&5
if eval "test \"`echo '$''{'samba_cv_REPLACE_GETPASS'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -8002,7 +8044,7 @@ else
SAVE_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS -I${srcdir-.}/include -I${srcdir-.}/ubiqx -I${srcdir-.}/smbwrapper"
cat > conftest.$ac_ext <<EOF
-#line 8006 "configure"
+#line 8048 "configure"
#include "confdefs.h"
#define REPLACE_GETPASS 1
@@ -8015,7 +8057,7 @@ int main() {
; return 0; }
EOF
-if { (eval echo configure:8019: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8061: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
samba_cv_REPLACE_GETPASS=yes
else
@@ -8038,7 +8080,7 @@ EOF
fi
echo $ac_n "checking for broken inet_ntoa""... $ac_c" 1>&6
-echo "configure:8042: checking for broken inet_ntoa" >&5
+echo "configure:8084: checking for broken inet_ntoa" >&5
if eval "test \"`echo '$''{'samba_cv_REPLACE_INET_NTOA'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -8047,19 +8089,21 @@ if test "$cross_compiling" = yes; then
samba_cv_REPLACE_INET_NTOA=cross
else
cat > conftest.$ac_ext <<EOF
-#line 8051 "configure"
+#line 8093 "configure"
#include "confdefs.h"
#include <stdio.h>
#include <sys/types.h>
#include <netinet/in.h>
+#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
+#endif
main() { struct in_addr ip; ip.s_addr = 0x12345678;
if (strcmp(inet_ntoa(ip),"18.52.86.120") &&
strcmp(inet_ntoa(ip),"120.86.52.18")) { exit(0); }
exit(1);}
EOF
-if { (eval echo configure:8063: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:8107: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
samba_cv_REPLACE_INET_NTOA=yes
else
@@ -8082,7 +8126,7 @@ EOF
fi
echo $ac_n "checking for root""... $ac_c" 1>&6
-echo "configure:8086: checking for root" >&5
+echo "configure:8130: checking for root" >&5
if eval "test \"`echo '$''{'samba_cv_HAVE_ROOT'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -8091,11 +8135,11 @@ if test "$cross_compiling" = yes; then
samba_cv_HAVE_ROOT=cross
else
cat > conftest.$ac_ext <<EOF
-#line 8095 "configure"
+#line 8139 "configure"
#include "confdefs.h"
main() { exit(getuid() != 0); }
EOF
-if { (eval echo configure:8099: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:8143: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
samba_cv_HAVE_ROOT=yes
else
@@ -8121,7 +8165,7 @@ fi
netmask=no;
echo $ac_n "checking for netmask ifconf""... $ac_c" 1>&6
-echo "configure:8125: checking for netmask ifconf" >&5
+echo "configure:8169: checking for netmask ifconf" >&5
if eval "test \"`echo '$''{'samba_cv_HAVE_NETMASK_IFCONF'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -8130,7 +8174,7 @@ if test "$cross_compiling" = yes; then
samba_cv_HAVE_NETMASK_IFCONF=cross
else
cat > conftest.$ac_ext <<EOF
-#line 8134 "configure"
+#line 8178 "configure"
#include "confdefs.h"
#define HAVE_NETMASK_IFCONF 1
@@ -8138,7 +8182,7 @@ else
#include "confdefs.h"
#include "${srcdir-.}/lib/netmask.c"
EOF
-if { (eval echo configure:8142: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:8186: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
samba_cv_HAVE_NETMASK_IFCONF=yes
else
@@ -8162,7 +8206,7 @@ fi
if test $netmask = no; then
echo $ac_n "checking for netmask ifreq""... $ac_c" 1>&6
-echo "configure:8166: checking for netmask ifreq" >&5
+echo "configure:8210: checking for netmask ifreq" >&5
if eval "test \"`echo '$''{'samba_cv_HAVE_NETMASK_IFREQ'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -8171,7 +8215,7 @@ if test "$cross_compiling" = yes; then
samba_cv_HAVE_NETMASK_IFREQ=cross
else
cat > conftest.$ac_ext <<EOF
-#line 8175 "configure"
+#line 8219 "configure"
#include "confdefs.h"
#define HAVE_NETMASK_IFREQ 1
@@ -8179,7 +8223,7 @@ else
#include "confdefs.h"
#include "${srcdir-.}/lib/netmask.c"
EOF
-if { (eval echo configure:8183: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:8227: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
samba_cv_HAVE_NETMASK_IFREQ=yes
else
@@ -8204,7 +8248,7 @@ fi
if test $netmask = no; then
echo $ac_n "checking for netmask AIX""... $ac_c" 1>&6
-echo "configure:8208: checking for netmask AIX" >&5
+echo "configure:8252: checking for netmask AIX" >&5
if eval "test \"`echo '$''{'samba_cv_HAVE_NETMASK_AIX'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -8213,7 +8257,7 @@ if test "$cross_compiling" = yes; then
samba_cv_HAVE_NETMASK_AIX=cross
else
cat > conftest.$ac_ext <<EOF
-#line 8217 "configure"
+#line 8261 "configure"
#include "confdefs.h"
#define HAVE_NETMASK_AIX 1
@@ -8221,7 +8265,7 @@ else
#include "confdefs.h"
#include "${srcdir-.}/lib/netmask.c"
EOF
-if { (eval echo configure:8225: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:8269: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
samba_cv_HAVE_NETMASK_AIX=yes
else
@@ -8245,7 +8289,7 @@ fi
fi
echo $ac_n "checking for trapdoor seteuid""... $ac_c" 1>&6
-echo "configure:8249: checking for trapdoor seteuid" >&5
+echo "configure:8293: checking for trapdoor seteuid" >&5
if eval "test \"`echo '$''{'samba_cv_HAVE_TRAPDOOR_UID'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -8254,11 +8298,11 @@ if test "$cross_compiling" = yes; then
:
else
cat > conftest.$ac_ext <<EOF
-#line 8258 "configure"
+#line 8302 "configure"
#include "confdefs.h"
#include "${srcdir-.}/tests/trapdoor.c"
EOF
-if { (eval echo configure:8262: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:8306: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
samba_cv_HAVE_TRAPDOOR_UID=no
else
@@ -8281,7 +8325,7 @@ EOF
fi
echo $ac_n "checking for shared mmap""... $ac_c" 1>&6
-echo "configure:8285: checking for shared mmap" >&5
+echo "configure:8329: checking for shared mmap" >&5
if eval "test \"`echo '$''{'samba_cv_HAVE_SHARED_MMAP'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -8290,11 +8334,11 @@ if test "$cross_compiling" = yes; then
samba_cv_HAVE_SHARED_MMAP=cross
else
cat > conftest.$ac_ext <<EOF
-#line 8294 "configure"
+#line 8338 "configure"
#include "confdefs.h"
#include "${srcdir-.}/tests/shared_mmap.c"
EOF
-if { (eval echo configure:8298: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:8342: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
samba_cv_HAVE_SHARED_MMAP=yes
else
@@ -8320,8 +8364,44 @@ EOF
fi
+echo $ac_n "checking for ftruncate needs root""... $ac_c" 1>&6
+echo "configure:8369: checking for ftruncate needs root" >&5
+if eval "test \"`echo '$''{'samba_cv_FTRUNCATE_NEEDS_ROOT'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+
+if test "$cross_compiling" = yes; then
+ samba_cv_FTRUNCATE_NEEDS_ROOT=cross
+else
+ cat > conftest.$ac_ext <<EOF
+#line 8378 "configure"
+#include "confdefs.h"
+#include "${srcdir-.}/tests/ftruncroot.c"
+EOF
+if { (eval echo configure:8382: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+ samba_cv_FTRUNCATE_NEEDS_ROOT=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ samba_cv_FTRUNCATE_NEEDS_ROOT=no
+fi
+rm -fr conftest*
+fi
+
+fi
+
+echo "$ac_t""$samba_cv_FTRUNCATE_NEEDS_ROOT" 1>&6
+if test x"$samba_cv_FTRUNCATE_NEEDS_ROOT" = x"yes"; then
+ cat >> confdefs.h <<\EOF
+#define FTRUNCATE_NEEDS_ROOT 1
+EOF
+
+fi
+
echo $ac_n "checking for fcntl locking""... $ac_c" 1>&6
-echo "configure:8325: checking for fcntl locking" >&5
+echo "configure:8405: checking for fcntl locking" >&5
if eval "test \"`echo '$''{'samba_cv_HAVE_FCNTL_LOCK'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -8330,11 +8410,11 @@ if test "$cross_compiling" = yes; then
samba_cv_HAVE_FCNTL_LOCK=cross
else
cat > conftest.$ac_ext <<EOF
-#line 8334 "configure"
+#line 8414 "configure"
#include "confdefs.h"
#include "${srcdir-.}/tests/fcntl_lock.c"
EOF
-if { (eval echo configure:8338: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:8418: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
samba_cv_HAVE_FCNTL_LOCK=yes
else
@@ -8357,7 +8437,7 @@ EOF
fi
echo $ac_n "checking for 64 bit fcntl locking""... $ac_c" 1>&6
-echo "configure:8361: checking for 64 bit fcntl locking" >&5
+echo "configure:8441: checking for 64 bit fcntl locking" >&5
if eval "test \"`echo '$''{'samba_cv_HAVE_STRUCT_FLOCK64'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -8366,7 +8446,7 @@ if test "$cross_compiling" = yes; then
samba_cv_HAVE_STRUCT_FLOCK64=cross
else
cat > conftest.$ac_ext <<EOF
-#line 8370 "configure"
+#line 8450 "configure"
#include "confdefs.h"
#if defined(HAVE_UNISTD_H)
@@ -8390,7 +8470,7 @@ exit(1);
#endif
}
EOF
-if { (eval echo configure:8394: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:8474: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
samba_cv_HAVE_STRUCT_FLOCK64=yes
else
@@ -8413,7 +8493,7 @@ EOF
fi
echo $ac_n "checking for sysv ipc""... $ac_c" 1>&6
-echo "configure:8417: checking for sysv ipc" >&5
+echo "configure:8497: checking for sysv ipc" >&5
if eval "test \"`echo '$''{'samba_cv_HAVE_SYSV_IPC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -8422,11 +8502,11 @@ if test "$cross_compiling" = yes; then
samba_cv_HAVE_SYSV_IPC=cross
else
cat > conftest.$ac_ext <<EOF
-#line 8426 "configure"
+#line 8506 "configure"
#include "confdefs.h"
#include "${srcdir-.}/tests/sysv_ipc.c"
EOF
-if { (eval echo configure:8430: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:8510: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
samba_cv_HAVE_SYSV_IPC=yes
else
@@ -8449,7 +8529,7 @@ EOF
fi
echo $ac_n "checking for a crypt that needs truncated salt""... $ac_c" 1>&6
-echo "configure:8453: checking for a crypt that needs truncated salt" >&5
+echo "configure:8533: checking for a crypt that needs truncated salt" >&5
if eval "test \"`echo '$''{'samba_cv_HAVE_TRUNCATED_SALT'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -8458,11 +8538,11 @@ if test "$cross_compiling" = yes; then
samba_cv_HAVE_TRUNCATED_SALT=cross
else
cat > conftest.$ac_ext <<EOF
-#line 8462 "configure"
+#line 8542 "configure"
#include "confdefs.h"
#include "${srcdir-.}/tests/crypttest.c"
EOF
-if { (eval echo configure:8466: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:8546: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
samba_cv_HAVE_TRUNCATED_SALT=no
else
@@ -8485,13 +8565,13 @@ EOF
fi
echo $ac_n "checking for broken nisplus include files""... $ac_c" 1>&6
-echo "configure:8489: checking for broken nisplus include files" >&5
+echo "configure:8569: checking for broken nisplus include files" >&5
if eval "test \"`echo '$''{'samba_cv_BROKEN_NISPLUS_INCLUDE_FILES'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 8495 "configure"
+#line 8575 "configure"
#include "confdefs.h"
#include <sys/acl.h>
#if defined(HAVE_RPCSVC_NIS_H)
@@ -8501,7 +8581,7 @@ int main() {
return 0;
; return 0; }
EOF
-if { (eval echo configure:8505: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8585: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
samba_cv_BROKEN_NISPLUS_INCLUDE_FILES=no
else
@@ -8525,7 +8605,7 @@ fi
#################################################
# check for smbwrapper support
echo $ac_n "checking whether to use smbwrapper""... $ac_c" 1>&6
-echo "configure:8529: checking whether to use smbwrapper" >&5
+echo "configure:8609: checking whether to use smbwrapper" >&5
# Check whether --with-smbwrapper or --without-smbwrapper was given.
if test "${with_smbwrapper+set}" = set; then
withval="$with_smbwrapper"
@@ -8569,7 +8649,7 @@ fi
#################################################
# check for the AFS filesystem
echo $ac_n "checking whether to use AFS""... $ac_c" 1>&6
-echo "configure:8573: checking whether to use AFS" >&5
+echo "configure:8653: checking whether to use AFS" >&5
# Check whether --with-afs or --without-afs was given.
if test "${with_afs+set}" = set; then
withval="$with_afs"
@@ -8595,7 +8675,7 @@ fi
#################################################
# check for the DFS auth system
echo $ac_n "checking whether to use DFS auth""... $ac_c" 1>&6
-echo "configure:8599: checking whether to use DFS auth" >&5
+echo "configure:8679: checking whether to use DFS auth" >&5
# Check whether --with-dfs or --without-dfs was given.
if test "${with_dfs+set}" = set; then
withval="$with_dfs"
@@ -8620,7 +8700,7 @@ fi
#################################################
# check for Kerberos IV auth system
echo $ac_n "checking whether to use Kerberos IV""... $ac_c" 1>&6
-echo "configure:8624: checking whether to use Kerberos IV" >&5
+echo "configure:8704: checking whether to use Kerberos IV" >&5
# Check whether --with-krb4 or --without-krb4 was given.
if test "${with_krb4+set}" = set; then
withval="$with_krb4"
@@ -8630,7 +8710,7 @@ if test "${with_krb4+set}" = set; then
EOF
echo $ac_n "checking for dn_expand in -lresolv""... $ac_c" 1>&6
-echo "configure:8634: checking for dn_expand in -lresolv" >&5
+echo "configure:8714: checking for dn_expand in -lresolv" >&5
ac_lib_var=`echo resolv'_'dn_expand | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -8638,7 +8718,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lresolv $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 8642 "configure"
+#line 8722 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -8649,7 +8729,7 @@ int main() {
dn_expand()
; return 0; }
EOF
-if { (eval echo configure:8653: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:8733: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -8688,7 +8768,7 @@ fi
#################################################
# check for Kerberos 5 auth system
echo $ac_n "checking whether to use Kerberos 5""... $ac_c" 1>&6
-echo "configure:8692: checking whether to use Kerberos 5" >&5
+echo "configure:8772: checking whether to use Kerberos 5" >&5
# Check whether --with-krb5 or --without-krb5 was given.
if test "${with_krb5+set}" = set; then
withval="$with_krb5"
@@ -8709,7 +8789,7 @@ fi
#################################################
# check for automount support
echo $ac_n "checking whether to use AUTOMOUNT""... $ac_c" 1>&6
-echo "configure:8713: checking whether to use AUTOMOUNT" >&5
+echo "configure:8793: checking whether to use AUTOMOUNT" >&5
# Check whether --with-automount or --without-automount was given.
if test "${with_automount+set}" = set; then
withval="$with_automount"
@@ -8734,7 +8814,7 @@ fi
#################################################
# check for smbmount support
echo $ac_n "checking whether to use SMBMOUNT""... $ac_c" 1>&6
-echo "configure:8738: checking whether to use SMBMOUNT" >&5
+echo "configure:8818: checking whether to use SMBMOUNT" >&5
# Check whether --with-smbmount or --without-smbmount was given.
if test "${with_smbmount+set}" = set; then
withval="$with_smbmount"
@@ -8762,7 +8842,7 @@ fi
#################################################
# check for a LDAP password database
echo $ac_n "checking whether to use LDAP password database""... $ac_c" 1>&6
-echo "configure:8766: checking whether to use LDAP password database" >&5
+echo "configure:8846: checking whether to use LDAP password database" >&5
# Check whether --with-ldap or --without-ldap was given.
if test "${with_ldap+set}" = set; then
withval="$with_ldap"
@@ -8787,7 +8867,7 @@ fi
#################################################
# check for a NISPLUS password database
echo $ac_n "checking whether to use NISPLUS password database""... $ac_c" 1>&6
-echo "configure:8791: checking whether to use NISPLUS password database" >&5
+echo "configure:8871: checking whether to use NISPLUS password database" >&5
# Check whether --with-nisplus or --without-nisplus was given.
if test "${with_nisplus+set}" = set; then
withval="$with_nisplus"
@@ -8812,7 +8892,7 @@ fi
#################################################
# check for a NISPLUS_HOME support
echo $ac_n "checking whether to use NISPLUS_HOME""... $ac_c" 1>&6
-echo "configure:8816: checking whether to use NISPLUS_HOME" >&5
+echo "configure:8896: checking whether to use NISPLUS_HOME" >&5
# Check whether --with-nisplus-home or --without-nisplus-home was given.
if test "${with_nisplus_home+set}" = set; then
withval="$with_nisplus_home"
@@ -8837,7 +8917,7 @@ fi
#################################################
# check for the secure socket layer
echo $ac_n "checking whether to use SSL""... $ac_c" 1>&6
-echo "configure:8841: checking whether to use SSL" >&5
+echo "configure:8921: checking whether to use SSL" >&5
# Check whether --with-ssl or --without-ssl was given.
if test "${with_ssl+set}" = set; then
withval="$with_ssl"
@@ -8862,7 +8942,7 @@ fi
#################################################
# check for experimental mmap support
echo $ac_n "checking whether to use MMAP""... $ac_c" 1>&6
-echo "configure:8866: checking whether to use MMAP" >&5
+echo "configure:8946: checking whether to use MMAP" >&5
# Check whether --with-mmap or --without-mmap was given.
if test "${with_mmap+set}" = set; then
withval="$with_mmap"
@@ -8887,7 +8967,7 @@ fi
#################################################
# check for syslog logging
echo $ac_n "checking whether to use syslog logging""... $ac_c" 1>&6
-echo "configure:8891: checking whether to use syslog logging" >&5
+echo "configure:8971: checking whether to use syslog logging" >&5
# Check whether --with-syslog or --without-syslog was given.
if test "${with_syslog+set}" = set; then
withval="$with_syslog"
@@ -8912,7 +8992,7 @@ fi
#################################################
# check for experimental netatalk resource fork support
echo $ac_n "checking whether to support netatalk""... $ac_c" 1>&6
-echo "configure:8916: checking whether to support netatalk" >&5
+echo "configure:8996: checking whether to support netatalk" >&5
# Check whether --with-netatalk or --without-netatalk was given.
if test "${with_netatalk+set}" = set; then
withval="$with_netatalk"
@@ -8939,7 +9019,7 @@ fi
QUOTAOBJS=noquotas.o
echo $ac_n "checking whether to support disk-quotas""... $ac_c" 1>&6
-echo "configure:8943: checking whether to support disk-quotas" >&5
+echo "configure:9023: checking whether to support disk-quotas" >&5
# Check whether --with-quotas or --without-quotas was given.
if test "${with_quotas+set}" = set; then
withval="$with_quotas"
@@ -9012,14 +9092,14 @@ fi
#################################################
# these tests are taken from the GNU fileutils package
echo "checking how to get filesystem space usage" 1>&6
-echo "configure:9016: checking how to get filesystem space usage" >&5
+echo "configure:9096: checking how to get filesystem space usage" >&5
space=no
# Test for statvfs64.
if test $space = no; then
# SVR4
echo $ac_n "checking statvfs64 function (SVR4)""... $ac_c" 1>&6
-echo "configure:9023: checking statvfs64 function (SVR4)" >&5
+echo "configure:9103: checking statvfs64 function (SVR4)" >&5
if eval "test \"`echo '$''{'fu_cv_sys_stat_statvfs64'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -9027,7 +9107,7 @@ else
fu_cv_sys_stat_statvfs64=cross
else
cat > conftest.$ac_ext <<EOF
-#line 9031 "configure"
+#line 9111 "configure"
#include "confdefs.h"
#if defined(HAVE_UNISTD_H)
@@ -9041,7 +9121,7 @@ else
exit (statvfs64 (".", &fsd));
}
EOF
-if { (eval echo configure:9045: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:9125: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
fu_cv_sys_stat_statvfs64=yes
else
@@ -9074,12 +9154,12 @@ fi
if test $space = no; then
# SVR4
echo $ac_n "checking statvfs function (SVR4)""... $ac_c" 1>&6
-echo "configure:9078: checking statvfs function (SVR4)" >&5
+echo "configure:9158: checking statvfs function (SVR4)" >&5
if eval "test \"`echo '$''{'fu_cv_sys_stat_statvfs'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 9083 "configure"
+#line 9163 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/statvfs.h>
@@ -9087,7 +9167,7 @@ int main() {
struct statvfs fsd; statvfs (0, &fsd);
; return 0; }
EOF
-if { (eval echo configure:9091: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:9171: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
fu_cv_sys_stat_statvfs=yes
else
@@ -9112,7 +9192,7 @@ fi
if test $space = no; then
# DEC Alpha running OSF/1
echo $ac_n "checking for 3-argument statfs function (DEC OSF/1)""... $ac_c" 1>&6
-echo "configure:9116: checking for 3-argument statfs function (DEC OSF/1)" >&5
+echo "configure:9196: checking for 3-argument statfs function (DEC OSF/1)" >&5
if eval "test \"`echo '$''{'fu_cv_sys_stat_statfs3_osf1'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -9120,7 +9200,7 @@ else
fu_cv_sys_stat_statfs3_osf1=no
else
cat > conftest.$ac_ext <<EOF
-#line 9124 "configure"
+#line 9204 "configure"
#include "confdefs.h"
#include <sys/param.h>
@@ -9133,7 +9213,7 @@ else
exit (statfs (".", &fsd, sizeof (struct statfs)));
}
EOF
-if { (eval echo configure:9137: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:9217: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
fu_cv_sys_stat_statfs3_osf1=yes
else
@@ -9160,7 +9240,7 @@ fi
if test $space = no; then
# AIX
echo $ac_n "checking for two-argument statfs with statfs.bsize member (AIX, 4.3BSD)""... $ac_c" 1>&6
-echo "configure:9164: checking for two-argument statfs with statfs.bsize member (AIX, 4.3BSD)" >&5
+echo "configure:9244: checking for two-argument statfs with statfs.bsize member (AIX, 4.3BSD)" >&5
if eval "test \"`echo '$''{'fu_cv_sys_stat_statfs2_bsize'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -9168,7 +9248,7 @@ else
fu_cv_sys_stat_statfs2_bsize=no
else
cat > conftest.$ac_ext <<EOF
-#line 9172 "configure"
+#line 9252 "configure"
#include "confdefs.h"
#ifdef HAVE_SYS_PARAM_H
@@ -9187,7 +9267,7 @@ else
exit (statfs (".", &fsd));
}
EOF
-if { (eval echo configure:9191: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:9271: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
fu_cv_sys_stat_statfs2_bsize=yes
else
@@ -9214,7 +9294,7 @@ fi
if test $space = no; then
# SVR3
echo $ac_n "checking for four-argument statfs (AIX-3.2.5, SVR3)""... $ac_c" 1>&6
-echo "configure:9218: checking for four-argument statfs (AIX-3.2.5, SVR3)" >&5
+echo "configure:9298: checking for four-argument statfs (AIX-3.2.5, SVR3)" >&5
if eval "test \"`echo '$''{'fu_cv_sys_stat_statfs4'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -9222,7 +9302,7 @@ else
fu_cv_sys_stat_statfs4=no
else
cat > conftest.$ac_ext <<EOF
-#line 9226 "configure"
+#line 9306 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/statfs.h>
@@ -9232,7 +9312,7 @@ else
exit (statfs (".", &fsd, sizeof fsd, 0));
}
EOF
-if { (eval echo configure:9236: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:9316: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
fu_cv_sys_stat_statfs4=yes
else
@@ -9259,7 +9339,7 @@ fi
if test $space = no; then
# 4.4BSD and NetBSD
echo $ac_n "checking for two-argument statfs with statfs.fsize member (4.4BSD and NetBSD)""... $ac_c" 1>&6
-echo "configure:9263: checking for two-argument statfs with statfs.fsize member (4.4BSD and NetBSD)" >&5
+echo "configure:9343: checking for two-argument statfs with statfs.fsize member (4.4BSD and NetBSD)" >&5
if eval "test \"`echo '$''{'fu_cv_sys_stat_statfs2_fsize'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -9267,7 +9347,7 @@ else
fu_cv_sys_stat_statfs2_fsize=no
else
cat > conftest.$ac_ext <<EOF
-#line 9271 "configure"
+#line 9351 "configure"
#include "confdefs.h"
#include <sys/types.h>
#ifdef HAVE_SYS_PARAM_H
@@ -9283,7 +9363,7 @@ else
exit (statfs (".", &fsd));
}
EOF
-if { (eval echo configure:9287: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:9367: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
fu_cv_sys_stat_statfs2_fsize=yes
else
@@ -9310,7 +9390,7 @@ fi
if test $space = no; then
# Ultrix
echo $ac_n "checking for two-argument statfs with struct fs_data (Ultrix)""... $ac_c" 1>&6
-echo "configure:9314: checking for two-argument statfs with struct fs_data (Ultrix)" >&5
+echo "configure:9394: checking for two-argument statfs with struct fs_data (Ultrix)" >&5
if eval "test \"`echo '$''{'fu_cv_sys_stat_fs_data'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -9318,7 +9398,7 @@ else
fu_cv_sys_stat_fs_data=no
else
cat > conftest.$ac_ext <<EOF
-#line 9322 "configure"
+#line 9402 "configure"
#include "confdefs.h"
#include <sys/types.h>
#ifdef HAVE_SYS_PARAM_H
@@ -9338,7 +9418,7 @@ else
exit (statfs (".", &fsd) != 1);
}
EOF
-if { (eval echo configure:9342: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:9422: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
fu_cv_sys_stat_fs_data=yes
else
@@ -9367,11 +9447,11 @@ if test "$cross_compiling" = yes; then
:
else
cat > conftest.$ac_ext <<EOF
-#line 9371 "configure"
+#line 9451 "configure"
#include "confdefs.h"
#include "${srcdir-.}/tests/summary.c"
EOF
-if { (eval echo configure:9375: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:9455: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
echo "configure OK";
else
diff --git a/source/configure.in b/source/configure.in
index 5cae42049b2..0fac3141ef1 100644
--- a/source/configure.in
+++ b/source/configure.in
@@ -116,7 +116,7 @@ AC_HEADER_STDC
AC_HEADER_DIRENT
AC_HEADER_TIME
AC_HEADER_SYS_WAIT
-AC_CHECK_HEADERS(sys/fcntl.h sys/select.h fcntl.h sys/time.h sys/unistd.h)
+AC_CHECK_HEADERS(arpa/inet.h sys/fcntl.h sys/select.h fcntl.h sys/time.h sys/unistd.h)
AC_CHECK_HEADERS(unistd.h utime.h grp.h sys/id.h limits.h memory.h net/if.h)
AC_CHECK_HEADERS(compat.h rpc/rpc.h rpcsvc/nis.h rpcsvc/yp_prot.h rpcsvc/ypclnt.h)
AC_CHECK_HEADERS(sys/param.h ctype.h sys/wait.h sys/resource.h sys/ioctl.h sys/mode.h)
@@ -697,6 +697,28 @@ if test x"$samba_cv_HAVE_UINT32_FROM_RPC_RPC_H" = x"yes"; then
AC_DEFINE(HAVE_UINT32_FROM_RPC_RPC_H)
fi
+dnl
+dnl Some systems (SCO) have a problem including
+dnl <prot.h> and <rpc/rpc.h> due to AUTH_ERROR being defined
+dnl as a #define in <prot.h> and as part of an enum
+dnl in <rpc/rpc.h>.
+dnl
+
+AC_CACHE_CHECK([for conflicting AUTH_ERROR define in rpc/rpc.h],samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT,[
+AC_TRY_COMPILE([#include <sys/types.h>
+#ifdef HAVE_SYS_SECURITY_H
+#include <sys/security.h>
+#include <prot.h>
+#endif /* HAVE_SYS_SECURITY_H */
+#if defined(HAVE_RPC_RPC_H)
+#include <rpc/rpc.h>
+#endif],
+[int testvar;],
+samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT=no,samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT=yes)])
+if test x"$samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT" = x"yes"; then
+ AC_DEFINE(HAVE_RPC_AUTH_ERROR_CONFLICT)
+fi
+
AC_MSG_CHECKING([for test routines])
AC_TRY_RUN([#include "${srcdir-.}/tests/trivial.c"],
AC_MSG_RESULT(yes),
@@ -738,7 +760,9 @@ AC_TRY_RUN([
#include <stdio.h>
#include <sys/types.h>
#include <netinet/in.h>
+#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
+#endif
main() { struct in_addr ip; ip.s_addr = 0x12345678;
if (strcmp(inet_ntoa(ip),"18.52.86.120") &&
strcmp(inet_ntoa(ip),"120.86.52.18")) { exit(0); }
@@ -810,6 +834,13 @@ if test x"$samba_cv_HAVE_SHARED_MMAP" = x"yes"; then
AC_DEFINE(HAVE_MMAP)
fi
+AC_CACHE_CHECK([for ftruncate needs root],samba_cv_FTRUNCATE_NEEDS_ROOT,[
+AC_TRY_RUN([#include "${srcdir-.}/tests/ftruncroot.c"],
+ samba_cv_FTRUNCATE_NEEDS_ROOT=yes,samba_cv_FTRUNCATE_NEEDS_ROOT=no,samba_cv_FTRUNCATE_NEEDS_ROOT=cross)])
+if test x"$samba_cv_FTRUNCATE_NEEDS_ROOT" = x"yes"; then
+ AC_DEFINE(FTRUNCATE_NEEDS_ROOT)
+fi
+
AC_CACHE_CHECK([for fcntl locking],samba_cv_HAVE_FCNTL_LOCK,[
AC_TRY_RUN([#include "${srcdir-.}/tests/fcntl_lock.c"],
samba_cv_HAVE_FCNTL_LOCK=yes,samba_cv_HAVE_FCNTL_LOCK=no,samba_cv_HAVE_FCNTL_LOCK=cross)])
diff --git a/source/include/config.h.in b/source/include/config.h.in
index f63b98e76a9..edcbf6d11ae 100644
--- a/source/include/config.h.in
+++ b/source/include/config.h.in
@@ -99,6 +99,7 @@
#undef HAVE_SYSV_IPC
#undef HAVE_FCNTL_LOCK
#undef HAVE_FTRUNCATE_EXTEND
+#undef FTRUNCATE_NEEDS_ROOT
#undef HAVE_TRAPDOOR_UID
#undef HAVE_ROOT
#undef HAVE_UNION_SEMUN
@@ -166,6 +167,7 @@
#undef HAVE_STRUCT_DIRENT64
#undef HAVE_TRUNCATED_SALT
#undef BROKEN_NISPLUS_INCLUDE_FILES
+#undef HAVE_RPC_AUTH_ERROR_CONFLICT
/* The number of bytes in a int. */
#undef SIZEOF_INT
@@ -653,6 +655,9 @@
/* Define if you have the yp_get_default_domain function. */
#undef HAVE_YP_GET_DEFAULT_DOMAIN
+/* Define if you have the <arpa/inet.h> header file. */
+#undef HAVE_ARPA_INET_H
+
/* Define if you have the <compat.h> header file. */
#undef HAVE_COMPAT_H
diff --git a/source/include/includes.h b/source/include/includes.h
index a811731c302..b05d8fbfd59 100644
--- a/source/include/includes.h
+++ b/source/include/includes.h
@@ -314,6 +314,12 @@
#endif
#if defined(HAVE_RPC_RPC_H)
+/*
+ * Check for AUTH_ERROR define conflict with rpc/rpc.h in prot.h.
+ */
+#if defined(HAVE_SYS_SECURITY_H) && defined(HAVE_RPC_AUTH_ERROR_CONFLICT)
+#undef AUTH_ERROR
+#endif
#include <rpc/rpc.h>
#endif
diff --git a/source/tests/ftruncroot.c b/source/tests/ftruncroot.c
new file mode 100644
index 00000000000..ce3bbbd92c1
--- /dev/null
+++ b/source/tests/ftruncroot.c
@@ -0,0 +1,64 @@
+/* test whether ftruncte() can truncate a file as non-root */
+
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <sys/wait.h>
+
+#define DATA "conftest.truncroot"
+
+static int sys_waitpid(pid_t pid,int *status,int options)
+{
+#ifdef HAVE_WAITPID
+ return waitpid(pid,status,options);
+#else /* USE_WAITPID */
+ return wait4(pid, status, options, NULL);
+#endif /* USE_WAITPID */
+}
+
+main()
+{
+ int fd;
+ char buf[1024];
+ pid_t pid;
+
+ if (getuid() != 0) {
+ fprintf(stderr,"ERROR: This test must be run as root - assuming \
+ftruncate doesn't need root.\n");
+ exit(1);
+ }
+
+ fd = open(DATA,O_RDWR|O_CREAT|O_TRUNC,0666);
+ if(!fd)
+ exit(1);
+
+ if(write(fd, buf, 1024) != 1024)
+ exit(1);
+
+ if((pid = fork()) < 0)
+ exit(1);
+
+ if(pid) {
+ /* Parent. */
+ int status = 1;
+ if(sys_waitpid(pid, &status, 0) != pid) {
+ unlink(DATA);
+ exit(1);
+ }
+ unlink(DATA);
+ exit(WEXITSTATUS(status));
+ }
+
+ /* Child. */
+ if(setuid(500) < 0)
+ exit(1);
+
+ if(ftruncate(fd, 0) < 0) {
+ if(errno == EPERM || errno == EACCES)
+ exit(0);
+ }
+ exit(1);
+}