]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Make sure asterisk builds on OpenBSD
authorKinsey Moore <kmoore@digium.com>
Fri, 13 Jan 2012 21:41:24 +0000 (21:41 +0000)
committerKinsey Moore <kmoore@digium.com>
Fri, 13 Jan 2012 21:41:24 +0000 (21:41 +0000)
OpenBSD defines SO_PEERCRED, but it returns a 'struct sockpeercred', not
'struct ucred', which causes compilation of main/asterisk.c to fail in
read_credentials().  This allows configure to check for sockpeercred and
asterisk to deal with it properly.

(closes issue ASTERISK-18929)
Reported-by: Barry Miller
Patch-by: Barry Miller
........

Merged revisions 350730 from http://svn.asterisk.org/svn/asterisk/branches/1.8

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/10@350731 65c4cc65-6c06-0410-ace0-fbb531ad65f3

bootstrap.sh
configure.ac
main/asterisk.c

index 6ca277df2ce25f6b2177fea893a90674b151c1fa..3497e24e62507f38613f0294aa24dd22cbc062ba 100755 (executable)
@@ -17,6 +17,10 @@ case `uname -sr` in
                MY_AC_VER=259
                MY_AM_VER=19
                ;;
+       OpenBSD*)
+               export AUTOCONF_VERSION=2.63
+               export AUTOMAKE_VERSION=1.9
+               ;;
        *'BSD'*)
                MY_AC_VER=-2.62
                MY_AM_VER=-1.9
index 3eaff5336503441a8f4b5de921385838c7097166..0b6fede621d12f61edd82b2a761305ce7c42cf3c 100644 (file)
@@ -540,7 +540,8 @@ AC_TYPE_OFF_T
 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 <sys/socket.h>])
+AC_CHECK_MEMBERS([struct ucred.uid, struct ucred.cr_uid, struct sockpeercred.uid], [], [], [#include <sys/types.h>
+#include <sys/socket.h> ])
 AC_CHECK_MEMBERS([struct ifreq.ifr_ifru.ifru_hwaddr], [], [], [#include <net/if.h>])
 AC_HEADER_TIME
 AC_STRUCT_TM
index edc2e6bf491a8b39c8877b22c42d1aa3060ef890..989a9887cf5af51a0e2d09872fe11f6b35d2697a 100644 (file)
@@ -1200,7 +1200,12 @@ static pthread_t lthread;
 static int read_credentials(int fd, char *buffer, size_t size, struct console *con)
 {
 #if defined(SO_PEERCRED)
+#ifdef HAVE_STRUCT_SOCKPEERCRED_UID
+#define HAVE_STRUCT_UCRED_UID
+       struct sockpeercred cred;
+#else
        struct ucred cred;
+#endif
        socklen_t len = sizeof(cred);
 #endif
 #if defined(HAVE_GETPEEREID)