Commit 9a089c64 authored by David Zeuthen's avatar David Zeuthen

Initial revision

parents
David Zeuthen <davidz@redhat.com>
This diff is collapsed.
2006-03-07 David Zeuthen <davidz@redhat.com>
Initial check-in of PolicyKit
Coding Style
===
- Please follow the coding style already used - it's not a must, but it's
nice to have consistency.
- Write docs for all functions and structs and so on.
- All external interfaces (network protocols, file formats, etc.)
should have documented specifications sufficient to allow an
alternative implementation to be written. Our implementation should
be strict about specification compliance (should not for example
heuristically parse a file and accept not-well-formed
data). Avoiding heuristics is also important for security reasons;
if it looks funny, ignore it (or exit, or disconnect).
## Process this file with automake to produce Makefile.in
SUBDIRS = libpolkit doc tools
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = polkit.pc
DISTCLEANFILES = polkit.pc
EXTRA_DIST = HACKING polkit.pc.in mkinstalldirs
clean-local :
rm -f *~
==========
PolicyKit 0.1 ""
==========
WRITE ME
Requirements for PolicyKit 0.1 "" (and CVS HEAD)
- glib >= 2.6.0
PolicyKit is a framework for defining policy for system-wide components and
for desktop pieces to configure it. It is used by HAL.
See also the file HACKING for notes of interest to developers working
on PolicyKit.
See http://www.freedesktop.org/Software/hal for lots of documentation,
mailing lists, etc.
dnl as-ac-expand.m4 0.1.0
dnl autostars m4 macro for expanding directories using configure's prefix
dnl thomas@apestaart.org
dnl AS_AC_EXPAND(VAR, CONFIGURE_VAR)
dnl
dnl example
dnl AS_AC_EXPAND(SYSCONFDIR, $sysconfdir)
dnl will set SYSCONFDIR to /usr/local/etc if prefix=/usr/local
AC_DEFUN([AS_AC_EXPAND],
[
EXP_VAR=[$1]
FROM_VAR=[$2]
dnl first expand prefix and exec_prefix if necessary
prefix_save=$prefix
exec_prefix_save=$exec_prefix
dnl if no prefix given, then use /usr/local, the default prefix
if test "x$prefix" = "xNONE"; then
prefix=$ac_default_prefix
fi
dnl if no exec_prefix given, then use prefix
if test "x$exec_prefix" = "xNONE"; then
exec_prefix=$prefix
fi
full_var="$FROM_VAR"
dnl loop until it doesn't change anymore
while true; do
new_full_var="`eval echo $full_var`"
if test "x$new_full_var"="x$full_var"; then break; fi
full_var=$new_full_var
done
dnl clean up
full_var=$new_full_var
AC_SUBST([$1], "$full_var")
dnl restore prefix and exec_prefix
prefix=$prefix_save
exec_prefix=$exec_prefix_save
])
dnl GTK_DOC_CHECK borrowed from cairo, thanks!
dnl Usage:
dnl GTK_DOC_CHECK([minimum-gtk-doc-version])
AC_DEFUN([GTK_DOC_CHECK],
[
AC_BEFORE([AC_PROG_LIBTOOL],[$0])dnl setup libtool first
AC_BEFORE([AM_PROG_LIBTOOL],[$0])dnl setup libtool first
dnl for overriding the documentation installation directory
AC_ARG_WITH(html-dir,
AC_HELP_STRING([--with-html-dir=PATH], [path to installed docs]),,
[with_html_dir='${datadir}/gtk-doc/html'])
HTML_DIR="$with_html_dir"
AC_SUBST(HTML_DIR)
dnl enable/disable documentation building
AC_ARG_ENABLE(gtk-doc,
AC_HELP_STRING([--enable-gtk-doc],
[use gtk-doc to build documentation [default=yes]]),,
enable_gtk_doc=yes)
have_gtk_doc=no
if test x$enable_gtk_doc = xyes; then
if test -z "$PKG_CONFIG"; then
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
fi
if test "$PKG_CONFIG" != "no" && $PKG_CONFIG --exists gtk-doc; then
have_gtk_doc=yes
fi
dnl do we want to do a version check?
ifelse([$1],[],,
[gtk_doc_min_version=$1
if test "$have_gtk_doc" = yes; then
AC_MSG_CHECKING([gtk-doc version >= $gtk_doc_min_version])
if $PKG_CONFIG --atleast-version $gtk_doc_min_version gtk-doc; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
have_gtk_doc=no
fi
fi
])
if test "$have_gtk_doc" != yes; then
enable_gtk_doc=no
fi
fi
AM_CONDITIONAL(ENABLE_GTK_DOC, test x$enable_gtk_doc = xyes)
AM_CONDITIONAL(GTK_DOC_USE_LIBTOOL, test -n "$LIBTOOL")
])
#!/bin/sh
# Run this to generate all the initial makefiles, etc.
srcdir=`dirname $0`
test -z "$srcdir" && srcdir=.
DIE=0
(test -f $srcdir/configure.in) || {
echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
echo " top-level package directory"
exit 1
}
(autoconf --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "**Error**: You must have \`autoconf' installed."
echo "Download the appropriate package for your distribution,"
echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
DIE=1
}
(grep "^AM_PROG_LIBTOOL" $srcdir/configure.in >/dev/null) && {
(libtool --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "**Error**: You must have \`libtool' installed."
echo "You can get it from: ftp://ftp.gnu.org/pub/gnu/"
DIE=1
}
}
(automake --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "**Error**: You must have \`automake' installed."
echo "You can get it from: ftp://ftp.gnu.org/pub/gnu/"
DIE=1
NO_AUTOMAKE=yes
}
# if no automake, don't bother testing for aclocal
test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "**Error**: Missing \`aclocal'. The version of \`automake'"
echo "installed doesn't appear recent enough."
echo "You can get automake from ftp://ftp.gnu.org/pub/gnu/"
DIE=1
}
if test "$DIE" -eq 1; then
exit 1
fi
if test -z "$*"; then
echo "**Warning**: I am going to run \`configure' with no arguments."
echo "If you wish to pass any to it, please specify them on the"
echo \`$0\'" command line."
echo
fi
case $CC in
xlc )
am_opt=--include-deps;;
esac
aclocalinclude="$ACLOCAL_FLAGS"
if grep "^AM_PROG_LIBTOOL" configure.in >/dev/null; then
if test -z "$NO_LIBTOOLIZE" ; then
echo "Running libtoolize..."
libtoolize --force --copy
fi
fi
echo "Running aclocal $aclocalinclude ..."
aclocal $aclocalinclude
if grep "^AM_CONFIG_HEADER" configure.in >/dev/null; then
echo "Running autoheader..."
autoheader
fi
echo "Running automake --gnu $am_opt ..."
automake --add-missing --gnu $am_opt
echo "Running autoconf ..."
autoconf
conf_flags="--enable-maintainer-mode --enable-gtk-doc"
if test x$NOCONFIGURE = x; then
echo Running $srcdir/configure $conf_flags "$@" ...
$srcdir/configure $conf_flags "$@" \
&& echo Now type \`make\' to compile. || exit 1
else
echo Skipping configure process.
fi
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.57)
AC_INIT(PolicyKit, 0.1, david@fubar.dk)
AM_INIT_AUTOMAKE(PolicyKit, 0.1)
AM_CONFIG_HEADER(config.h)
AM_MAINTAINER_MODE
# libtool versioning - this applies to libpolkit
#
# See http://sources.redhat.com/autobook/autobook/autobook_91.html#SEC91 for details
#
LT_CURRENT=0
LT_REVISION=0
LT_AGE=0
AC_SUBST(LT_CURRENT)
AC_SUBST(LT_REVISION)
AC_SUBST(LT_AGE)
AC_ISC_POSIX
AC_PROG_CC
AM_PROG_CC_STDC
AC_HEADER_STDC
AM_PROG_LIBTOOL
AC_PROG_MAKE_SET
AC_PROG_LN_S
AC_SYS_LARGEFILE
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_ARG_WITH(polkit_group,[ --with-hal-group=<grp> Group for PolicyKit])
if test -z "$with_polkit_group" ; then
POLKIT_GROUP=polkit
else
POLKIT_GROUP=$with_polkit_group
fi
AC_SUBST(POLKIT_GROUP)
AC_DEFINE_UNQUOTED(POLKIT_GROUP,"$POLKIT_GROUP", [Group for PolicyKit])
# Taken from dbus
AC_ARG_ENABLE(ansi, [ --enable-ansi enable -ansi -pedantic gcc flags],enable_ansi=$enableval,enable_ansi=no)
AC_ARG_ENABLE(verbose-mode, [ --enable-verbose-mode support verbose debug mode],enable_verbose_mode=$enableval,enable_verbose_mode=$USE_MAINTAINER_MODE)
GTK_DOC_CHECK([1.3])
#### gcc warning flags
if test "x$GCC" = "xyes"; then
changequote(,)dnl
case " $CFLAGS " in
*[\ \ ]-Wall[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -Wall" ;;
esac
case " $CFLAGS " in
*[\ \ ]-Wchar-subscripts[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -Wchar-subscripts" ;;
esac
case " $CFLAGS " in
*[\ \ ]-Wmissing-declarations[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -Wmissing-declarations" ;;
esac
case " $CFLAGS " in
*[\ \ ]-Wnested-externs[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -Wnested-externs" ;;
esac
case " $CFLAGS " in
*[\ \ ]-Wpointer-arith[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -Wpointer-arith" ;;
esac
case " $CFLAGS " in
*[\ \ ]-Wcast-align[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -Wcast-align" ;;
esac
case " $CFLAGS " in
*[\ \ ]-Wsign-compare[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -Wsign-compare" ;;
esac
if test "x$enable_ansi" = "xyes"; then
case " $CFLAGS " in
*[\ \ ]-ansi[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -ansi" ;;
esac
case " $CFLAGS " in
*[\ \ ]-D_POSIX_C_SOURCE*) ;;
*) CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=199309L" ;;
esac
case " $CFLAGS " in
*[\ \ ]-D_BSD_SOURCE[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -D_BSD_SOURCE" ;;
esac
case " $CFLAGS " in
*[\ \ ]-pedantic[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -pedantic" ;;
esac
fi
if test x$enable_gcov = xyes; then
case " $CFLAGS " in
*[\ \ ]-fprofile-arcs[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -fprofile-arcs" ;;
esac
case " $CFLAGS " in
*[\ \ ]-ftest-coverage[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -ftest-coverage" ;;
esac
## remove optimization
CFLAGS=`echo "$CFLAGS" | sed -e 's/-O[0-9]*//g'`
fi
changequote([,])dnl
else
if test x$enable_gcov = xyes; then
AC_MSG_ERROR([--enable-gcov can only be used with gcc])
fi
fi
AM_CONDITIONAL(GCOV, test x$enable_gcov = xyes)
PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.6.0])
AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)
AC_CHECK_FUNCS(getgrouplist)
AS_AC_EXPAND(LOCALSTATEDIR, $localstatedir)
AS_AC_EXPAND(SYSCONFDIR, $sysconfdir)
AS_AC_EXPAND(DATADIR, $datadir)
AS_AC_EXPAND(BINDIR, $bindir)
AS_AC_EXPAND(SBINDIR, $sbindir)
AS_AC_EXPAND(LIBDIR, $libdir)
AS_AC_EXPAND(LIBEXECDIR, $libexecdir)
# documentation target
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
DOCDIR="$DATADIR/doc/PolicyKit-$VERSION"
fi
AC_SUBST(DOCDIR)
AC_OUTPUT([
polkit.pc
Makefile
libpolkit/Makefile
tools/Makefile
doc/Makefile
doc/api/Makefile
])
dnl ==========================================================================
echo "
PolicyKit $VERSION
=================
prefix: ${prefix}
libdir: ${LIBDIR}
libexecdir: ${LIBEXECDIR}
bindir: ${BINDIR}
sbindir: ${SBINDIR}
datadir: ${DATADIR}
sysconfdir: ${SYSCONFDIR}
localstatedir: ${LOCALSTATEDIR}
docdir: ${DOCDIR}
compiler: ${CC}
cflags: ${CFLAGS}
cppflags: ${CPPFLAGS}
User for PolicyKit: ${POLKIT_USER}
Group for PolicyKit: ${POLKIT_GROUP}
Maintainer mode: ${USE_MAINTAINER_MODE}
Building verbose mode: ${enable_verbose_mode}
Building api docs: ${enable_gtk_doc}
"
echo "NOTE: Remember to create user ${POLKIT_USER} and group ${POLKIT_GROUP} before make install"
echo
EXTRA_DIST = TODO
SUBDIRS = api
clean-local:
rm -f *~
## Process this file with automake to create Makefile.in.
AUTOMAKE_OPTIONS = 1.7
# The name of the module.
DOC_MODULE=polkit
# The top-level SGML file.
DOC_MAIN_SGML_FILE=polkit-docs.xml
# Extra options to supply to gtkdoc-scan
#SCAN_OPTIONS=--deprecated-guards="CAIRO_DISABLE_DEPRECATED"
# The directory containing the source code. Relative to $(srcdir)
DOC_SOURCE_DIR=../../libpolkit
# Used for dependencies
HFILE_GLOB=$(top_srcdir)/libpolkit/*.h
CFILE_GLOB=$(top_srcdir)/libpolkit/*.c
# Headers to ignore
IGNORE_HFILES=
# CFLAGS and LDFLAGS for compiling scan program. Only needed
# if $(DOC_MODULE).types is non-empty.
INCLUDES =
GTKDOC_LIBS =
# Extra options to supply to gtkdoc-mkdb
MKDB_OPTIONS=--sgml-mode --output-format=xml
# Extra options to supply to gtkdoc-mktmpl
MKTMPL_OPTIONS=
# Non-autogenerated SGML files to be included in $(DOC_MAIN_SGML_FILE)
content_files =
# Images to copy into HTML directory
HTML_IMAGES =
# Extra options to supply to gtkdoc-fixref
FIXXREF_OPTIONS=
include $(top_srcdir)/gtk-doc.make
<?xml version="1.0"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
<book id="index" xmlns:xi="http://www.w3.org/2003/XInclude">
<bookinfo>
<title>PolicyKit Reference Manual</title>
</bookinfo>
<chapter>
<title>Client library</title>
<xi:include href="xml/libpolkit.xml"/>
</chapter>
</book>
<!-- ##### SECTION Title ##### -->
libpolkit
<!-- ##### SECTION Short_Description ##### -->
<!-- ##### SECTION Long_Description ##### -->
<para>
</para>
<!-- ##### SECTION See_Also ##### -->
<para>
</para>
<!-- ##### SECTION Stability_Level ##### -->
<!-- ##### ENUM LibPolKitResult ##### -->
<para>
</para>
@LIBPOLKIT_RESULT_OK:
@LIBPOLKIT_RESULT_ERROR:
@LIBPOLKIT_RESULT_INVALID_CONTEXT:
@LIBPOLKIT_RESULT_PERMISSON_DENIED:
@LIBPOLKIT_RESULT_NO_SUCH_POLICY:
<!-- ##### STRUCT LibPolKitContext_s ##### -->
<para>
</para>
<!-- ##### TYPEDEF LibPolKitContext ##### -->
<para>
</para>
<!-- ##### ENUM LibPolKitElementType ##### -->
<para>
</para>
@LIBPOLKIT_ELEMENT_TYPE_UID:
@LIBPOLKIT_ELEMENT_TYPE_GID:
<!-- ##### STRUCT LibPolKitElement_s ##### -->
<para>
</para>
<!-- ##### TYPEDEF LibPolKitElement ##### -->
<para>
</para>
<!-- ##### FUNCTION libpolkit_new_context ##### -->
<para>
</para>
@Returns:
<!-- ##### FUNCTION libpolkit_context_set_txt_source ##### -->
<para>
</para>
@ctx:
@directory:
@Returns:
<!-- ##### FUNCTION libpolkit_free_context ##### -->
<para>
</para>
@ctx:
@Returns:
<!-- ##### FUNCTION libpolkit_get_policies ##### -->
<para>
</para>
@ctx:
@result:
@Returns:
<!-- ##### FUNCTION libpolkit_is_uid_allowed_for_policy ##### -->
<para>
</para>
@ctx:
@uid:
@policy:
@resource:
@result:
@Returns:
<!-- ##### FUNCTION libpolkit_is_uid_gid_allowed_for_policy ##### -->
<para>
</para>
@ctx:
@uid:
@num_gids:
@gid_list:
@policy:
@resource:
@result:
@Returns:
<!-- ##### FUNCTION libpolkit_get_whitelist ##### -->
<para>
</para>
@ctx:
@policy:
@result:
@Returns:
<!-- ##### FUNCTION libpolkit_get_blacklist ##### -->
<para>
</para>
@ctx:
@policy:
@result:
@Returns: