diff --git a/configure.ac b/configure.ac index d099f92..360c101 100644 --- a/configure.ac +++ b/configure.ac @@ -83,10 +83,19 @@ AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal) EXTRA_COMPILE_WARNINGS(yes) # Solaris requires libresolv for daemon() -case "$host" in - *-*-solaris*) +case "$host_os" in + solaris*) AC_CHECK_LIB(resolv, daemon, [CONSOLE_KIT_LIBS="$CONSOLE_KIT_LIBS -lresolv"]) ;; + kfreebsd*-gnu) + have_getpeereid=no + AC_CHECK_LIB(bsd, getpeereid, have_getpeereid=yes) + if test "x$have_getpeereid" = "xyes"; then + CONSOLE_KIT_LIBS="${CONSOLE_KIT_LIBS} -lbsd" + TOOLS_LIBS="${TOOLS_LIBS} -lbsd" + AC_DEFINE(HAVE_GETPEEREID, [], [Define if we have getpeereid]) + fi + ;; esac diff --git a/src/ck-sysdeps-unix.c b/src/ck-sysdeps-unix.c index 4a1736c..c400b88 100644 --- a/src/ck-sysdeps-unix.c +++ b/src/ck-sysdeps-unix.c @@ -100,6 +100,15 @@ ck_get_socket_peer_credentials (int socket_fd, if (ucred != NULL) { ucred_free (ucred); } +#elif defined(HAVE_GETPEEREID) + gid_t dummy; + + if (getpeereid (socket_fd, &uid_read, &dummy) == 0) { + ret = TRUE; + } else { + g_warning ("Failed to getpeereid() credentials: %s\n", + g_strerror (errno)); + } #else /* !SO_PEERCRED && !HAVE_GETPEERUCRED */ g_warning ("Socket credentials not supported on this OS\n"); #endif