Source: p11-kit Version: 0.24.0-2 Severity: important Tags: patch User: debian-h...@lists.debian.org debian-k...@lists.debian.org Usertags: hurd
Hi, Currently p11-kit FTBFS on GNU/Hurd due to a missing implementation in common/unix-peer.c. Fortunately the function getpeereid() is available in the libbsd library. The same function is also available for kFreeBSD. The patch debian_control.diff adds a build dependency of libbsd0 for kFreeBSD and Hurd. configure.ac.diff adds the bsd library, while common_unix_peer.diff adds the declaration of the function getpeereid(). This is added so that the header file bsd/unistd.h is not necessarily included (which conflicts with parts of unistd.h). Note that with the attached patches the patch, 41_kfreebsd_LOCAL_PEERCRED.diff, for kFreeBSD is no longer needed. The patches have been used to successfully build p11-kit on Linux, Hurd and kFreeBSD. Thanks!
Index: p11-kit-0.24.0-2.3/common/unix-peer.c =================================================================== --- p11-kit-0.24.0-2.3.orig/common/unix-peer.c +++ p11-kit-0.24.0-2.3/common/unix-peer.c @@ -47,6 +47,11 @@ # include <ucred.h> #endif +#ifdef HAVE_GETPEEREID +/* Declare getpeereid from /usr/include/bsd/unistd.h */ +extern int getpeereid(int s, uid_t *euid, gid_t *egid); +#endif + /* Returns the unix domain socket peer information. * Returns zero on success. */ @@ -73,7 +78,8 @@ p11_get_upeer_id (int cfd, uid_t *uid, u *pid = cr.pid; #elif defined(HAVE_GETPEEREID) - /* *BSD/MacOSX */ + /* *BSD/MacOSX/kFreeBSD/Hurd */ + uid_t euid; gid_t egid;
Index: p11-kit-0.24.0-2.3/configure.ac =================================================================== --- p11-kit-0.24.0-2.3.orig/configure.ac +++ p11-kit-0.24.0-2.3/configure.ac @@ -132,6 +132,16 @@ if test "$os_unix" = "yes"; then AC_CHECK_FUNCS([getpeereid]) AC_CHECK_FUNCS([getpeerucred]) AC_CHECK_FUNCS([issetugid]) + case "$host_os" in + kfreebsd*-gnu | gnu*) + have_getpeereid=no + AC_CHECK_LIB(bsd, getpeereid, have_getpeereid=yes) + if test "x$have_getpeereid" = "xyes"; then + AC_DEFINE([HAVE_GETPEEREID], [1], [have getpeereid]) + AC_SEARCH_LIBS([getpeereid], [bsd]) + fi + ;; + esac AC_CACHE_CHECK([for thread-local storage class], [ac_cv_tls_keyword],
--- a/debian/control 2021-06-20 14:49:24.000000000 +0200 +++ b/debian/control 2021-09-25 01:02:28.693455906 +0200 @@ -7,7 +7,8 @@ gtk-doc-tools, libffi-dev, libtasn1-6-dev, - pkg-config + pkg-config, + libbsd0 [kfreebsd-any hurd-any] Standards-Version: 4.5.1 Rules-Requires-Root: no Section: libs