aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCollin Funk via Gnupg-devel <[email protected]>2025-05-01 06:35:30 +0200
committerWerner Koch <[email protected]>2025-10-24 15:39:00 +0200
commit563252ade0684fb197c095da2d6272dfc763a852 (patch)
treeeb8aa6fb702e4a0b02ade10637e3f2406f30e87d
parentUpdate version string in libassuan.m4. (diff)
downloadlibassuan-563252ade0684fb197c095da2d6272dfc763a852.tar.gz
libassuan-563252ade0684fb197c095da2d6272dfc763a852.zip
Work around missing getpeereid declaration on AIX.
* configure.ac: Check for a declaration of getpeereid. * src/assuan-socket-server.c (getpeereid) [HAVE_GETPEEREID && !HAVE_DECL_GETPEEREID]: Declare function. (accept_connection_bottom): Adjust a comment. -- GnuPG-bug-id: 7631 Signed-off-by: Collin Funk <[email protected]>
-rw-r--r--configure.ac8
-rw-r--r--src/assuan-socket-server.c7
2 files changed, 13 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index 42939e2..e434821 100644
--- a/configure.ac
+++ b/configure.ac
@@ -471,8 +471,14 @@ AC_CHECK_MEMBER(struct sockpeercred.pid,
# (Open)Solaris
AC_CHECK_FUNCS([getpeerucred])
-# FreeBSD
+# FreeBSD and AIX
AC_CHECK_FUNCS([getpeereid])
+# AIX is missing the declaration.
+AC_CHECK_DECLS([getpeereid],,, [[
+#include <sys/types.h>
+#include <unistd.h>
+#include <sys/socket.h>
+]])
AC_CHECK_MEMBER(struct xucred.cr_pid,
[AC_DEFINE(HAVE_XUCRED_CR_PID, 1,
Define if struct xucred contains the cr_pid member.)],
diff --git a/src/assuan-socket-server.c b/src/assuan-socket-server.c
index c270e8d..8c44755 100644
--- a/src/assuan-socket-server.c
+++ b/src/assuan-socket-server.c
@@ -55,6 +55,11 @@
#include "debug.h"
#include "assuan-defs.h"
+/* Missing declaration on AIX. */
+#if HAVE_GETPEEREID && !HAVE_DECL_GETPEEREID
+int getpeereid (int fd, uid_t *euid, gid_t *egid);
+#endif
+
static gpg_error_t
accept_connection_bottom (assuan_context_t ctx)
{
@@ -130,7 +135,7 @@ accept_connection_bottom (assuan_context_t ctx)
}
}
#elif defined(HAVE_GETPEEREID)
- { /* FreeBSD */
+ { /* FreeBSD and AIX */
if (getpeereid (fd, &ctx->peercred.uid, &ctx->peercred.gid) != -1)
{
ctx->peercred_valid = 1;