PolicyKit COPYING, 1.1.1.1, 1.2 ChangeLog, 1.6, 1.7 Makefile.am, 1.1.1.1, 1.2 configure.in, 1.1.1.1, 1.2 policy-kit.in, NONE, 1.1 polkit-interface-manager.xml, NONE, 1.1 polkit-interface-session.xml, NONE, 1.1 polkit.pc.in, 1.5, 1.6

David Zeuthen david at kemper.freedesktop.org
Mon Mar 13 22:14:35 PST 2006


Update of /cvs/hal/PolicyKit
In directory kemper:/tmp/cvs-serv13970

Modified Files:
	COPYING ChangeLog Makefile.am configure.in polkit.pc.in 
Added Files:
	policy-kit.in polkit-interface-manager.xml 
	polkit-interface-session.xml 
Log Message:
2006-03-14  David Zeuthen  <davidz at redhat.com>

	Add a bunch of code; basically a full rewrite moving all queries
	to the daemon.

	* COPYING:
	* Makefile.am:
	* configure.in:
	* libpolkit/Makefile.am:
	* libpolkit/libpolkit-test.c:
	* libpolkit/libpolkit.c: (libpolkit_new_context),
	(libpolkit_free_context),
	(libpolkit_get_allowed_resources_for_privilege_for_uid),
	(libpolkit_is_uid_allowed_for_privilege),
	(libpolkit_get_privilege_list):
	* libpolkit/libpolkit.h:
	* policy-kit.in:
	* polkit-interface-manager.xml:
	* polkit-interface-session.xml:
	* polkit.pc.in:
	* polkitd/Makefile.am:
	* polkitd/debug-polkitd.sh:
	* polkitd/main.c: (usage), (delete_pid), (main):
	* polkitd/policy.c: (policy_util_set_policy_directory),
	(policy_element_new), (policy_element_free),
	(policy_element_free_list), (policy_element_dump),
	(txt_backend_read_policy), (policy_get_whitelist),
	(policy_get_blacklist), (policy_get_policies), (afp_process_elem),
	(policy_get_allowed_resources_for_policy_for_uid_gid),
	(policy_is_uid_gid_allowed_for_policy), (policy_util_uid_to_name),
	(policy_util_gid_to_name), (policy_util_name_to_uid),
	(policy_util_name_to_gid),
	(policy_get_allowed_resources_for_policy_for_uid),
	(policy_is_uid_allowed_for_policy), (getgrouplist):
	* polkitd/policy.h:
	* polkitd/polkit-manager.c: (caller_info_delete),
	(polkit_manager_init), (polkit_manager_finalize),
	(polkit_manager_class_init), (polkit_manager_error_quark),
	(polkit_manager_error_get_type), (bus_name_owner_changed),
	(session_remover), (session_finalized), (polkit_manager_new),
	(uid_from_username), (safe_strcmp),
	(polkit_manager_get_caller_info),
	(polkit_manager_initiate_privilege_grant),
	(polkit_manager_is_user_privileged),
	(polkit_manager_get_allowed_resources_for_privilege),
	(polkit_manager_list_privileges),
	(polkit_manager_add_temporary_privilege),
	(polkit_manager_remove_temporary_privilege):
	* polkitd/polkit-manager.h:
	* polkitd/polkit-marshal.list:
	* polkitd/polkit-session.c: (polkit_session_init),
	(polkit_session_finalize), (polkit_session_class_init),
	(polkit_session_error_quark), (polkit_session_error_get_type),
	(polkit_session_check_caller), (polkit_session_is_authenticated),
	(polkit_session_get_auth_denied_reason), (safe_memset),
	(my_conversation), (write_back_to_parent), (do_pam_auth),
	(data_from_pam), (polkit_session_get_auth_details),
	(polkit_session_initiate_auth), (polkit_session_get_questions),
	(polkit_session_provide_answers), (polkit_session_close),
	(polkit_session_grant_privilege_temporarily), (polkit_session_new),
	(polkit_session_initiator_disconnected):
	* polkitd/polkit-session.h:
	* polkitd/polkitd-test.c: (my_exit), (do_check),
	(write_test_policy), (do_read_tests), (main):
	* polkitd/run-polkitd.sh:
	* polkitd/valgrind-polkitd.sh:
	* privileges/Makefile.am:
	* privileges/desktop-console.privilege:
	* tools/Makefile.am:
	* tools/Makefile.in:
	* tools/polkit-grant-privilege.c: (have_questions_handler),
	(auth_done_handler), (do_grant_privilege), (usage), (main):
	* tools/polkit-is-privileged.c: (usage), (main):
	* tools/polkit-list-privileges.c: (usage), (main):



