PolicyKit: Branch 'master'

David Zeuthen david at kemper.freedesktop.org
Tue Apr 8 09:32:10 PDT 2008


 configure.in                                    |   18 ++
 src/kit/kit-file.h                              |    3 
 src/kit/kit-message.h                           |    5 
 src/kit/kit-spawn.c                             |  106 ++++++++--------
 src/kit/kit-spawn.h                             |    6 
 src/kit/kit-string.c                            |   20 +++
 src/kit/kit-string.h                            |    4 
 src/kit/kit-test.c                              |    7 +
 src/kit/kit.h                                   |    6 
 src/polkit-dbus/polkit-read-auth-helper.c       |   11 +
 src/polkit-dbus/polkit-resolve-exe-helper.c     |   11 +
 src/polkit-dbus/polkit-set-default-helper.c     |   11 +
 src/polkit-grant/polkit-explicit-grant-helper.c |   11 +
 src/polkit-grant/polkit-grant-helper-pam.c      |   14 ++
 src/polkit-grant/polkit-grant-helper.c          |   11 +
 src/polkit-grant/polkit-grant.c                 |   44 +++++++
 src/polkit-grant/polkit-revoke-helper.c         |   11 +
 src/polkit/polkit-authorization-constraint.c    |   30 ++--
 src/polkit/polkit-context.c                     |  150 ++++++++++++++++++++++++
 src/polkit/polkit-debug.h                       |    4 
 src/polkit/polkit-error.h                       |    4 
 src/polkit/polkit-policy-cache.c                |    3 
 src/polkit/polkit-policy-file.c                 |   20 +++
 src/polkit/polkit-sysdeps.c                     |   56 ++++++++
 tools/polkit-auth.c                             |    3 
 25 files changed, 496 insertions(+), 73 deletions(-)

New commits:
commit 00b85cf33fde2117ec1ea6fd89eb50fdb4d67be4
Author: Jim Li <Jim.Li at Sun.COM>
Date:   Tue Apr 8 12:27:37 2008 -0400

    add support for Solaris platform
    
    Add support for Solaris platform. The patch contains some implement
    for GNU library extentsion function which isn't support by Solaris,
    for instance, vasprintf(), strndup(), clearenv(), and clearenv(). Also
    rewriting some code which Sun compiler doesn't support, such as empty
    union name.

diff --git a/configure.in b/configure.in
index 0e6ae9c..370aa69 100644
--- a/configure.in
+++ b/configure.in
@@ -433,7 +433,7 @@ fi
 
 AC_SUBST(PAM_MODULE_DIR)
 
-AC_ARG_WITH(os-type,     [  --with-os-type=<os>        distribution or OS (redhat/suse/gentoo/pardus)])
+AC_ARG_WITH(os-type,     [  --with-os-type=<os>        distribution or OS (redhat/suse/gentoo/pardus/solaris)])
 
 #### Check our operating system (distro-tweaks required)
 if test "z$with_os_type" = "z"; then
@@ -458,6 +458,8 @@ if test x$with_os_type = x; then
         with_os_type=gentoo
     elif test x$operating_system = xpardus ; then
         with_os_type=pardus
+    elif test x$operating_system = xsolaris ; then
+	with_os_type=solaris
     else
         with_os_type=unknown
     fi
