diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-11-29 07:27:09 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-11-29 07:27:09 +0000 |
commit | e895a233fb5ef5b99c69f1d79b5f785194501492 (patch) | |
tree | eb10d3eaa82227e0de4f07a95dc54e50b525ae25 /main | |
parent | 4741a1dbc6f752d3c487bad77d4a3ba5d20616ea (diff) |
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: http://svn.digium.com/svn/asterisk/branches/1.6.2@296533 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r-- | main/asterisk.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/main/asterisk.c b/main/asterisk.c index 12025f5b9..4c79aee6c 100644 --- a/main/asterisk.c +++ b/main/asterisk.c @@ -1193,12 +1193,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; |