Index: COPYING
===================================================================
RCS file: /cvs/hal/PolicyKit/COPYING,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- COPYING	8 Mar 2006 01:52:02 -0000	1.1.1.1
+++ COPYING	14 Mar 2006 06:14:33 -0000	1.2
@@ -1,5 +1,9 @@
+The PolicyKit daemon and associated command-line tools polkit-* is
+licensed to you under the GNU General Public License version 2.
+
 libpolkit is licensed to you under your choice of the Academic Free
 License version 2.1, or the GNU General Public License version 2.
+
 Both licenses are included here. Some individual source code files 
 and/or binaries may be under the GPL only or under the LGPG.
 

Index: ChangeLog
===================================================================
RCS file: /cvs/hal/PolicyKit/ChangeLog,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- ChangeLog	9 Mar 2006 17:14:48 -0000	1.6
+++ ChangeLog	14 Mar 2006 06:14:33 -0000	1.7
@@ -1,3 +1,78 @@
+2006-03-14  David Zeuthen  <davidz at redhat.com>
+
+	Add a bunch of code; basically a full rewrite moving all queries
+	to the daemon.
+
+	* COPYING:
+	* Makefile.am:
+	* configure.in:
+	* libpolkit/Makefile.am:
+	* libpolkit/libpolkit-test.c:
+	* libpolkit/libpolkit.c: (libpolkit_new_context),
+	(libpolkit_free_context),
+	(libpolkit_get_allowed_resources_for_privilege_for_uid),
+	(libpolkit_is_uid_allowed_for_privilege),
+	(libpolkit_get_privilege_list):
+	* libpolkit/libpolkit.h:
+	* policy-kit.in:
+	* polkit-interface-manager.xml:
+	* polkit-interface-session.xml:
+	* polkit.pc.in:
+	* polkitd/Makefile.am:
+	* polkitd/debug-polkitd.sh:
+	* polkitd/main.c: (usage), (delete_pid), (main):
+	* polkitd/policy.c: (policy_util_set_policy_directory),
+	(policy_element_new), (policy_element_free),
+	(policy_element_free_list), (policy_element_dump),
+	(txt_backend_read_policy), (policy_get_whitelist),
+	(policy_get_blacklist), (policy_get_policies), (afp_process_elem),
+	(policy_get_allowed_resources_for_policy_for_uid_gid),
+	(policy_is_uid_gid_allowed_for_policy), (policy_util_uid_to_name),
+	(policy_util_gid_to_name), (policy_util_name_to_uid),
+	(policy_util_name_to_gid),
+	(policy_get_allowed_resources_for_policy_for_uid),
+	(policy_is_uid_allowed_for_policy), (getgrouplist):
+	* polkitd/policy.h:
+	* polkitd/polkit-manager.c: (caller_info_delete),
+	(polkit_manager_init), (polkit_manager_finalize),
+	(polkit_manager_class_init), (polkit_manager_error_quark),
+	(polkit_manager_error_get_type), (bus_name_owner_changed),
+	(session_remover), (session_finalized), (polkit_manager_new),
+	(uid_from_username), (safe_strcmp),
+	(polkit_manager_get_caller_info),
+	(polkit_manager_initiate_privilege_grant),
+	(polkit_manager_is_user_privileged),
+	(polkit_manager_get_allowed_resources_for_privilege),
+	(polkit_manager_list_privileges),
+	(polkit_manager_add_temporary_privilege),
+	(polkit_manager_remove_temporary_privilege):
+	* polkitd/polkit-manager.h:
+	* polkitd/polkit-marshal.list:
+	* polkitd/polkit-session.c: (polkit_session_init),
+	(polkit_session_finalize), (polkit_session_class_init),
+	(polkit_session_error_quark), (polkit_session_error_get_type),
+	(polkit_session_check_caller), (polkit_session_is_authenticated),
+	(polkit_session_get_auth_denied_reason), (safe_memset),
+	(my_conversation), (write_back_to_parent), (do_pam_auth),
+	(data_from_pam), (polkit_session_get_auth_details),
+	(polkit_session_initiate_auth), (polkit_session_get_questions),
+	(polkit_session_provide_answers), (polkit_session_close),
+	(polkit_session_grant_privilege_temporarily), (polkit_session_new),
+	(polkit_session_initiator_disconnected):
+	* polkitd/polkit-session.h:
+	* polkitd/polkitd-test.c: (my_exit), (do_check),
+	(write_test_policy), (do_read_tests), (main):
+	* polkitd/run-polkitd.sh:
+	* polkitd/valgrind-polkitd.sh:
+	* privileges/Makefile.am:
+	* privileges/desktop-console.privilege:
+	* tools/Makefile.am:
+	* tools/Makefile.in:
+	* tools/polkit-grant-privilege.c: (have_questions_handler),
+	(auth_done_handler), (do_grant_privilege), (usage), (main):
+	* tools/polkit-is-privileged.c: (usage), (main):
+	* tools/polkit-list-privileges.c: (usage), (main):
+
 2006-03-09  David Zeuthen  <davidz at redhat.com>
 
 	* polkit.pc.in (exec_prefix): Use right Cflags

