Index: configure =================================================================== --- configure (revision 295512) +++ configure (working copy) @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.ac Revision: 290201 . +# From configure.ac Revision: 294429 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.65 for asterisk 1.6.2. # @@ -11845,6 +11845,27 @@ fi +ac_fn_c_check_member "$LINENO" "struct ucred" "uid" "ac_cv_member_struct_ucred_uid" "#include +" +if test "x$ac_cv_member_struct_ucred_uid" = x""yes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_UCRED_UID 1 +_ACEOF + + +fi +ac_fn_c_check_member "$LINENO" "struct ucred" "cr_uid" "ac_cv_member_struct_ucred_cr_uid" "#include +" +if test "x$ac_cv_member_struct_ucred_cr_uid" = x""yes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_UCRED_CR_UID 1 +_ACEOF + + +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 $as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } if test "${ac_cv_header_time+set}" = set; then : Index: configure.ac =================================================================== --- configure.ac (revision 295512) +++ configure.ac (working copy) @@ -392,6 +392,7 @@ AC_TYPE_PID_T AC_TYPE_SIZE_T AC_CHECK_MEMBERS([struct stat.st_blksize]) +AC_CHECK_MEMBERS([struct ucred.uid, struct ucred.cr_uid], [], [], [#include ]) AC_HEADER_TIME AC_STRUCT_TM AC_C_VOLATILE Index: include/asterisk/autoconfig.h.in =================================================================== --- include/asterisk/autoconfig.h.in (revision 295512) +++ include/asterisk/autoconfig.h.in (working copy) @@ -705,6 +705,12 @@ /* Define to 1 if `st_blksize' is a member of `struct stat'. */ #undef HAVE_STRUCT_STAT_ST_BLKSIZE +/* Define to 1 if `cr_uid' is a member of `struct ucred'. */ +#undef HAVE_STRUCT_UCRED_CR_UID + +/* Define to 1 if `uid' is a member of `struct ucred'. */ +#undef HAVE_STRUCT_UCRED_UID + /* Define to 1 if you have the mISDN Supplemental Services library. */ #undef HAVE_SUPPSERV Index: main/asterisk.c =================================================================== --- main/asterisk.c (revision 295512) +++ main/asterisk.c (working copy) @@ -1193,12 +1193,18 @@ return result; } -#if defined(SO_PEERCRED) +#if defined(SO_PEERCRED) && (defined(HAVE_STRUCT_UCRED_UID) || defined(HAVE_STRUCT_UCRED_CR_UID)) if (getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &cred, &len)) { return result; } +#if defined(HAVE_STRUCT_UCRED_UID) uid = cred.uid; gid = cred.gid; +#else /* defined(HAVE_STRUCT_UCRED_CR_UID) */ + uid = cred.cr_uid; + gid = cred.cr_gid; +#endif /* defined(HAVE_STRUCT_UCRED_UID) */ + #elif defined(HAVE_GETPEEREID) if (getpeereid(fd, &uid, &gid)) { return result;