[asterisk-commits] tilghman: branch 1.6.2 r296533 - in /branches/1.6.2: ./ include/asterisk/ main/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Nov 29 01:27:15 CST 2010
Author: tilghman
Date: Mon Nov 29 01:27:09 2010
New Revision: 296533
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=296533
Log:
I love standards. There are so many to choose from. Except when there isn't one.
Linux and *BSD disagree on the elements within the ucred structure. Detect
which one is in use on the system.
(closes issue #18384)
Reported by: bjm
Patches:
cred-diffs uploaded by bjm (license 473)
20101127__issue18384__1.6.2.diff.txt uploaded by tilghman (license 14)
20101127__issue18384__1.8.diff.txt uploaded by tilghman (license 14)
Tested by: tilghman, bjm
Modified:
branches/1.6.2/configure
branches/1.6.2/configure.ac
branches/1.6.2/include/asterisk/autoconfig.h.in
branches/1.6.2/main/asterisk.c
Modified: branches/1.6.2/configure.ac
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/configure.ac?view=diff&rev=296533&r1=296532&r2=296533
==============================================================================
--- branches/1.6.2/configure.ac (original)
+++ branches/1.6.2/configure.ac Mon Nov 29 01:27:09 2010
@@ -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 <sys/socket.h>])
AC_HEADER_TIME
AC_STRUCT_TM
AC_C_VOLATILE
Modified: branches/1.6.2/include/asterisk/autoconfig.h.in
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/include/asterisk/autoconfig.h.in?view=diff&rev=296533&r1=296532&r2=296533
==============================================================================
--- branches/1.6.2/include/asterisk/autoconfig.h.in (original)
+++ branches/1.6.2/include/asterisk/autoconfig.h.in Mon Nov 29 01:27:09 2010
@@ -704,6 +704,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
Modified: branches/1.6.2/main/asterisk.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/main/asterisk.c?view=diff&rev=296533&r1=296532&r2=296533
==============================================================================
--- branches/1.6.2/main/asterisk.c (original)
+++ branches/1.6.2/main/asterisk.c Mon Nov 29 01:27:09 2010
@@ -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;
More information about the asterisk-commits
mailing list