Index: Makefile.am
===================================================================
RCS file: /cvs/hal/PolicyKit/Makefile.am,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- Makefile.am	8 Mar 2006 01:52:02 -0000	1.1.1.1
+++ Makefile.am	14 Mar 2006 06:14:33 -0000	1.2
@@ -1,13 +1,16 @@
 ## Process this file with automake to produce Makefile.in
 
-SUBDIRS = libpolkit doc tools
+SUBDIRS = libpolkit polkitd doc tools privileges
+
+pamdir = $(sysconfdir)/pam.d
+pam_DATA = policy-kit
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = polkit.pc
 
 DISTCLEANFILES = polkit.pc
 
-EXTRA_DIST = HACKING polkit.pc.in mkinstalldirs
+EXTRA_DIST = HACKING polkit-interface-manager.xml polkit-interface-session.xml polkit.pc.in policy-kit.in mkinstalldirs
 
 clean-local :
 	rm -f *~

Index: configure.in
===================================================================
RCS file: /cvs/hal/PolicyKit/configure.in,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- configure.in	8 Mar 2006 01:52:02 -0000	1.1.1.1
+++ configure.in	14 Mar 2006 06:14:33 -0000	1.2
@@ -26,16 +26,16 @@
 AC_PROG_LN_S
 AC_SYS_LARGEFILE
 
-AC_ARG_WITH(polkit_user,[  --with-polkit-user=<user>  User for PolicyKit])
+AC_ARG_WITH(polkit_user,[  --with-polkit-user=<user>  user for PolicyKit])
 if test -z "$with_polkit_user" ; then
     POLKIT_USER=polkit
 else
     POLKIT_USER=$with_polkit_user
 fi
 AC_SUBST(POLKIT_USER)
-AC_DEFINE_UNQUOTED(POLKIT_USER,"POLKIT_USER", [User for PolicyKit])
+AC_DEFINE_UNQUOTED(POLKIT_USER, "$POLKIT_USER", [User for PolicyKit])
 
-AC_ARG_WITH(polkit_group,[  --with-hal-group=<grp>  Group for PolicyKit])
+AC_ARG_WITH(polkit_group,[  --with-polkit-group=<grp>  group for PolicyKit])
 if test -z "$with_polkit_group" ; then
     POLKIT_GROUP=polkit
 else
