From fe4f355328b8f1d5f591f19eb865e6d60b444631 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Sun, 2 Mar 2003 21:46:40 +0000 Subject: [PATCH] Add acc_rights detection (needs testing) --- build/openldap.m4 | 13 +++++++ configure | 60 ++++++++++++++++++++++++++------- configure.in | 1 + include/portable.h.in | 3 ++ libraries/libldap/os-local.c | 4 ++- libraries/liblutil/getpeereid.c | 3 +- 6 files changed, 69 insertions(+), 15 deletions(-) diff --git a/build/openldap.m4 b/build/openldap.m4 index 3d03aaeaeb..a660b02550 100644 --- a/build/openldap.m4 +++ b/build/openldap.m4 @@ -1216,3 +1216,16 @@ AC_DEFUN([OL_SASL_COMPAT], #endif ], [ol_cv_sasl_compat=yes], [ol_cv_sasl_compat=no])]) ]) +dnl ==================================================================== +dnl check for msg_accrights in msghdr +AC_DEFUN(OL_MSGHDR_MSG_ACCRIGHTS, + [AC_CACHE_CHECK(msg_accrights in msghdr, ol_cv_msg_accrights, + [AC_TRY_COMPILE([#include ], + [struct msghdr m; m.msg_accrightslen=0], + ol_cv_msghdr_msg_accrights=yes, ol_cv_msghdr_msg_accrights=no) + ]) + if test $ol_cv_func_ctime_r_type = "int" ; then + AC_DEFINE(HAVE_MSGHDR_MSG_ACCRIGHTS,1, + [define if struct msghdr has msg_accrights]) + fi +])dnl diff --git a/configure b/configure index 27a7ef9782..b279d5e5fe 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # $OpenLDAP$ -# from OpenLDAP: pkg/ldap/configure.in,v 1.460 2003/02/15 17:20:38 kurt Exp +# from OpenLDAP: pkg/ldap/configure.in,v 1.461 2003/03/02 20:21:39 kurt Exp # Copyright 1998-2003 The OpenLDAP Foundation. All Rights Reserved. # @@ -22952,6 +22952,40 @@ if test "$ac_cv_func_getopt" != yes; then LIBSRCS="$LIBSRCS getopt.c" fi if test "$ac_cv_func_getpeereid" != yes; then + echo $ac_n "checking msg_accrights in msghdr""... $ac_c" 1>&6 +echo "configure:22957: checking msg_accrights in msghdr" >&5 +if eval "test \"\${ol_cv_msg_accrights+set}\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +int main() { +struct msghdr m; m.msg_accrightslen=0 +; return 0; } +EOF +if { (eval echo configure:22969: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ol_cv_msghdr_msg_accrights=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ol_cv_msghdr_msg_accrights=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ol_cv_msg_accrights" 1>&6 + if test $ol_cv_func_ctime_r_type = "int" ; then + cat >> confdefs.h <<\EOF +#define HAVE_MSGHDR_MSG_ACCRIGHTS 1 +EOF + + fi + LIBSRCS="$LIBSRCS getpeereid.c" fi if test "$ac_cv_func_snprintf" != yes -o "$ac_cv_func_vsnprintf" != yes; then @@ -22971,13 +23005,13 @@ fi # Check Configuration echo $ac_n "checking declaration of sys_errlist""... $ac_c" 1>&6 -echo "configure:22975: checking declaration of sys_errlist" >&5 +echo "configure:23009: checking declaration of sys_errlist" >&5 if eval "test \"\${ol_cv_dcl_sys_errlist+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -22990,7 +23024,7 @@ int main() { char *c = (char *) *sys_errlist ; return 0; } EOF -if { (eval echo configure:22994: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:23028: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ol_cv_dcl_sys_errlist=yes ol_cv_have_sys_errlist=yes @@ -23013,20 +23047,20 @@ EOF echo $ac_n "checking existence of sys_errlist""... $ac_c" 1>&6 -echo "configure:23017: checking existence of sys_errlist" >&5 +echo "configure:23051: checking existence of sys_errlist" >&5 if eval "test \"\${ol_cv_have_sys_errlist+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { char *c = (char *) *sys_errlist ; return 0; } EOF -if { (eval echo configure:23030: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:23064: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ol_cv_have_sys_errlist=yes else @@ -23054,17 +23088,17 @@ if test "$ol_enable_slapi" != no ; then do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:23058: checking for $ac_hdr" >&5 +echo "configure:23092: checking for $ac_hdr" >&5 if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:23068: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:23102: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -23095,7 +23129,7 @@ done { echo "configure: error: could not locate " 1>&2; exit 1; } fi echo $ac_n "checking for lt_dlinit in -lltdl""... $ac_c" 1>&6 -echo "configure:23099: checking for lt_dlinit in -lltdl" >&5 +echo "configure:23133: checking for lt_dlinit in -lltdl" >&5 ac_lib_var=`echo ltdl'_'lt_dlinit | sed 'y%./+-:%__p__%'` if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -23103,7 +23137,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lltdl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:23152: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else diff --git a/configure.in b/configure.in index ad27eb86c4..c2d8d0cbe4 100644 --- a/configure.in +++ b/configure.in @@ -2497,6 +2497,7 @@ if test "$ac_cv_func_getopt" != yes; then LIBSRCS="$LIBSRCS getopt.c" fi if test "$ac_cv_func_getpeereid" != yes; then + OL_MSGHDR_MSG_ACCRIGHTS LIBSRCS="$LIBSRCS getpeereid.c" fi if test "$ac_cv_func_snprintf" != yes -o "$ac_cv_func_vsnprintf" != yes; then diff --git a/include/portable.h.in b/include/portable.h.in index 9dad59a13b..0c254d1a07 100644 --- a/include/portable.h.in +++ b/include/portable.h.in @@ -887,6 +887,9 @@ /* define to vsnprintf routine */ #undef vsnprintf +/* define if struct msghdr has msg_accrights */ +#undef HAVE_MSGHDR_MSG_ACCRIGHTS + /* define to snprintf routine */ #undef snprintf diff --git a/libraries/libldap/os-local.c b/libraries/libldap/os-local.c index 9c6e5f9f29..024b21bc45 100644 --- a/libraries/libldap/os-local.c +++ b/libraries/libldap/os-local.c @@ -135,7 +135,9 @@ ldap_pvt_is_socket_ready(LDAP *ld, int s) } #undef TRACE -#if !defined(HAVE_GETPEEREID) && !defined(SO_PEERCRED) && !defined(LOCAL_PEERCRED) && defined(HAVE_SENDMSG) +#if !defined(HAVE_GETPEEREID) && \ + !defined(SO_PEERCRED) && !defined(LOCAL_PEERCRED) && \ + defined(HAVE_SENDMSG) && defined(HAVE_MSGHDR_MSG_ACCRIGHTS) #define DO_SENDMSG #endif diff --git a/libraries/liblutil/getpeereid.c b/libraries/liblutil/getpeereid.c index 2cc0ea1bd7..2642886c27 100644 --- a/libraries/liblutil/getpeereid.c +++ b/libraries/liblutil/getpeereid.c @@ -19,7 +19,8 @@ #include #endif -#if !defined(SO_PEERCRED) && !defined(LOCAL_PEERCRED) && defined(HAVE_SENDMSG) +#if !defined(SO_PEERCRED) && !defined(LOCAL_PEERCRED) && \ + defined(HAVE_SENDMSG) && defined(HAVE_MSGHDR_MSG_ACCRIGHTS) #define DO_SENDMSG #ifdef HAVE_SYS_UIO_H #include -- 2.39.5