@@ -469,6 +471,7 @@ AM_CONDITIONAL(OS_TYPE_RED_HAT, test x$with_os_type = xredhat, [Running on Red H
 AM_CONDITIONAL(OS_TYPE_SUSE, test x$with_os_type = xsuse, [Running on SUSE OS'es])
 AM_CONDITIONAL(OS_TYPE_GENTOO, test x$with_os_type = xgentoo, [Running on Gentoo OS'es])
 AM_CONDITIONAL(OS_TYPE_PARDUS, test x$with_os_type = xpardus, [Running on Pardus OS'es])
+AM_CONDITIONAL(OS_TYPE_SALARIS, test x$with_os_type = xsolaris, [Running os Solaris OS'es])
 
 AC_ARG_WITH(pam-include, [  --with-pam-include=<file>  pam file to include])
 
@@ -483,7 +486,7 @@ elif test x$with_os_type = xredhat -o x$with_os_type = xgentoo -o x$with_os_type
    PAM_FILE_INCLUDE_ACCOUNT=system-auth
    PAM_FILE_INCLUDE_PASSWORD=system-auth
    PAM_FILE_INCLUDE_SESSION=system-auth
-elif test x$with_os_type = xsuse ; then
+elif test x$with_os_type = xsuse -o x$with_os_type = xsolaris ; then
    PAM_FILE_INCLUDE_AUTH=common-auth
    PAM_FILE_INCLUDE_ACCOUNT=common-account
    PAM_FILE_INCLUDE_PASSWORD=common-password
@@ -504,6 +507,17 @@ AC_DEFINE_UNQUOTED(PAM_FILE_INCLUDE_ACCOUNT, "$PAM_FILE_INCLUDE_ACCOUNT", [pam f
 AC_DEFINE_UNQUOTED(PAM_FILE_INCLUDE_PASSWORD, "$PAM_FILE_INCLUDE_PASSWORD", [pam file password])
 AC_DEFINE_UNQUOTED(PAM_FILE_INCLUDE_SESSION, "$PAM_FILE_INCLUDE_SESSION", [pam file session])
 
+dnl ---------------------------------------------------------------------------
+dnl - check OS 
+dnl ---------------------------------------------------------------------------
+case "$host_os" in
+  *linux*)
+	;;
+  *solaris*)
+	AC_DEFINE([HAVE_SOLARIS], 1, [Is this a Solaris system?])
+	;;
+esac
+
 # ********************
 # Internationalisation
 # ********************
diff --git a/src/kit/kit-file.h b/src/kit/kit-file.h
index c4dedbc..fb7c5be 100644
--- a/src/kit/kit-file.h
+++ b/src/kit/kit-file.h
@@ -35,6 +35,9 @@
 #define KIT_FILE_H
 
 #include <kit/kit.h>
+#ifdef HAVE_SOLARIS
+#include <sys/types.h>
+#endif
 
 KIT_BEGIN_DECLS
 
diff --git a/src/kit/kit-message.h b/src/kit/kit-message.h
index d92ec27..7d363b5 100644
--- a/src/kit/kit-message.h
+++ b/src/kit/kit-message.h
@@ -38,8 +38,13 @@
 
 KIT_BEGIN_DECLS
 
+#ifdef __sun
+void kit_debug   (const char *format, ...);
+void kit_warning (const char *format, ...);
+#else
 void kit_debug   (const char *format, ...) __attribute__((__format__ (__printf__, 1, 2)));
 void kit_warning (const char *format, ...) __attribute__((__format__ (__printf__, 1, 2)));
+#endif
 
 KIT_END_DECLS
 
diff --git a/src/kit/kit-spawn.c b/src/kit/kit-spawn.c
index b99b05c..836dcda 100644
--- a/src/kit/kit-spawn.c
+++ b/src/kit/kit-spawn.c
@@ -156,9 +156,9 @@ out:
  * @flags: A combination of flags from #KitSpawnFlags
  * @argv: #NULL terminated argument vector
  * @envp: #NULL terminated environment or #NULL to inherit parents;
- * @stdin: String to write to stdin of child or #NULL
- * @stdout: Return location for stdout from child or #NULL. Free with kit_free().
- * @stderr: Return location for stderr from child or #NULL. Free with kit_free().
+ * @stdinp: String to write to stdin of child or #NULL
+ * @stdoutp: Return location for stdout from child or #NULL. Free with kit_free().
+ * @stderrp: Return location for stderr from child or #NULL. Free with kit_free().
  * @out_exit_status: Return location for exit status
  *
  * Executes a child process and waits for the child process to exit
@@ -175,9 +175,9 @@ kit_spawn_sync (const char     *working_directory,
                 KitSpawnFlags   flags,
                 char          **argv,
                 char          **envp,
-                char           *stdin,
-                char          **stdout,
-                char          **stderr,
+                char           *stdinp,
+                char          **stdoutp,
+                char          **stderrp,
                 int            *out_exit_status)
 {
         kit_bool_t ret;
@@ -191,28 +191,28 @@ kit_spawn_sync (const char     *working_directory,
 
         kit_return_val_if_fail (argv != NULL, FALSE);
         kit_return_val_if_fail (out_exit_status != NULL, FALSE);
-        kit_return_val_if_fail (! ((flags & KIT_SPAWN_CHILD_INHERITS_STDIN) && stdin != NULL), FALSE);
-        kit_return_val_if_fail (! ((flags & KIT_SPAWN_STDOUT_TO_DEV_NULL) && stdout != NULL), FALSE);
-        kit_return_val_if_fail (! ((flags & KIT_SPAWN_STDERR_TO_DEV_NULL) && stderr != NULL), FALSE);
+        kit_return_val_if_fail (! ((flags & KIT_SPAWN_CHILD_INHERITS_STDIN) && stdinp != NULL), FALSE);
+        kit_return_val_if_fail (! ((flags & KIT_SPAWN_STDOUT_TO_DEV_NULL) && stdoutp != NULL), FALSE);
+        kit_return_val_if_fail (! ((flags & KIT_SPAWN_STDERR_TO_DEV_NULL) && stderrp != NULL), FALSE);
 
-        if (stdout != NULL)
-                *stdout = NULL;
-        if (stderr != NULL)
-                *stderr = NULL;
+        if (stdoutp != NULL)
+                *stdoutp = NULL;
+        if (stderrp != NULL)
+                *stderrp = NULL;
 
-        if (stdin != NULL) {
+        if (stdinp != NULL) {
                 if (pipe (stdin_pipe) != 0) {
                         goto out;
                 }
         }
 
-        if (stdout != NULL) {
+        if (stdoutp != NULL) {
                 if (pipe (stdout_pipe) != 0) {
                         goto out;
                 }
         }
 
-        if (stderr != NULL) {
+        if (stderrp != NULL) {
                 if (pipe (stderr_pipe) != 0) {
                         goto out;
                 }
@@ -260,9 +260,9 @@ kit_spawn_sync (const char     *working_directory,
                         }
                 }
 
-                /* set stdin, stdout and stderr */
+                /* set stdinp, stdoutp and stderrp */
 
-                if (stdin != NULL) {
+                if (stdinp != NULL) {
                         if (_sane_dup2 (stdin_pipe[0], 0) < 0) {
                                 exit (128 + errno);
                         }
@@ -272,7 +272,7 @@ kit_spawn_sync (const char     *working_directory,
                         }
                 }
 
-                if (stdout != NULL) {
+                if (stdoutp != NULL) {
                         if (_sane_dup2 (stdout_pipe[1], 1) < 0) {
                                 exit (128 + errno);
                         }
@@ -282,7 +282,7 @@ kit_spawn_sync (const char     *working_directory,
                         }
                 }
 
-                if (stderr != NULL) {
+                if (stderrp != NULL) {
                         if (_sane_dup2 (stderr_pipe[1], 2) < 0) {
                                 exit (128 + errno);
                         }
@@ -322,7 +322,7 @@ kit_spawn_sync (const char     *working_directory,
                         close (stderr_pipe[1]);
                 }
 
-                wp = stdin;
+                wp = stdinp;
 
                 while (stdin_pipe[1] != -1 || stdout_pipe[0] != -1 || stderr_pipe[0] != -1) {
                         int ret;
@@ -375,7 +375,7 @@ kit_spawn_sync (const char     *working_directory,
                         }
                         
                         if (stdout_pipe[0] != -1) {
-                                num_read = _read_from (stdout_pipe[0], stdout);
+                                num_read = _read_from (stdout_pipe[0], stdoutp);
                                 if (num_read == 0) {
                                         close (stdout_pipe[0]);
                                         stdout_pipe[0] = -1;
@@ -385,7 +385,7 @@ kit_spawn_sync (const char     *working_directory,
                         }
                         
                         if (stderr_pipe[0] != -1) {
-                                num_read = _read_from (stderr_pipe[0], stderr);
+                                num_read = _read_from (stderr_pipe[0], stderrp);
                                 if (num_read == 0) {
                                         close (stderr_pipe[0]);
                                         stderr_pipe[0] = -1;
@@ -424,13 +424,13 @@ out:
                 close (stderr_pipe[0]);
 
         if (!ret) {
-                if (stdout != NULL) {
-                        kit_free (*stdout);
-                        *stdout = NULL;
+                if (stdoutp != NULL) {
+                        kit_free (*stdoutp);
+                        *stdoutp = NULL;
                 }
-                if (stderr != NULL) {
-                        kit_free (*stderr);
-                        *stderr = NULL;
+                if (stderrp != NULL) {
+                        kit_free (*stderrp);
+                        *stderrp = NULL;
                 }
         }
 
@@ -483,8 +483,8 @@ _run_test (void)
                 "echo -n \"$value\""                       "\n"
                 "exit 0"                                   "\n";
         char *argv[] = {"/tmp/kit-spawn-test", NULL};
-        char *stdout;
-        char *stderr;
+        char *stdoutp;
+        char *stderrp;
         int exit_status;
         struct stat statbuf;
 
@@ -495,14 +495,14 @@ _run_test (void)
                                     argv,
                                     NULL,
                                     NULL,
-                                    &stdout,
-                                    &stderr,
+                                    &stdoutp,
+                                    &stderrp,
                                     &exit_status)) {
                         kit_assert (WEXITSTATUS (exit_status) == 42);
-                        kit_assert (stdout != NULL && strcmp (stdout, "Hello World\n") == 0);
-                        kit_assert (stderr != NULL && strcmp (stderr, "Goodbye World\n") == 0);
-                        kit_free (stdout);
-                        kit_free (stderr);
+                        kit_assert (stdoutp != NULL && strcmp (stdoutp, "Hello World\n") == 0);
+                        kit_assert (stderrp != NULL && strcmp (stderrp, "Goodbye World\n") == 0);
+                        kit_free (stdoutp);
+                        kit_free (stderrp);
                 }
 
                 if (kit_spawn_sync ("/",
@@ -526,12 +526,12 @@ _run_test (void)
                                     argv,
                                     NULL,
                                     NULL,
-                                    &stdout,
-                                    &stderr,
+                                    &stdoutp,
+                                    &stderrp,
                                     &exit_status)) {
                         kit_assert (WEXITSTATUS (exit_status) == 43);
-                        kit_assert (stdout == NULL);
-                        kit_assert (stderr == NULL);
+                        kit_assert (stdoutp == NULL);
+                        kit_assert (stderrp == NULL);
                 }
 
                 kit_assert (unlink (path) == 0);
@@ -546,12 +546,12 @@ _run_test (void)
                                     argv,
                                     envp,
                                     NULL,
-                                    &stdout,
+                                    &stdoutp,
                                     NULL,
                                     &exit_status)) {
                         kit_assert (WEXITSTATUS (exit_status) == 0);
-                        kit_assert (stdout != NULL && strcmp (stdout, "some_value") == 0);
-                        kit_free (stdout);
+                        kit_assert (stdoutp != NULL && strcmp (stdoutp, "some_value") == 0);
+                        kit_free (stdoutp);
                 }
 
                 kit_assert (unlink (path) == 0);
@@ -606,12 +606,12 @@ _run_test (void)
                                     argv,
                                     NULL,
                                     NULL,
-                                    &stdout,
+                                    &stdoutp,
                                     NULL,
                                     &exit_status)) {
                         kit_assert (WEXITSTATUS (exit_status) == 0);
-                        kit_assert (stdout != NULL && strcmp (stdout, "/tmp\n") == 0);
-                        kit_free (stdout);
+                        kit_assert (stdoutp != NULL && strcmp (stdoutp, "/tmp\n") == 0);
+                        kit_free (stdoutp);
                 }
 
                 kit_assert (stat ("/usr", &statbuf) == 0 && S_ISDIR (statbuf.st_mode));
@@ -620,12 +620,12 @@ _run_test (void)
                                     argv,
                                     NULL,
                                     NULL,
-                                    &stdout,
+                                    &stdoutp,
                                     NULL,
                                     &exit_status)) {
                         kit_assert (WEXITSTATUS (exit_status) == 0);
-                        kit_assert (stdout != NULL && strcmp (stdout, "/usr\n") == 0);
-                        kit_free (stdout);
+                        kit_assert (stdoutp != NULL && strcmp (stdoutp, "/usr\n") == 0);
+                        kit_free (stdoutp);
                 }
 
                 kit_assert (unlink (path) == 0);
@@ -650,12 +650,12 @@ _run_test (void)
                                     argv,
                                     NULL,
                                     "foobar0\nfoobar1",
-                                    &stdout,
+                                    &stdoutp,
                                     NULL,
                                     &exit_status)) {
                         kit_assert (WEXITSTATUS (exit_status) == 0);
-                        kit_assert (stdout != NULL && strcmp (stdout, "foobar0 foobar1") == 0);
-                        kit_free (stdout);
+                        kit_assert (stdoutp != NULL && strcmp (stdoutp, "foobar0 foobar1") == 0);
+                        kit_free (stdoutp);
                 }
 
                 kit_assert (unlink (path) == 0);
diff --git a/src/kit/kit-spawn.h b/src/kit/kit-spawn.h
index 400359d..6f40dd9 100644
--- a/src/kit/kit-spawn.h
+++ b/src/kit/kit-spawn.h
@@ -57,9 +57,9 @@ kit_bool_t kit_spawn_sync (const char     *working_directory,
                            KitSpawnFlags   flags,
                            char          **argv,
                            char          **envp,
-                           char           *stdin,
-                           char          **stdout,
-                           char          **stderr,
+                           char           *stdinp,
+                           char          **stdoutp,
+                           char          **stderrp,
                            int            *out_exit_status);
 
 KIT_END_DECLS
diff --git a/src/kit/kit-string.c b/src/kit/kit-string.c
index 579e568..9ce0570 100644
--- a/src/kit/kit-string.c
+++ b/src/kit/kit-string.c
@@ -127,6 +127,26 @@ kit_strndup (const char *s, size_t n)
 
 #endif /* KIT_BUILD_TESTS */
 
+#ifdef HAVE_SOLARIS
+int vasprintf(char **strp, const char *fmt, va_list ap)
+{
+        int size;
+        va_list ap2;
+        char s;
+
+        *strp = NULL;
+        va_copy(ap2, ap);
+        size = vsnprintf(&s, 1, fmt, ap2);
+        va_end(ap2);
+        *strp = malloc(size + 1);
+        if (!*strp)
+                return -1;
+        vsnprintf(*strp, size + 1, fmt, ap);
+
+        return size;
+}
+#endif
+
 /**
  * kit_strdup_printf:
  * @format: sprintf(3) format string
diff --git a/src/kit/kit-string.h b/src/kit/kit-string.h
index d5e5ff5..3f58e21 100644
--- a/src/kit/kit-string.h
+++ b/src/kit/kit-string.h
@@ -40,7 +40,11 @@ KIT_BEGIN_DECLS
 
 char *kit_strdup         (const char *s);
 char *kit_strndup        (const char *s, size_t n);
+#ifdef __sun
+char *kit_strdup_printf  (const char *format, ...);
+#else
 char *kit_strdup_printf  (const char *format, ...) __attribute__((__format__ (__printf__, 1, 2)));
+#endif
 char *kit_strdup_vprintf (const char *format, va_list args);
 char *kit_str_append     (char *s, const char *s2);
 
diff --git a/src/kit/kit-test.c b/src/kit/kit-test.c
index 3a8f2db..5aae02e 100644
--- a/src/kit/kit-test.c
+++ b/src/kit/kit-test.c
@@ -27,8 +27,15 @@
  *
  **************************************************************************/
 
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include <stdio.h>
 #include <stdlib.h>
+#ifdef HAVE_SOLARIS
+#include <sys/types.h>
+#endif
 #include <kit/kit-test.h>
 #include <kit/kit-memory.h>
 
diff --git a/src/kit/kit.h b/src/kit/kit.h
index a3d762f..c5ca791 100644
--- a/src/kit/kit.h
+++ b/src/kit/kit.h
@@ -72,6 +72,9 @@ typedef int kit_bool_t;
 
 void kit_print_backtrace (void);
 
+#ifdef HAVE_SOLARIS
+#define __PRETTY_FUNCTION__ __func__
+#endif
 /**
  * kit_assert:
  * @expr: expression
@@ -140,6 +143,9 @@ do {
 
 #define _KIT_INSIDE_KIT_H 1
 
+#ifdef HAVE_SOLARIS
+#include <sys/types.h>
+#endif
 #include <kit/kit-memory.h>
 #include <kit/kit-string.h>
 #include <kit/kit-list.h>
diff --git a/src/polkit-dbus/polkit-read-auth-helper.c b/src/polkit-dbus/polkit-read-auth-helper.c
index 25505ca..4e065c2 100644
--- a/src/polkit-dbus/polkit-read-auth-helper.c
+++ b/src/polkit-dbus/polkit-read-auth-helper.c
@@ -48,6 +48,10 @@
 #include <utime.h>
 #include <fcntl.h>
 #include <dirent.h>
+#ifdef HAVE_SOLARIS
+#include <limits.h>
+#define LOG_AUTHPRIV    (10<<3)
+#endif
 
 #include <polkit-dbus/polkit-dbus.h>
 #include <polkit/polkit-private.h>
@@ -287,8 +291,15 @@ main (int argc, char *argv[])
 
 #ifndef POLKIT_BUILD_TESTS
         /* clear the entire environment to avoid attacks using with libraries honoring environment variables */
+#ifdef HAVE_SOLARIS
+        extern char **environ;
+
+        if (environ != NULL)
+                environ[0] = NULL;
+#else
         if (clearenv () != 0)
                 goto out;
+#endif
         /* set a minimal environment */
         setenv ("PATH", "/usr/sbin:/usr/bin:/sbin:/bin", 1);
 #endif
diff --git a/src/polkit-dbus/polkit-resolve-exe-helper.c b/src/polkit-dbus/polkit-resolve-exe-helper.c
index 18d3260..fb96804 100644
--- a/src/polkit-dbus/polkit-resolve-exe-helper.c
+++ b/src/polkit-dbus/polkit-resolve-exe-helper.c
@@ -53,6 +53,10 @@
 #include <polkit-dbus/polkit-dbus.h>
 #include <polkit/polkit-private.h>
 
+#ifdef HAVE_SOLARIS
+#define LOG_AUTHPRIV	(10<<3)
+#define PATH_MAX	1024
+#endif
 
 int
 main (int argc, char *argv[])
@@ -72,8 +76,15 @@ main (int argc, char *argv[])
         ret = 1;
 
         /* clear the entire environment to avoid attacks using with libraries honoring environment variables */
+#ifdef HAVE_SOLARIS
+	extern char **environ;
+
+	if (environ != NULL)
+		environ[0] = NULL;
+#else
         if (clearenv () != 0)
                 goto out;
+#endif
         /* set a minimal environment */
         setenv ("PATH", "/usr/sbin:/usr/bin:/sbin:/bin", 1);
 
diff --git a/src/polkit-dbus/polkit-set-default-helper.c b/src/polkit-dbus/polkit-set-default-helper.c
index e62529e..2efaffc 100644
--- a/src/polkit-dbus/polkit-set-default-helper.c
+++ b/src/polkit-dbus/polkit-set-default-helper.c
@@ -54,6 +54,10 @@
 #include <polkit/polkit-private.h>
 #include <polkit-dbus/polkit-dbus.h>
 
+#ifdef HAVE_SOLARIS
+#define LOG_AUTHPRIV    (10<<3)
+#endif
+
 static polkit_bool_t
 set_default (const char *action_id, const char *any, const char *inactive, const char *active)
 {
@@ -126,8 +130,15 @@ main (int argc, char *argv[])
 
         ret = 1;
         /* clear the entire environment to avoid attacks using with libraries honoring environment variables */
+#ifdef HAVE_SOLARIS
+        extern char **environ;
+
+        if (environ != NULL)
+                environ[0] = NULL;
+#else
         if (clearenv () != 0)
                 goto out;
+#endif
         /* set a minimal environment */
         setenv ("PATH", "/usr/sbin:/usr/bin:/sbin:/bin", 1);
 
diff --git a/src/polkit-grant/polkit-explicit-grant-helper.c b/src/polkit-grant/polkit-explicit-grant-helper.c
index 3cb468a..39cdcaa 100644
--- a/src/polkit-grant/polkit-explicit-grant-helper.c
+++ b/src/polkit-grant/polkit-explicit-grant-helper.c
@@ -52,6 +52,10 @@
 #include <polkit-dbus/polkit-dbus.h>
 #include <polkit/polkit-private.h>
 
+#ifdef HAVE_SOLARIS
+#define LOG_AUTHPRIV    (10<<3)
+#endif
+
 int
 main (int argc, char *argv[])
 {
@@ -66,8 +70,15 @@ main (int argc, char *argv[])
         ret = 1;
 
         /* clear the entire environment to avoid attacks using with libraries honoring environment variables */
+#ifdef HAVE_SOLARIS
+        extern char **environ;
+
+        if (environ != NULL)
+                environ[0] = NULL;
+#else
         if (clearenv () != 0)
                 goto out;
+#endif
         /* set a minimal environment */
         setenv ("PATH", "/usr/sbin:/usr/bin:/sbin:/bin", 1);
 
diff --git a/src/polkit-grant/polkit-grant-helper-pam.c b/src/polkit-grant/polkit-grant-helper-pam.c
index 4cf3cf2..7ce19b0 100644
--- a/src/polkit-grant/polkit-grant-helper-pam.c
+++ b/src/polkit-grant/polkit-grant-helper-pam.c
@@ -28,6 +28,9 @@
  **************************************************************************/
 
 /* TODO: FIXME: XXX: this code needs security review before it can be released! */
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -38,6 +41,10 @@
 #include <syslog.h>
 #include <security/pam_appl.h>
 
+#ifdef HAVE_SOLARIS
+#define LOG_AUTHPRIV    (10<<3)
+#endif
+
 /* Development aid: define PGH_DEBUG to get debugging output. Do _NOT_
  * enable this in production builds; it may leak passwords and other
  * sensitive information.
@@ -60,8 +67,15 @@ main (int argc, char *argv[])
         pam_h = NULL;
 
         /* clear the entire environment to avoid attacks using with libraries honoring environment variables */
+#ifdef HAVE_SOLARIS
+        extern char **environ;
+
+        if (environ != NULL)
+                environ[0] = NULL;
+#else
         if (clearenv () != 0)
                 goto error;
+#endif
         /* set a minimal environment */
         setenv ("PATH", "/usr/sbin:/usr/bin:/sbin:/bin", 1);
 
diff --git a/src/polkit-grant/polkit-grant-helper.c b/src/polkit-grant/polkit-grant-helper.c
index e141edd..f568686 100644
--- a/src/polkit-grant/polkit-grant-helper.c
+++ b/src/polkit-grant/polkit-grant-helper.c
@@ -60,6 +60,10 @@
 #include <polkit-dbus/polkit-dbus.h>
 // #include <polkit/polkit-grant-database.h>
 
+#ifdef HAVE_SOLARIS
+#define LOG_AUTHPRIV    (10<<3)
+#endif
+
 /* Development aid: define PGH_DEBUG to get debugging output. Do _NOT_
  * enable this in production builds; it may leak passwords and other
  * sensitive information.
@@ -560,8 +564,15 @@ main (int argc, char *argv[])
         ret = 3;
 
         /* clear the entire environment to avoid attacks using with libraries honoring environment variables */
+#ifdef HAVE_SOLARIS
+        extern char **environ;
+
+        if (environ != NULL)
+                environ[0] = NULL;
+#else
         if (clearenv () != 0)
                 goto out;
+#endif
         /* set a minimal environment */
         setenv ("PATH", "/usr/sbin:/usr/bin:/sbin:/bin", 1);
 
diff --git a/src/polkit-grant/polkit-grant.c b/src/polkit-grant/polkit-grant.c
index 3ade9ff..02077c0 100644
--- a/src/polkit-grant/polkit-grant.c
+++ b/src/polkit-grant/polkit-grant.c
@@ -35,6 +35,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <errno.h>
 #include <sys/types.h>
 #include <unistd.h>
 #include <sys/wait.h>
@@ -542,6 +543,49 @@ error:
         return FALSE;
 }
 
+#ifdef HAVE_SOLARIS
+#define BUFFER_LEN      256
+
+ssize_t getline (char **lineptr, size_t *n, FILE *f)
+{
+        char ch;
+        size_t m = 0;
+        ssize_t buf_len = 0;
+        char * buf = NULL;
+        char * p = NULL;
+
+
+        while ( (ch = getc(f)) !=EOF )
+        {
+                if (errno != 0)
+                        return -1;
+                if ( m++ >= buf_len )
+                {
+                        buf_len += BUFFER_LEN;
+                        buf = (char *) realloc(buf, buf_len + 1);
+                        if ( buf == NULL )
+                        {
+                                return -1;
+                        }
+                        p = buf + buf_len - BUFFER_LEN;
+                }
+                if ( ch == '\n' )
+                        break;
+                *p = ch;
+                p++;
+        }
+        if ( m == 0 )
+        {
+                return -1;
+        } else {
+                *p = '\0';
+                *lineptr = buf;
+                *n = m;
+                return m;
+        }
+}
+#endif
+
 #ifdef POLKIT_BUILD_TESTS
 
 static polkit_bool_t
diff --git a/src/polkit-grant/polkit-revoke-helper.c b/src/polkit-grant/polkit-revoke-helper.c
index e2cca4f..6052df0 100644
--- a/src/polkit-grant/polkit-revoke-helper.c
+++ b/src/polkit-grant/polkit-revoke-helper.c
@@ -51,6 +51,10 @@
 #include <polkit-dbus/polkit-dbus.h>
 #include <polkit/polkit-private.h>
 
+#ifdef HAVE_SOLARIS
+#define LOG_AUTHPRIV    (10<<3)
+#endif
+
 static int
 _write_to_fd (int fd, const char *str, ssize_t str_len)
 {
@@ -108,8 +112,15 @@ main (int argc, char *argv[])
 
 #ifndef POLKIT_BUILD_TESTS
         /* clear the entire environment to avoid attacks using with libraries honoring environment variables */
+#ifdef HAVE_SOLARIS
+        extern char **environ;
+
+        if (environ != NULL)
+                environ[0] = NULL;
+#else
         if (clearenv () != 0)
                 goto out;
+#endif
         /* set a minimal environment */
         setenv ("PATH", "/usr/sbin:/usr/bin:/sbin:/bin", 1);
 #endif
diff --git a/src/polkit/polkit-authorization-constraint.c b/src/polkit/polkit-authorization-constraint.c
index 63a8e5d..cf2b0d2 100644
--- a/src/polkit/polkit-authorization-constraint.c
+++ b/src/polkit/polkit-authorization-constraint.c
@@ -81,7 +81,7 @@ struct _PolKitAuthorizationConstraint
                 struct {
                         char *context;
                 } selinux_context;
-        };
+        } data;
 };
 
 static PolKitAuthorizationConstraint _local_constraint = {-1, 
@@ -148,11 +148,11 @@ polkit_authorization_constraint_unref (PolKitAuthorizationConstraint *authc)
                 break;
 
         case POLKIT_AUTHORIZATION_CONSTRAINT_TYPE_REQUIRE_EXE:
-                kit_free (authc->exe.path);
+                kit_free (authc->data.exe.path);
                 break;
 
         case POLKIT_AUTHORIZATION_CONSTRAINT_TYPE_REQUIRE_SELINUX_CONTEXT:
-                kit_free (authc->selinux_context.context);
+                kit_free (authc->data.selinux_context.context);
                 break;
         }
 
@@ -287,7 +287,7 @@ polkit_authorization_constraint_check_caller (PolKitAuthorizationConstraint *aut
                         n = polkit_sysdeps_get_exe_for_pid_with_helper (pid, buf, sizeof (buf));
 
                         if (n != -1 && n < (int) sizeof (buf)) {
-                                if (strcmp (authc->exe.path, buf) == 0) {
+                                if (strcmp (authc->data.exe.path, buf) == 0) {
                                         ret = TRUE;
                                 }
                         }
@@ -297,7 +297,7 @@ polkit_authorization_constraint_check_caller (PolKitAuthorizationConstraint *aut
 
         case POLKIT_AUTHORIZATION_CONSTRAINT_TYPE_REQUIRE_SELINUX_CONTEXT:
                 if (polkit_caller_get_selinux_context (caller, &selinux_context) && selinux_context != NULL) {
-                        if (strcmp (authc->selinux_context.context, selinux_context) == 0) {
+                        if (strcmp (authc->data.selinux_context.context, selinux_context) == 0) {
                                 ret = TRUE;
                         }
                 } else {
@@ -350,7 +350,7 @@ polkit_authorization_constraint_get_exe (PolKitAuthorizationConstraint *authc)
         kit_return_val_if_fail (authc != NULL, NULL);
         kit_return_val_if_fail (authc->type == POLKIT_AUTHORIZATION_CONSTRAINT_TYPE_REQUIRE_EXE, NULL);
 
-        return authc->exe.path;
+        return authc->data.exe.path;
 }
 
 /**
@@ -371,7 +371,7 @@ polkit_authorization_constraint_get_selinux_context (PolKitAuthorizationConstrai
         kit_return_val_if_fail (authc != NULL, NULL);
         kit_return_val_if_fail (authc->type == POLKIT_AUTHORIZATION_CONSTRAINT_TYPE_REQUIRE_SELINUX_CONTEXT, NULL);
 
-        return authc->selinux_context.context;
+        return authc->data.selinux_context.context;
 }
 
 /**
@@ -428,8 +428,8 @@ polkit_authorization_constraint_get_require_exe (const char *path)
         if (authc == NULL)
                 goto out;
         authc->type = POLKIT_AUTHORIZATION_CONSTRAINT_TYPE_REQUIRE_EXE;
-        authc->exe.path = kit_strdup (path);
-        if (authc->exe.path == NULL) {
+        authc->data.exe.path = kit_strdup (path);
+        if (authc->data.exe.path == NULL) {
                 polkit_authorization_constraint_unref (authc);
                 authc = NULL;
         }
@@ -460,8 +460,8 @@ polkit_authorization_constraint_get_require_selinux_context (const char *context
         if (authc == NULL)
                 goto out;
         authc->type = POLKIT_AUTHORIZATION_CONSTRAINT_TYPE_REQUIRE_SELINUX_CONTEXT;
-        authc->selinux_context.context = kit_strdup (context);
-        if (authc->selinux_context.context == NULL) {
+        authc->data.selinux_context.context = kit_strdup (context);
+        if (authc->data.selinux_context.context == NULL) {
                 polkit_authorization_constraint_unref (authc);
                 authc = NULL;
         }
@@ -500,10 +500,10 @@ polkit_authorization_constraint_to_string (PolKitAuthorizationConstraint *authc,
                 return snprintf (out_buf, buf_size, "active");
 
         case POLKIT_AUTHORIZATION_CONSTRAINT_TYPE_REQUIRE_EXE:
-                return snprintf (out_buf, buf_size, "exe:%s", authc->exe.path);
+                return snprintf (out_buf, buf_size, "exe:%s", authc->data.exe.path);
                 
         case POLKIT_AUTHORIZATION_CONSTRAINT_TYPE_REQUIRE_SELINUX_CONTEXT:
-                return snprintf (out_buf, buf_size, "selinux_context:%s", authc->selinux_context.context);
+                return snprintf (out_buf, buf_size, "selinux_context:%s", authc->data.selinux_context.context);
         }
 
         return 0;
@@ -688,10 +688,10 @@ polkit_authorization_constraint_equal (PolKitAuthorizationConstraint *a, PolKitA
                 goto out;
 
         if (a->type == POLKIT_AUTHORIZATION_CONSTRAINT_TYPE_REQUIRE_EXE) {
-                if (strcmp (a->exe.path, b->exe.path) != 0)
+                if (strcmp (a->data.exe.path, b->data.exe.path) != 0)
                         goto out;
         } else if (a->type == POLKIT_AUTHORIZATION_CONSTRAINT_TYPE_REQUIRE_SELINUX_CONTEXT) {
-                if (strcmp (a->selinux_context.context, b->selinux_context.context) != 0)
+                if (strcmp (a->data.selinux_context.context, b->data.selinux_context.context) != 0)
                         goto out;
         }
 
diff --git a/src/polkit/polkit-context.c b/src/polkit/polkit-context.c
index 9548dfc..2b6c1f5 100644
--- a/src/polkit/polkit-context.c
+++ b/src/polkit/polkit-context.c
@@ -39,7 +39,12 @@
 #include <grp.h>
 #include <unistd.h>
 #include <errno.h>
+#ifdef HAVE_SOLARIS
+#include <port.h>
+#include <sys/stat.h>
+#else
 #include <sys/inotify.h>
+#endif
 #include <syslog.h>
 
 #include "polkit-config.h"
@@ -153,6 +158,59 @@ polkit_context_init (PolKitContext *pk_context, PolKitError **error)
 
         /* NOTE: we don't load the configuration file until it's needed */
 
+#ifdef HAVE_SOLARIS
+        if (pk_context->io_add_watch_func != NULL) {
+                pk_context->inotify_fd = port_create ();
+                if (pk_context->inotify_fd < 0) {
+                        _pk_debug ("failed to port_create: %s", strerror (errno));
+                        /* TODO: set error */
+                        goto error;
+                }
+
+                /* Watch the /etc/PolicyKit/PolicyKit.conf file */
+                pk_context->inotify_config_wd = port_add_watch (pk_context->inotify_fd,
+                                                                   PACKAGE_SYSCONF_DIR "/PolicyKit/PolicyKit.conf",
+                                                                   FILE_MODIFIED | FILE_ATTRIB);
+                if (pk_context->inotify_config_wd < 0) {
+                        _pk_debug ("failed to add watch on file '" PACKAGE_SYSCONF_DIR "/PolicyKit/PolicyKit.conf': %s",
+                                   strerror (errno));
+                        /* TODO: set error */
+                        goto error;
+                }
+
+                /* Watch the /usr/share/PolicyKit/policy directory */
+                pk_context->inotify_policy_wd = port_add_watch (pk_context->inotify_fd,
+                                                                   PACKAGE_DATA_DIR "/PolicyKit/policy",
+                                                                   FILE_MODIFIED | FILE_ATTRIB);
+                if (pk_context->inotify_policy_wd < 0) {
+                        _pk_debug ("failed to add watch on directory '" PACKAGE_DATA_DIR "/PolicyKit/policy': %s",
+                                   strerror (errno));
+                        /* TODO: set error */
+                        goto error;
+                }
+
+#ifdef POLKIT_AUTHDB_DEFAULT
+                /* Watch the /var/lib/misc/PolicyKit.reload file */
+                pk_context->inotify_grant_perm_wd = port_add_watch (pk_context->inotify_fd,
+                                                                       PACKAGE_LOCALSTATE_DIR "/lib/misc/PolicyKit.reload",
+                                                                       FILE_MODIFIED | FILE_ATTRIB);
+                if (pk_context->inotify_grant_perm_wd < 0) {
+                        _pk_debug ("failed to add watch on file '" PACKAGE_LOCALSTATE_DIR "/lib/misc/PolicyKit.reload': %s",
+                                   strerror (errno));
+                        /* TODO: set error */
+                        goto error;
+                }
+#endif
+
+                pk_context->inotify_fd_watch_id = pk_context->io_add_watch_func (pk_context, pk_context->inotify_fd);
+                if (pk_context->inotify_fd_watch_id == 0) {
+                        _pk_debug ("failed to add io watch");
+                        /* TODO: set error */
+                        goto error;
+                }
+        }
+
+#else
         if (pk_context->io_add_watch_func != NULL) {
                 pk_context->inotify_fd = inotify_init ();
                 if (pk_context->inotify_fd < 0) {
@@ -203,12 +261,78 @@ polkit_context_init (PolKitContext *pk_context, PolKitError **error)
                         goto error;
                 }
         }
+#endif
 
         return TRUE;
 error:
         return FALSE;
 }
 
+#ifdef HAVE_SOLARIS
+
+struct fileportinfo {
+        struct file_obj fobj;
+        int events;
+        int port;
+};
+
+/**
+ * port_add_watch:
+ * @port: the port object
+ * @name: filename which will be added to the port
+ * @events: the event which will be watched for
+ *
+ * add file watch .
+ *
+ * Returns: the object
+ **/
+int
+port_add_watch (int port, const char *name, uint32_t events)
+{
+        struct fileportinfo *fpi;
+
+        if ( (fpi = kit_malloc (sizeof(struct fileportinfo)) ) == NULL ) {
+                _pk_debug ("Faile to kit_malloc!");
+                /* TODO: set error */
+                return -1;
+        }
+
+        fpi->fobj.fo_name = strdup (name);
+        fpi->events = events;
+        fpi->port = port;
+
+        if ( file_associate (fpi, events) < 0 ) {
+                _pk_debug ("Failed to associate with file %s: %s", fpi->fobj.fo_name, strerror (errno));
+                /* TODO: set error */
+                return -1;
+        }
+        return 0;
+}
+
+int
+file_associate (struct fileportinfo *fpinfo, int events)
+{
+        struct stat sb;
+
+        if ( stat (fpinfo->fobj.fo_name, &sb) == -1) {
+                _pk_debug ("Failed to stat file %s: %s", fpinfo->fobj.fo_name, strerror (errno));
+                /* TODO: set error */
+                return -1;
+        }
+
+        fpinfo->fobj.fo_atime = sb.st_atim;
+        fpinfo->fobj.fo_mtime = sb.st_mtim;
+        fpinfo->fobj.fo_ctime = sb.st_ctim;
+
+        if ( port_associate (fpinfo->port, PORT_SOURCE_FILE, (uintptr_t)&(fpinfo->fobj), events, (void *)fpinfo ) == -1) {
+                _pk_debug ("Failed to register file %s: %s", fpinfo->fobj.fo_name, strerror (errno));
+                /* TODO: set error */
+                return -1;
+        }
+        return 0;
+}
+#endif
+
 /**
  * polkit_context_ref:
  * @pk_context: the context object
@@ -296,6 +420,31 @@ polkit_context_io_func (PolKitContext *pk_context, int fd)
 
         config_changed = FALSE;
 
+#ifdef HAVE_SOLARIS
+        if (fd == pk_context->inotify_fd) {
+                port_event_t pe;
+                struct file_obj *fobjp;
+                struct fileportinfo *fpip;
+
+                while ( !port_get (fd, &pe, NULL) ) {
+                        switch (pe.portev_source) {
+                        case PORT_SOURCE_FILE:
+                                fpip = (struct fileportinfo *)pe.portev_object;
+                                fobjp = &fpip->fobj;
+                                _pk_debug ("filename = %s, events = %d", fobjp->fo_name, pe.portev_events);
+                                config_changed = TRUE;
+                                _pk_debug ("Config changed");
+                                file_associate ((struct fileportinfo *)pe.portev_object, pe.portev_events);
+                                break;
+                        default:
+                                _pk_debug ("Event from unexpected source");
+                        }
+                        if ( config_changed )
+                                break;
+                }
+        }
+
+#else
         if (fd == pk_context->inotify_fd) {
 /* size of the event structure, not counting name */
 #define EVENT_SIZE  (sizeof (struct inotify_event))
@@ -327,6 +476,7 @@ again:
                         i += EVENT_SIZE + event->len;
                 }
         }
+#endif
 
         if (config_changed) {
                 polkit_context_force_reload (pk_context);
diff --git a/src/polkit/polkit-debug.h b/src/polkit/polkit-debug.h
index 61f16e5..8fee7f8 100644
--- a/src/polkit/polkit-debug.h
+++ b/src/polkit/polkit-debug.h
@@ -30,7 +30,11 @@
 #ifndef POLKIT_DEBUG_H
 #define POLKIT_DEBUG_H
 
+#ifdef __sun
+void _pk_debug (const char *format, ...);
+#else
 void _pk_debug (const char *format, ...) __attribute__((__format__ (__printf__, 1, 2)));
+#endif
 
 #endif /* POLKIT_DEBUG_H */
 
diff --git a/src/polkit/polkit-error.h b/src/polkit/polkit-error.h
index b240959..6044677 100644
--- a/src/polkit/polkit-error.h
+++ b/src/polkit/polkit-error.h
@@ -89,7 +89,11 @@ const char      *polkit_error_get_error_name (PolKitError *error);
 PolKitErrorCode  polkit_error_get_error_code (PolKitError *error);
 const char      *polkit_error_get_error_message (PolKitError *error);
 void             polkit_error_free (PolKitError *error);
+#ifdef __sun
+polkit_bool_t    polkit_error_set_error (PolKitError **error, PolKitErrorCode error_code, const char *format, ...);
+#else
 polkit_bool_t    polkit_error_set_error (PolKitError **error, PolKitErrorCode error_code, const char *format, ...) __attribute__((__format__ (__printf__, 3, 4)));
+#endif
 
 POLKIT_END_DECLS
 
diff --git a/src/polkit/polkit-policy-cache.c b/src/polkit/polkit-policy-cache.c
index 0d6c2fc..ddcc135 100644
--- a/src/polkit/polkit-policy-cache.c
+++ b/src/polkit/polkit-policy-cache.c
@@ -37,6 +37,9 @@
 #include <stdlib.h>
 #include <string.h>
 #include <sys/types.h>
+#if HAVE_SOLARIS
+#include <sys/stat.h>
+#endif
 #include <pwd.h>
 #include <grp.h>
 #include <unistd.h>
diff --git a/src/polkit/polkit-policy-file.c b/src/polkit/polkit-policy-file.c
index 5b04a2a..7f942a8 100644
--- a/src/polkit/polkit-policy-file.c
+++ b/src/polkit/polkit-policy-file.c
@@ -804,6 +804,26 @@ polkit_policy_file_entry_foreach (PolKitPolicyFile                 *policy_file,
 
         return FALSE;
 }
+#ifdef HAVE_SOLARIS
+char *strndup ( const char *s, size_t n)
+{
+        size_t nAvail;
+        char *p;
+
+        if ( !s )
+                return 0;
+
+        if ( strlen(s) > n )
+                nAvail = n + 1;
+        else
+                nAvail = strlen(s) + 1;
+        p = malloc ( nAvail );
+        memcpy ( p, s, nAvail );
+        p[nAvail - 1] = '\0';
+
+        return p;
+}
+#endif
 
 #ifdef POLKIT_BUILD_TESTS
 
diff --git a/src/polkit/polkit-sysdeps.c b/src/polkit/polkit-sysdeps.c
index 29e57c8..7a7c386 100644
--- a/src/polkit/polkit-sysdeps.c
+++ b/src/polkit/polkit-sysdeps.c
@@ -40,7 +40,20 @@
 #include <grp.h>
 #include <unistd.h>
 #include <errno.h>
+
+#ifdef HAVE_SOLARIS
+#include <fcntl.h>
+#include <sys/time.h>
+#if _FILE_OFFSET_BITS==64
+#undef _FILE_OFFSET_BITS
+#include <procfs.h>
+#define _FILE_OFFSET_BITS 64
+#else
+#include <procfs.h>
+#endif
+#else
 #include <sys/inotify.h>
+#endif
 #include <syslog.h>
 
 #include "polkit-sysdeps.h"
@@ -75,14 +88,24 @@ polkit_sysdeps_get_start_time_for_pid (pid_t pid)
         char *contents;
         size_t length;
         polkit_uint64_t start_time;
+#ifdef HAVE_SOLARIS
+        struct psinfo info;
+#else
         char **tokens;
         size_t num_tokens;
         char *p;
         char *endp;
+#endif
 
         start_time = 0;
         contents = NULL;
 
+#ifdef HAVE_SOLARIS
+        if (polkit_sysdeps_pid_psinfo ( pid, &info)) {
+                goto out;
+        }
+        start_time = (unsigned long long) (info.pr_start.tv_sec);
+#else
         filename = kit_strdup_printf ("/proc/%d/stat", pid);
         if (filename == NULL) {
                 errno = ENOMEM;
@@ -119,10 +142,13 @@ polkit_sysdeps_get_start_time_for_pid (pid_t pid)
         }
 
         kit_strfreev (tokens);
+#endif
 
 out:
+#ifndef HAVE_SOLARIS
         kit_free (filename);
         kit_free (contents);
+#endif
         return start_time;
 }
 
@@ -200,12 +226,22 @@ polkit_sysdeps_get_exe_for_pid (pid_t pid, char *out_buf, size_t buf_size)
 
         ret = 0;
 
+#ifdef HAVE_SOLARIS
+        struct psinfo info;
+
+        if (polkit_sysdeps_pid_psinfo (pid, &info)) {
+                goto out;
+        }
+        ret = strlen (info.pr_psargs);
+        strncpy (out_buf, info.pr_psargs, ret);
+#else
         snprintf (proc_name, sizeof (proc_name), "/proc/%d/exe", pid);
         ret = readlink (proc_name, out_buf, buf_size - 1);
         if (ret == -1) {
                 strncpy (out_buf, "(unknown)", buf_size);
                 goto out;
         }
+#endif
         kit_assert (ret >= 0 && ret < (int) buf_size - 1);
         out_buf[ret] = '\0';
 
@@ -293,6 +329,26 @@ out:
 }
 
 
+#ifdef HAVE_SOLARIS
+int
+polkit_sysdeps_pid_psinfo (pid_t pid, struct psinfo *ps)
+{
+        char pname[32];
+        int  procfd;
+
+        (void) snprintf(pname, sizeof(pname), "/proc/%d/psinfo", pid);
+        if ((procfd = open(pname, O_RDONLY)) == -1) {
+                return -1;
+        }
+        if (read(procfd, ps, sizeof(struct psinfo)) < 0) {
+                (void) close(procfd);
+                return -1;
+        }
+        (void) close(procfd);
+        return 0;
+}
+#endif
+
 #ifdef POLKIT_BUILD_TESTS
 
 static polkit_bool_t
diff --git a/tools/polkit-auth.c b/tools/polkit-auth.c
index 76b18bd..0ce5e29 100644
--- a/tools/polkit-auth.c
+++ b/tools/polkit-auth.c
@@ -37,6 +37,9 @@
 #include <stdlib.h>
 #include <string.h>
 #include <sys/types.h>
+#ifdef HAVE_SOLARIS
+#include <sys/wait.h>
+#endif
 #include <pwd.h>
 #include <grp.h>
 #include <unistd.h>


More information about the hal-commit mailing list