@@ -137,6 +137,14 @@
 AC_SUBST(GLIB_CFLAGS)
 AC_SUBST(GLIB_LIBS)
 
+PKG_CHECK_MODULES(DBUS, [dbus-1 >= 0.60])
+AC_SUBST(DBUS_CFLAGS)
+AC_SUBST(DBUS_LIBS)
+
+PKG_CHECK_MODULES(DBUS_GLIB, [dbus-glib-1 >= 0.60])
+AC_SUBST(DBUS_GLIB_CFLAGS)
+AC_SUBST(DBUS_GLIB_LIBS)
+
 AC_CHECK_FUNCS(getgrouplist)
 
 AS_AC_EXPAND(LOCALSTATEDIR, $localstatedir)
@@ -148,7 +156,7 @@
 AS_AC_EXPAND(LIBEXECDIR, $libexecdir)
 
 # documentation target
-AC_ARG_WITH(doc-dir,   [  --with-doc-dir=[dirname]  directory to install documentation])
+AC_ARG_WITH(doc-dir,   [  --with-doc-dir=[dirname]     directory to install documentation])
 if ! test -z "$with_doc_dir"; then
    DOCDIR=$with_doc_dir
 else
@@ -157,13 +165,137 @@
 
 AC_SUBST(DOCDIR)
 
