Commit abe07b26 authored by OBATA Akio's avatar OBATA Akio Committed by Miloslav Trmač
parent 5a7e3b76
......@@ -421,7 +421,7 @@ fi
AC_SUBST(PAM_MODULE_DIR)
AC_ARG_WITH(os-type, [ --with-os-type=<os> distribution or OS (redhat/suse/gentoo/pardus/solaris)])
AC_ARG_WITH(os-type, [ --with-os-type=<os> distribution or OS (redhat/suse/gentoo/pardus/solaris/netbsd)])
#### Check our operating system (distro-tweaks required)
if test "z$with_os_type" = "z"; then
......@@ -450,8 +450,17 @@ if test x$with_os_type = x; then
with_os_type=solaris
elif test x$operating_system = xfreebsd ; then
with_os_type=freebsd
elif test x$operating_system = xnetbsd ; then
with_os_type=netbsd
else
with_os_type=unknown
case "$host_os" in
*netbsd*)
with_os_type=netbsd
;;
*)
with_os_type=unknown
::
esac
fi
fi
......@@ -482,7 +491,7 @@ elif test x$with_os_type = xsuse -o x$with_os_type = xsolaris ; then
PAM_FILE_INCLUDE_ACCOUNT=common-account
PAM_FILE_INCLUDE_PASSWORD=common-password
PAM_FILE_INCLUDE_SESSION=common-session
elif test x$with_os_type = xfreebsd ; then
elif test x$with_os_type = xfreebsd -o x$with_os_type = xnetbsd; then
PAM_FILE_INCLUDE_AUTH=system
PAM_FILE_INCLUDE_ACCOUNT=system
PAM_FILE_INCLUDE_PASSWORD=system
......@@ -515,6 +524,9 @@ case "$host_os" in
*freebsd*)
AC_DEFINE([HAVE_FREEBSD], 1, [Is this a FreeBSD system?])
;;
*netbsd*)
AC_DEFINE([HAVE_NETBSD], 1, [Is this an NetBSD system?])
;;
*openbsd*)
AC_DEFINE([HAVE_OPENBSD], 1, [Is this an OpenBSD system?])
;;
......
......@@ -29,6 +29,10 @@
#include <sys/sysctl.h>
#include <sys/user.h>
#endif
#ifdef HAVE_NETBSD
#include <sys/param.h>
#include <sys/sysctl.h>
#endif
#ifdef HAVE_OPENBSD
#include <sys/sysctl.h>
#endif
......@@ -89,8 +93,13 @@ static guint64 get_start_time_for_pid (gint pid,
static gint _polkit_unix_process_get_owner (PolkitUnixProcess *process,
GError **error);
#if defined(HAVE_FREEBSD) || defined(HAVE_OPENBSD)
static gboolean get_kinfo_proc (gint pid, struct kinfo_proc *p);
#if defined(HAVE_FREEBSD) || defined(HAVE_NETBSD) || defined(HAVE_OPENBSD)
static gboolean get_kinfo_proc (gint pid,
#if defined(HAVE_NETBSD)
struct kinfo_proc2 *p);
#else
struct kinfo_proc *p);
#endif
#endif
G_DEFINE_TYPE_WITH_CODE (PolkitUnixProcess, polkit_unix_process, G_TYPE_OBJECT,
......@@ -557,9 +566,14 @@ get_kinfo_proc (pid_t pid, struct kinfo_proc *p)
}
#endif
#ifdef HAVE_OPENBSD
#if defined(HAVE_NETBSD) || defined(HAVE_OPENBSD)
static gboolean
get_kinfo_proc (gint pid, struct kinfo_proc *p)
get_kinfo_proc (gint pid,
#ifdef HAVE_NETBSD
struct kinfo_proc2 *p)
#else
struct kinfo_proc *p)
#endif
{
int name[6];
u_int namelen;
......@@ -568,7 +582,11 @@ get_kinfo_proc (gint pid, struct kinfo_proc *p)
sz = sizeof(*p);
namelen = 0;
name[namelen++] = CTL_KERN;
#ifdef HAVE_NETBSD
name[namelen++] = KERN_PROC2;
#else
name[namelen++] = KERN_PROC;
#endif
name[namelen++] = KERN_PROC_PID;
name[namelen++] = pid;
name[namelen++] = sz;
......@@ -586,7 +604,7 @@ get_start_time_for_pid (pid_t pid,
GError **error)
{
guint64 start_time;
#if !defined(HAVE_FREEBSD) && !defined(HAVE_OPENBSD)
#if !defined(HAVE_FREEBSD) && !defined(HAVE_NETBSD) && !defined(HAVE_OPENBSD)
gchar *filename;
gchar *contents;
size_t length;
......@@ -658,8 +676,12 @@ get_start_time_for_pid (pid_t pid,
out:
g_free (filename);
g_free (contents);
#else
#ifdef HAVE_NETBSD
struct kinfo_proc2 p;
#else
struct kinfo_proc p;
#endif
start_time = 0;
......@@ -695,6 +717,8 @@ _polkit_unix_process_get_owner (PolkitUnixProcess *process,
gchar **lines;
#if defined(HAVE_FREEBSD) || defined(HAVE_OPENBSD)
struct kinfo_proc p;
#elif defined(HAVE_NETBSD)
struct kinfo_proc2 p;
#else
gchar filename[64];
guint n;
......@@ -707,7 +731,7 @@ _polkit_unix_process_get_owner (PolkitUnixProcess *process,
lines = NULL;
contents = NULL;
#if defined(HAVE_FREEBSD) || defined(HAVE_OPENBSD)
#if defined(HAVE_FREEBSD) || defined(HAVE_NETBSD) || defined(HAVE_OPENBSD)
if (get_kinfo_proc (process->pid, &p) == 0)
{
g_set_error (error,
......
......@@ -2240,7 +2240,7 @@ get_users_in_net_group (PolkitIdentity *group,
for (;;)
{
#if defined HAVE_OPENBSD
#if defined(HAVE_NETBSD) || defined(HAVE_OPENBSD)
const char *hostname, *username, *domainname;
#else
char *hostname, *username, *domainname;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment