summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2018-02-20 10:48:52 +0900
committerNIIBE Yutaka <gniibe@fsij.org>2018-02-20 10:58:41 +0900
commit0ad3aafe2c02cdff21e10a59de56b8a2f9532be3 (patch)
tree1d0702c230671eb76b5690a4f19d1088efb30d03 /configure.ac
parent9d7ac1e7deb750cf70d78b9298db9a8a60b62a43 (diff)
downloadlibassuan-0ad3aafe2c02cdff21e10a59de56b8a2f9532be3.tar.gz
Better credential support for other OSes.
* configure.ac (HAVE_UCRED_H, HAVE_SYS_UCRED_H): Check these headers unconditionally. (HAVE_SO_PEERCRED, HAVE_LOCAL_PEEREID): Remove. (HAVE_STRUCT_SOCKPEERCRED_PID): New. (HAVE_GETPEEREID): New. * src/assuan-socket-server.c (accept_connection_bottom): Add support for OpenBSD, macOS, and FreeBSD. -- Code in gpg-agent/command-ssh.c are integrated. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac50
1 files changed, 9 insertions, 41 deletions
diff --git a/configure.ac b/configure.ac
index e824b39..d37f07f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -319,7 +319,7 @@ AC_SUBST(LIBASSUAN_CONFIG_EXTRA_LIBS)
AC_HEADER_STDC
AC_CHECK_HEADERS([string.h locale.h sys/uio.h stdint.h inttypes.h \
sys/types.h sys/stat.h unistd.h sys/time.h fcntl.h \
- sys/select.h ])
+ sys/select.h ucred.h sys/ucred.h])
AC_TYPE_UINTPTR_T
AC_TYPE_UINT16_T
@@ -421,48 +421,16 @@ AC_REPLACE_FUNCS(setenv)
#
-# Check for the getsockopt SO_PEERCRED
+# Check for the getsockopt SO_PEERCRED, etc.
#
-AC_MSG_CHECKING(for SO_PEERCRED)
-AC_CACHE_VAL(assuan_cv_sys_so_peercred,
- [AC_TRY_COMPILE([#include <sys/socket.h>],
- [struct ucred cr;
- int cl = sizeof cr;
- getsockopt (1, SOL_SOCKET, SO_PEERCRED, &cr, &cl);],
- assuan_cv_sys_so_peercred=yes,
- assuan_cv_sys_so_peercred=no)
- ])
-AC_MSG_RESULT($assuan_cv_sys_so_peercred)
+AC_CHECK_MEMBER(struct sockpeercred.pid, [], [], [#include <sys/types.h>
+#include <sys/socket.h> ])
-if test $assuan_cv_sys_so_peercred = yes; then
- AC_DEFINE(HAVE_SO_PEERCRED, 1,
- [Defined if SO_PEERCRED is supported (Linux specific)])
-else
- # Check for the getsockopt LOCAL_PEEREID (NetBSD)
- AC_MSG_CHECKING(for LOCAL_PEEREID)
- AC_CACHE_VAL(assuan_cv_sys_so_local_peereid,
- [AC_TRY_COMPILE([#include <sys/socket.>
- #include <sys/un.h>],
- [struct unpcbid unp;
- int unpl = sizeof unp;
- getsockopt (1, SOL_SOCKET, LOCAL_PEEREID, &unp, &unpl);],
- assuan_cv_sys_so_local_peereid=yes,
- assuan_cv_sys_so_local_peereid=no)
- ])
- AC_MSG_RESULT($assuan_cv_sys_so_local_peereid)
-
- if test $assuan_cv_sys_so_local_peereid = yes; then
- AC_DEFINE(HAVE_LOCAL_PEEREID, 1,
- [Defined if LOCAL_PEEREID is supported (NetBSD specific)])
- else
- # (Open)Solaris
- AC_CHECK_FUNCS([getpeerucred], AC_CHECK_HEADERS([ucred.h]))
- if test $ac_cv_func_getpeerucred != yes; then
- # FreeBSD
- AC_CHECK_FUNCS([getpeereid])
- fi
- fi
-fi
+# (Open)Solaris
+AC_CHECK_FUNCS([getpeerucred])
+
+# FreeBSD
+AC_CHECK_FUNCS([getpeereid])
#