+# PAM stuff borrowed from gnome-screensaver
+
+# Determine PAM prefix
+
+withval=""
+AC_ARG_WITH(pam-prefix,
+[  --with-pam-prefix=<prefix> specify where pam files go],[
+if test x$withval != x; then
+   AC_MSG_RESULT("PAM files will be installed in prefix ${withval}.")
+fi])
+if test x$withval != x; then
+	PAM_PREFIX_UNEXPANDED="$withval"
+else
+	PAM_PREFIX_UNEXPANDED="$sysconfdir"
+fi
+PAM_PREFIX=`eval echo $PAM_PREFIX_UNEXPANDED`
+AC_SUBST(PAM_PREFIX)
+
+
+dnl ---------------------------------------------------------------------------
+dnl - Check for PAM
+dnl ---------------------------------------------------------------------------
+
+have_pam=no
+AC_CHECK_LIB(pam, pam_start, have_pam=yes)
+if test "x$have_pam" = "xyes"; then
+    AUTH_LIBS="${AUTH_LIBS} -lpam"
+    AC_DEFINE(HAVE_PAM, 1, [Define if PAM support is included])
+
+    # On Linux, sigtimedwait() is in libc; on Solaris, it's in librt.
+    have_timedwait=no
+    AC_CHECK_LIB(c, sigtimedwait, [have_timedwait=yes])
+    if test "$have_timedwait" = no ; then
+      AC_CHECK_LIB(rt, sigtimedwait, [AUTH_LIBS="${AUTH_LIBS} -lrt"])
+    fi
+
+    AC_MSG_CHECKING(how to call pam_strerror)
+    AC_CACHE_VAL(ac_cv_pam_strerror_args,
+     [AC_TRY_COMPILE([#include <stdio.h>
+                      #include <stdlib.h>
+                      #include <security/pam_appl.h>],
+                     [pam_handle_t *pamh = 0;
+                      char *s = pam_strerror(pamh, PAM_SUCCESS);],
+                     [ac_pam_strerror_args=2],
+                     [AC_TRY_COMPILE([#include <stdio.h>
+                                      #include <stdlib.h>
+                                      #include <security/pam_appl.h>],
+                                     [char *s =
+                                       pam_strerror(PAM_SUCCESS);],
+                                     [ac_pam_strerror_args=1],
+                                     [ac_pam_strerror_args=0])])
+      ac_cv_pam_strerror_args=$ac_pam_strerror_args])
+    ac_pam_strerror_args=$ac_cv_pam_strerror_args
+    if test "$ac_pam_strerror_args" = 1 ; then
+      AC_MSG_RESULT(one argument)
+    elif test "$ac_pam_strerror_args" = 2 ; then
+      AC_DEFINE(PAM_STRERROR_TWO_ARGS, 1, [Define if pam_strerror takes two arguments])
+      AC_MSG_RESULT(two arguments)
+    else
+      AC_MSG_RESULT(unknown)
+    fi
+ 
+fi
+AM_CONDITIONAL(HAVE_PAM, test x$have_pam = xyes)
+AC_SUBST(HAVE_PAM)
+AC_SUBST(AUTH_LIBS)
+
+
+AC_ARG_WITH(os-type,     [  --with-os-type=<os>        distribution or OS (redhat)])
+
+#### Check our operating system (distro-tweaks required)
+operating_system=unknown
+if test -f /etc/redhat-release || test -f SYSCONFDIR/redhat-release ; then
+   operating_system=redhat
+fi
+
+#### Sort out OS (distro-tweaks required)
+
+if test x$with_os_type = x; then
+    if test x$operating_system = xredhat ; then
+        with_os_type=redhat
+    else
+        with_os_type=unknown
+    fi
+fi
+
+# (distro-tweaks required)
+AM_CONDITIONAL(OS_TYPE_UNKNOWN, test x$with_os_type = xunknown, [Running on unknown OS])
+AM_CONDITIONAL(OS_TYPE_RED_HAT, test x$with_os_type = xredhat, [Running on Red Hat OS'es])
+
+AC_ARG_WITH(pid-file,    [  --with-pid-file=<file>     pid file for polkitd])
+
+#### Set up the pid file (distro-tweaks required)
+if ! test -z "$with_pid_file"; then
+   POLKITD_PID_FILE=$with_pid_file
+elif test x$with_os_type = xredhat ; then
+   POLKITD_PID_FILE=${LOCALSTATEDIR}/run/polkitd.pid
+else
+   POLKITD_PID_FILE=${LOCALSTATEDIR}/run/polkitd/pid
+fi
+
+AC_SUBST(POLKITD_PID_FILE)
+AC_DEFINE_UNQUOTED(POLKITD_PID_FILE, "$POLKITD_PID_FILE", [pid file])
+
+AC_ARG_WITH(pam-include, [  --with-pam-include=<file>  pam file to include])
+
+#### Set up pam file to include (distro-tweaks required)
+if ! test -z "$with_pam_include"; then
+   PAM_FILE_INCLUDE=$with_pam_include
+elif test x$with_os_type = xredhat ; then
+   PAM_FILE_INCLUDE=system-auth
+else
+   PAM_FILE_INCLUDE=system-auth
+fi
+
+AC_SUBST(PAM_FILE_INCLUDE)
+AC_DEFINE_UNQUOTED(PAM_FILE_INCLUDE, "$PAM_FILE_INCLUDE", [pam file to include])
+
+
 AC_OUTPUT([
+policy-kit
 polkit.pc
 Makefile
+polkitd/Makefile
+polkitd/PolicyKit
+polkitd/PolicyKit.conf
 libpolkit/Makefile
 tools/Makefile
 doc/Makefile
 doc/api/Makefile
+privileges/Makefile
 ])
 
 dnl ==========================================================================
@@ -180,18 +312,30 @@
         sysconfdir:                 ${SYSCONFDIR}
         localstatedir:              ${LOCALSTATEDIR}
         docdir:                     ${DOCDIR}
+        PAM prefix:                 ${PAM_PREFIX}
 
         compiler:                   ${CC}
         cflags:                     ${CFLAGS}
         cppflags:                   ${CPPFLAGS}
-        User for PolicyKit:         ${POLKIT_USER}
-        Group for PolicyKit:        ${POLKIT_GROUP}
+        user for PolicyKit:         ${POLKIT_USER}
+        group for PolicyKit:        ${POLKIT_GROUP}
+        pidfile for polkitd:        ${POLKITD_PID_FILE}
+
+        PAM support:                ${have_pam}
+	PAM file to include:        ${PAM_FILE_INCLUDE}
 
         Maintainer mode:            ${USE_MAINTAINER_MODE}
         Building verbose mode:      ${enable_verbose_mode}
         Building api docs:          ${enable_gtk_doc}
 "
 
+# (distro-tweaks required)
+if test x$with_os_type = xredhat; then
+   echo "NOTE: Red Hat style init scripts and pam file will be installed"
+else
+   echo "NOTE: You have to install init scripts yourself and tweak your own pam file"
+fi
+echo
 
 echo "NOTE: Remember to create user ${POLKIT_USER} and group ${POLKIT_GROUP} before make install"
 echo

--- NEW FILE: policy-kit.in ---
#%PAM-1.0

auth       include      @PAM_FILE_INCLUDE@
account    include      @PAM_FILE_INCLUDE@
password   include      @PAM_FILE_INCLUDE@
session    include      @PAM_FILE_INCLUDE@



--- NEW FILE: polkit-interface-manager.xml ---
<?xml version="1.0" encoding="UTF-8" ?>

<node name="/org/freedesktop/PolicyKit/Manager">
  <interface name="org.freedesktop.PolicyKit.Manager">

    <method name="InitiatePrivilegeGrant">
      <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
      <arg name="user"            type="s" direction="in"/>
      <arg name="privilege"       type="s" direction="in"/>
      <arg name="resource"        type="s" direction="in"/>
      <arg name="session_objpath" type="o" direction="out"/>
    </method>

    <method name="IsUserPrivileged">
      <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
      <arg name="pid"           type="i" direction="in"/>
      <arg name="user"          type="s" direction="in"/>
      <arg name="privilege"     type="s" direction="in"/>
      <arg name="resource"      type="s" direction="in"/>
      <arg name="is_privileged" type="b" direction="out"/>
    </method>

    <method name="GetAllowedResourcesForPrivilege">
      <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
      <arg name="user"          type="s"  direction="in"/>
      <arg name="privilege"     type="s"  direction="in"/>
      <arg name="resource_list" type="as" direction="out"/>
    </method>

    <method name="ListPrivileges">
      <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
      <arg name="privilege_list" type="as" direction="out"/>
    </method>

  </interface>
</node>

--- NEW FILE: polkit-interface-session.xml ---
<?xml version="1.0" encoding="UTF-8" ?>

<node>
  <interface name="org.freedesktop.PolicyKit.Session">

    <method name="InitiateAuth">
      <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
    </method>

    <method name="GetQuestions">
      <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
      <arg name="question_list" type="as" direction="out"/>
    </method>

    <method name="GetAuthDetails">
      <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
      <arg name="user"             type="s" direction="out"/>
      <arg name="pam_service_name" type="s" direction="out"/>
    </method>

    <method name="ProvideAnswers">
      <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
      <arg name="answer_list" type="as" direction="in"/>
    </method>

    <method name="IsAuthenticated">
      <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
      <arg name="is_authenticated" type="b" direction="out"/>
    </method>

    <method name="GetAuthDeniedReason">
      <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
      <arg name="reason" type="s" direction="out"/>
    </method>

    <method name="Close">
      <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
      <arg name="do_not_revoke_privileges" type="b" direction="in"/>
    </method>

    <method name="GrantPrivilegeTemporarily">
      <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
      <arg name="restrict_to_callers_pid" type="b" direction="in"/>
    </method>

    <signal name="HaveQuestions"/>

    <signal name="AuthenticationDone"/>

  </interface>
</node>

Index: polkit.pc.in
===================================================================
RCS file: /cvs/hal/PolicyKit/polkit.pc.in,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- polkit.pc.in	9 Mar 2006 17:14:48 -0000	1.5
+++ polkit.pc.in	14 Mar 2006 06:14:33 -0000	1.6
@@ -5,7 +5,7 @@
 
 user=@POLKIT_USER@
 group=@POLKIT_GROUP@
-txtsrc=@sysconfdir@/PolicyKit/policy
+txtsrc=@sysconfdir@/PolicyKit/privilege.d
 
 Name: libpolkit
 Description: library for querying and setting system-wide policy




More information about the hal-commit mailing list