summaryrefslogtreecommitdiff
path: root/main/asterisk.c
diff options
context:
space:
mode:
authorTilghman Lesher <tilghman@meg.abyt.es>2010-11-29 07:30:09 +0000
committerTilghman Lesher <tilghman@meg.abyt.es>2010-11-29 07:30:09 +0000
commit22cca55597496a3b620cd00efb5d19a543d38deb (patch)
tree7652322ad83a61be83b19b5aa66d986f2fe2f67b /main/asterisk.c
parent758a67121942443fa1c04d60f83259f4132a4735 (diff)
Merged revisions 296534 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8 ................ r296534 | tilghman | 2010-11-29 01:28:44 -0600 (Mon, 29 Nov 2010) | 20 lines Merged revisions 296533 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.6.2 ........ r296533 | tilghman | 2010-11-29 01:27:09 -0600 (Mon, 29 Nov 2010) | 13 lines 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 ........ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@296535 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/asterisk.c')
-rw-r--r--main/asterisk.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/main/asterisk.c b/main/asterisk.c
index ca3f68ba9..465b29e0c 100644
--- a/main/asterisk.c
+++ b/main/asterisk.c
@@ -1202,12 +1202,18 @@ static int read_credentials(int fd, char *buffer, size_t size, struct console *c
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;