diff --git a/Makefile.am b/Makefile.am
index cf1dbb7496c68bfd06e971844bd4a3e9671870fa..2214028a27ab3a75219060afb92d54b819f4c526 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,14 +1,6 @@
## Process this file with automake to produce Makefile.in
-SUBDIRS = libpolkit libpolkit-dbus libpolkit-grant modules doc tools policy
-
-pamdir = $(sysconfdir)/pam.d
-pam_DATA = polkit
-
-pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = libpolkit.pc libpolkit-dbus.pc libpolkit-grant.pc
-
-DISTCLEANFILES = libpolkit.pc libpolkit-dbus.pc libpolkit-grant.pc
+SUBDIRS = data polkit polkit-dbus polkit-grant modules doc tools policy
# Creating ChangeLog from git log (taken from cairo/Makefile.am):
ChangeLog: $(srcdir)/ChangeLog
@@ -29,7 +21,7 @@ $(srcdir)/ChangeLog:
.PHONY: ChangeLog $(srcdir)/ChangeLog
-EXTRA_DIST = HACKING polkit.in libpolkit.pc.in libpolkit-dbus.pc.in libpolkit-grant.pc.in mkinstalldirs ChangeLog
+EXTRA_DIST = HACKING mkinstalldirs ChangeLog
clean-local :
rm -f *~
diff --git a/configure.in b/configure.in
index 126b9b135eb25803d3e07a3549884ec7fe1a374a..ae55f162d9b2188777ac6effc76f7fbf48929337 100644
--- a/configure.in
+++ b/configure.in
@@ -6,7 +6,7 @@ AM_INIT_AUTOMAKE(PolicyKit, 0.3)
AM_CONFIG_HEADER(config.h)
AM_MAINTAINER_MODE
-# libtool versioning - this applies to libpolkit
+# libtool versioning - this applies to all libraries in this package
#
# See http://sources.redhat.com/autobook/autobook/autobook_91.html#SEC91 for details
#
@@ -325,23 +325,24 @@ AC_DEFINE_UNQUOTED(PAM_FILE_INCLUDE_PASSWORD, "$PAM_FILE_INCLUDE_PASSWORD", [pam
AC_DEFINE_UNQUOTED(PAM_FILE_INCLUDE_SESSION, "$PAM_FILE_INCLUDE_SESSION", [pam file session])
AC_OUTPUT([
-libpolkit.pc
-libpolkit-dbus.pc
-libpolkit-grant.pc
Makefile
-polkit
-libpolkit/Makefile
-libpolkit-dbus/Makefile
-libpolkit-grant/Makefile
+data/Makefile
+data/polkit
+data/polkit.pc
+data/polkit-dbus.pc
+data/polkit-grant.pc
+polkit/Makefile
+polkit-dbus/Makefile
+polkit-grant/Makefile
tools/Makefile
doc/Makefile
doc/api/Makefile
-doc/api/libpolkit/Makefile
-doc/api/libpolkit/version.xml
-doc/api/libpolkit-dbus/Makefile
-doc/api/libpolkit-dbus/version.xml
-doc/api/libpolkit-grant/Makefile
-doc/api/libpolkit-grant/version.xml
+doc/api/polkit/Makefile
+doc/api/polkit/version.xml
+doc/api/polkit-dbus/Makefile
+doc/api/polkit-dbus/version.xml
+doc/api/polkit-grant/Makefile
+doc/api/polkit-grant/version.xml
doc/spec/Makefile
doc/spec/polkit-spec.xml.in
doc/man/Makefile
diff --git a/data/Makefile.am b/data/Makefile.am
new file mode 100644
index 0000000000000000000000000000000000000000..0de382e93cea8c3d13d76582512a1c0ae4e87b02
--- /dev/null
+++ b/data/Makefile.am
@@ -0,0 +1,14 @@
+## Process this file with automake to produce Makefile.in
+
+pamdir = $(sysconfdir)/pam.d
+pam_DATA = polkit
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = polkit.pc polkit-dbus.pc polkit-grant.pc
+
+DISTCLEANFILES = polkit.pc polkit-dbus.pc polkit-grant.pc
+
+EXTRA_DIST = polkit.in polkit.pc.in polkit-dbus.pc.in polkit-grant.pc.in
+
+clean-local :
+ rm -f *~
diff --git a/libpolkit-dbus.pc.in b/data/polkit-dbus.pc.in
similarity index 100%
rename from libpolkit-dbus.pc.in
rename to data/polkit-dbus.pc.in
diff --git a/libpolkit-grant.pc.in b/data/polkit-grant.pc.in
similarity index 100%
rename from libpolkit-grant.pc.in
rename to data/polkit-grant.pc.in
diff --git a/polkit.in b/data/polkit.in
similarity index 100%
rename from polkit.in
rename to data/polkit.in
diff --git a/libpolkit.pc.in b/data/polkit.pc.in
similarity index 100%
rename from libpolkit.pc.in
rename to data/polkit.pc.in
diff --git a/doc/api/Makefile.am b/doc/api/Makefile.am
index 46809b2a7fb440a9bff58fde1212668108de4d08..81fbf849090662c3d5adc65590c9c8638fb36cb2 100644
--- a/doc/api/Makefile.am
+++ b/doc/api/Makefile.am
@@ -1,6 +1,6 @@
## Process this file with automake to create Makefile.in.
-SUBDIRS = libpolkit libpolkit-dbus libpolkit-grant
+SUBDIRS = polkit polkit-dbus polkit-grant
MAINTAINERCLEANFILES = \
*~ \
diff --git a/doc/api/libpolkit/Makefile.am b/doc/api/polkit-dbus/Makefile.am
similarity index 81%
rename from doc/api/libpolkit/Makefile.am
rename to doc/api/polkit-dbus/Makefile.am
index 6c3d6f9516f57afd9b3ff0cd892cd0a0a2e124f1..6427986c0cea826df1e2bce94a1a33c7a8d35be0 100644
--- a/doc/api/libpolkit/Makefile.am
+++ b/doc/api/polkit-dbus/Makefile.am
@@ -5,20 +5,20 @@ NULL =
AUTOMAKE_OPTIONS = 1.7
# The name of the module.
-DOC_MODULE=libpolkit
+DOC_MODULE=polkit-dbus
# The top-level SGML file.
-DOC_MAIN_SGML_FILE=libpolkit-docs.xml
+DOC_MAIN_SGML_FILE=polkit-dbus-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
+DOC_SOURCE_DIR=../../../polkit-dbus
# Used for dependencies
-HFILE_GLOB=$(top_srcdir)/libpolkit/*.h
-CFILE_GLOB=$(top_srcdir)/libpolkit/*.c
+HFILE_GLOB=$(top_srcdir)/polkit-dbus/*.h
+CFILE_GLOB=$(top_srcdir)/polkit-dbus/*.c
# Headers to ignore
IGNORE_HFILES= \
@@ -34,7 +34,7 @@ INCLUDES = \
GTKDOC_LIBS = \
$(GLIB_LIBS) \
- $(top_builddir)/libpolkit/libpolkit.la \
+ $(top_builddir)/polkit-dbus/libpolkit-dbus.la \
$(NULL)
# Extra options to supply to gtkdoc-mkdb
@@ -57,8 +57,8 @@ FIXXREF_OPTIONS=
MAINTAINERCLEANFILES = \
*~ \
Makefile.in \
- libpolkit.types \
- libpolkit-*.txt \
+ polkit-dbus.types \
+ polkit-dbus-*.txt \
$(NULL)
include $(top_srcdir)/gtk-doc.make
diff --git a/doc/api/libpolkit-dbus/libpolkit-dbus-docs.xml b/doc/api/polkit-dbus/polkit-dbus-docs.xml
similarity index 98%
rename from doc/api/libpolkit-dbus/libpolkit-dbus-docs.xml
rename to doc/api/polkit-dbus/polkit-dbus-docs.xml
index 9dcf9782be27803228b941705000aecb9e458794..ed64c6d2b32b5f00a00b43375e934216473dad1e 100644
--- a/doc/api/libpolkit-dbus/libpolkit-dbus-docs.xml
+++ b/doc/api/polkit-dbus/polkit-dbus-docs.xml
@@ -64,7 +64,7 @@
PolicyKit D-Bus helper library.
-
+
diff --git a/doc/api/libpolkit-dbus/libpolkit-dbus.types b/doc/api/polkit-dbus/polkit-dbus.types
similarity index 100%
rename from doc/api/libpolkit-dbus/libpolkit-dbus.types
rename to doc/api/polkit-dbus/polkit-dbus.types
diff --git a/doc/api/libpolkit-dbus/version.xml.in b/doc/api/polkit-dbus/version.xml.in
similarity index 100%
rename from doc/api/libpolkit-dbus/version.xml.in
rename to doc/api/polkit-dbus/version.xml.in
diff --git a/doc/api/libpolkit-grant/Makefile.am b/doc/api/polkit-grant/Makefile.am
similarity index 79%
rename from doc/api/libpolkit-grant/Makefile.am
rename to doc/api/polkit-grant/Makefile.am
index f65956ec5e45c6040e94a76892cd469b655fa20d..b0a3babd73f570c65096af1e5dc45699dbcb788c 100644
--- a/doc/api/libpolkit-grant/Makefile.am
+++ b/doc/api/polkit-grant/Makefile.am
@@ -5,20 +5,20 @@ NULL =
AUTOMAKE_OPTIONS = 1.7
# The name of the module.
-DOC_MODULE=libpolkit-grant
+DOC_MODULE=polkit-grant
# The top-level SGML file.
-DOC_MAIN_SGML_FILE=libpolkit-grant-docs.xml
+DOC_MAIN_SGML_FILE=polkit-grant-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-grant
+DOC_SOURCE_DIR=../../../polkit-grant
# Used for dependencies
-HFILE_GLOB=$(top_srcdir)/libpolkit-grant/*.h
-CFILE_GLOB=$(top_srcdir)/libpolkit-grant/*.c
+HFILE_GLOB=$(top_srcdir)/polkit-grant/*.h
+CFILE_GLOB=$(top_srcdir)/polkit-grant/*.c
# Headers to ignore
IGNORE_HFILES= \
@@ -34,7 +34,7 @@ INCLUDES = \
GTKDOC_LIBS = \
$(GLIB_LIBS) \
- $(top_builddir)/libpolkit-grant/libpolkit-grant.la \
+ $(top_builddir)/polkit-grant/libpolkit-grant.la \
$(NULL)
# Extra options to supply to gtkdoc-mkdb
@@ -57,8 +57,8 @@ FIXXREF_OPTIONS=
MAINTAINERCLEANFILES = \
*~ \
Makefile.in \
- libpolkit-grant.types \
- libpolkit-grant-*.txt \
+ polkit-grant.types \
+ polkit-grant-*.txt \
$(NULL)
include $(top_srcdir)/gtk-doc.make
diff --git a/doc/api/libpolkit-grant/libpolkit-grant-docs.xml b/doc/api/polkit-grant/polkit-grant-docs.xml
similarity index 98%
rename from doc/api/libpolkit-grant/libpolkit-grant-docs.xml
rename to doc/api/polkit-grant/polkit-grant-docs.xml
index 0ca0f9fd3863a3badc6e22c7a8e0ae2a12d0e8a7..41204c47ce0c6ca1f53ccdc3a161128bafdf9452 100644
--- a/doc/api/libpolkit-grant/libpolkit-grant-docs.xml
+++ b/doc/api/polkit-grant/polkit-grant-docs.xml
@@ -64,7 +64,7 @@
PolicyKit granting helper library.
-
+
diff --git a/doc/api/libpolkit-grant/libpolkit-grant.types b/doc/api/polkit-grant/polkit-grant.types
similarity index 100%
rename from doc/api/libpolkit-grant/libpolkit-grant.types
rename to doc/api/polkit-grant/polkit-grant.types
diff --git a/doc/api/libpolkit-grant/version.xml.in b/doc/api/polkit-grant/version.xml.in
similarity index 100%
rename from doc/api/libpolkit-grant/version.xml.in
rename to doc/api/polkit-grant/version.xml.in
diff --git a/doc/api/libpolkit-dbus/Makefile.am b/doc/api/polkit/Makefile.am
similarity index 76%
rename from doc/api/libpolkit-dbus/Makefile.am
rename to doc/api/polkit/Makefile.am
index c5392677a0f40ce51146c615091360c569e24a0b..0b8d70a52ba35299d0b09093cc1b80ebabd35069 100644
--- a/doc/api/libpolkit-dbus/Makefile.am
+++ b/doc/api/polkit/Makefile.am
@@ -5,20 +5,20 @@ NULL =
AUTOMAKE_OPTIONS = 1.7
# The name of the module.
-DOC_MODULE=libpolkit-dbus
+DOC_MODULE=polkit
# The top-level SGML file.
-DOC_MAIN_SGML_FILE=libpolkit-dbus-docs.xml
+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-dbus
+DOC_SOURCE_DIR=../../../polkit
# Used for dependencies
-HFILE_GLOB=$(top_srcdir)/libpolkit-dbus/*.h
-CFILE_GLOB=$(top_srcdir)/libpolkit-dbus/*.c
+HFILE_GLOB=$(top_srcdir)/polkit/*.h
+CFILE_GLOB=$(top_srcdir)/polkit/*.c
# Headers to ignore
IGNORE_HFILES= \
@@ -34,7 +34,7 @@ INCLUDES = \
GTKDOC_LIBS = \
$(GLIB_LIBS) \
- $(top_builddir)/libpolkit-dbus/libpolkit-dbus.la \
+ $(top_builddir)/polkit/libpolkit.la \
$(NULL)
# Extra options to supply to gtkdoc-mkdb
@@ -54,11 +54,11 @@ HTML_IMAGES =
# Extra options to supply to gtkdoc-fixref
FIXXREF_OPTIONS=
-MAINTAINERCLEANFILES = \
- *~ \
- Makefile.in \
- libpolkit-dbus.types \
- libpolkit-dbus-*.txt \
+MAINTAINERCLEANFILES = \
+ *~ \
+ Makefile.in \
+ polkit.types \
+ polkit-*.txt \
$(NULL)
include $(top_srcdir)/gtk-doc.make
diff --git a/doc/api/libpolkit/libpolkit-docs.xml b/doc/api/polkit/polkit-docs.xml
similarity index 79%
rename from doc/api/libpolkit/libpolkit-docs.xml
rename to doc/api/polkit/polkit-docs.xml
index b0f538f63a0c2a6b8cc09010d1fdcd31cd63989f..6ed6222413cd5bcf5199d32b502751339382274f 100644
--- a/doc/api/libpolkit/libpolkit-docs.xml
+++ b/doc/api/polkit/polkit-docs.xml
@@ -64,22 +64,20 @@
PolicyKit library.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/doc/api/libpolkit/libpolkit.types b/doc/api/polkit/polkit.types
similarity index 100%
rename from doc/api/libpolkit/libpolkit.types
rename to doc/api/polkit/polkit.types
diff --git a/doc/api/libpolkit/version.xml.in b/doc/api/polkit/version.xml.in
similarity index 100%
rename from doc/api/libpolkit/version.xml.in
rename to doc/api/polkit/version.xml.in
diff --git a/libpolkit/Makefile.am b/libpolkit/Makefile.am
deleted file mode 100644
index 457f07ace87b21f4eb28e139352ad63e7d39d414..0000000000000000000000000000000000000000
--- a/libpolkit/Makefile.am
+++ /dev/null
@@ -1,62 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-INCLUDES = \
- -I$(top_builddir) -I$(top_srcdir) \
- -DPACKAGE_LIBEXEC_DIR=\""$(libexecdir)"\" \
- -DPACKAGE_SYSCONF_DIR=\""$(sysconfdir)"\" \
- -DPACKAGE_DATA_DIR=\""$(datadir)"\" \
- -DPACKAGE_BIN_DIR=\""$(bindir)"\" \
- -DPACKAGE_LOCALSTATEDIR=\""$(localstatedir)"\" \
- -DPACKAGE_LOCALE_DIR=\""$(localedir)"\" \
- -DPACKAGE_LIB_DIR=\""$(libdir)"\" \
- -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT \
- -DPOLKIT_COMPILATION \
- @GLIB_CFLAGS@
-
-lib_LTLIBRARIES=libpolkit.la
-
-libpolkitincludedir=$(includedir)/PolicyKit/libpolkit
-
-libpolkitinclude_HEADERS = \
- libpolkit.h \
- libpolkit-types.h \
- libpolkit-error.h \
- libpolkit-result.h \
- libpolkit-context.h \
- libpolkit-action.h \
- libpolkit-resource.h \
- libpolkit-seat.h \
- libpolkit-session.h \
- libpolkit-caller.h \
- libpolkit-policy-file-entry.h \
- libpolkit-policy-file.h \
- libpolkit-policy-cache.h \
- libpolkit-policy-default.h \
- libpolkit-module.h
-
-libpolkit_la_SOURCES = \
- libpolkit.h \
- libpolkit-types.h \
- libpolkit-error.h libpolkit-error.c \
- libpolkit-result.h libpolkit-result.c \
- libpolkit-context.h libpolkit-context.c \
- libpolkit-action.h libpolkit-action.c \
- libpolkit-resource.h libpolkit-resource.c \
- libpolkit-seat.h libpolkit-seat.c \
- libpolkit-session.h libpolkit-session.c \
- libpolkit-caller.h libpolkit-caller.c \
- libpolkit-policy-file-entry.h libpolkit-policy-file-entry.c \
- libpolkit-policy-file.h libpolkit-policy-file.c \
- libpolkit-policy-cache.h libpolkit-policy-cache.c \
- libpolkit-policy-default.h libpolkit-policy-default.c \
- libpolkit-debug.h libpolkit-debug.c \
- libpolkit-utils.h libpolkit-utils.c \
- libpolkit-module.h libpolkit-module.c
-
-libpolkit_la_LIBADD = @GLIB_LIBS@ -ldl
-
-libpolkit_la_LDFLAGS = -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
-
-clean-local :
- rm -f *~ $(BUILT_SOURCES)
-
diff --git a/libpolkit/libpolkit-caller.h b/libpolkit/libpolkit-caller.h
deleted file mode 100644
index bb91f6e25997974934e7b5df098be3436e64b690..0000000000000000000000000000000000000000
--- a/libpolkit/libpolkit-caller.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
-/***************************************************************************
- *
- * libpolkit-caller.h : callers
- *
- * Copyright (C) 2007 David Zeuthen,
- *
- * Licensed under the Academic Free License version 2.1
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- **************************************************************************/
-
-#if !defined (POLKIT_COMPILATION) && !defined(_POLKIT_INSIDE_POLKIT_H)
-#error "Only can be included directly, this file may disappear or change contents."
-#endif
-
-#ifndef LIBPOLKIT_CALLER_H
-#define LIBPOLKIT_CALLER_H
-
-#include
-#include
-#include
-
-struct PolKitCaller;
-typedef struct PolKitCaller PolKitCaller;
-
-PolKitCaller *libpolkit_caller_new (void);
-PolKitCaller *libpolkit_caller_ref (PolKitCaller *caller);
-void libpolkit_caller_unref (PolKitCaller *caller);
-polkit_bool_t libpolkit_caller_set_dbus_name (PolKitCaller *caller, const char *dbus_name);
-polkit_bool_t libpolkit_caller_set_uid (PolKitCaller *caller, uid_t uid);
-polkit_bool_t libpolkit_caller_set_pid (PolKitCaller *caller, pid_t pid);
-polkit_bool_t libpolkit_caller_set_selinux_context (PolKitCaller *caller, const char *selinux_context);
-polkit_bool_t libpolkit_caller_set_ck_session (PolKitCaller *caller, PolKitSession *session);
-polkit_bool_t libpolkit_caller_get_dbus_name (PolKitCaller *caller, char **out_dbus_name);
-polkit_bool_t libpolkit_caller_get_uid (PolKitCaller *caller, uid_t *out_uid);
-polkit_bool_t libpolkit_caller_get_pid (PolKitCaller *caller, pid_t *out_pid);
-polkit_bool_t libpolkit_caller_get_selinux_context (PolKitCaller *caller, char **out_selinux_context);
-polkit_bool_t libpolkit_caller_get_ck_session (PolKitCaller *caller, PolKitSession **out_session);
-
-void libpolkit_caller_debug (PolKitCaller *caller);
-polkit_bool_t libpolkit_caller_validate (PolKitCaller *caller);
-
-#endif /* LIBPOLKIT_H */
diff --git a/libpolkit/libpolkit-result.h b/libpolkit/libpolkit-result.h
deleted file mode 100644
index 74da7942a24f5e518643fa374a5c3a976e6315df..0000000000000000000000000000000000000000
--- a/libpolkit/libpolkit-result.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
-/***************************************************************************
- *
- * libpolkit-result.h : result codes from PolicyKit
- *
- * Copyright (C) 2007 David Zeuthen,
- *
- * Licensed under the Academic Free License version 2.1
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- **************************************************************************/
-
-#if !defined (POLKIT_COMPILATION) && !defined(_POLKIT_INSIDE_POLKIT_H)
-#error "Only can be included directly, this file may disappear or change contents."
-#endif
-
-#ifndef LIBPOLKIT_RESULT_H
-#define LIBPOLKIT_RESULT_H
-
-#include
-
-/**
- * PolKitResult:
- * @LIBPOLKIT_RESULT_UNKNOWN_ACTION: The passed action is unknown.
- * @LIBPOLKIT_RESULT_NOT_AUTHORIZED_TO_KNOW: The caller of libpolkit is not sufficiently privilege to know the answer.
- * @LIBPOLKIT_RESULT_NO: Access denied.
- * @LIBPOLKIT_RESULT_ONLY_VIA_ROOT_AUTH: Access denied, but authentication of the caller as
- * root will grant access to the resource... but the access isn't permanent
- * @LIBPOLKIT_RESULT_ONLY_VIA_ROOT_AUTH_KEEP_SESSION: Access denied, but authentication of the caller as
- * root will grant access to the resource for the remainder of the session
- * @LIBPOLKIT_RESULT_ONLY_VIA_ROOT_AUTH_KEEP_ALWAYS: Access denied, but authentication of the caller as
- * root will grant access to the resource in the future.
- * @LIBPOLKIT_RESULT_ONLY_VIA_SELF_AUTH: Access denied, but authentication of the caller as
- * himself will grant access to the resource... but the access isn't permanent
- * @LIBPOLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_SESSION: Access denied, but authentication of the caller as
- * himself will grant access to the resource for the remainder of the session
- * @LIBPOLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_ALWAYS: Access denied, but authentication of the caller as
- * himself will grant access to the resource in the future.
- * @LIBPOLKIT_RESULT_YES: Access granted.
- * @LIBPOLKIT_RESULT_N_RESULTS: Number of result codes
- *
- * Result codes from queries to PolicyKit. These are ordered and we
- * say that a result A is "more strict" than a result B, if A has a
- * lower numerical value. (e.g. #LIBPOLKIT_RESULT_NO is more strict
- * than #LIBPOLKIT_RESULT_YES).
- */
-typedef enum
-{
- LIBPOLKIT_RESULT_UNKNOWN_ACTION,
- LIBPOLKIT_RESULT_NOT_AUTHORIZED_TO_KNOW,
- LIBPOLKIT_RESULT_NO,
-
- LIBPOLKIT_RESULT_ONLY_VIA_ROOT_AUTH,
- LIBPOLKIT_RESULT_ONLY_VIA_ROOT_AUTH_KEEP_SESSION,
- LIBPOLKIT_RESULT_ONLY_VIA_ROOT_AUTH_KEEP_ALWAYS,
-
- LIBPOLKIT_RESULT_ONLY_VIA_SELF_AUTH,
- LIBPOLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_SESSION,
- LIBPOLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_ALWAYS,
-
- LIBPOLKIT_RESULT_YES,
- LIBPOLKIT_RESULT_N_RESULTS
-} PolKitResult;
-
-const char *
-libpolkit_result_to_string_representation (PolKitResult result);
-
-polkit_bool_t
-libpolkit_result_from_string_representation (const char *string, PolKitResult *out_result);
-
-#endif /* LIBPOLKIT_RESULT_H */
diff --git a/libpolkit/libpolkit-session.h b/libpolkit/libpolkit-session.h
deleted file mode 100644
index 2ee4bdacda83ddf83365ef043e9836888af844ea..0000000000000000000000000000000000000000
--- a/libpolkit/libpolkit-session.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
-/***************************************************************************
- *
- * libpolkit-session.h : sessions
- *
- * Copyright (C) 2007 David Zeuthen,
- *
- * Licensed under the Academic Free License version 2.1
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- **************************************************************************/
-
-#if !defined (POLKIT_COMPILATION) && !defined(_POLKIT_INSIDE_POLKIT_H)
-#error "Only can be included directly, this file may disappear or change contents."
-#endif
-
-#ifndef LIBPOLKIT_SESSION_H
-#define LIBPOLKIT_SESSION_H
-
-#include
-#include
-
-#include
-
-struct PolKitSession;
-typedef struct PolKitSession PolKitSession;
-
-PolKitSession *libpolkit_session_new (void);
-PolKitSession *libpolkit_session_ref (PolKitSession *session);
-void libpolkit_session_unref (PolKitSession *session);
-polkit_bool_t libpolkit_session_set_uid (PolKitSession *session, uid_t uid);
-polkit_bool_t libpolkit_session_set_seat (PolKitSession *session, PolKitSeat *seat);
-polkit_bool_t libpolkit_session_set_ck_objref (PolKitSession *session, const char *ck_objref);
-polkit_bool_t libpolkit_session_set_ck_is_active (PolKitSession *session, polkit_bool_t is_active);
-polkit_bool_t libpolkit_session_set_ck_is_local (PolKitSession *session, polkit_bool_t is_local);
-polkit_bool_t libpolkit_session_set_ck_remote_host (PolKitSession *session, const char *remote_host);
-polkit_bool_t libpolkit_session_get_uid (PolKitSession *session, uid_t *out_uid);
-polkit_bool_t libpolkit_session_get_seat (PolKitSession *session, PolKitSeat **out_seat);
-polkit_bool_t libpolkit_session_get_ck_objref (PolKitSession *session, char **out_ck_objref);
-polkit_bool_t libpolkit_session_get_ck_is_active (PolKitSession *session, polkit_bool_t *out_is_active);
-polkit_bool_t libpolkit_session_get_ck_is_local (PolKitSession *session, polkit_bool_t *out_is_local);
-polkit_bool_t libpolkit_session_get_ck_remote_host (PolKitSession *session, char **out_remote_host);
-
-void libpolkit_session_debug (PolKitSession *session);
-polkit_bool_t libpolkit_session_validate (PolKitSession *session);
-
-#endif /* LIBPOLKIT_SESSION_H */
diff --git a/modules/allow-all/Makefile.am b/modules/allow-all/Makefile.am
index a833468b493742f587183c93b07ba5cf940fd3d4..316f3a69236f01f3485074061bc5ab96af140e7e 100644
--- a/modules/allow-all/Makefile.am
+++ b/modules/allow-all/Makefile.am
@@ -19,7 +19,7 @@ polkitmodule_LTLIBRARIES = \
polkit_module_allow_all_la_SOURCES = polkit-module-allow-all.c
polkit_module_allow_all_la_LDFLAGS = -no-undefined -module -avoid-version
-polkit_module_allow_all_la_LIBADD = $(top_builddir)/libpolkit/libpolkit.la
+polkit_module_allow_all_la_LIBADD = $(top_builddir)/polkit/libpolkit.la
clean-local :
rm -f *~
diff --git a/modules/allow-all/polkit-module-allow-all.c b/modules/allow-all/polkit-module-allow-all.c
index 3da56c29ce49548e546ed1edccd464ad80642f68..0d32478a6a00108bd941cda300a5ad7833900c04 100644
--- a/modules/allow-all/polkit-module-allow-all.c
+++ b/modules/allow-all/polkit-module-allow-all.c
@@ -28,10 +28,10 @@
#endif
#include
-#include
+#include
-/* The symbol that libpolkit looks up when loading this module */
-polkit_bool_t libpolkit_module_set_functions (PolKitModuleInterface *module_interface);
+/* The symbol that polkit looks up when loading this module */
+polkit_bool_t polkit_module_set_functions (PolKitModuleInterface *module_interface);
static polkit_bool_t
_module_init (PolKitModuleInterface *module_interface, int argc, char *argv[])
@@ -51,7 +51,7 @@ _module_can_session_access_resource (PolKitModuleInterface *module_interface,
PolKitResource *resource,
PolKitSession *session)
{
- return LIBPOLKIT_RESULT_YES;
+ return POLKIT_RESULT_YES;
}
static PolKitResult
@@ -61,11 +61,11 @@ _module_can_caller_access_resource (PolKitModuleInterface *module_interface,
PolKitResource *resource,
PolKitCaller *caller)
{
- return LIBPOLKIT_RESULT_YES;
+ return POLKIT_RESULT_YES;
}
polkit_bool_t
-libpolkit_module_set_functions (PolKitModuleInterface *module_interface)
+polkit_module_set_functions (PolKitModuleInterface *module_interface)
{
polkit_bool_t ret;
@@ -73,10 +73,10 @@ libpolkit_module_set_functions (PolKitModuleInterface *module_interface)
if (module_interface == NULL)
goto out;
- libpolkit_module_set_func_initialize (module_interface, _module_init);
- libpolkit_module_set_func_shutdown (module_interface, _module_shutdown);
- libpolkit_module_set_func_can_session_access_resource (module_interface, _module_can_session_access_resource);
- libpolkit_module_set_func_can_caller_access_resource (module_interface, _module_can_caller_access_resource);
+ polkit_module_set_func_initialize (module_interface, _module_init);
+ polkit_module_set_func_shutdown (module_interface, _module_shutdown);
+ polkit_module_set_func_can_session_access_resource (module_interface, _module_can_session_access_resource);
+ polkit_module_set_func_can_caller_access_resource (module_interface, _module_can_caller_access_resource);
ret = TRUE;
out:
diff --git a/modules/default/Makefile.am b/modules/default/Makefile.am
index 91f49d47eb30785fcae549a0bfb41ec53f85434e..ec20eed771ee7d4a5ac56b63d90bf52eb03dbb50 100644
--- a/modules/default/Makefile.am
+++ b/modules/default/Makefile.am
@@ -19,7 +19,7 @@ polkitmodule_LTLIBRARIES = \
polkit_module_default_la_SOURCES = polkit-module-default.c
polkit_module_default_la_LDFLAGS = -no-undefined -module -avoid-version
-polkit_module_default_la_LIBADD = $(top_builddir)/libpolkit/libpolkit.la
+polkit_module_default_la_LIBADD = $(top_builddir)/polkit/libpolkit.la
clean-local :
rm -f *~
diff --git a/modules/default/polkit-module-default.c b/modules/default/polkit-module-default.c
index 86a0635df3a16854f966514b2a36aaee7436e496..7b7338804ce3abefc59f888d290062694bc10d5d 100644
--- a/modules/default/polkit-module-default.c
+++ b/modules/default/polkit-module-default.c
@@ -28,10 +28,10 @@
#endif
#include
-#include
+#include
-/* The symbol that libpolkit looks up when loading this module */
-polkit_bool_t libpolkit_module_set_functions (PolKitModuleInterface *module_interface);
+/* The symbol that polkit looks up when loading this module */
+polkit_bool_t polkit_module_set_functions (PolKitModuleInterface *module_interface);
static polkit_bool_t
_module_init (PolKitModuleInterface *module_interface,
@@ -57,11 +57,11 @@ _module_can_session_access_resource (PolKitModuleInterface *module_interface,
PolKitPolicyCache *cache;
PolKitPolicyFileEntry *pfe;
- result = LIBPOLKIT_RESULT_NO;
- cache = libpolkit_context_get_policy_cache (pk_context);
- pfe = libpolkit_policy_cache_get_entry (cache, action);
- return libpolkit_policy_default_can_session_access_resource (
- libpolkit_policy_file_entry_get_default (pfe),
+ result = POLKIT_RESULT_NO;
+ cache = polkit_context_get_policy_cache (pk_context);
+ pfe = polkit_policy_cache_get_entry (cache, action);
+ return polkit_policy_default_can_session_access_resource (
+ polkit_policy_file_entry_get_default (pfe),
action,
resource,
session);
@@ -78,18 +78,18 @@ _module_can_caller_access_resource (PolKitModuleInterface *module_interface,
PolKitPolicyCache *cache;
PolKitPolicyFileEntry *pfe;
- result = LIBPOLKIT_RESULT_NO;
- cache = libpolkit_context_get_policy_cache (pk_context);
- pfe = libpolkit_policy_cache_get_entry (cache, action);
- return libpolkit_policy_default_can_caller_access_resource (
- libpolkit_policy_file_entry_get_default (pfe),
+ result = POLKIT_RESULT_NO;
+ cache = polkit_context_get_policy_cache (pk_context);
+ pfe = polkit_policy_cache_get_entry (cache, action);
+ return polkit_policy_default_can_caller_access_resource (
+ polkit_policy_file_entry_get_default (pfe),
action,
resource,
caller);
}
polkit_bool_t
-libpolkit_module_set_functions (PolKitModuleInterface *module_interface)
+polkit_module_set_functions (PolKitModuleInterface *module_interface)
{
polkit_bool_t ret;
@@ -97,10 +97,10 @@ libpolkit_module_set_functions (PolKitModuleInterface *module_interface)
if (module_interface == NULL)
goto out;
- libpolkit_module_set_func_initialize (module_interface, _module_init);
- libpolkit_module_set_func_shutdown (module_interface, _module_shutdown);
- libpolkit_module_set_func_can_session_access_resource (module_interface, _module_can_session_access_resource);
- libpolkit_module_set_func_can_caller_access_resource (module_interface, _module_can_caller_access_resource);
+ polkit_module_set_func_initialize (module_interface, _module_init);
+ polkit_module_set_func_shutdown (module_interface, _module_shutdown);
+ polkit_module_set_func_can_session_access_resource (module_interface, _module_can_session_access_resource);
+ polkit_module_set_func_can_caller_access_resource (module_interface, _module_can_caller_access_resource);
ret = TRUE;
out:
diff --git a/modules/deny-all/Makefile.am b/modules/deny-all/Makefile.am
index 345dcf4f24fa22641615602fb305a33adb193f47..732d92937c105bb9f59fce1b9f5b5b5ae9159b4d 100644
--- a/modules/deny-all/Makefile.am
+++ b/modules/deny-all/Makefile.am
@@ -19,7 +19,7 @@ polkitmodule_LTLIBRARIES = \
polkit_module_deny_all_la_SOURCES = polkit-module-deny-all.c
polkit_module_deny_all_la_LDFLAGS = -no-undefined -module -avoid-version
-polkit_module_deny_all_la_LIBADD = $(top_builddir)/libpolkit/libpolkit.la
+polkit_module_deny_all_la_LIBADD = $(top_builddir)/polkit/libpolkit.la
clean-local :
rm -f *~
diff --git a/modules/deny-all/polkit-module-deny-all.c b/modules/deny-all/polkit-module-deny-all.c
index e2eb517ea93e37e79ad099789ddc1724fcb55ef9..0306e198d708b16cbc3fbb620e684963b3b438f6 100644
--- a/modules/deny-all/polkit-module-deny-all.c
+++ b/modules/deny-all/polkit-module-deny-all.c
@@ -28,10 +28,10 @@
#endif
#include
-#include
+#include
-/* The symbol that libpolkit looks up when loading this module */
-polkit_bool_t libpolkit_module_set_functions (PolKitModuleInterface *module_interface);
+/* The symbol that polkit looks up when loading this module */
+polkit_bool_t polkit_module_set_functions (PolKitModuleInterface *module_interface);
static polkit_bool_t
_module_init (PolKitModuleInterface *module_interface, int argc, char *argv[])
@@ -51,7 +51,7 @@ _module_can_session_access_resource (PolKitModuleInterface *module_interface,
PolKitResource *resource,
PolKitSession *session)
{
- return LIBPOLKIT_RESULT_NO;
+ return POLKIT_RESULT_NO;
}
static PolKitResult
@@ -61,11 +61,11 @@ _module_can_caller_access_resource (PolKitModuleInterface *module_interface,
PolKitResource *resource,
PolKitCaller *caller)
{
- return LIBPOLKIT_RESULT_NO;
+ return POLKIT_RESULT_NO;
}
polkit_bool_t
-libpolkit_module_set_functions (PolKitModuleInterface *module_interface)
+polkit_module_set_functions (PolKitModuleInterface *module_interface)
{
polkit_bool_t ret;
@@ -73,10 +73,10 @@ libpolkit_module_set_functions (PolKitModuleInterface *module_interface)
if (module_interface == NULL)
goto out;
- libpolkit_module_set_func_initialize (module_interface, _module_init);
- libpolkit_module_set_func_shutdown (module_interface, _module_shutdown);
- libpolkit_module_set_func_can_session_access_resource (module_interface, _module_can_session_access_resource);
- libpolkit_module_set_func_can_caller_access_resource (module_interface, _module_can_caller_access_resource);
+ polkit_module_set_func_initialize (module_interface, _module_init);
+ polkit_module_set_func_shutdown (module_interface, _module_shutdown);
+ polkit_module_set_func_can_session_access_resource (module_interface, _module_can_session_access_resource);
+ polkit_module_set_func_can_caller_access_resource (module_interface, _module_can_caller_access_resource);
ret = TRUE;
out:
diff --git a/modules/grant/Makefile.am b/modules/grant/Makefile.am
index 0b7c5f12558ff321718ce4fba6eaed569947fd26..6306ac5d0e7d618323adc7047b7231c010f8840e 100644
--- a/modules/grant/Makefile.am
+++ b/modules/grant/Makefile.am
@@ -19,7 +19,7 @@ polkitmodule_LTLIBRARIES = \
polkit_module_grant_la_SOURCES = polkit-module-grant.c
polkit_module_grant_la_LDFLAGS = -no-undefined -module -avoid-version
-polkit_module_grant_la_LIBADD = $(top_builddir)/libpolkit/libpolkit.la @GLIB_LIBS@
+polkit_module_grant_la_LIBADD = $(top_builddir)/polkit/libpolkit.la @GLIB_LIBS@
clean-local :
rm -f *~
diff --git a/modules/grant/polkit-module-grant.c b/modules/grant/polkit-module-grant.c
index 15a06c0f809bcc8014c03d622b8877ee34725a1f..d49c5a6f0087a9b3d0ba63a68d4d04e14b74a198 100644
--- a/modules/grant/polkit-module-grant.c
+++ b/modules/grant/polkit-module-grant.c
@@ -31,11 +31,11 @@
#include
#include
#include
-#include
+#include
#include
-/* The symbol that libpolkit looks up when loading this module */
-polkit_bool_t libpolkit_module_set_functions (PolKitModuleInterface *module_interface);
+/* The symbol that polkit looks up when loading this module */
+polkit_bool_t polkit_module_set_functions (PolKitModuleInterface *module_interface);
static polkit_bool_t
_module_init (PolKitModuleInterface *module_interface, int argc, char *argv[])
@@ -57,7 +57,7 @@ _module_can_session_access_resource (PolKitModuleInterface *module_interface,
PolKitResource *resource,
PolKitSession *session)
{
- return LIBPOLKIT_RESULT_UNKNOWN_ACTION;
+ return POLKIT_RESULT_UNKNOWN_ACTION;
}
static PolKitResult
@@ -71,7 +71,7 @@ _module_can_caller_access_resource (PolKitModuleInterface *module_interface,
PolKitSession *session;
PolKitResult result;
- result = LIBPOLKIT_RESULT_UNKNOWN_ACTION;
+ result = POLKIT_RESULT_UNKNOWN_ACTION;
/* file format:
*
@@ -101,24 +101,24 @@ _module_can_caller_access_resource (PolKitModuleInterface *module_interface,
char *dbus_name;
guint resource_hash;
- if (!libpolkit_action_get_action_id (action, &action_name))
+ if (!polkit_action_get_action_id (action, &action_name))
goto out;
- if (!libpolkit_caller_get_uid (caller, &invoking_user_id))
+ if (!polkit_caller_get_uid (caller, &invoking_user_id))
goto out;
if (resource == NULL)
goto out;
- if (!libpolkit_resource_get_resource_type (resource, &resource_type))
+ if (!polkit_resource_get_resource_type (resource, &resource_type))
goto out;
- if (!libpolkit_resource_get_resource_id (resource, &resource_id))
+ if (!polkit_resource_get_resource_id (resource, &resource_id))
goto out;
session_name = NULL;
- if (!libpolkit_caller_get_ck_session (caller, &session))
+ if (!polkit_caller_get_ck_session (caller, &session))
goto out;
- if (!libpolkit_caller_get_dbus_name (caller, &dbus_name))
+ if (!polkit_caller_get_dbus_name (caller, &dbus_name))
goto out;
- if (!libpolkit_session_get_ck_objref (session, &session_objpath))
+ if (!polkit_session_get_ck_objref (session, &session_objpath))
goto out;
session_name = g_basename (session_objpath);
@@ -129,7 +129,7 @@ _module_can_caller_access_resource (PolKitModuleInterface *module_interface,
/* TODO: FIXME: XXX: this format of storing granted privileges needs be redone
*
* this concerns these two files
- * - libpolkit-grant/polkit-grant-helper.c
+ * - polkit-grant/polkit-grant-helper.c
* - modules/grant/polkit-module-grant.c
*/
@@ -145,7 +145,7 @@ _module_can_caller_access_resource (PolKitModuleInterface *module_interface,
grant_file = g_strdup_printf (PACKAGE_LOCALSTATE_DIR "/run/PolicyKit/dbus_%s_%d_%s_%u.grant",
dbus_name, invoking_user_id, action_name, resource_hash);
if (g_file_test (grant_file, G_FILE_TEST_EXISTS)) {
- result = LIBPOLKIT_RESULT_YES;
+ result = POLKIT_RESULT_YES;
g_free (grant_file);
goto out;
}
@@ -154,7 +154,7 @@ _module_can_caller_access_resource (PolKitModuleInterface *module_interface,
grant_file = g_strdup_printf (PACKAGE_LOCALSTATE_DIR "/run/PolicyKit/session_%s_%d_%s_%u.grant",
session_name, invoking_user_id, action_name, resource_hash);
if (g_file_test (grant_file, G_FILE_TEST_EXISTS)) {
- result = LIBPOLKIT_RESULT_YES;
+ result = POLKIT_RESULT_YES;
g_free (grant_file);
goto out;
}
@@ -163,7 +163,7 @@ _module_can_caller_access_resource (PolKitModuleInterface *module_interface,
grant_file = g_strdup_printf (PACKAGE_LOCALSTATE_DIR "/lib/PolicyKit/uid_%d_%s_%u.grant",
invoking_user_id, action_name, resource_hash);
if (g_file_test (grant_file, G_FILE_TEST_EXISTS)) {
- result = LIBPOLKIT_RESULT_YES;
+ result = POLKIT_RESULT_YES;
g_free (grant_file);
goto out;
}
@@ -175,7 +175,7 @@ out:
}
polkit_bool_t
-libpolkit_module_set_functions (PolKitModuleInterface *module_interface)
+polkit_module_set_functions (PolKitModuleInterface *module_interface)
{
polkit_bool_t ret;
@@ -183,10 +183,10 @@ libpolkit_module_set_functions (PolKitModuleInterface *module_interface)
if (module_interface == NULL)
goto out;
- libpolkit_module_set_func_initialize (module_interface, _module_init);
- libpolkit_module_set_func_shutdown (module_interface, _module_shutdown);
- libpolkit_module_set_func_can_session_access_resource (module_interface, _module_can_session_access_resource);
- libpolkit_module_set_func_can_caller_access_resource (module_interface, _module_can_caller_access_resource);
+ polkit_module_set_func_initialize (module_interface, _module_init);
+ polkit_module_set_func_shutdown (module_interface, _module_shutdown);
+ polkit_module_set_func_can_session_access_resource (module_interface, _module_can_session_access_resource);
+ polkit_module_set_func_can_caller_access_resource (module_interface, _module_can_caller_access_resource);
ret = TRUE;
out:
diff --git a/modules/run-program/Makefile.am b/modules/run-program/Makefile.am
index 057c996318d42f64e906b1314f52ace36f82fd3f..61d1ad5149dad2e34866b4152e942daa31355d0b 100644
--- a/modules/run-program/Makefile.am
+++ b/modules/run-program/Makefile.am
@@ -19,7 +19,7 @@ polkitmodule_LTLIBRARIES = \
polkit_module_run_program_la_SOURCES = polkit-module-run-program.c
polkit_module_run_program_la_LDFLAGS = -no-undefined -module -avoid-version
-polkit_module_run_program_la_LIBADD = $(top_builddir)/libpolkit/libpolkit.la @GLIB_LIBS@
+polkit_module_run_program_la_LIBADD = $(top_builddir)/polkit/libpolkit.la @GLIB_LIBS@
clean-local :
rm -f *~
diff --git a/modules/run-program/polkit-module-run-program.c b/modules/run-program/polkit-module-run-program.c
index f0189f796532f8a4b3a22a64891e6c3b1efaa209..e08235f15ccaeab8e4350acab8326269f0c91c5f 100644
--- a/modules/run-program/polkit-module-run-program.c
+++ b/modules/run-program/polkit-module-run-program.c
@@ -27,11 +27,11 @@
# include
#endif
-#include
+#include
#include
-/* The symbol that libpolkit looks up when loading this module */
-polkit_bool_t libpolkit_module_set_functions (PolKitModuleInterface *module_interface);
+/* The symbol that polkit looks up when loading this module */
+polkit_bool_t polkit_module_set_functions (PolKitModuleInterface *module_interface);
typedef struct {
int program_argc;
@@ -75,7 +75,7 @@ _module_init (PolKitModuleInterface *module_interface, int argc, char *argv[])
if (user_data->program_argv == NULL)
goto error;
- libpolkit_module_set_user_data (module_interface, user_data);
+ polkit_module_set_user_data (module_interface, user_data);
return TRUE;
error:
@@ -89,7 +89,7 @@ static void
_module_shutdown (PolKitModuleInterface *module_interface)
{
UserData *user_data;
- user_data = libpolkit_module_get_user_data (module_interface);
+ user_data = polkit_module_get_user_data (module_interface);
if (user_data != NULL) {
if (user_data->program_argv != NULL)
g_strfreev (user_data->program_argv);
@@ -101,7 +101,7 @@ static polkit_bool_t
_add_action_to_env (PolKitAction *action, GPtrArray *envp)
{
char *p_id;
- if (!libpolkit_action_get_action_id (action, &p_id))
+ if (!polkit_action_get_action_id (action, &p_id))
goto error;
g_ptr_array_add (envp, g_strdup_printf ("POLKIT_ACTION_ID=%s", p_id));
return TRUE;
@@ -114,9 +114,9 @@ _add_resource_to_env (PolKitResource *resource, GPtrArray *envp)
{
char *r_type;
char *r_id;
- if (!libpolkit_resource_get_resource_type (resource, &r_type))
+ if (!polkit_resource_get_resource_type (resource, &r_type))
goto error;
- if (!libpolkit_resource_get_resource_id (resource, &r_id))
+ if (!polkit_resource_get_resource_id (resource, &r_id))
goto error;
g_ptr_array_add (envp, g_strdup_printf ("POLKIT_RESOURCE_TYPE=%s", r_type));
g_ptr_array_add (envp, g_strdup_printf ("POLKIT_RESOURCE_ID=%s", r_id));
@@ -129,7 +129,7 @@ static polkit_bool_t
_add_seat_to_env (PolKitSeat *seat, GPtrArray *envp)
{
char *s_ck_objref;
- if (!libpolkit_seat_get_ck_objref (seat, &s_ck_objref))
+ if (!polkit_seat_get_ck_objref (seat, &s_ck_objref))
goto error;
g_ptr_array_add (envp, g_strdup_printf ("POLKIT_SEAT_CK_OBJREF=%s", s_ck_objref));
return TRUE;
@@ -147,18 +147,18 @@ _add_session_to_env (PolKitSession *session, GPtrArray *envp)
char *s_ck_remote_host;
PolKitSeat *s_seat;
- if (!libpolkit_session_get_uid (session, &s_uid))
+ if (!polkit_session_get_uid (session, &s_uid))
goto error;
- if (!libpolkit_session_get_ck_objref (session, &s_ck_objref))
+ if (!polkit_session_get_ck_objref (session, &s_ck_objref))
goto error;
- if (!libpolkit_session_get_ck_is_active (session, &s_ck_is_active))
+ if (!polkit_session_get_ck_is_active (session, &s_ck_is_active))
goto error;
- if (!libpolkit_session_get_ck_is_local (session, &s_ck_is_local))
+ if (!polkit_session_get_ck_is_local (session, &s_ck_is_local))
goto error;
if (!s_ck_is_local)
- if (!libpolkit_session_get_ck_remote_host (session, &s_ck_remote_host))
+ if (!polkit_session_get_ck_remote_host (session, &s_ck_remote_host))
goto error;
- if (!libpolkit_session_get_seat (session, &s_seat))
+ if (!polkit_session_get_seat (session, &s_seat))
goto error;
if (!_add_seat_to_env (s_seat, envp))
@@ -183,15 +183,15 @@ _add_caller_to_env (PolKitCaller *caller, GPtrArray *envp)
char *c_dbus_name;
PolKitSession *c_session;
- if (!libpolkit_caller_get_uid (caller, &c_uid))
+ if (!polkit_caller_get_uid (caller, &c_uid))
goto error;
- if (!libpolkit_caller_get_pid (caller, &c_pid))
+ if (!polkit_caller_get_pid (caller, &c_pid))
goto error;
- if (!libpolkit_caller_get_dbus_name (caller, &c_dbus_name))
+ if (!polkit_caller_get_dbus_name (caller, &c_dbus_name))
goto error;
- if (!libpolkit_caller_get_selinux_context (caller, &c_selinux_context)) /* SELinux may not be available */
+ if (!polkit_caller_get_selinux_context (caller, &c_selinux_context)) /* SELinux may not be available */
c_selinux_context = NULL;
- if (!libpolkit_caller_get_ck_session (caller, &c_session)) /* Caller may not originate from a session */
+ if (!polkit_caller_get_ck_session (caller, &c_session)) /* Caller may not originate from a session */
c_session = NULL;
if (c_session != NULL)
@@ -244,7 +244,7 @@ _run_program (UserData *user_data, char **envp, PolKitResult *result)
;
prog_stdout[n] = '\0';
- if (!libpolkit_result_from_string_representation (prog_stdout, result)) {
+ if (!polkit_result_from_string_representation (prog_stdout, result)) {
g_warning ("malformed result '%s' from program", prog_stdout);
goto error;
}
@@ -268,9 +268,9 @@ _module_can_session_access_resource (PolKitModuleInterface *module_interface,
GPtrArray *envp;
envp = NULL;
- result = LIBPOLKIT_RESULT_UNKNOWN_ACTION;
+ result = POLKIT_RESULT_UNKNOWN_ACTION;
- user_data = libpolkit_module_get_user_data (module_interface);
+ user_data = polkit_module_get_user_data (module_interface);
envp = g_ptr_array_new ();
@@ -308,8 +308,8 @@ _module_can_caller_access_resource (PolKitModuleInterface *module_interface,
GPtrArray *envp;
envp = NULL;
- result = LIBPOLKIT_RESULT_NO;
- user_data = libpolkit_module_get_user_data (module_interface);
+ result = POLKIT_RESULT_NO;
+ user_data = polkit_module_get_user_data (module_interface);
envp = g_ptr_array_new ();
if (!_add_action_to_env (action, envp))
@@ -334,7 +334,7 @@ error:
}
polkit_bool_t
-libpolkit_module_set_functions (PolKitModuleInterface *module_interface)
+polkit_module_set_functions (PolKitModuleInterface *module_interface)
{
polkit_bool_t ret;
@@ -342,10 +342,10 @@ libpolkit_module_set_functions (PolKitModuleInterface *module_interface)
if (module_interface == NULL)
goto out;
- libpolkit_module_set_func_initialize (module_interface, _module_init);
- libpolkit_module_set_func_shutdown (module_interface, _module_shutdown);
- libpolkit_module_set_func_can_session_access_resource (module_interface, _module_can_session_access_resource);
- libpolkit_module_set_func_can_caller_access_resource (module_interface, _module_can_caller_access_resource);
+ polkit_module_set_func_initialize (module_interface, _module_init);
+ polkit_module_set_func_shutdown (module_interface, _module_shutdown);
+ polkit_module_set_func_can_session_access_resource (module_interface, _module_can_session_access_resource);
+ polkit_module_set_func_can_caller_access_resource (module_interface, _module_can_caller_access_resource);
ret = TRUE;
out:
diff --git a/libpolkit-dbus/Makefile.am b/polkit-dbus/Makefile.am
similarity index 79%
rename from libpolkit-dbus/Makefile.am
rename to polkit-dbus/Makefile.am
index 3a51c3a01839dad16a24965610a478be5167668c..0cee7251dd3b7da0469f1f503e464f607c08e210 100644
--- a/libpolkit-dbus/Makefile.am
+++ b/polkit-dbus/Makefile.am
@@ -14,15 +14,15 @@ INCLUDES = \
lib_LTLIBRARIES=libpolkit-dbus.la
-libpolkit_dbusincludedir=$(includedir)/PolicyKit/libpolkit-dbus
+libpolkit_dbusincludedir=$(includedir)/PolicyKit/polkit-dbus
libpolkit_dbusinclude_HEADERS = \
- libpolkit-dbus.h
+ polkit-dbus.h
libpolkit_dbus_la_SOURCES = \
- libpolkit-dbus.h libpolkit-dbus.c
+ polkit-dbus.h polkit-dbus.c
-libpolkit_dbus_la_LIBADD = @DBUS_LIBS@ $(top_builddir)/libpolkit/libpolkit.la
+libpolkit_dbus_la_LIBADD = @DBUS_LIBS@ $(top_builddir)/polkit/libpolkit.la
libpolkit_dbus_la_LDFLAGS = -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
diff --git a/libpolkit-dbus/libpolkit-dbus.c b/polkit-dbus/polkit-dbus.c
similarity index 83%
rename from libpolkit-dbus/libpolkit-dbus.c
rename to polkit-dbus/polkit-dbus.c
index 6c4995a6dad1f2d851431b28d244e1ec779eca63..8609aaccb8c8a5494a011a1bb9fef6d2e756781a 100644
--- a/libpolkit-dbus/libpolkit-dbus.c
+++ b/polkit-dbus/polkit-dbus.c
@@ -1,7 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/***************************************************************************
*
- * libpolkit-dbus.h : helper library for obtaining seat, session and
+ * polkit-dbus.h : helper library for obtaining seat, session and
* caller information via D-Bus and ConsoleKit
*
* Copyright (C) 2007 David Zeuthen,
@@ -25,7 +25,7 @@
**************************************************************************/
/**
- * SECTION:libpolkit-dbus
+ * SECTION:polkit-dbus
* @short_description: Helper library for obtaining seat, session and caller information via D-Bus and ConsoleKit.
*
* Helper library for obtaining seat, session and caller information
@@ -44,11 +44,11 @@
#include
#include
-#include "libpolkit-dbus.h"
+#include "polkit-dbus.h"
/**
- * libpolkit_session_new_from_objpath:
+ * polkit_session_new_from_objpath:
* @con: D-Bus system bus connection
* @objpath: object path of ConsoleKit session object
* @uid: the user owning the session or -1 if unknown
@@ -64,7 +64,7 @@
* @error will be set)
**/
PolKitSession *
-libpolkit_session_new_from_objpath (DBusConnection *con, const char *objpath, uid_t uid, DBusError *error)
+polkit_session_new_from_objpath (DBusConnection *con, const char *objpath, uid_t uid, DBusError *error)
{
PolKitSeat *seat;
PolKitSession *session;
@@ -198,67 +198,67 @@ libpolkit_session_new_from_objpath (DBusConnection *con, const char *objpath, ui
dbus_message_unref (reply);
}
- session = libpolkit_session_new ();
+ session = polkit_session_new ();
if (session == NULL) {
goto out;
}
- if (!libpolkit_session_set_ck_objref (session, objpath)) {
- libpolkit_session_unref (session);
+ if (!polkit_session_set_ck_objref (session, objpath)) {
+ polkit_session_unref (session);
session = NULL;
goto out;
}
- if (!libpolkit_session_set_ck_is_active (session, is_active)) {
- libpolkit_session_unref (session);
+ if (!polkit_session_set_ck_is_active (session, is_active)) {
+ polkit_session_unref (session);
session = NULL;
goto out;
}
- if (!libpolkit_session_set_ck_is_local (session, is_local)) {
- libpolkit_session_unref (session);
+ if (!polkit_session_set_ck_is_local (session, is_local)) {
+ polkit_session_unref (session);
session = NULL;
goto out;
}
if (!is_local) {
- if (!libpolkit_session_set_ck_remote_host (session, remote_host)) {
- libpolkit_session_unref (session);
+ if (!polkit_session_set_ck_remote_host (session, remote_host)) {
+ polkit_session_unref (session);
session = NULL;
goto out;
}
}
- seat = libpolkit_seat_new ();
+ seat = polkit_seat_new ();
if (seat == NULL) {
- libpolkit_session_unref (session);
+ polkit_session_unref (session);
session = NULL;
goto out;
}
- if (!libpolkit_seat_set_ck_objref (seat, seat_path)) {
- libpolkit_seat_unref (seat);
+ if (!polkit_seat_set_ck_objref (seat, seat_path)) {
+ polkit_seat_unref (seat);
seat = NULL;
- libpolkit_session_unref (session);
+ polkit_session_unref (session);
session = NULL;
goto out;
}
- if (!libpolkit_seat_validate (seat)) {
- libpolkit_seat_unref (seat);
+ if (!polkit_seat_validate (seat)) {
+ polkit_seat_unref (seat);
seat = NULL;
- libpolkit_session_unref (session);
+ polkit_session_unref (session);
session = NULL;
goto out;
}
- if (!libpolkit_session_set_seat (session, seat)) {
- libpolkit_seat_unref (seat);
+ if (!polkit_session_set_seat (session, seat)) {
+ polkit_seat_unref (seat);
seat = NULL;
- libpolkit_session_unref (session);
+ polkit_session_unref (session);
session = NULL;
goto out;
}
- libpolkit_seat_unref (seat); /* session object now owns this object */
+ polkit_seat_unref (seat); /* session object now owns this object */
seat = NULL;
- if (!libpolkit_session_validate (session)) {
- libpolkit_session_unref (session);
+ if (!polkit_session_validate (session)) {
+ polkit_session_unref (session);
session = NULL;
goto out;
}
@@ -270,7 +270,7 @@ out:
}
/**
- * libpolkit_session_new_from_cookie:
+ * polkit_session_new_from_cookie:
* @con: D-Bus system bus connection
* @cookie: a ConsoleKit XDG_SESSION_COOKIE
* @error: D-Bus error
@@ -284,7 +284,7 @@ out:
* @error will be set)
**/
PolKitSession *
-libpolkit_session_new_from_cookie (DBusConnection *con, const char *cookie, DBusError *error)
+polkit_session_new_from_cookie (DBusConnection *con, const char *cookie, DBusError *error)
{
PolKitSession *session;
DBusMessage *message;
@@ -324,7 +324,7 @@ libpolkit_session_new_from_cookie (DBusConnection *con, const char *cookie, DBus
dbus_message_unref (message);
dbus_message_unref (reply);
- session = libpolkit_session_new_from_objpath (con, objpath, -1, error);
+ session = polkit_session_new_from_objpath (con, objpath, -1, error);
out:
g_free (objpath);
@@ -333,7 +333,7 @@ out:
/**
- * libpolkit_caller_new_from_dbus_name:
+ * polkit_caller_new_from_dbus_name:
* @con: D-Bus system bus connection
* @dbus_name: unique system bus connection name
* @error: D-Bus error
@@ -348,7 +348,7 @@ out:
* @error will be set)
**/
PolKitCaller *
-libpolkit_caller_new_from_dbus_name (DBusConnection *con, const char *dbus_name, DBusError *error)
+polkit_caller_new_from_dbus_name (DBusConnection *con, const char *dbus_name, DBusError *error)
{
PolKitCaller *caller;
pid_t pid;
@@ -453,82 +453,82 @@ libpolkit_caller_new_from_dbus_name (DBusConnection *con, const char *dbus_name,
dbus_message_unref (message);
dbus_message_unref (reply);
- session = libpolkit_session_new_from_objpath (con, ck_session_objpath, uid, error);
+ session = polkit_session_new_from_objpath (con, ck_session_objpath, uid, error);
if (session == NULL) {
g_warning ("Got a session objpath but couldn't construct session object!");
goto out;
}
- if (!libpolkit_session_validate (session)) {
- libpolkit_session_unref (session);
+ if (!polkit_session_validate (session)) {
+ polkit_session_unref (session);
session = NULL;
goto out;
}
not_in_session:
- caller = libpolkit_caller_new ();
+ caller = polkit_caller_new ();
if (caller == NULL) {
if (session != NULL) {
- libpolkit_session_unref (session);
+ polkit_session_unref (session);
session = NULL;
}
goto out;
}
- if (!libpolkit_caller_set_dbus_name (caller, dbus_name)) {
+ if (!polkit_caller_set_dbus_name (caller, dbus_name)) {
if (session != NULL) {
- libpolkit_session_unref (session);
+ polkit_session_unref (session);
session = NULL;
}
- libpolkit_caller_unref (caller);
+ polkit_caller_unref (caller);
caller = NULL;
goto out;
}
- if (!libpolkit_caller_set_uid (caller, uid)) {
+ if (!polkit_caller_set_uid (caller, uid)) {
if (session != NULL) {
- libpolkit_session_unref (session);
+ polkit_session_unref (session);
session = NULL;
}
- libpolkit_caller_unref (caller);
+ polkit_caller_unref (caller);
caller = NULL;
goto out;
}
- if (!libpolkit_caller_set_pid (caller, pid)) {
+ if (!polkit_caller_set_pid (caller, pid)) {
if (session != NULL) {
- libpolkit_session_unref (session);
+ polkit_session_unref (session);
session = NULL;
}
- libpolkit_caller_unref (caller);
+ polkit_caller_unref (caller);
caller = NULL;
goto out;
}
if (selinux_context != NULL) {
- if (!libpolkit_caller_set_selinux_context (caller, selinux_context)) {
+ if (!polkit_caller_set_selinux_context (caller, selinux_context)) {
if (session != NULL) {
- libpolkit_session_unref (session);
+ polkit_session_unref (session);
session = NULL;
}
- libpolkit_caller_unref (caller);
+ polkit_caller_unref (caller);
caller = NULL;
goto out;
}
}
if (session != NULL) {
- if (!libpolkit_caller_set_ck_session (caller, session)) {
+ if (!polkit_caller_set_ck_session (caller, session)) {
if (session != NULL) {
- libpolkit_session_unref (session);
+ polkit_session_unref (session);
session = NULL;
}
- libpolkit_caller_unref (caller);
+ polkit_caller_unref (caller);
caller = NULL;
goto out;
}
- libpolkit_session_unref (session); /* caller object now own this object */
+ polkit_session_unref (session); /* caller object now own this object */
session = NULL;
}
- if (!libpolkit_caller_validate (caller)) {
- libpolkit_caller_unref (caller);
+ if (!polkit_caller_validate (caller)) {
+ polkit_caller_unref (caller);
caller = NULL;
goto out;
}
diff --git a/libpolkit-dbus/libpolkit-dbus.h b/polkit-dbus/polkit-dbus.h
similarity index 68%
rename from libpolkit-dbus/libpolkit-dbus.h
rename to polkit-dbus/polkit-dbus.h
index dd8d019e9427370996b16c94c85c40344e17edeb..39c00cb3fd63f90eb1a74bdec02734edfe950570 100644
--- a/libpolkit-dbus/libpolkit-dbus.h
+++ b/polkit-dbus/polkit-dbus.h
@@ -1,7 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/***************************************************************************
*
- * libpolkit-dbus.h : helper library for obtaining seat, session and
+ * polkit-dbus.h : helper library for obtaining seat, session and
* caller information via D-Bus and ConsoleKit
*
* Copyright (C) 2007 David Zeuthen,
@@ -24,18 +24,18 @@
*
**************************************************************************/
-#ifndef LIBPOLKIT_DBUS_H
-#define LIBPOLKIT_DBUS_H
+#ifndef POLKIT_DBUS_H
+#define POLKIT_DBUS_H
-#include
+#include
#include
-PolKitSession *libpolkit_session_new_from_objpath (DBusConnection *con, const char *objpath, uid_t uid, DBusError *error);
-PolKitSession *libpolkit_session_new_from_cookie (DBusConnection *con, const char *cookie, DBusError *error);
+PolKitSession *polkit_session_new_from_objpath (DBusConnection *con, const char *objpath, uid_t uid, DBusError *error);
+PolKitSession *polkit_session_new_from_cookie (DBusConnection *con, const char *cookie, DBusError *error);
-PolKitCaller *libpolkit_caller_new_from_dbus_name (DBusConnection *con, const char *dbus_name, DBusError *error);
+PolKitCaller *polkit_caller_new_from_dbus_name (DBusConnection *con, const char *dbus_name, DBusError *error);
-#endif /* LIBPOLKIT_DBUS_H */
+#endif /* POLKIT_DBUS_H */
diff --git a/libpolkit-grant/Makefile.am b/polkit-grant/Makefile.am
similarity index 87%
rename from libpolkit-grant/Makefile.am
rename to polkit-grant/Makefile.am
index 01ebcfe0849c58f3f435d5e3c1e1b981a53b078f..17f07e54b263e2dc567d71673b3a2fb8c883d586 100644
--- a/libpolkit-grant/Makefile.am
+++ b/polkit-grant/Makefile.am
@@ -14,22 +14,22 @@ INCLUDES = \
lib_LTLIBRARIES=libpolkit-grant.la
-libpolkit_grantincludedir=$(includedir)/PolicyKit/libpolkit-grant
+libpolkit_grantincludedir=$(includedir)/PolicyKit/polkit-grant
libpolkit_grantinclude_HEADERS = \
- libpolkit-grant.h
+ polkit-grant.h
libpolkit_grant_la_SOURCES = \
- libpolkit-grant.h libpolkit-grant.c
+ polkit-grant.h polkit-grant.c
-libpolkit_grant_la_LIBADD = @GLIB_LIBS@ @DBUS_LIBS@ $(top_builddir)/libpolkit/libpolkit.la
+libpolkit_grant_la_LIBADD = @GLIB_LIBS@ @DBUS_LIBS@ $(top_builddir)/polkit/libpolkit.la
libpolkit_grant_la_LDFLAGS = -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
libexec_PROGRAMS = polkit-grant-helper
polkit_grant_helper_SOURCES = polkit-grant-helper.c
-polkit_grant_helper_LDADD = @GLIB_LIBS@ @DBUS_LIBS@ @AUTH_LIBS@ $(top_builddir)/libpolkit/libpolkit.la $(top_builddir)/libpolkit-dbus/libpolkit-dbus.la
+polkit_grant_helper_LDADD = @GLIB_LIBS@ @DBUS_LIBS@ @AUTH_LIBS@ $(top_builddir)/polkit/libpolkit.la $(top_builddir)/polkit-dbus/libpolkit-dbus.la
polkit_grant_alwaysdir = $(localstatedir)/lib/PolicyKit
dist_polkit_grant_always_DATA =
diff --git a/libpolkit-grant/polkit-grant-helper.c b/polkit-grant/polkit-grant-helper.c
similarity index 79%
rename from libpolkit-grant/polkit-grant-helper.c
rename to polkit-grant/polkit-grant-helper.c
index cd488100270cb722fb04786685bd382eb743dfd6..8b901074bbe5c4d6524b3f1407823b389adb9b23 100644
--- a/libpolkit-grant/polkit-grant-helper.c
+++ b/polkit-grant/polkit-grant-helper.c
@@ -39,7 +39,7 @@
#include
-#include
+#include
static int
conversation_function (int n,
@@ -197,28 +197,28 @@ verify_with_polkit (const char *dbus_name,
goto out;
}
- action = libpolkit_action_new ();
- libpolkit_action_set_action_id (action, action_name);
+ action = polkit_action_new ();
+ polkit_action_set_action_id (action, action_name);
if (resource_type != NULL && resource_name != NULL) {
- resource = libpolkit_resource_new ();
- libpolkit_resource_set_resource_type (resource, resource_type);
- libpolkit_resource_set_resource_id (resource, resource_name);
+ resource = polkit_resource_new ();
+ polkit_resource_set_resource_type (resource, resource_type);
+ polkit_resource_set_resource_id (resource, resource_name);
} else {
resource = NULL;
}
- caller = libpolkit_caller_new_from_dbus_name (bus, dbus_name, &error);
+ caller = polkit_caller_new_from_dbus_name (bus, dbus_name, &error);
if (caller == NULL) {
fprintf (stderr, "cannot get caller from dbus name\n");
goto out;
}
- if (!libpolkit_caller_get_ck_session (caller, &session)) {
+ if (!polkit_caller_get_ck_session (caller, &session)) {
fprintf (stderr, "caller is not in a session\n");
goto out;
}
- if (!libpolkit_session_get_ck_objref (session, &str)) {
+ if (!polkit_session_get_ck_objref (session, &str)) {
fprintf (stderr, "cannot get session ck objpath\n");
goto out;
}
@@ -226,22 +226,22 @@ verify_with_polkit (const char *dbus_name,
if (*out_session_objpath == NULL)
goto out;
- //libpolkit_caller_debug (caller);
+ //polkit_caller_debug (caller);
- pol_ctx = libpolkit_context_new ();
- if (!libpolkit_context_init (pol_ctx, NULL)) {
+ pol_ctx = polkit_context_new ();
+ if (!polkit_context_init (pol_ctx, NULL)) {
fprintf (stderr, "cannot init polkit\n");
goto out;
}
- *result = libpolkit_context_can_caller_access_resource (pol_ctx, action, resource, caller);
+ *result = polkit_context_can_caller_access_resource (pol_ctx, action, resource, caller);
- if (*result != LIBPOLKIT_RESULT_ONLY_VIA_ROOT_AUTH &&
- *result != LIBPOLKIT_RESULT_ONLY_VIA_ROOT_AUTH_KEEP_SESSION &&
- *result != LIBPOLKIT_RESULT_ONLY_VIA_ROOT_AUTH_KEEP_ALWAYS &&
- *result != LIBPOLKIT_RESULT_ONLY_VIA_SELF_AUTH &&
- *result != LIBPOLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_SESSION &&
- *result != LIBPOLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_ALWAYS) {
+ if (*result != POLKIT_RESULT_ONLY_VIA_ROOT_AUTH &&
+ *result != POLKIT_RESULT_ONLY_VIA_ROOT_AUTH_KEEP_SESSION &&
+ *result != POLKIT_RESULT_ONLY_VIA_ROOT_AUTH_KEEP_ALWAYS &&
+ *result != POLKIT_RESULT_ONLY_VIA_SELF_AUTH &&
+ *result != POLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_SESSION &&
+ *result != POLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_ALWAYS) {
fprintf (stderr, "given auth type is bogus\n");
goto out;
}
@@ -266,12 +266,12 @@ get_and_validate_override_details (PolKitResult *result)
fprintf (stderr, "User said '%s'\n", buf);
- if (!libpolkit_result_from_string_representation (buf, &desired_result))
+ if (!polkit_result_from_string_representation (buf, &desired_result))
goto error;
fprintf (stderr, "Testing for voluntarily downgrade from '%s' to '%s'\n",
- libpolkit_result_to_string_representation (*result),
- libpolkit_result_to_string_representation (desired_result));
+ polkit_result_to_string_representation (*result),
+ polkit_result_to_string_representation (desired_result));
/* See the huge comment in main() below...
*
@@ -279,35 +279,35 @@ get_and_validate_override_details (PolKitResult *result)
*
*/
switch (*result) {
- case LIBPOLKIT_RESULT_ONLY_VIA_ROOT_AUTH:
- if (desired_result != LIBPOLKIT_RESULT_ONLY_VIA_ROOT_AUTH)
+ case POLKIT_RESULT_ONLY_VIA_ROOT_AUTH:
+ if (desired_result != POLKIT_RESULT_ONLY_VIA_ROOT_AUTH)
goto error;
break;
- case LIBPOLKIT_RESULT_ONLY_VIA_ROOT_AUTH_KEEP_SESSION:
- if (desired_result != LIBPOLKIT_RESULT_ONLY_VIA_ROOT_AUTH &&
- desired_result != LIBPOLKIT_RESULT_ONLY_VIA_ROOT_AUTH_KEEP_SESSION)
+ case POLKIT_RESULT_ONLY_VIA_ROOT_AUTH_KEEP_SESSION:
+ if (desired_result != POLKIT_RESULT_ONLY_VIA_ROOT_AUTH &&
+ desired_result != POLKIT_RESULT_ONLY_VIA_ROOT_AUTH_KEEP_SESSION)
goto error;
break;
- case LIBPOLKIT_RESULT_ONLY_VIA_ROOT_AUTH_KEEP_ALWAYS:
- if (desired_result != LIBPOLKIT_RESULT_ONLY_VIA_ROOT_AUTH &&
- desired_result != LIBPOLKIT_RESULT_ONLY_VIA_ROOT_AUTH_KEEP_SESSION &&
- desired_result != LIBPOLKIT_RESULT_ONLY_VIA_ROOT_AUTH_KEEP_ALWAYS)
+ case POLKIT_RESULT_ONLY_VIA_ROOT_AUTH_KEEP_ALWAYS:
+ if (desired_result != POLKIT_RESULT_ONLY_VIA_ROOT_AUTH &&
+ desired_result != POLKIT_RESULT_ONLY_VIA_ROOT_AUTH_KEEP_SESSION &&
+ desired_result != POLKIT_RESULT_ONLY_VIA_ROOT_AUTH_KEEP_ALWAYS)
goto error;
break;
- case LIBPOLKIT_RESULT_ONLY_VIA_SELF_AUTH:
- if (desired_result != LIBPOLKIT_RESULT_ONLY_VIA_SELF_AUTH)
+ case POLKIT_RESULT_ONLY_VIA_SELF_AUTH:
+ if (desired_result != POLKIT_RESULT_ONLY_VIA_SELF_AUTH)
goto error;
break;
- case LIBPOLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_SESSION:
- if (desired_result != LIBPOLKIT_RESULT_ONLY_VIA_SELF_AUTH &&
- desired_result != LIBPOLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_SESSION)
+ case POLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_SESSION:
+ if (desired_result != POLKIT_RESULT_ONLY_VIA_SELF_AUTH &&
+ desired_result != POLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_SESSION)
goto error;
break;
- case LIBPOLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_ALWAYS:
- if (desired_result != LIBPOLKIT_RESULT_ONLY_VIA_SELF_AUTH &&
- desired_result != LIBPOLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_SESSION &&
- desired_result != LIBPOLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_ALWAYS)
+ case POLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_ALWAYS:
+ if (desired_result != POLKIT_RESULT_ONLY_VIA_SELF_AUTH &&
+ desired_result != POLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_SESSION &&
+ desired_result != POLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_ALWAYS)
goto error;
break;
@@ -318,8 +318,8 @@ get_and_validate_override_details (PolKitResult *result)
if (*result != desired_result) {
fprintf (stderr, "Voluntarily downgrading from '%s' to '%s'\n",
- libpolkit_result_to_string_representation (*result),
- libpolkit_result_to_string_representation (desired_result));
+ polkit_result_to_string_representation (*result),
+ polkit_result_to_string_representation (desired_result));
}
*result = desired_result;
@@ -427,13 +427,13 @@ main (int argc, char *argv[])
goto out;
/* tell user about the grant details; e.g. whether it's auth_self_keep_always or auth_self etc. */
- fprintf (stdout, "POLKIT_GRANT_HELPER_TELL_TYPE %s\n", libpolkit_result_to_string_representation (result));
+ fprintf (stdout, "POLKIT_GRANT_HELPER_TELL_TYPE %s\n", polkit_result_to_string_representation (result));
fflush (stdout);
/* figure out what user to auth */
- if (result == LIBPOLKIT_RESULT_ONLY_VIA_ROOT_AUTH ||
- result == LIBPOLKIT_RESULT_ONLY_VIA_ROOT_AUTH_KEEP_SESSION ||
- result == LIBPOLKIT_RESULT_ONLY_VIA_ROOT_AUTH_KEEP_ALWAYS) {
+ if (result == POLKIT_RESULT_ONLY_VIA_ROOT_AUTH ||
+ result == POLKIT_RESULT_ONLY_VIA_ROOT_AUTH_KEEP_SESSION ||
+ result == POLKIT_RESULT_ONLY_VIA_ROOT_AUTH_KEEP_ALWAYS) {
user_to_auth = "root";
} else {
user_to_auth = invoking_user_name;
@@ -449,7 +449,7 @@ main (int argc, char *argv[])
* See docs for the PolKitGrantOverrideGrantType callback type for use cases.
*/
fprintf (stdout, "POLKIT_GRANT_HELPER_ASK_OVERRIDE_GRANT_TYPE %s\n",
- libpolkit_result_to_string_representation (result));
+ polkit_result_to_string_representation (result));
fflush (stdout);
if (!get_and_validate_override_details (&result))
@@ -458,7 +458,7 @@ main (int argc, char *argv[])
/* TODO: FIXME: XXX: this format of storing granted privileges needs be redone
*
* this concerns these two files
- * - libpolkit-grant/polkit-grant-helper.c
+ * - polkit-grant/polkit-grant-helper.c
* - modules/grant/polkit-module-grant.c
*/
@@ -481,20 +481,20 @@ main (int argc, char *argv[])
g_free (resource_str_to_hash);
switch (result) {
- case LIBPOLKIT_RESULT_ONLY_VIA_ROOT_AUTH:
- case LIBPOLKIT_RESULT_ONLY_VIA_SELF_AUTH:
+ case POLKIT_RESULT_ONLY_VIA_ROOT_AUTH:
+ case POLKIT_RESULT_ONLY_VIA_SELF_AUTH:
grant_file = g_strdup_printf (PACKAGE_LOCALSTATE_DIR "/run/PolicyKit/dbus_%s_%d_%s_%u.grant",
dbus_name, invoking_user_id, action_name, resource_hash);
break;
- case LIBPOLKIT_RESULT_ONLY_VIA_ROOT_AUTH_KEEP_SESSION:
- case LIBPOLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_SESSION:
+ case POLKIT_RESULT_ONLY_VIA_ROOT_AUTH_KEEP_SESSION:
+ case POLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_SESSION:
grant_file = g_strdup_printf (PACKAGE_LOCALSTATE_DIR "/run/PolicyKit/session_%s_%d_%s_%u.grant",
session_name, invoking_user_id, action_name, resource_hash);
break;
- case LIBPOLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_ALWAYS:
- case LIBPOLKIT_RESULT_ONLY_VIA_ROOT_AUTH_KEEP_ALWAYS:
+ case POLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_ALWAYS:
+ case POLKIT_RESULT_ONLY_VIA_ROOT_AUTH_KEEP_ALWAYS:
grant_file = g_strdup_printf (PACKAGE_LOCALSTATE_DIR "/lib/PolicyKit/uid_%d_%s_%u.grant",
invoking_user_id, action_name, resource_hash);
break;
diff --git a/libpolkit-grant/libpolkit-grant.c b/polkit-grant/polkit-grant.c
similarity index 91%
rename from libpolkit-grant/libpolkit-grant.c
rename to polkit-grant/polkit-grant.c
index d15f8a0939bedb59b67b5e778781801ea40cea55..0197aa98534e831f2ed3bae097cf310703936f90 100644
--- a/libpolkit-grant/libpolkit-grant.c
+++ b/polkit-grant/polkit-grant.c
@@ -1,7 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/***************************************************************************
*
- * libpolkit-grant.c : library for obtaining privileges
+ * polkit-grant.c : library for obtaining privileges
*
* Copyright (C) 2007 David Zeuthen,
*
@@ -36,10 +36,10 @@
#include
#include
-#include "libpolkit-grant.h"
+#include "polkit-grant.h"
/**
- * SECTION:libpolkit-grant
+ * SECTION:polkit-grant
* @short_description: Obtain privileges through authentication.
*
* These functions are used to obtain privileges for a user that is
@@ -81,7 +81,7 @@ struct PolKitGrant
};
/**
- * libpolkit_grant_new:
+ * polkit_grant_new:
* @void:
*
* Creates a #PolKitGrant object.
@@ -89,7 +89,7 @@ struct PolKitGrant
* Returns: the new object or #NULL on error.
**/
PolKitGrant *
-libpolkit_grant_new (void)
+polkit_grant_new (void)
{
PolKitGrant *polkit_grant;
polkit_grant = g_new0 (PolKitGrant, 1);
@@ -98,7 +98,7 @@ libpolkit_grant_new (void)
}
/**
- * libpolkit_grant_ref:
+ * polkit_grant_ref:
* @polkit_grant: the object
*
* Increase reference count.
@@ -106,7 +106,7 @@ libpolkit_grant_new (void)
* Returns: the object.
**/
PolKitGrant *
-libpolkit_grant_ref (PolKitGrant *polkit_grant)
+polkit_grant_ref (PolKitGrant *polkit_grant)
{
g_return_val_if_fail (polkit_grant != NULL, NULL);
@@ -115,7 +115,7 @@ libpolkit_grant_ref (PolKitGrant *polkit_grant)
}
/**
- * libpolkit_grant_unref:
+ * polkit_grant_unref:
* @polkit_grant: the object
*
* Decreases the reference count of the object. If it becomes zero,
@@ -123,7 +123,7 @@ libpolkit_grant_ref (PolKitGrant *polkit_grant)
* objects are decresed by one.
**/
void
-libpolkit_grant_unref (PolKitGrant *polkit_grant)
+polkit_grant_unref (PolKitGrant *polkit_grant)
{
g_return_if_fail (polkit_grant != NULL);
@@ -154,7 +154,7 @@ libpolkit_grant_unref (PolKitGrant *polkit_grant)
}
/**
- * libpolkit_grant_set_functions:
+ * polkit_grant_set_functions:
* @polkit_grant: the object
* @func_add_io_watch: Callback function
* @func_add_child_watch: Callback function
@@ -171,7 +171,7 @@ libpolkit_grant_unref (PolKitGrant *polkit_grant)
* Set callback functions used for authentication.
**/
void
-libpolkit_grant_set_functions (PolKitGrant *polkit_grant,
+polkit_grant_set_functions (PolKitGrant *polkit_grant,
PolKitGrantAddIOWatch func_add_io_watch,
PolKitGrantAddChildWatch func_add_child_watch,
PolKitGrantRemoveWatch func_remove_watch,
@@ -209,7 +209,7 @@ libpolkit_grant_set_functions (PolKitGrant *polkit_grant,
/**
- * libpolkit_grant_child_func:
+ * polkit_grant_child_func:
* @polkit_grant: the object
* @pid: pid of the child
* @exit_code: exit code of the child
@@ -219,7 +219,7 @@ libpolkit_grant_set_functions (PolKitGrant *polkit_grant,
* #PolKitGrantAddChildWatch terminates.
**/
void
-libpolkit_grant_child_func (PolKitGrant *polkit_grant, pid_t pid, int exit_code)
+polkit_grant_child_func (PolKitGrant *polkit_grant, pid_t pid, int exit_code)
{
g_return_if_fail (polkit_grant != NULL);
g_return_if_fail (polkit_grant->auth_in_progress);
@@ -230,7 +230,7 @@ libpolkit_grant_child_func (PolKitGrant *polkit_grant, pid_t pid, int exit_code)
/**
- * libpolkit_grant_io_func:
+ * polkit_grant_io_func:
* @polkit_grant: the object
* @fd: the file descriptor passed to the supplied function of type #PolKitGrantAddIOWatch.
*
@@ -239,7 +239,7 @@ libpolkit_grant_child_func (PolKitGrant *polkit_grant, pid_t pid, int exit_code)
* type #PolKitGrantAddIOWatch.
**/
void
-libpolkit_grant_io_func (PolKitGrant *polkit_grant, int fd)
+polkit_grant_io_func (PolKitGrant *polkit_grant, int fd)
{
char *line = NULL;
size_t line_len = 0;
@@ -299,7 +299,7 @@ libpolkit_grant_io_func (PolKitGrant *polkit_grant, int fd)
if (g_str_has_prefix (line, id)) {
PolKitResult result;
id_len = strlen (id);
- if (!libpolkit_result_from_string_representation (line + id_len, &result)) {
+ if (!polkit_result_from_string_representation (line + id_len, &result)) {
/* TODO: danger will robinson */
}
polkit_grant->func_type (polkit_grant,
@@ -313,13 +313,13 @@ libpolkit_grant_io_func (PolKitGrant *polkit_grant, int fd)
PolKitResult override;
PolKitResult result;
id_len = strlen (id);
- if (!libpolkit_result_from_string_representation (line + id_len, &result)) {
+ if (!polkit_result_from_string_representation (line + id_len, &result)) {
/* TODO: danger will robinson */
}
override = polkit_grant->func_override_grant_type (polkit_grant,
result,
polkit_grant->user_data);
- response = g_strdup (libpolkit_result_to_string_representation (override));
+ response = g_strdup (polkit_result_to_string_representation (override));
goto processed;
}
@@ -341,13 +341,13 @@ libpolkit_grant_io_func (PolKitGrant *polkit_grant, int fd)
}
/**
- * libpolkit_grant_cancel_auth:
+ * polkit_grant_cancel_auth:
* @polkit_grant: the object
*
* Cancel an authentication in progress
**/
void
-libpolkit_grant_cancel_auth (PolKitGrant *polkit_grant)
+polkit_grant_cancel_auth (PolKitGrant *polkit_grant)
{
GPid pid;
g_return_if_fail (polkit_grant != NULL);
@@ -360,7 +360,7 @@ libpolkit_grant_cancel_auth (PolKitGrant *polkit_grant)
}
/**
- * libpolkit_grant_initiate_auth:
+ * polkit_grant_initiate_auth:
* @polkit_grant: the object
* @action: Action requested by caller
* @resource: Resource in question
@@ -369,7 +369,7 @@ libpolkit_grant_cancel_auth (PolKitGrant *polkit_grant)
* Initiate authentication to obtain the privilege for the given
* @caller to perform the specified @action on the given
* @resource. The caller of this method must have setup callback
- * functions using the method libpolkit_grant_set_functions() prior to
+ * functions using the method polkit_grant_set_functions() prior to
* calling this method.
*
* Implementation-wise, this class uses a secure (e.g. as in that it
@@ -383,7 +383,7 @@ libpolkit_grant_cancel_auth (PolKitGrant *polkit_grant)
* Returns: #TRUE only if authentication have been initiated.
**/
polkit_bool_t
-libpolkit_grant_initiate_auth (PolKitGrant *polkit_grant,
+polkit_grant_initiate_auth (PolKitGrant *polkit_grant,
PolKitAction *action,
PolKitResource *resource,
PolKitCaller *caller)
@@ -399,21 +399,21 @@ libpolkit_grant_initiate_auth (PolKitGrant *polkit_grant,
/* check that callback functions have been properly set up */
g_return_val_if_fail (polkit_grant->func_done != NULL, FALSE);
- if (!libpolkit_caller_get_dbus_name (caller, &dbus_name))
+ if (!polkit_caller_get_dbus_name (caller, &dbus_name))
goto error;
- if (!libpolkit_action_get_action_id (action, &action_id))
+ if (!polkit_action_get_action_id (action, &action_id))
goto error;
- if (!libpolkit_resource_get_resource_type (resource, &resource_type))
+ if (!polkit_resource_get_resource_type (resource, &resource_type))
goto error;
- if (!libpolkit_resource_get_resource_id (resource, &resource_id))
+ if (!polkit_resource_get_resource_id (resource, &resource_id))
goto error;
/* TODO: verify incoming args */
- //helper_argv[0] = "/home/davidz/Hacking/PolicyKit/libpolkit-grant/.libs/polkit-grant-helper";
+ //helper_argv[0] = "/home/davidz/Hacking/PolicyKit/polkit-grant/.libs/polkit-grant-helper";
helper_argv[0] = PACKAGE_LIBEXEC_DIR "/polkit-grant-helper";
helper_argv[1] = dbus_name;
helper_argv[2] = action_id;
diff --git a/libpolkit-grant/libpolkit-grant.h b/polkit-grant/polkit-grant.h
similarity index 77%
rename from libpolkit-grant/libpolkit-grant.h
rename to polkit-grant/polkit-grant.h
index 0ba8925295c68792f355ea88d2dc35eff5302785..0339f3d3f44b6cffd7ad22c0b3d904e158b63db0 100644
--- a/libpolkit-grant/libpolkit-grant.h
+++ b/polkit-grant/polkit-grant.h
@@ -1,7 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/***************************************************************************
*
- * libpolkit-grant.h : library for obtaining privileges
+ * polkit-grant.h : library for obtaining privileges
*
* Copyright (C) 2007 David Zeuthen,
*
@@ -23,10 +23,10 @@
*
**************************************************************************/
-#ifndef LIBPOLKIT_GRANT_H
-#define LIBPOLKIT_GRANT_H
+#ifndef POLKIT_GRANT_H
+#define POLKIT_GRANT_H
-#include
+#include
struct PolKitGrant;
typedef struct PolKitGrant PolKitGrant;
@@ -35,7 +35,7 @@ typedef struct PolKitGrant PolKitGrant;
* PolKitGrantType:
* @polkit_grant: the grant object
* @grant_type: the current type of what privilege to obtain
- * @user_data: user data pointed as passed into libpolkit_grant_set_functions()
+ * @user_data: user data pointed as passed into polkit_grant_set_functions()
*
* Type for callback function that describes to what extent the
* privilege can be obtained; e.g. whether the user can keep it
@@ -53,7 +53,7 @@ typedef void (*PolKitGrantType) (PolKitGrant *polkit_grant,
* PolKitGrantConversationPromptEchoOff:
* @polkit_grant: the grant object
* @prompt: prompt passed by the authentication layer; do not free this string
- * @user_data: user data pointed as passed into libpolkit_grant_set_functions()
+ * @user_data: user data pointed as passed into polkit_grant_set_functions()
*
* Type for callback function that is invoked when the authentication
* layer needs to ask the user a secret and the UI should NOT echo what
@@ -70,7 +70,7 @@ typedef char* (*PolKitGrantConversationPromptEchoOff) (PolKitGrant *polkit_grant
* PolKitGrantConversationPromptEchoOn:
* @polkit_grant: the grant object
* @prompt: prompt passed by the authentication layer; do not free this string
- * @user_data: user data pointed as passed into libpolkit_grant_set_functions()
+ * @user_data: user data pointed as passed into polkit_grant_set_functions()
*
* Type for callback function that is invoked when the authentication
* layer needs to ask the user a secret and the UI should echo what
@@ -87,7 +87,7 @@ typedef char* (*PolKitGrantConversationPromptEchoOn) (PolKitGrant *polkit_grant,
* PolKitGrantConversationErrorMessage:
* @polkit_grant: the grant object
* @error_message: error message passed by the authentication layer; do not free this string
- * @user_data: user data pointed as passed into libpolkit_grant_set_functions()
+ * @user_data: user data pointed as passed into polkit_grant_set_functions()
*
* Type for callback function that is invoked when the authentication
* layer produces an error message that should be displayed in the UI.
@@ -100,7 +100,7 @@ typedef void (*PolKitGrantConversationErrorMessage) (PolKitGrant *polkit_grant,
* PolKitGrantConversationTextInfo:
* @polkit_grant: the grant object
* @text_info: information passed by the authentication layer; do not free this string
- * @user_data: user data pointed as passed into libpolkit_grant_set_functions()
+ * @user_data: user data pointed as passed into polkit_grant_set_functions()
*
* Type for callback function that is invoked when the authentication
* layer produces an informational message that should be displayed in
@@ -115,7 +115,7 @@ typedef void (*PolKitGrantConversationTextInfo) (PolKitGrant *polkit_grant,
* @polkit_grant: the grant object
* @grant_type: the current type of what privilege to obtain; this is
* the same value as passed to the callback of type #PolKitGrantType.
- * @user_data: user data pointed as passed into libpolkit_grant_set_functions()
+ * @user_data: user data pointed as passed into polkit_grant_set_functions()
*
* Type for callback function that enables the UI to request a lesser
* privilege than is obtainable. This callback is invoked when the
@@ -141,14 +141,14 @@ typedef void (*PolKitGrantConversationTextInfo) (PolKitGrant *polkit_grant,
*
*
* This dialog assumes that @grant_type passed was
- * #LIBPOLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_ALWAYS. By ticking the
+ * #POLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_ALWAYS. By ticking the
* check boxes in the dialog, the user can override this to either
- * #LIBPOLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_SESSION or
- * #LIBPOLKIT_RESULT_ONLY_VIA_SELF_AUTH. Thus, the user can
+ * #POLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_SESSION or
+ * #POLKIT_RESULT_ONLY_VIA_SELF_AUTH. Thus, the user can
* voluntarily choose to obtain a lesser privilege.
*
* Another example, would be that the @grant_type passed was
- * #LIBPOLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_SESSION. Then the dialog
+ * #POLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_SESSION. Then the dialog
* should look like this:
*
*
@@ -165,7 +165,7 @@ typedef void (*PolKitGrantConversationTextInfo) (PolKitGrant *polkit_grant,
*
*
* Finally, if the @grant_type value passed is
- * e.g. #LIBPOLKIT_RESULT_ONLY_VIA_SELF_AUTH, there are no options to
+ * e.g. #POLKIT_RESULT_ONLY_VIA_SELF_AUTH, there are no options to
* click.:
*
*
@@ -180,13 +180,13 @@ typedef void (*PolKitGrantConversationTextInfo) (PolKitGrant *polkit_grant,
*
*
* Of course, these examples also applies to
- * #LIBPOLKIT_RESULT_ONLY_VIA_ROOT_AUTH and friends.
+ * #POLKIT_RESULT_ONLY_VIA_ROOT_AUTH and friends.
*
* Returns: the desired type of what privilege to obtain; note that it
* won't work asking for more privileges than what @grant_type
* specifies; the passed value is properly checked in the secure
* setgid granting helper mentioned in
- * libpolkit_grant_initiate_auth().
+ * polkit_grant_initiate_auth().
**/
typedef PolKitResult (*PolKitGrantOverrideGrantType) (PolKitGrant *polkit_grant,
PolKitResult grant_type,
@@ -196,11 +196,11 @@ typedef PolKitResult (*PolKitGrantOverrideGrantType) (PolKitGrant *polkit_grant,
* PolKitGrantDone:
* @polkit_grant: the grant object
* @gained_privilege: whether the privilege was obtained
- * @user_data: user data pointed as passed into libpolkit_grant_set_functions()
+ * @user_data: user data pointed as passed into polkit_grant_set_functions()
*
* This function is called when the granting process ends; either if
* successful or if it was canceled using
- * e.g. libpolkit_grant_cancel_auth().
+ * e.g. polkit_grant_cancel_auth().
**/
typedef void (*PolKitGrantDone) (PolKitGrant *polkit_grant,
polkit_bool_t gained_privilege,
@@ -213,7 +213,7 @@ typedef void (*PolKitGrantDone) (PolKitGrant *polkit_grant,
*
* Type for function supplied by the application to integrate a watch
* on a child process into the applications main loop. The
- * application must call libpolkit_grant_child_func() when the
+ * application must call polkit_grant_child_func() when the
* child dies
*
* For glib mainloop, the function will typically look like this:
@@ -225,7 +225,7 @@ typedef void (*PolKitGrantDone) (PolKitGrant *polkit_grant,
* gpointer user_data)
* {
* PolKitGrant *polkit_grant = user_data;
- * libpolkit_grant_child_func (polkit_grant, pid, WEXITSTATUS (status));
+ * polkit_grant_child_func (polkit_grant, pid, WEXITSTATUS (status));
* }
*
* static int
@@ -248,7 +248,7 @@ typedef int (*PolKitGrantAddChildWatch) (PolKitGrant *polkit_grant,
*
* Type for function supplied by the application to integrate a watch
* on a file descriptor into the applications main loop. The
- * application must call libpolkit_grant_io_func() when there is data
+ * application must call polkit_grant_io_func() when there is data
* to read from the file descriptor.
*
* For glib mainloop, the function will typically look like this:
@@ -260,7 +260,7 @@ typedef int (*PolKitGrantAddChildWatch) (PolKitGrant *polkit_grant,
* int fd;
* PolKitGrant *polkit_grant = user_data;
* fd = g_io_channel_unix_get_fd (channel);
- * libpolkit_grant_io_func (polkit_grant, fd);
+ * polkit_grant_io_func (polkit_grant, fd);
* return TRUE;
* }
*
@@ -313,32 +313,32 @@ typedef int (*PolKitGrantAddIOWatch) (PolKitGrant *polkit_grant,
typedef void (*PolKitGrantRemoveWatch) (PolKitGrant *polkit_grant,
int watch_id);
-PolKitGrant *libpolkit_grant_new (void);
-PolKitGrant *libpolkit_grant_ref (PolKitGrant *polkit_grant);
-void libpolkit_grant_unref (PolKitGrant *polkit_grant);
-void libpolkit_grant_set_functions (PolKitGrant *polkit_grant,
- PolKitGrantAddIOWatch func_add_io_watch,
- PolKitGrantAddChildWatch func_add_child_watch,
- PolKitGrantRemoveWatch func_remove_watch,
- PolKitGrantType func_type,
- PolKitGrantConversationPromptEchoOff func_prompt_echo_off,
- PolKitGrantConversationPromptEchoOn func_prompt_echo_on,
- PolKitGrantConversationErrorMessage func_error_message,
- PolKitGrantConversationTextInfo func_text_info,
- PolKitGrantOverrideGrantType func_override_grant_type,
- PolKitGrantDone func_done,
- void *user_data);
-polkit_bool_t libpolkit_grant_initiate_auth (PolKitGrant *polkit_grant,
- PolKitAction *action,
- PolKitResource *resource,
- PolKitCaller *caller);
+PolKitGrant *polkit_grant_new (void);
+PolKitGrant *polkit_grant_ref (PolKitGrant *polkit_grant);
+void polkit_grant_unref (PolKitGrant *polkit_grant);
+void polkit_grant_set_functions (PolKitGrant *polkit_grant,
+ PolKitGrantAddIOWatch func_add_io_watch,
+ PolKitGrantAddChildWatch func_add_child_watch,
+ PolKitGrantRemoveWatch func_remove_watch,
+ PolKitGrantType func_type,
+ PolKitGrantConversationPromptEchoOff func_prompt_echo_off,
+ PolKitGrantConversationPromptEchoOn func_prompt_echo_on,
+ PolKitGrantConversationErrorMessage func_error_message,
+ PolKitGrantConversationTextInfo func_text_info,
+ PolKitGrantOverrideGrantType func_override_grant_type,
+ PolKitGrantDone func_done,
+ void *user_data);
+polkit_bool_t polkit_grant_initiate_auth (PolKitGrant *polkit_grant,
+ PolKitAction *action,
+ PolKitResource *resource,
+ PolKitCaller *caller);
-void libpolkit_grant_cancel_auth (PolKitGrant *polkit_grant);
+void polkit_grant_cancel_auth (PolKitGrant *polkit_grant);
-void libpolkit_grant_io_func (PolKitGrant *polkit_grant, int fd);
-void libpolkit_grant_child_func (PolKitGrant *polkit_grant, pid_t pid, int exit_code);
+void polkit_grant_io_func (PolKitGrant *polkit_grant, int fd);
+void polkit_grant_child_func (PolKitGrant *polkit_grant, pid_t pid, int exit_code);
-#endif /* LIBPOLKIT_GRANT_H */
+#endif /* POLKIT_GRANT_H */
diff --git a/libpolkit/.gitignore b/polkit/.gitignore
similarity index 100%
rename from libpolkit/.gitignore
rename to polkit/.gitignore
diff --git a/polkit/Makefile.am b/polkit/Makefile.am
new file mode 100644
index 0000000000000000000000000000000000000000..0b3bbb18d1941fe04db361e362c1b401ae085e42
--- /dev/null
+++ b/polkit/Makefile.am
@@ -0,0 +1,61 @@
+## Process this file with automake to produce Makefile.in
+
+INCLUDES = \
+ -I$(top_builddir) -I$(top_srcdir) \
+ -DPACKAGE_LIBEXEC_DIR=\""$(libexecdir)"\" \
+ -DPACKAGE_SYSCONF_DIR=\""$(sysconfdir)"\" \
+ -DPACKAGE_DATA_DIR=\""$(datadir)"\" \
+ -DPACKAGE_BIN_DIR=\""$(bindir)"\" \
+ -DPACKAGE_LOCALSTATEDIR=\""$(localstatedir)"\" \
+ -DPACKAGE_LOCALE_DIR=\""$(localedir)"\" \
+ -DPACKAGE_LIB_DIR=\""$(libdir)"\" \
+ -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT \
+ -DPOLKIT_COMPILATION \
+ @GLIB_CFLAGS@
+
+lib_LTLIBRARIES=libpolkit.la
+
+libpolkitincludedir=$(includedir)/PolicyKit/polkit
+
+libpolkitinclude_HEADERS = \
+ polkit.h \
+ polkit-types.h \
+ polkit-error.h \
+ polkit-result.h \
+ polkit-context.h \
+ polkit-action.h \
+ polkit-resource.h \
+ polkit-seat.h \
+ polkit-session.h \
+ polkit-caller.h \
+ polkit-policy-file-entry.h \
+ polkit-policy-file.h \
+ polkit-policy-cache.h \
+ polkit-policy-default.h \
+ polkit-module.h
+
+libpolkit_la_SOURCES = \
+ polkit.h \
+ polkit-types.h \
+ polkit-error.h polkit-error.c \
+ polkit-result.h polkit-result.c \
+ polkit-context.h polkit-context.c \
+ polkit-action.h polkit-action.c \
+ polkit-resource.h polkit-resource.c \
+ polkit-seat.h polkit-seat.c \
+ polkit-session.h polkit-session.c \
+ polkit-caller.h polkit-caller.c \
+ polkit-policy-file-entry.h polkit-policy-file-entry.c \
+ polkit-policy-file.h polkit-policy-file.c \
+ polkit-policy-cache.h polkit-policy-cache.c \
+ polkit-policy-default.h polkit-policy-default.c \
+ polkit-debug.h polkit-debug.c \
+ polkit-utils.h polkit-utils.c \
+ polkit-module.h polkit-module.c
+
+libpolkit_la_LIBADD = @GLIB_LIBS@ -ldl
+
+libpolkit_la_LDFLAGS = -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
+
+clean-local :
+ rm -f *~ $(BUILT_SOURCES)
diff --git a/libpolkit/libpolkit-action.c b/polkit/polkit-action.c
similarity index 85%
rename from libpolkit/libpolkit-action.c
rename to polkit/polkit-action.c
index f0a0a8c628ba2c6764bd354a0889122b81a01120..d9ad78ae265d6d5bd1c66339fb1d31c4a3684bd0 100644
--- a/libpolkit/libpolkit-action.c
+++ b/polkit/polkit-action.c
@@ -1,7 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/***************************************************************************
*
- * libpolkit-action.c : action
+ * polkit-action.c : action
*
* Copyright (C) 2007 David Zeuthen,
*
@@ -37,12 +37,12 @@
#include
#include
-#include "libpolkit-debug.h"
-#include "libpolkit-action.h"
-#include "libpolkit-utils.h"
+#include "polkit-debug.h"
+#include "polkit-action.h"
+#include "polkit-utils.h"
/**
- * SECTION:libpolkit-action
+ * SECTION:polkit-action
* @short_description: Actions.
*
* This class is used to represent an action. TODO: describe what a action really is.
@@ -61,14 +61,14 @@ struct PolKitAction
};
/**
- * libpolkit_action_new:
+ * polkit_action_new:
*
* Create a new #PolKitAction object.
*
* Returns: the new object
**/
PolKitAction *
-libpolkit_action_new (void)
+polkit_action_new (void)
{
PolKitAction *action;
action = g_new0 (PolKitAction, 1);
@@ -81,7 +81,7 @@ libpolkit_action_new (void)
}
/**
- * libpolkit_action_ref:
+ * polkit_action_ref:
* @action: the action object
*
* Increase reference count.
@@ -89,7 +89,7 @@ libpolkit_action_new (void)
* Returns: the object
**/
PolKitAction *
-libpolkit_action_ref (PolKitAction *action)
+polkit_action_ref (PolKitAction *action)
{
g_return_val_if_fail (action != NULL, action);
action->refcount++;
@@ -97,7 +97,7 @@ libpolkit_action_ref (PolKitAction *action)
}
/**
- * libpolkit_action_unref:
+ * polkit_action_unref:
* @action: the action object
*
* Decreases the reference count of the object. If it becomes zero,
@@ -105,7 +105,7 @@ libpolkit_action_ref (PolKitAction *action)
* objects are decresed by one.
**/
void
-libpolkit_action_unref (PolKitAction *action)
+polkit_action_unref (PolKitAction *action)
{
g_return_if_fail (action != NULL);
action->refcount--;
@@ -117,7 +117,7 @@ libpolkit_action_unref (PolKitAction *action)
}
/**
- * libpolkit_action_set_action_id:
+ * polkit_action_set_action_id:
* @action: the action object
* @action_id: action identifier
*
@@ -126,7 +126,7 @@ libpolkit_action_unref (PolKitAction *action)
* Returns: #TRUE only if the value validated and was set
**/
polkit_bool_t
-libpolkit_action_set_action_id (PolKitAction *action, const char *action_id)
+polkit_action_set_action_id (PolKitAction *action, const char *action_id)
{
g_return_val_if_fail (action != NULL, FALSE);
g_return_val_if_fail (_pk_validate_identifier (action_id), FALSE);
@@ -137,7 +137,7 @@ libpolkit_action_set_action_id (PolKitAction *action, const char *action_id)
}
/**
- * libpolkit_action_get_action_id:
+ * polkit_action_get_action_id:
* @action: the action object
* @out_action_id: Returns the action identifier. The caller shall not free this string.
*
@@ -146,7 +146,7 @@ libpolkit_action_set_action_id (PolKitAction *action, const char *action_id)
* Returns: TRUE iff the value was returned.
**/
polkit_bool_t
-libpolkit_action_get_action_id (PolKitAction *action, char **out_action_id)
+polkit_action_get_action_id (PolKitAction *action, char **out_action_id)
{
g_return_val_if_fail (action != NULL, FALSE);
g_return_val_if_fail (out_action_id != NULL, FALSE);
@@ -157,20 +157,20 @@ libpolkit_action_get_action_id (PolKitAction *action, char **out_action_id)
}
/**
- * libpolkit_action_debug:
+ * polkit_action_debug:
* @action: the object
*
* Print debug details
**/
void
-libpolkit_action_debug (PolKitAction *action)
+polkit_action_debug (PolKitAction *action)
{
g_return_if_fail (action != NULL);
_pk_debug ("PolKitAction: refcount=%d id=%s", action->refcount, action->id);
}
/**
- * libpolkit_action_validate:
+ * polkit_action_validate:
* @action: the object
*
* Validate the object
@@ -178,7 +178,7 @@ libpolkit_action_debug (PolKitAction *action)
* Returns: #TRUE iff the object is valid.
**/
polkit_bool_t
-libpolkit_action_validate (PolKitAction *action)
+polkit_action_validate (PolKitAction *action)
{
g_return_val_if_fail (action != NULL, FALSE);
g_return_val_if_fail (action->id != NULL, FALSE);
diff --git a/libpolkit/libpolkit-action.h b/polkit/polkit-action.h
similarity index 60%
rename from libpolkit/libpolkit-action.h
rename to polkit/polkit-action.h
index e266c2dc3a8300f6c95c789a76d40bacaa46769c..af89f815799183d92643a3a01183e014d15d23a4 100644
--- a/libpolkit/libpolkit-action.h
+++ b/polkit/polkit-action.h
@@ -1,7 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/***************************************************************************
*
- * libpolkit-action.h : actions
+ * polkit-action.h : actions
*
* Copyright (C) 2007 David Zeuthen,
*
@@ -24,26 +24,26 @@
**************************************************************************/
#if !defined (POLKIT_COMPILATION) && !defined(_POLKIT_INSIDE_POLKIT_H)
-#error "Only can be included directly, this file may disappear or change contents."
+#error "Only can be included directly, this file may disappear or change contents."
#endif
-#ifndef LIBPOLKIT_ACTION_H
-#define LIBPOLKIT_ACTION_H
+#ifndef POLKIT_ACTION_H
+#define POLKIT_ACTION_H
-#include
+#include
struct PolKitAction;
typedef struct PolKitAction PolKitAction;
-PolKitAction *libpolkit_action_new (void);
-PolKitAction *libpolkit_action_ref (PolKitAction *action);
-void libpolkit_action_unref (PolKitAction *action);
-polkit_bool_t libpolkit_action_set_action_id (PolKitAction *action, const char *action_id);
-polkit_bool_t libpolkit_action_get_action_id (PolKitAction *action, char **out_action_id);
+PolKitAction *polkit_action_new (void);
+PolKitAction *polkit_action_ref (PolKitAction *action);
+void polkit_action_unref (PolKitAction *action);
+polkit_bool_t polkit_action_set_action_id (PolKitAction *action, const char *action_id);
+polkit_bool_t polkit_action_get_action_id (PolKitAction *action, char **out_action_id);
-void libpolkit_action_debug (PolKitAction *action);
-polkit_bool_t libpolkit_action_validate (PolKitAction *action);
+void polkit_action_debug (PolKitAction *action);
+polkit_bool_t polkit_action_validate (PolKitAction *action);
-#endif /* LIBPOLKIT_ACTION_H */
+#endif /* POLKIT_ACTION_H */
diff --git a/libpolkit/libpolkit-caller.c b/polkit/polkit-caller.c
similarity index 80%
rename from libpolkit/libpolkit-caller.c
rename to polkit/polkit-caller.c
index c9808ae7d417695044c36defc69b880f3fde3985..e096d0b15f2ccf6b2bf3414bba4891d0959ed581 100644
--- a/libpolkit/libpolkit-caller.c
+++ b/polkit/polkit-caller.c
@@ -1,7 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/***************************************************************************
*
- * libpolkit-caller.c : callers
+ * polkit-caller.c : callers
*
* Copyright (C) 2007 David Zeuthen,
*
@@ -24,7 +24,7 @@
**************************************************************************/
/**
- * SECTION:libpolkit-caller
+ * SECTION:polkit-caller
* @short_description: Callers on the system message bus.
*
* This class is used to represent a caller in another process connected to the system message bus.
@@ -44,9 +44,9 @@
#include
#include
-#include "libpolkit-debug.h"
-#include "libpolkit-caller.h"
-#include "libpolkit-utils.h"
+#include "polkit-debug.h"
+#include "polkit-caller.h"
+#include "polkit-utils.h"
/**
* PolKitCaller:
@@ -65,14 +65,14 @@ struct PolKitCaller
};
/**
- * libpolkit_caller_new:
+ * polkit_caller_new:
*
* Creates a new #PolKitCaller object.
*
* Returns: the new object
**/
PolKitCaller *
-libpolkit_caller_new (void)
+polkit_caller_new (void)
{
PolKitCaller *caller;
caller = g_new0 (PolKitCaller, 1);
@@ -81,7 +81,7 @@ libpolkit_caller_new (void)
}
/**
- * libpolkit_caller_ref:
+ * polkit_caller_ref:
* @caller: The caller object
*
* Increase reference count.
@@ -89,7 +89,7 @@ libpolkit_caller_new (void)
* Returns: the object
**/
PolKitCaller *
-libpolkit_caller_ref (PolKitCaller *caller)
+polkit_caller_ref (PolKitCaller *caller)
{
g_return_val_if_fail (caller != NULL, caller);
caller->refcount++;
@@ -98,7 +98,7 @@ libpolkit_caller_ref (PolKitCaller *caller)
/**
- * libpolkit_caller_unref:
+ * polkit_caller_unref:
* @caller: The caller object
*
* Decreases the reference count of the object. If it becomes zero,
@@ -106,7 +106,7 @@ libpolkit_caller_ref (PolKitCaller *caller)
* objects are decresed by one.
**/
void
-libpolkit_caller_unref (PolKitCaller *caller)
+polkit_caller_unref (PolKitCaller *caller)
{
g_return_if_fail (caller != NULL);
caller->refcount--;
@@ -115,12 +115,12 @@ libpolkit_caller_unref (PolKitCaller *caller)
g_free (caller->dbus_name);
g_free (caller->selinux_context);
if (caller->session != NULL)
- libpolkit_session_unref (caller->session);
+ polkit_session_unref (caller->session);
g_free (caller);
}
/**
- * libpolkit_caller_set_dbus_name:
+ * polkit_caller_set_dbus_name:
* @caller: The caller object
* @dbus_name: unique system bus connection name
*
@@ -129,7 +129,7 @@ libpolkit_caller_unref (PolKitCaller *caller)
* Returns: #TRUE only if the value validated and was set
**/
polkit_bool_t
-libpolkit_caller_set_dbus_name (PolKitCaller *caller, const char *dbus_name)
+polkit_caller_set_dbus_name (PolKitCaller *caller, const char *dbus_name)
{
g_return_val_if_fail (caller != NULL, FALSE);
g_return_val_if_fail (_pk_validate_unique_bus_name (dbus_name), FALSE);
@@ -140,7 +140,7 @@ libpolkit_caller_set_dbus_name (PolKitCaller *caller, const char *dbus_name)
}
/**
- * libpolkit_caller_set_uid:
+ * polkit_caller_set_uid:
* @caller: The caller object
* @uid: UNIX user id
*
@@ -149,7 +149,7 @@ libpolkit_caller_set_dbus_name (PolKitCaller *caller, const char *dbus_name)
* Returns: #TRUE only if the value validated and was set
**/
polkit_bool_t
-libpolkit_caller_set_uid (PolKitCaller *caller, uid_t uid)
+polkit_caller_set_uid (PolKitCaller *caller, uid_t uid)
{
g_return_val_if_fail (caller != NULL, FALSE);
caller->uid = uid;
@@ -157,7 +157,7 @@ libpolkit_caller_set_uid (PolKitCaller *caller, uid_t uid)
}
/**
- * libpolkit_caller_set_pid:
+ * polkit_caller_set_pid:
* @caller: The caller object
* @pid: UNIX process id
*
@@ -166,7 +166,7 @@ libpolkit_caller_set_uid (PolKitCaller *caller, uid_t uid)
* Returns: #TRUE only if the value validated and was set
**/
polkit_bool_t
-libpolkit_caller_set_pid (PolKitCaller *caller, pid_t pid)
+polkit_caller_set_pid (PolKitCaller *caller, pid_t pid)
{
g_return_val_if_fail (caller != NULL, FALSE);
caller->pid = pid;
@@ -174,7 +174,7 @@ libpolkit_caller_set_pid (PolKitCaller *caller, pid_t pid)
}
/**
- * libpolkit_caller_set_selinux_context:
+ * polkit_caller_set_selinux_context:
* @caller: The caller object
* @selinux_context: SELinux security context
*
@@ -183,7 +183,7 @@ libpolkit_caller_set_pid (PolKitCaller *caller, pid_t pid)
* Returns: #TRUE only if the value validated and was set
**/
polkit_bool_t
-libpolkit_caller_set_selinux_context (PolKitCaller *caller, const char *selinux_context)
+polkit_caller_set_selinux_context (PolKitCaller *caller, const char *selinux_context)
{
g_return_val_if_fail (caller != NULL, FALSE);
/* TODO: probably should have a separate validation function for SELinux contexts */
@@ -196,7 +196,7 @@ libpolkit_caller_set_selinux_context (PolKitCaller *caller, const char *selinux_
}
/**
- * libpolkit_caller_set_ck_session:
+ * polkit_caller_set_ck_session:
* @caller: The caller object
* @session: a session object
*
@@ -207,18 +207,18 @@ libpolkit_caller_set_selinux_context (PolKitCaller *caller, const char *selinux_
* Returns: #TRUE only if the value validated and was set
**/
polkit_bool_t
-libpolkit_caller_set_ck_session (PolKitCaller *caller, PolKitSession *session)
+polkit_caller_set_ck_session (PolKitCaller *caller, PolKitSession *session)
{
g_return_val_if_fail (caller != NULL, FALSE);
- g_return_val_if_fail (libpolkit_session_validate (session), FALSE);
+ g_return_val_if_fail (polkit_session_validate (session), FALSE);
if (caller->session != NULL)
- libpolkit_session_unref (caller->session);
- caller->session = session != NULL ? libpolkit_session_ref (session) : NULL;
+ polkit_session_unref (caller->session);
+ caller->session = session != NULL ? polkit_session_ref (session) : NULL;
return TRUE;
}
/**
- * libpolkit_caller_get_dbus_name:
+ * polkit_caller_get_dbus_name:
* @caller: The caller object
* @out_dbus_name: Returns the unique system bus connection name. The caller shall not free this string.
*
@@ -227,7 +227,7 @@ libpolkit_caller_set_ck_session (PolKitCaller *caller, PolKitSession *session)
* Returns: TRUE iff the value is returned
**/
polkit_bool_t
-libpolkit_caller_get_dbus_name (PolKitCaller *caller, char **out_dbus_name)
+polkit_caller_get_dbus_name (PolKitCaller *caller, char **out_dbus_name)
{
g_return_val_if_fail (caller != NULL, FALSE);
g_return_val_if_fail (out_dbus_name != NULL, FALSE);
@@ -236,7 +236,7 @@ libpolkit_caller_get_dbus_name (PolKitCaller *caller, char **out_dbus_name)
}
/**
- * libpolkit_caller_get_uid:
+ * polkit_caller_get_uid:
* @caller: The caller object
* @out_uid: Returns the UNIX user id
*
@@ -245,7 +245,7 @@ libpolkit_caller_get_dbus_name (PolKitCaller *caller, char **out_dbus_name)
* Returns: TRUE iff the value is returned
**/
polkit_bool_t
-libpolkit_caller_get_uid (PolKitCaller *caller, uid_t *out_uid)
+polkit_caller_get_uid (PolKitCaller *caller, uid_t *out_uid)
{
g_return_val_if_fail (caller != NULL, FALSE);
g_return_val_if_fail (out_uid != NULL, FALSE);
@@ -254,7 +254,7 @@ libpolkit_caller_get_uid (PolKitCaller *caller, uid_t *out_uid)
}
/**
- * libpolkit_caller_get_pid:
+ * polkit_caller_get_pid:
* @caller: The caller object
* @out_pid: Returns the UNIX process id
*
@@ -263,7 +263,7 @@ libpolkit_caller_get_uid (PolKitCaller *caller, uid_t *out_uid)
* Returns: TRUE iff the value is returned
**/
polkit_bool_t
-libpolkit_caller_get_pid (PolKitCaller *caller, pid_t *out_pid)
+polkit_caller_get_pid (PolKitCaller *caller, pid_t *out_pid)
{
g_return_val_if_fail (caller != NULL, FALSE);
g_return_val_if_fail (out_pid != NULL, FALSE);
@@ -272,7 +272,7 @@ libpolkit_caller_get_pid (PolKitCaller *caller, pid_t *out_pid)
}
/**
- * libpolkit_caller_get_selinux_context:
+ * polkit_caller_get_selinux_context:
* @caller: The caller object
* @out_selinux_context: Returns the SELinux security context. The caller shall not free this string.
*
@@ -282,7 +282,7 @@ libpolkit_caller_get_pid (PolKitCaller *caller, pid_t *out_pid)
* Returns: TRUE iff the value is returned
**/
polkit_bool_t
-libpolkit_caller_get_selinux_context (PolKitCaller *caller, char **out_selinux_context)
+polkit_caller_get_selinux_context (PolKitCaller *caller, char **out_selinux_context)
{
g_return_val_if_fail (caller != NULL, FALSE);
g_return_val_if_fail (out_selinux_context != NULL, FALSE);
@@ -291,7 +291,7 @@ libpolkit_caller_get_selinux_context (PolKitCaller *caller, char **out_selinux_c
}
/**
- * libpolkit_caller_get_ck_session:
+ * polkit_caller_get_ck_session:
* @caller: The caller object
* @out_session: Returns the session object. Caller shall not unref it.
*
@@ -301,7 +301,7 @@ libpolkit_caller_get_selinux_context (PolKitCaller *caller, char **out_selinux_c
* Returns: TRUE iff the value is returned
**/
polkit_bool_t
-libpolkit_caller_get_ck_session (PolKitCaller *caller, PolKitSession **out_session)
+polkit_caller_get_ck_session (PolKitCaller *caller, PolKitSession **out_session)
{
g_return_val_if_fail (caller != NULL, FALSE);
g_return_val_if_fail (out_session != NULL, FALSE);
@@ -310,24 +310,24 @@ libpolkit_caller_get_ck_session (PolKitCaller *caller, PolKitSession **out_sessi
}
/**
- * libpolkit_caller_debug:
+ * polkit_caller_debug:
* @caller: the object
*
* Print debug details
**/
void
-libpolkit_caller_debug (PolKitCaller *caller)
+polkit_caller_debug (PolKitCaller *caller)
{
g_return_if_fail (caller != NULL);
_pk_debug ("PolKitCaller: refcount=%d dbus_name=%s uid=%d pid=%d selinux_context=%s",
caller->refcount, caller->dbus_name, caller->uid, caller->pid, caller->selinux_context);
if (caller->session != NULL)
- libpolkit_session_debug (caller->session);
+ polkit_session_debug (caller->session);
}
/**
- * libpolkit_caller_validate:
+ * polkit_caller_validate:
* @caller: the object
*
* Validate the object
@@ -335,7 +335,7 @@ libpolkit_caller_debug (PolKitCaller *caller)
* Returns: #TRUE iff the object is valid.
**/
polkit_bool_t
-libpolkit_caller_validate (PolKitCaller *caller)
+polkit_caller_validate (PolKitCaller *caller)
{
g_return_val_if_fail (caller != NULL, FALSE);
g_return_val_if_fail (caller->pid > 0, FALSE);
diff --git a/polkit/polkit-caller.h b/polkit/polkit-caller.h
new file mode 100644
index 0000000000000000000000000000000000000000..86643d93892b230665a3876a5372721cd7c86d84
--- /dev/null
+++ b/polkit/polkit-caller.h
@@ -0,0 +1,57 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
+/***************************************************************************
+ *
+ * polkit-caller.h : callers
+ *
+ * Copyright (C) 2007 David Zeuthen,
+ *
+ * Licensed under the Academic Free License version 2.1
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ **************************************************************************/
+
+#if !defined (POLKIT_COMPILATION) && !defined(_POLKIT_INSIDE_POLKIT_H)
+#error "Only can be included directly, this file may disappear or change contents."
+#endif
+
+#ifndef POLKIT_CALLER_H
+#define POLKIT_CALLER_H
+
+#include
+#include
+#include
+
+struct PolKitCaller;
+typedef struct PolKitCaller PolKitCaller;
+
+PolKitCaller *polkit_caller_new (void);
+PolKitCaller *polkit_caller_ref (PolKitCaller *caller);
+void polkit_caller_unref (PolKitCaller *caller);
+polkit_bool_t polkit_caller_set_dbus_name (PolKitCaller *caller, const char *dbus_name);
+polkit_bool_t polkit_caller_set_uid (PolKitCaller *caller, uid_t uid);
+polkit_bool_t polkit_caller_set_pid (PolKitCaller *caller, pid_t pid);
+polkit_bool_t polkit_caller_set_selinux_context (PolKitCaller *caller, const char *selinux_context);
+polkit_bool_t polkit_caller_set_ck_session (PolKitCaller *caller, PolKitSession *session);
+polkit_bool_t polkit_caller_get_dbus_name (PolKitCaller *caller, char **out_dbus_name);
+polkit_bool_t polkit_caller_get_uid (PolKitCaller *caller, uid_t *out_uid);
+polkit_bool_t polkit_caller_get_pid (PolKitCaller *caller, pid_t *out_pid);
+polkit_bool_t polkit_caller_get_selinux_context (PolKitCaller *caller, char **out_selinux_context);
+polkit_bool_t polkit_caller_get_ck_session (PolKitCaller *caller, PolKitSession **out_session);
+
+void polkit_caller_debug (PolKitCaller *caller);
+polkit_bool_t polkit_caller_validate (PolKitCaller *caller);
+
+#endif /* POLKIT_H */
diff --git a/libpolkit/libpolkit-context.c b/polkit/polkit-context.c
similarity index 76%
rename from libpolkit/libpolkit-context.c
rename to polkit/polkit-context.c
index de9aad8a9ef45b848d767db29bbffc46f8537a59..a1248fd7aace3edb82e7e82cfbfd09bb62f2cd43 100644
--- a/libpolkit/libpolkit-context.c
+++ b/polkit/polkit-context.c
@@ -1,7 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/***************************************************************************
*
- * libpolkit-context.c : context for PolicyKit
+ * polkit-context.c : context for PolicyKit
*
* Copyright (C) 2007 David Zeuthen,
*
@@ -37,20 +37,20 @@
#include
#include
-#include "libpolkit-debug.h"
-#include "libpolkit-context.h"
-#include "libpolkit-policy-cache.h"
-#include "libpolkit-module.h"
+#include "polkit-debug.h"
+#include "polkit-context.h"
+#include "polkit-policy-cache.h"
+#include "polkit-module.h"
/**
- * SECTION:libpolkit
+ * SECTION:polkit
* @short_description: Centralized policy management.
*
- * libpolkit is a C library for centralized policy management.
+ * polkit is a C library for centralized policy management.
**/
/**
- * SECTION:libpolkit-context
+ * SECTION:polkit-context
* @short_description: Context.
*
* This class is used to represent the interface to PolicyKit.
@@ -79,14 +79,14 @@ struct PolKitContext
};
/**
- * libpolkit_context_new:
+ * polkit_context_new:
*
* Create a new context
*
* Returns: the object
**/
PolKitContext *
-libpolkit_context_new (void)
+polkit_context_new (void)
{
PolKitContext *pk_context;
pk_context = g_new0 (PolKitContext, 1);
@@ -100,7 +100,7 @@ unload_modules (PolKitContext *pk_context)
GSList *i;
for (i = pk_context->modules; i != NULL; i = g_slist_next (i)) {
PolKitModuleInterface *module_interface = i->data;
- libpolkit_module_interface_unref (module_interface);
+ polkit_module_interface_unref (module_interface);
}
g_slist_free (pk_context->modules);
pk_context->modules = NULL;
@@ -192,7 +192,7 @@ load_modules (PolKitContext *pk_context, PolKitError **error)
g_strfreev (tokens);
continue;
}
- if (!libpolkit_module_control_from_string_representation (tokens[0], &module_control)) {
+ if (!polkit_module_control_from_string_representation (tokens[0], &module_control)) {
_pk_debug ("Unknown module_control '%s' at line %d - skipping line", tokens[0], line_number);
g_strfreev (tokens);
continue;
@@ -202,7 +202,7 @@ load_modules (PolKitContext *pk_context, PolKitError **error)
module_path = g_strdup_printf (PACKAGE_LIB_DIR "/PolicyKit/modules/%s", module_name);
_pk_debug ("MODULE: number=%d control=%d name=%s argc=%d",
mod_number, module_control, module_name, argc - 1);
- module_interface = libpolkit_module_interface_load_module (module_path,
+ module_interface = polkit_module_interface_load_module (module_path,
module_control,
argc - 1,
tokens + 1);
@@ -251,7 +251,7 @@ _policy_dir_events (PolKitContext *pk_context,
/* mark cache of policy files as stale.. (will be populated on-demand, see _get_cache()) */
if (pk_context->priv_cache != NULL) {
_pk_debug ("Something happened in %s - invalidating cache", pk_context->policy_dir);
- libpolkit_policy_cache_unref (pk_context->priv_cache);
+ polkit_policy_cache_unref (pk_context->priv_cache);
pk_context->priv_cache = NULL;
}
@@ -262,7 +262,7 @@ _policy_dir_events (PolKitContext *pk_context,
}
/**
- * libpolkit_context_init:
+ * polkit_context_init:
* @pk_context: the context object
* @error: return location for error
*
@@ -273,7 +273,7 @@ _policy_dir_events (PolKitContext *pk_context,
* Returns: #FALSE if @error was set, otherwise #TRUE
**/
polkit_bool_t
-libpolkit_context_init (PolKitContext *pk_context, PolKitError **error)
+polkit_context_init (PolKitContext *pk_context, PolKitError **error)
{
const char *dirname;
@@ -316,13 +316,13 @@ libpolkit_context_init (PolKitContext *pk_context, PolKitError **error)
return TRUE;
error:
if (pk_context != NULL)
- libpolkit_context_unref (pk_context);
+ polkit_context_unref (pk_context);
return FALSE;
}
/**
- * libpolkit_context_ref:
+ * polkit_context_ref:
* @pk_context: the context object
*
* Increase reference count.
@@ -330,7 +330,7 @@ error:
* Returns: the object
**/
PolKitContext *
-libpolkit_context_ref (PolKitContext *pk_context)
+polkit_context_ref (PolKitContext *pk_context)
{
g_return_val_if_fail (pk_context != NULL, pk_context);
pk_context->refcount++;
@@ -338,7 +338,7 @@ libpolkit_context_ref (PolKitContext *pk_context)
}
/**
- * libpolkit_context_unref:
+ * polkit_context_unref:
* @pk_context: the context object
*
* Decreases the reference count of the object. If it becomes zero,
@@ -346,7 +346,7 @@ libpolkit_context_ref (PolKitContext *pk_context)
* objects are decresed by one.
**/
void
-libpolkit_context_unref (PolKitContext *pk_context)
+polkit_context_unref (PolKitContext *pk_context)
{
g_return_if_fail (pk_context != NULL);
@@ -360,7 +360,7 @@ libpolkit_context_unref (PolKitContext *pk_context)
}
/**
- * libpolkit_context_set_config_changed:
+ * polkit_context_set_config_changed:
* @pk_context: the context object
* @cb: the callback to invoke
* @user_data: user data to pass to the callback
@@ -379,7 +379,7 @@ libpolkit_context_unref (PolKitContext *pk_context)
* timeframe.
**/
void
-libpolkit_context_set_config_changed (PolKitContext *pk_context,
+polkit_context_set_config_changed (PolKitContext *pk_context,
PolKitContextConfigChangedCB cb,
void *user_data)
{
@@ -389,7 +389,7 @@ libpolkit_context_set_config_changed (PolKitContext *pk_context,
}
/**
- * libpolkit_context_set_file_monitor:
+ * polkit_context_set_file_monitor:
* @pk_context: the context object
* @add_watch_func: the function that the PolicyKit library can invoke to start watching a file
* @remove_watch_func: the function that the PolicyKit library can invoke to stop watching a file
@@ -397,7 +397,7 @@ libpolkit_context_set_config_changed (PolKitContext *pk_context,
* Register a functions that PolicyKit can use for watching files.
**/
void
-libpolkit_context_set_file_monitor (PolKitContext *pk_context,
+polkit_context_set_file_monitor (PolKitContext *pk_context,
PolKitContextFileMonitorAddWatch add_watch_func,
PolKitContextFileMonitorRemoveWatch remove_watch_func)
{
@@ -408,7 +408,7 @@ libpolkit_context_set_file_monitor (PolKitContext *pk_con
/**
- * libpolkit_context_get_policy_cache:
+ * polkit_context_get_policy_cache:
* @pk_context: the context
*
* Get the #PolKitPolicyCache object that holds all the defined policies as well as their defaults.
@@ -416,7 +416,7 @@ libpolkit_context_set_file_monitor (PolKitContext *pk_con
* Returns: the #PolKitPolicyCache object. Caller shall not unref it.
**/
PolKitPolicyCache *
-libpolkit_context_get_policy_cache (PolKitContext *pk_context)
+polkit_context_get_policy_cache (PolKitContext *pk_context)
{
g_return_val_if_fail (pk_context != NULL, NULL);
@@ -426,13 +426,13 @@ libpolkit_context_get_policy_cache (PolKitContext *pk_context)
_pk_debug ("Populating cache from directory %s", pk_context->policy_dir);
error = NULL;
- pk_context->priv_cache = libpolkit_policy_cache_new (pk_context->policy_dir, &error);
+ pk_context->priv_cache = polkit_policy_cache_new (pk_context->policy_dir, &error);
if (pk_context->priv_cache == NULL) {
g_warning ("Error loading policy files from %s: %s",
pk_context->policy_dir, polkit_error_get_error_message (error));
polkit_error_free (error);
} else {
- libpolkit_policy_cache_debug (pk_context->priv_cache);
+ polkit_policy_cache_debug (pk_context->priv_cache);
}
}
@@ -441,7 +441,7 @@ libpolkit_context_get_policy_cache (PolKitContext *pk_context)
/**
- * libpolkit_context_get_seat_resource_association:
+ * polkit_context_get_seat_resource_association:
* @pk_context: the PolicyKit context
* @visitor: visitor function
* @user_data: user data
@@ -460,41 +460,41 @@ libpolkit_context_get_policy_cache (PolKitContext *pk_context)
* available to any local seat.
*
* Returns: A #PolKitResult - can only be one of
- * #LIBPOLKIT_RESULT_NOT_AUTHORIZED_TO_KNOW or
- * #LIBPOLKIT_RESULT_YES (if the callback was invoked)
+ * #POLKIT_RESULT_NOT_AUTHORIZED_TO_KNOW or
+ * #POLKIT_RESULT_YES (if the callback was invoked)
*/
PolKitResult
-libpolkit_context_get_seat_resource_association (PolKitContext *pk_context,
+polkit_context_get_seat_resource_association (PolKitContext *pk_context,
PolKitSeatVisitorCB visitor,
void *user_data)
{
- return LIBPOLKIT_RESULT_YES;
+ return POLKIT_RESULT_YES;
}
/**
- * libpolkit_context_is_resource_associated_with_seat:
+ * polkit_context_is_resource_associated_with_seat:
* @pk_context: the PolicyKit context
* @resource: the resource in question
* @seat: the seat
*
* Determine if a given resource is associated with a given seat. The
- * same comments noted in libpolkit_get_seat_resource_association() about the
+ * same comments noted in polkit_get_seat_resource_association() about the
* source purely being user configuration applies here as well.
*
* Returns: A #PolKitResult - can only be one of
- * #LIBPOLKIT_RESULT_NOT_AUTHORIZED_TO_KNOW,
- * #LIBPOLKIT_RESULT_YES, #LIBPOLKIT_RESULT_NO.
+ * #POLKIT_RESULT_NOT_AUTHORIZED_TO_KNOW,
+ * #POLKIT_RESULT_YES, #POLKIT_RESULT_NO.
*/
PolKitResult
-libpolkit_context_is_resource_associated_with_seat (PolKitContext *pk_context,
+polkit_context_is_resource_associated_with_seat (PolKitContext *pk_context,
PolKitResource *resource,
PolKitSeat *seat)
{
- return LIBPOLKIT_RESULT_NO;
+ return POLKIT_RESULT_NO;
}
/**
- * libpolkit_context_can_session_access_resource:
+ * polkit_context_can_session_access_resource:
* @pk_context: the PolicyKit context
* @action: the type of access to check for
* @resource: the resource in question or #NULL to test for all resources
@@ -503,11 +503,11 @@ libpolkit_context_is_resource_associated_with_seat (PolKitContext *pk_context,
* Determine if a given session can access a given resource in a given way.
*
* Returns: A #PolKitResult - can only be one of
- * #LIBPOLKIT_RESULT_NOT_AUTHORIZED_TO_KNOW,
- * #LIBPOLKIT_RESULT_YES, #LIBPOLKIT_RESULT_NO.
+ * #POLKIT_RESULT_NOT_AUTHORIZED_TO_KNOW,
+ * #POLKIT_RESULT_YES, #POLKIT_RESULT_NO.
*/
PolKitResult
-libpolkit_context_can_session_access_resource (PolKitContext *pk_context,
+polkit_context_can_session_access_resource (PolKitContext *pk_context,
PolKitAction *action,
PolKitResource *resource,
PolKitSession *session)
@@ -518,7 +518,7 @@ libpolkit_context_can_session_access_resource (PolKitContext *pk_context,
PolKitModuleControl current_control;
GSList *i;
- current_result = LIBPOLKIT_RESULT_NO;
+ current_result = POLKIT_RESULT_NO;
g_return_val_if_fail (pk_context != NULL, current_result);
/* resource may actually by NULL */
@@ -527,65 +527,65 @@ libpolkit_context_can_session_access_resource (PolKitContext *pk_context,
/* now validate the incoming objects */
- if (!libpolkit_action_validate (action))
+ if (!polkit_action_validate (action))
goto out;
if (resource == NULL)
- if (!libpolkit_resource_validate (resource))
+ if (!polkit_resource_validate (resource))
goto out;
- if (!libpolkit_session_validate (session))
+ if (!polkit_session_validate (session))
goto out;
- cache = libpolkit_context_get_policy_cache (pk_context);
+ cache = polkit_context_get_policy_cache (pk_context);
if (cache == NULL)
goto out;
- _pk_debug ("entering libpolkit_can_session_access_resource()");
- libpolkit_action_debug (action);
+ _pk_debug ("entering polkit_can_session_access_resource()");
+ polkit_action_debug (action);
if (resource != NULL)
- libpolkit_resource_debug (resource);
- libpolkit_session_debug (session);
+ polkit_resource_debug (resource);
+ polkit_session_debug (session);
- pfe = libpolkit_policy_cache_get_entry (cache, action);
+ pfe = polkit_policy_cache_get_entry (cache, action);
if (pfe == NULL) {
char *action_name;
- if (!libpolkit_action_get_action_id (action, &action_name)) {
+ if (!polkit_action_get_action_id (action, &action_name)) {
g_warning ("given action has no name");
} else {
g_warning ("no action with name '%s'", action_name);
}
- current_result = LIBPOLKIT_RESULT_UNKNOWN_ACTION;
+ current_result = POLKIT_RESULT_UNKNOWN_ACTION;
goto out;
}
- libpolkit_policy_file_entry_debug (pfe);
+ polkit_policy_file_entry_debug (pfe);
- current_result = LIBPOLKIT_RESULT_UNKNOWN_ACTION;
- current_control = LIBPOLKIT_MODULE_CONTROL_ADVISE; /* start with advise */
+ current_result = POLKIT_RESULT_UNKNOWN_ACTION;
+ current_control = POLKIT_MODULE_CONTROL_ADVISE; /* start with advise */
/* visit modules */
for (i = pk_context->modules; i != NULL; i = g_slist_next (i)) {
PolKitModuleInterface *module_interface = i->data;
PolKitModuleCanSessionAccessResource func;
- func = libpolkit_module_get_func_can_session_access_resource (module_interface);
+ func = polkit_module_get_func_can_session_access_resource (module_interface);
if (func != NULL) {
PolKitModuleControl module_control;
PolKitResult module_result;
- _pk_debug ("Asking module '%s'", libpolkit_module_get_name (module_interface));
+ _pk_debug ("Asking module '%s'", polkit_module_get_name (module_interface));
- module_control = libpolkit_module_interface_get_control (module_interface);
+ module_control = polkit_module_interface_get_control (module_interface);
- if (libpolkit_module_interface_check_builtin_confinement_for_session (
+ if (polkit_module_interface_check_builtin_confinement_for_session (
module_interface,
pk_context,
action,
resource,
session)) {
/* module is confined by built-in options */
- module_result = LIBPOLKIT_RESULT_UNKNOWN_ACTION;
+ module_result = POLKIT_RESULT_UNKNOWN_ACTION;
_pk_debug ("Module '%s' confined by built-in's",
- libpolkit_module_get_name (module_interface));
+ polkit_module_get_name (module_interface));
} else {
module_result = func (module_interface,
pk_context,
@@ -599,40 +599,40 @@ libpolkit_context_can_session_access_resource (PolKitContext *pk_context,
* will return this if it's confined to only consider certain actions
* or certain users.
*/
- if (module_result != LIBPOLKIT_RESULT_UNKNOWN_ACTION) {
+ if (module_result != POLKIT_RESULT_UNKNOWN_ACTION) {
- if (current_control == LIBPOLKIT_MODULE_CONTROL_ADVISE &&
- module_control == LIBPOLKIT_MODULE_CONTROL_ADVISE) {
+ if (current_control == POLKIT_MODULE_CONTROL_ADVISE &&
+ module_control == POLKIT_MODULE_CONTROL_ADVISE) {
/* take the less strict result */
if (current_result < module_result) {
current_result = module_result;
}
- } else if (current_control == LIBPOLKIT_MODULE_CONTROL_ADVISE &&
- module_control == LIBPOLKIT_MODULE_CONTROL_MANDATORY) {
+ } else if (current_control == POLKIT_MODULE_CONTROL_ADVISE &&
+ module_control == POLKIT_MODULE_CONTROL_MANDATORY) {
/* here we just override */
current_result = module_result;
/* we are now in mandatory mode */
- current_control = LIBPOLKIT_MODULE_CONTROL_MANDATORY;
+ current_control = POLKIT_MODULE_CONTROL_MANDATORY;
}
}
}
}
/* Never return UNKNOWN_ACTION to user */
- if (current_result == LIBPOLKIT_RESULT_UNKNOWN_ACTION)
- current_result = LIBPOLKIT_RESULT_NO;
+ if (current_result == POLKIT_RESULT_UNKNOWN_ACTION)
+ current_result = POLKIT_RESULT_NO;
out:
- _pk_debug ("... result was %s", libpolkit_result_to_string_representation (current_result));
+ _pk_debug ("... result was %s", polkit_result_to_string_representation (current_result));
return current_result;
}
/**
- * libpolkit_context_can_caller_access_resource:
+ * polkit_context_can_caller_access_resource:
* @pk_context: the PolicyKit context
* @action: the type of access to check for
* @resource: the resource in question or #NULL to test for all resources
@@ -644,7 +644,7 @@ out:
* access the resource in the given way
*/
PolKitResult
-libpolkit_context_can_caller_access_resource (PolKitContext *pk_context,
+polkit_context_can_caller_access_resource (PolKitContext *pk_context,
PolKitAction *action,
PolKitResource *resource,
PolKitCaller *caller)
@@ -655,73 +655,73 @@ libpolkit_context_can_caller_access_resource (PolKitContext *pk_context,
PolKitModuleControl current_control;
GSList *i;
- current_result = LIBPOLKIT_RESULT_NO;
+ current_result = POLKIT_RESULT_NO;
g_return_val_if_fail (pk_context != NULL, current_result);
/* resource may actually by NULL */
if (action == NULL || caller == NULL)
goto out;
- cache = libpolkit_context_get_policy_cache (pk_context);
+ cache = polkit_context_get_policy_cache (pk_context);
if (cache == NULL)
goto out;
/* now validate the incoming objects */
- if (!libpolkit_action_validate (action))
+ if (!polkit_action_validate (action))
goto out;
if (resource == NULL)
- if (!libpolkit_resource_validate (resource))
+ if (!polkit_resource_validate (resource))
goto out;
- if (!libpolkit_caller_validate (caller))
+ if (!polkit_caller_validate (caller))
goto out;
- _pk_debug ("entering libpolkit_can_caller_access_resource()");
- libpolkit_action_debug (action);
+ _pk_debug ("entering polkit_can_caller_access_resource()");
+ polkit_action_debug (action);
if (resource != NULL)
- libpolkit_resource_debug (resource);
- libpolkit_caller_debug (caller);
+ polkit_resource_debug (resource);
+ polkit_caller_debug (caller);
- pfe = libpolkit_policy_cache_get_entry (cache, action);
+ pfe = polkit_policy_cache_get_entry (cache, action);
if (pfe == NULL) {
char *action_name;
- if (!libpolkit_action_get_action_id (action, &action_name)) {
+ if (!polkit_action_get_action_id (action, &action_name)) {
g_warning ("given action has no name");
} else {
g_warning ("no action with name '%s'", action_name);
}
- current_result = LIBPOLKIT_RESULT_UNKNOWN_ACTION;
+ current_result = POLKIT_RESULT_UNKNOWN_ACTION;
goto out;
}
- libpolkit_policy_file_entry_debug (pfe);
+ polkit_policy_file_entry_debug (pfe);
- current_result = LIBPOLKIT_RESULT_UNKNOWN_ACTION;
- current_control = LIBPOLKIT_MODULE_CONTROL_ADVISE; /* start with advise */
+ current_result = POLKIT_RESULT_UNKNOWN_ACTION;
+ current_control = POLKIT_MODULE_CONTROL_ADVISE; /* start with advise */
/* visit modules */
for (i = pk_context->modules; i != NULL; i = g_slist_next (i)) {
PolKitModuleInterface *module_interface = i->data;
PolKitModuleCanCallerAccessResource func;
- func = libpolkit_module_get_func_can_caller_access_resource (module_interface);
+ func = polkit_module_get_func_can_caller_access_resource (module_interface);
if (func != NULL) {
PolKitModuleControl module_control;
PolKitResult module_result;
- _pk_debug ("Asking module '%s'", libpolkit_module_get_name (module_interface));
+ _pk_debug ("Asking module '%s'", polkit_module_get_name (module_interface));
- module_control = libpolkit_module_interface_get_control (module_interface);
+ module_control = polkit_module_interface_get_control (module_interface);
- if (libpolkit_module_interface_check_builtin_confinement_for_caller (
+ if (polkit_module_interface_check_builtin_confinement_for_caller (
module_interface,
pk_context,
action,
resource,
caller)) {
/* module is confined by built-in options */
- module_result = LIBPOLKIT_RESULT_UNKNOWN_ACTION;
+ module_result = POLKIT_RESULT_UNKNOWN_ACTION;
_pk_debug ("Module '%s' confined by built-in's",
- libpolkit_module_get_name (module_interface));
+ polkit_module_get_name (module_interface));
} else {
module_result = func (module_interface,
pk_context,
@@ -735,33 +735,33 @@ libpolkit_context_can_caller_access_resource (PolKitContext *pk_context,
* will return this if it's confined to only consider certain actions
* or certain users.
*/
- if (module_result != LIBPOLKIT_RESULT_UNKNOWN_ACTION) {
+ if (module_result != POLKIT_RESULT_UNKNOWN_ACTION) {
- if (current_control == LIBPOLKIT_MODULE_CONTROL_ADVISE &&
- module_control == LIBPOLKIT_MODULE_CONTROL_ADVISE) {
+ if (current_control == POLKIT_MODULE_CONTROL_ADVISE &&
+ module_control == POLKIT_MODULE_CONTROL_ADVISE) {
/* take the less strict result */
if (current_result < module_result) {
current_result = module_result;
}
- } else if (current_control == LIBPOLKIT_MODULE_CONTROL_ADVISE &&
- module_control == LIBPOLKIT_MODULE_CONTROL_MANDATORY) {
+ } else if (current_control == POLKIT_MODULE_CONTROL_ADVISE &&
+ module_control == POLKIT_MODULE_CONTROL_MANDATORY) {
/* here we just override */
current_result = module_result;
/* we are now in mandatory mode */
- current_control = LIBPOLKIT_MODULE_CONTROL_MANDATORY;
+ current_control = POLKIT_MODULE_CONTROL_MANDATORY;
}
}
}
}
/* Never return UNKNOWN_ACTION to user */
- if (current_result == LIBPOLKIT_RESULT_UNKNOWN_ACTION)
- current_result = LIBPOLKIT_RESULT_NO;
+ if (current_result == POLKIT_RESULT_UNKNOWN_ACTION)
+ current_result = POLKIT_RESULT_NO;
out:
- _pk_debug ("... result was %s", libpolkit_result_to_string_representation (current_result));
+ _pk_debug ("... result was %s", polkit_result_to_string_representation (current_result));
return current_result;
}
diff --git a/libpolkit/libpolkit-context.h b/polkit/polkit-context.h
similarity index 79%
rename from libpolkit/libpolkit-context.h
rename to polkit/polkit-context.h
index cf0f2c42de54fbc44b9e06f1a1d717bef1912822..5963abe52cc40cd7e3e3aa5205bafb94bc245136 100644
--- a/libpolkit/libpolkit-context.h
+++ b/polkit/polkit-context.h
@@ -1,7 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/***************************************************************************
*
- * libpolkit-context.h : PolicyKit context
+ * polkit-context.h : PolicyKit context
*
* Copyright (C) 2007 David Zeuthen,
*
@@ -24,22 +24,22 @@
**************************************************************************/
#if !defined (POLKIT_COMPILATION) && !defined(_POLKIT_INSIDE_POLKIT_H)
-#error "Only can be included directly, this file may disappear or change contents."
+#error "Only can be included directly, this file may disappear or change contents."
#endif
-#ifndef LIBPOLKIT_CONTEXT_H
-#define LIBPOLKIT_CONTEXT_H
+#ifndef POLKIT_CONTEXT_H
+#define POLKIT_CONTEXT_H
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
struct PolKitContext;
typedef struct PolKitContext PolKitContext;
@@ -133,19 +133,19 @@ typedef void (*PolKitContextFileMonitorRemoveWatch) (PolKitContext
int watch_id);
-PolKitContext *libpolkit_context_new (void);
-void libpolkit_context_set_config_changed (PolKitContext *pk_context,
+PolKitContext *polkit_context_new (void);
+void polkit_context_set_config_changed (PolKitContext *pk_context,
PolKitContextConfigChangedCB cb,
void *user_data);
-void libpolkit_context_set_file_monitor (PolKitContext *pk_context,
+void polkit_context_set_file_monitor (PolKitContext *pk_context,
PolKitContextFileMonitorAddWatch add_watch_func,
PolKitContextFileMonitorRemoveWatch remove_watch_func);
-polkit_bool_t libpolkit_context_init (PolKitContext *pk_context,
+polkit_bool_t polkit_context_init (PolKitContext *pk_context,
PolKitError **error);
-PolKitContext *libpolkit_context_ref (PolKitContext *pk_context);
-void libpolkit_context_unref (PolKitContext *pk_context);
+PolKitContext *polkit_context_ref (PolKitContext *pk_context);
+void polkit_context_unref (PolKitContext *pk_context);
-PolKitPolicyCache *libpolkit_context_get_policy_cache (PolKitContext *pk_context);
+PolKitPolicyCache *polkit_context_get_policy_cache (PolKitContext *pk_context);
/**
* PolKitSeatVisitorCB:
@@ -153,34 +153,34 @@ PolKitPolicyCache *libpolkit_context_get_policy_cache (PolKitContext *pk_context
* @resources_associated_with_seat: A NULL terminated array of resources associated with the seat
* @user_data: user data
*
- * Visitor function for libpolkit_get_seat_resource_association(). The caller should _not_ unref the passed objects.
+ * Visitor function for polkit_get_seat_resource_association(). The caller should _not_ unref the passed objects.
*/
typedef void (*PolKitSeatVisitorCB) (PolKitSeat *seat,
PolKitResource **resources_associated_with_seat,
void *user_data);
PolKitResult
-libpolkit_context_get_seat_resource_association (PolKitContext *pk_context,
+polkit_context_get_seat_resource_association (PolKitContext *pk_context,
PolKitSeatVisitorCB visitor,
void *user_data);
PolKitResult
-libpolkit_context_is_resource_associated_with_seat (PolKitContext *pk_context,
+polkit_context_is_resource_associated_with_seat (PolKitContext *pk_context,
PolKitResource *resource,
PolKitSeat *seat);
PolKitResult
-libpolkit_context_can_session_access_resource (PolKitContext *pk_context,
+polkit_context_can_session_access_resource (PolKitContext *pk_context,
PolKitAction *action,
PolKitResource *resource,
PolKitSession *session);
PolKitResult
-libpolkit_context_can_caller_access_resource (PolKitContext *pk_context,
+polkit_context_can_caller_access_resource (PolKitContext *pk_context,
PolKitAction *action,
PolKitResource *resource,
PolKitCaller *caller);
-#endif /* LIBPOLKIT_CONTEXT_H */
+#endif /* POLKIT_CONTEXT_H */
diff --git a/libpolkit/libpolkit-debug.c b/polkit/polkit-debug.c
similarity index 91%
rename from libpolkit/libpolkit-debug.c
rename to polkit/polkit-debug.c
index d81b7e75bd3d9e128410f9958fc2af7e86fb5d34..50c1491ce3d9486c94c91c70467e6430beadae0a 100644
--- a/libpolkit/libpolkit-debug.c
+++ b/polkit/polkit-debug.c
@@ -1,7 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/***************************************************************************
*
- * libpolkit.c : library for querying system-wide policy
+ * polkit.c : library for querying system-wide policy
*
* Copyright (C) 2007 David Zeuthen,
*
@@ -24,8 +24,8 @@
**************************************************************************/
/**
- * SECTION:libpolkit-debug
- * @short_description: Internal debug functions for libpolkit.
+ * SECTION:polkit-debug
+ * @short_description: Internal debug functions for polkit.
*
* These functions are used for debug purposes
**/
@@ -40,8 +40,8 @@
#include
#include
-#include "libpolkit-types.h"
-#include "libpolkit-debug.h"
+#include "polkit-types.h"
+#include "polkit-debug.h"
/**
* pk_debug:
diff --git a/libpolkit/libpolkit-debug.h b/polkit/polkit-debug.h
similarity index 89%
rename from libpolkit/libpolkit-debug.h
rename to polkit/polkit-debug.h
index d6c51f2f96a819380147b580aa4328d273de83f2..7177e7edc12079c745df49ff6ae6f95be5af35c2 100644
--- a/libpolkit/libpolkit-debug.h
+++ b/polkit/polkit-debug.h
@@ -1,7 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/***************************************************************************
*
- * libpolkit-debug.h : debug infrastructure for libpolkit
+ * polkit-debug.h : debug infrastructure for polkit
*
* Copyright (C) 2007 David Zeuthen,
*
@@ -23,11 +23,11 @@
*
**************************************************************************/
-#ifndef LIBPOLKIT_DEBUG_H
-#define LIBPOLKIT_DEBUG_H
+#ifndef POLKIT_DEBUG_H
+#define POLKIT_DEBUG_H
void _pk_debug (const char *format, ...) __attribute__((__format__ (__printf__, 1, 2)));
-#endif /* LIBPOLKIT_DEBUG_H */
+#endif /* POLKIT_DEBUG_H */
diff --git a/libpolkit/libpolkit-error.c b/polkit/polkit-error.c
similarity index 95%
rename from libpolkit/libpolkit-error.c
rename to polkit/polkit-error.c
index e6cf33b9bc5a2bf8656c01a171f6b9195af20aa7..cec8cc4aef059c0c89b0b7049e3f4a97e569457f 100644
--- a/libpolkit/libpolkit-error.c
+++ b/polkit/polkit-error.c
@@ -1,7 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/***************************************************************************
*
- * libpolkit-error.c : GError error codes from PolicyKit
+ * polkit-error.c : GError error codes from PolicyKit
*
* Copyright (C) 2007 David Zeuthen,
*
@@ -24,7 +24,7 @@
**************************************************************************/
/**
- * SECTION:libpolkit-error
+ * SECTION:polkit-error
* @short_description: Error codes from PolicyKit.
*
* Error codes from PolicyKit.
@@ -45,8 +45,8 @@
#include
-#include "libpolkit-types.h"
-#include "libpolkit-error.h"
+#include "polkit-types.h"
+#include "polkit-error.h"
/**
* PolKitError:
diff --git a/libpolkit/libpolkit-error.h b/polkit/polkit-error.h
similarity index 88%
rename from libpolkit/libpolkit-error.h
rename to polkit/polkit-error.h
index d5d5e8ebdba58b698f58550f5df00f4ffd4cefc1..ec0f19ad02a8d944bef8dcdb240d518abed152ae 100644
--- a/libpolkit/libpolkit-error.h
+++ b/polkit/polkit-error.h
@@ -1,7 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/***************************************************************************
*
- * libpolkit-error.h : error reporting from PolicyKit
+ * polkit-error.h : error reporting from PolicyKit
*
* Copyright (C) 2007 David Zeuthen,
*
@@ -24,11 +24,11 @@
**************************************************************************/
#if !defined (POLKIT_COMPILATION) && !defined(_POLKIT_INSIDE_POLKIT_H)
-#error "Only can be included directly, this file may disappear or change contents."
+#error "Only can be included directly, this file may disappear or change contents."
#endif
-#ifndef LIBPOLKIT_ERROR_H
-#define LIBPOLKIT_ERROR_H
+#ifndef POLKIT_ERROR_H
+#define POLKIT_ERROR_H
/**
* PolKitErrorCode:
@@ -51,4 +51,4 @@ const char *polkit_error_get_error_message (PolKitError *error);
void polkit_error_free (PolKitError *error);
void polkit_error_set_error (PolKitError **error, PolKitErrorCode error_code, const char *format, ...) __attribute__((__format__ (__printf__, 3, 4)));
-#endif /* LIBPOLKIT_ERROR_H */
+#endif /* POLKIT_ERROR_H */
diff --git a/libpolkit/libpolkit-module.c b/polkit/polkit-module.c
similarity index 81%
rename from libpolkit/libpolkit-module.c
rename to polkit/polkit-module.c
index 7e1440f0b851fa111264d16892eb04a9fe02ed95..aab1fc46155c251c26b2b25253b72535e4a7801a 100644
--- a/libpolkit/libpolkit-module.c
+++ b/polkit/polkit-module.c
@@ -1,7 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/***************************************************************************
*
- * libpolkit-module.c : PolicyKit loadable module interface
+ * polkit-module.c : PolicyKit loadable module interface
*
* Copyright (C) 2007 David Zeuthen,
*
@@ -24,7 +24,7 @@
**************************************************************************/
/**
- * SECTION:libpolkit-module
+ * SECTION:polkit-module
* @short_description: PolicyKit loadable module interface
*
* These functions are used by loadable PolicyKit modules.
@@ -40,8 +40,8 @@
#include
#include
-#include "libpolkit-debug.h"
-#include "libpolkit-module.h"
+#include "polkit-debug.h"
+#include "polkit-module.h"
/**
* PolKitModuleInterface:
@@ -172,7 +172,7 @@ error:
}
/**
- * libpolkit_module_interface_load_module:
+ * polkit_module_interface_load_module:
* @name: name of module, e.g. "polkit-module-default.so"
* @module_control: the module control; from the configuration file
* @argc: number arguments to pass
@@ -183,7 +183,7 @@ error:
* Returns: A #PolKitModuleInterface object on success; #NULL on failure.
**/
PolKitModuleInterface *
-libpolkit_module_interface_load_module (const char *name, PolKitModuleControl module_control, int argc, char *argv[])
+polkit_module_interface_load_module (const char *name, PolKitModuleControl module_control, int argc, char *argv[])
{
void *handle;
PolKitModuleInterface *mi;
@@ -199,15 +199,15 @@ libpolkit_module_interface_load_module (const char *name, PolKitModuleControl mo
goto error;
}
- func = dlsym (handle, "libpolkit_module_set_functions");
+ func = dlsym (handle, "polkit_module_set_functions");
if (func == NULL) {
- _pk_debug ("Cannot get symbol 'libpolkit_module_set_functions' in module '%s'", name);
+ _pk_debug ("Cannot get symbol 'polkit_module_set_functions' in module '%s'", name);
goto error;
}
_pk_debug ("func = %p", func);
- mi = libpolkit_module_interface_new ();
+ mi = polkit_module_interface_new ();
if (!func (mi)) {
_pk_debug ("Module '%s' returned FALSE when asked to set functions", name);
goto error;
@@ -239,14 +239,14 @@ libpolkit_module_interface_load_module (const char *name, PolKitModuleControl mo
return mi;
error:
if (mi != NULL)
- libpolkit_module_interface_unref (mi);
+ polkit_module_interface_unref (mi);
if (handle != NULL)
dlclose (handle);
return NULL;
}
/**
- * libpolkit_module_get_name:
+ * polkit_module_get_name:
* @module_interface: the module interface
*
* Get the name of the module
@@ -254,7 +254,7 @@ error:
* Returns: name or #NULL if an error occured
**/
const char *
-libpolkit_module_get_name (PolKitModuleInterface *module_interface)
+polkit_module_get_name (PolKitModuleInterface *module_interface)
{
g_return_val_if_fail (module_interface != NULL, NULL);
return module_interface->name;
@@ -262,14 +262,14 @@ libpolkit_module_get_name (PolKitModuleInterface *module_interface)
/**
- * libpolkit_module_interface_new:
+ * polkit_module_interface_new:
*
* Create a new #PolKitModuleInterface object.
*
* Returns: the new object
**/
PolKitModuleInterface *
-libpolkit_module_interface_new (void)
+polkit_module_interface_new (void)
{
PolKitModuleInterface *module_interface;
module_interface = g_new0 (PolKitModuleInterface, 1);
@@ -278,7 +278,7 @@ libpolkit_module_interface_new (void)
}
/**
- * libpolkit_module_interface_ref:
+ * polkit_module_interface_ref:
* @module_interface: the module_interface object
*
* Increase reference count.
@@ -286,7 +286,7 @@ libpolkit_module_interface_new (void)
* Returns: the object
**/
PolKitModuleInterface *
-libpolkit_module_interface_ref (PolKitModuleInterface *module_interface)
+polkit_module_interface_ref (PolKitModuleInterface *module_interface)
{
g_return_val_if_fail (module_interface != NULL, module_interface);
module_interface->refcount++;
@@ -294,7 +294,7 @@ libpolkit_module_interface_ref (PolKitModuleInterface *module_interface)
}
/**
- * libpolkit_module_interface_unref:
+ * polkit_module_interface_unref:
* @module_interface: the module_interface object
*
* Decreases the reference count of the object. If it becomes zero,
@@ -302,7 +302,7 @@ libpolkit_module_interface_ref (PolKitModuleInterface *module_interface)
* objects are decresed by one.
**/
void
-libpolkit_module_interface_unref (PolKitModuleInterface *module_interface)
+polkit_module_interface_unref (PolKitModuleInterface *module_interface)
{
g_return_if_fail (module_interface != NULL);
module_interface->refcount--;
@@ -325,14 +325,14 @@ libpolkit_module_interface_unref (PolKitModuleInterface *module_interface)
}
/**
- * libpolkit_module_set_func_initialize:
+ * polkit_module_set_func_initialize:
* @module_interface: the module interface
* @func: the function pointer
*
* Set the function pointer.
**/
void
-libpolkit_module_set_func_initialize (PolKitModuleInterface *module_interface,
+polkit_module_set_func_initialize (PolKitModuleInterface *module_interface,
PolKitModuleInitialize func)
{
g_return_if_fail (module_interface != NULL);
@@ -340,14 +340,14 @@ libpolkit_module_set_func_initialize (PolKitModuleInterface *module_interface,
}
/**
- * libpolkit_module_set_func_shutdown:
+ * polkit_module_set_func_shutdown:
* @module_interface: the module interface
* @func: the function pointer
*
* Set the function pointer.
**/
void
-libpolkit_module_set_func_shutdown (PolKitModuleInterface *module_interface,
+polkit_module_set_func_shutdown (PolKitModuleInterface *module_interface,
PolKitModuleShutdown func)
{
g_return_if_fail (module_interface != NULL);
@@ -355,14 +355,14 @@ libpolkit_module_set_func_shutdown (PolKitModuleInterface *module_interface,
}
/**
- * libpolkit_module_set_func_get_seat_resource_association:
+ * polkit_module_set_func_get_seat_resource_association:
* @module_interface: the module interface
* @func: the function pointer
*
* Set the function pointer.
**/
void
-libpolkit_module_set_func_get_seat_resource_association (PolKitModuleInterface *module_interface,
+polkit_module_set_func_get_seat_resource_association (PolKitModuleInterface *module_interface,
PolKitModuleGetSeatResourceAssociation func)
{
g_return_if_fail (module_interface != NULL);
@@ -370,13 +370,13 @@ libpolkit_module_set_func_get_seat_resource_association (PolKitModuleInterface
}
/**
- * libpolkit_module_set_func_is_resource_associated_with_seat:
+ * polkit_module_set_func_is_resource_associated_with_seat:
* @module_interface: the module interface
* @func: the function pointer
*
* Set the function pointer.
**/
-void libpolkit_module_set_func_is_resource_associated_with_seat (PolKitModuleInterface *module_interface,
+void polkit_module_set_func_is_resource_associated_with_seat (PolKitModuleInterface *module_interface,
PolKitModuleIsResourceAssociatedWithSeat func)
{
g_return_if_fail (module_interface != NULL);
@@ -384,13 +384,13 @@ void libpolkit_module_set_func_is_resource_associated_with_seat (PolKitModuleInt
}
/**
- * libpolkit_module_set_func_can_session_access_resource:
+ * polkit_module_set_func_can_session_access_resource:
* @module_interface: the module interface
* @func: the function pointer
*
* Set the function pointer.
**/
-void libpolkit_module_set_func_can_session_access_resource (PolKitModuleInterface *module_interface,
+void polkit_module_set_func_can_session_access_resource (PolKitModuleInterface *module_interface,
PolKitModuleCanSessionAccessResource func)
{
g_return_if_fail (module_interface != NULL);
@@ -398,13 +398,13 @@ void libpolkit_module_set_func_can_session_access_resource (PolKitModuleInterfac
}
/**
- * libpolkit_module_set_func_can_caller_access_resource:
+ * polkit_module_set_func_can_caller_access_resource:
* @module_interface: the module interface
* @func: the function pointer
*
* Set the function pointer.
**/
-void libpolkit_module_set_func_can_caller_access_resource (PolKitModuleInterface *module_interface,
+void polkit_module_set_func_can_caller_access_resource (PolKitModuleInterface *module_interface,
PolKitModuleCanCallerAccessResource func)
{
g_return_if_fail (module_interface != NULL);
@@ -412,7 +412,7 @@ void libpolkit_module_set_func_can_caller_access_resource (PolKitModuleInterface
}
/**
- * libpolkit_module_get_func_initialize:
+ * polkit_module_get_func_initialize:
* @module_interface: the module interface
*
* Get the function pointer.
@@ -420,14 +420,14 @@ void libpolkit_module_set_func_can_caller_access_resource (PolKitModuleInterface
* Returns: Function pointer or #NULL if it's unavailable or an error occured
**/
PolKitModuleInitialize
-libpolkit_module_get_func_initialize (PolKitModuleInterface *module_interface)
+polkit_module_get_func_initialize (PolKitModuleInterface *module_interface)
{
g_return_val_if_fail (module_interface != NULL, NULL);
return module_interface->func_initialize;
}
/**
- * libpolkit_module_get_func_shutdown:
+ * polkit_module_get_func_shutdown:
* @module_interface: the module interface
*
* Get the function pointer.
@@ -435,14 +435,14 @@ libpolkit_module_get_func_initialize (PolKitModuleInterface *module_interface)
* Returns: Function pointer or #NULL if it's unavailable or an error occured
**/
PolKitModuleShutdown
-libpolkit_module_get_func_shutdown (PolKitModuleInterface *module_interface)
+polkit_module_get_func_shutdown (PolKitModuleInterface *module_interface)
{
g_return_val_if_fail (module_interface != NULL, NULL);
return module_interface->func_shutdown;
}
/**
- * libpolkit_module_get_func_get_seat_resource_association:
+ * polkit_module_get_func_get_seat_resource_association:
* @module_interface: the module interface
*
* Get the function pointer.
@@ -450,14 +450,14 @@ libpolkit_module_get_func_shutdown (PolKitModuleInterface *module_interface)
* Returns: Function pointer or #NULL if it's unavailable or an error occured
**/
PolKitModuleGetSeatResourceAssociation
-libpolkit_module_get_func_get_seat_resource_association (PolKitModuleInterface *module_interface)
+polkit_module_get_func_get_seat_resource_association (PolKitModuleInterface *module_interface)
{
g_return_val_if_fail (module_interface != NULL, NULL);
return module_interface->func_get_seat_resource_association;
}
/**
- * libpolkit_module_get_func_is_resource_associated_with_seat:
+ * polkit_module_get_func_is_resource_associated_with_seat:
* @module_interface: the module interface
*
* Get the function pointer.
@@ -465,14 +465,14 @@ libpolkit_module_get_func_get_seat_resource_association (PolKitModuleInterface *
* Returns: Function pointer or #NULL if it's unavailable or an error occured
**/
PolKitModuleIsResourceAssociatedWithSeat
-libpolkit_module_get_func_is_resource_associated_with_seat (PolKitModuleInterface *module_interface)
+polkit_module_get_func_is_resource_associated_with_seat (PolKitModuleInterface *module_interface)
{
g_return_val_if_fail (module_interface != NULL, NULL);
return module_interface->func_is_resource_associated_with_seat;
}
/**
- * libpolkit_module_get_func_can_session_access_resource:
+ * polkit_module_get_func_can_session_access_resource:
* @module_interface: the module interface
*
* Get the function pointer.
@@ -480,14 +480,14 @@ libpolkit_module_get_func_is_resource_associated_with_seat (PolKitModuleInterfac
* Returns: Function pointer or #NULL if it's unavailable or an error occured
**/
PolKitModuleCanSessionAccessResource
-libpolkit_module_get_func_can_session_access_resource (PolKitModuleInterface *module_interface)
+polkit_module_get_func_can_session_access_resource (PolKitModuleInterface *module_interface)
{
g_return_val_if_fail (module_interface != NULL, NULL);
return module_interface->func_can_session_access_resource;
}
/**
- * libpolkit_module_get_func_can_caller_access_resource:
+ * polkit_module_get_func_can_caller_access_resource:
* @module_interface: the module interface
*
* Get the function pointer.
@@ -495,7 +495,7 @@ libpolkit_module_get_func_can_session_access_resource (PolKitModuleInterface *mo
* Returns: Function pointer or #NULL if it's unavailable or an error occured
**/
PolKitModuleCanCallerAccessResource
-libpolkit_module_get_func_can_caller_access_resource (PolKitModuleInterface *module_interface)
+polkit_module_get_func_can_caller_access_resource (PolKitModuleInterface *module_interface)
{
g_return_val_if_fail (module_interface != NULL, NULL);
return module_interface->func_can_caller_access_resource;
@@ -503,7 +503,7 @@ libpolkit_module_get_func_can_caller_access_resource (PolKitModuleInterface *mod
/**
- * libpolkit_module_interface_get_control:
+ * polkit_module_interface_get_control:
* @module_interface: the module interface
*
* Get the control for this module.
@@ -511,10 +511,10 @@ libpolkit_module_get_func_can_caller_access_resource (PolKitModuleInterface *mod
* Returns: A #PolKitModuleControl value.
**/
PolKitModuleControl
-libpolkit_module_interface_get_control (PolKitModuleInterface *module_interface)
+polkit_module_interface_get_control (PolKitModuleInterface *module_interface)
{
/* hmm, should we have UNKNOWN? */
- g_return_val_if_fail (module_interface != NULL, LIBPOLKIT_MODULE_CONTROL_MANDATORY);
+ g_return_val_if_fail (module_interface != NULL, POLKIT_MODULE_CONTROL_MANDATORY);
return module_interface->module_control;
}
@@ -523,13 +523,13 @@ static const struct {
const char *str;
} mapping[] =
{
- {LIBPOLKIT_MODULE_CONTROL_ADVISE, "advise"},
- {LIBPOLKIT_MODULE_CONTROL_MANDATORY, "mandatory"},
+ {POLKIT_MODULE_CONTROL_ADVISE, "advise"},
+ {POLKIT_MODULE_CONTROL_MANDATORY, "mandatory"},
{0, NULL}
};
/**
- * libpolkit_module_control_to_string_representation:
+ * polkit_module_control_to_string_representation:
* @module_control: the given value
*
* Gives a textual representation of a #PolKitModuleControl object.
@@ -537,9 +537,9 @@ static const struct {
* Returns: The textual representation or #NULL if the value passed is invalid
**/
const char *
-libpolkit_module_control_to_string_representation (PolKitModuleControl module_control)
+polkit_module_control_to_string_representation (PolKitModuleControl module_control)
{
- if (module_control < 0 || module_control >= LIBPOLKIT_MODULE_CONTROL_N_CONTROLS) {
+ if (module_control < 0 || module_control >= POLKIT_MODULE_CONTROL_N_CONTROLS) {
g_warning ("The passed module control identifier, %d, is not valid", module_control);
return NULL;
}
@@ -548,7 +548,7 @@ libpolkit_module_control_to_string_representation (PolKitModuleControl module_co
}
/**
- * libpolkit_module_control_from_string_representation:
+ * polkit_module_control_from_string_representation:
* @string: the textual representation
* @out_module_control: return location for the value
*
@@ -557,13 +557,13 @@ libpolkit_module_control_to_string_representation (PolKitModuleControl module_co
* Returns: TRUE if the textual representation was valid, otherwise FALSE
**/
polkit_bool_t
-libpolkit_module_control_from_string_representation (const char *string, PolKitModuleControl *out_module_control)
+polkit_module_control_from_string_representation (const char *string, PolKitModuleControl *out_module_control)
{
int n;
g_return_val_if_fail (out_module_control != NULL, FALSE);
- for (n = 0; n < LIBPOLKIT_MODULE_CONTROL_N_CONTROLS; n++) {
+ for (n = 0; n < POLKIT_MODULE_CONTROL_N_CONTROLS; n++) {
if (mapping[n].str == NULL)
break;
if (g_ascii_strcasecmp (mapping[n].str, string) == 0) {
@@ -579,7 +579,7 @@ found:
/**
- * libpolkit_module_set_user_data:
+ * polkit_module_set_user_data:
* @module_interface: module interface
* @user_data: user data to set
*
@@ -588,22 +588,22 @@ found:
* instantiated at the same time.
**/
void
-libpolkit_module_set_user_data (PolKitModuleInterface *module_interface, void *user_data)
+polkit_module_set_user_data (PolKitModuleInterface *module_interface, void *user_data)
{
g_return_if_fail (module_interface != NULL);
module_interface->module_user_data = user_data;
}
/**
- * libpolkit_module_get_user_data:
+ * polkit_module_get_user_data:
* @module_interface: module interface
*
* Get user data.
*
- * Returns: The user data set with libpolkit_module_set_user_data()
+ * Returns: The user data set with polkit_module_set_user_data()
**/
void *
-libpolkit_module_get_user_data (PolKitModuleInterface *module_interface)
+polkit_module_get_user_data (PolKitModuleInterface *module_interface)
{
g_return_val_if_fail (module_interface != NULL, NULL);
return module_interface->module_user_data;
@@ -618,7 +618,7 @@ _check_action (PolKitModuleInterface *module_interface, PolKitAction *action)
if (module_interface->builtin_have_action_regex) {
char *action_name;
- if (libpolkit_action_get_action_id (action, &action_name)) {
+ if (polkit_action_get_action_id (action, &action_name)) {
if (regexec (&module_interface->builtin_action_regex_compiled,
action_name, 0, NULL, 0) == 0) {
ret = TRUE;
@@ -655,7 +655,7 @@ _check_users_for_session (PolKitModuleInterface *module_interface, PolKitSession
return TRUE;
if (session == NULL)
return FALSE;
- if (!libpolkit_session_get_uid (session, &uid))
+ if (!polkit_session_get_uid (session, &uid))
return FALSE;
return _check_uid_in_list (list, uid);
}
@@ -669,14 +669,14 @@ _check_users_for_caller (PolKitModuleInterface *module_interface, PolKitCaller *
return TRUE;
if (caller == NULL)
return FALSE;
- if (!libpolkit_caller_get_uid (caller, &uid))
+ if (!polkit_caller_get_uid (caller, &uid))
return FALSE;
return _check_uid_in_list (list, uid);
}
/**
- * libpolkit_module_interface_check_builtin_confinement_for_session:
+ * polkit_module_interface_check_builtin_confinement_for_session:
* @module_interface: the given module
* @pk_context: the PolicyKit context
* @action: the type of access to check for
@@ -689,7 +689,7 @@ _check_users_for_caller (PolKitModuleInterface *module_interface, PolKitCaller *
* Returns: TRUE if, and only if, the module is confined from handling the request
**/
polkit_bool_t
-libpolkit_module_interface_check_builtin_confinement_for_session (PolKitModuleInterface *module_interface,
+polkit_module_interface_check_builtin_confinement_for_session (PolKitModuleInterface *module_interface,
PolKitContext *pk_context,
PolKitAction *action,
PolKitResource *resource,
@@ -712,7 +712,7 @@ out:
}
/**
- * libpolkit_module_interface_check_builtin_confinement_for_caller:
+ * polkit_module_interface_check_builtin_confinement_for_caller:
* @module_interface: the given module
* @pk_context: the PolicyKit context
* @action: the type of access to check for
@@ -725,7 +725,7 @@ out:
* Returns: TRUE if, and only if, the module is confined from handling the request
**/
polkit_bool_t
-libpolkit_module_interface_check_builtin_confinement_for_caller (PolKitModuleInterface *module_interface,
+polkit_module_interface_check_builtin_confinement_for_caller (PolKitModuleInterface *module_interface,
PolKitContext *pk_context,
PolKitAction *action,
PolKitResource *resource,
diff --git a/libpolkit/libpolkit-module.h b/polkit/polkit-module.h
similarity index 64%
rename from libpolkit/libpolkit-module.h
rename to polkit/polkit-module.h
index bb4bbc96567f753d2201a6cabcd9b05c596666e6..3e6fed7baedfbd457b8953b4499c8594cba334d5 100644
--- a/libpolkit/libpolkit-module.h
+++ b/polkit/polkit-module.h
@@ -1,7 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/***************************************************************************
*
- * libpolkit-module.h : PolicyKit loadable module interface
+ * polkit-module.h : PolicyKit loadable module interface
*
* Copyright (C) 2007 David Zeuthen,
*
@@ -24,14 +24,14 @@
**************************************************************************/
#if !defined (POLKIT_COMPILATION) && !defined(_POLKIT_INSIDE_POLKIT_H)
-#error "Only can be included directly, this file may disappear or change contents."
+#error "Only can be included directly, this file may disappear or change contents."
#endif
-#ifndef LIBPOLKIT_MODULE_H
-#define LIBPOLKIT_MODULE_H
+#ifndef POLKIT_MODULE_H
+#define POLKIT_MODULE_H
-#include
-#include
+#include
+#include
struct PolKitModuleInterface;
typedef struct PolKitModuleInterface PolKitModuleInterface;
@@ -65,7 +65,7 @@ typedef void (*PolKitModuleShutdown) (PolKitModuleInterface *module_interface);
* @visitor: visitor function
* @user_data: user data
*
- * Type of PolicyKit module function to implement libpolkit_get_seat_resource_association().
+ * Type of PolicyKit module function to implement polkit_get_seat_resource_association().
*
* Returns: the #PolKitResult
**/
@@ -81,7 +81,7 @@ typedef PolKitResult (*PolKitModuleGetSeatResourceAssociation) (PolKitModuleInte
* @resource: the resource in question
* @seat: the seat
*
- * Type of PolicyKit module function to implement libpolkit_is_resource_associated_with_seat().
+ * Type of PolicyKit module function to implement polkit_is_resource_associated_with_seat().
*
* Returns: the #PolKitResult
**/
@@ -98,7 +98,7 @@ typedef PolKitResult (*PolKitModuleIsResourceAssociatedWithSeat) (PolKitModuleIn
* @resource: the resource in question
* @session: the session in question
*
- * Type of PolicyKit module function to implement libpolkit_can_session_access_resource().
+ * Type of PolicyKit module function to implement polkit_can_session_access_resource().
*
* Returns: the #PolKitResult
**/
@@ -116,7 +116,7 @@ typedef PolKitResult (*PolKitModuleCanSessionAccessResource) (PolKitModuleInterf
* @resource: the resource in question
* @caller: the resource in question
*
- * Type of PolicyKit module function to implement libpolkit_can_caller_access_resource().
+ * Type of PolicyKit module function to implement polkit_can_caller_access_resource().
*
* Returns: the #PolKitResult
**/
@@ -126,43 +126,43 @@ typedef PolKitResult (*PolKitModuleCanCallerAccessResource) (PolKitModuleInterfa
PolKitResource *resource,
PolKitCaller *caller);
-PolKitModuleInterface *libpolkit_module_interface_new (void);
-PolKitModuleInterface *libpolkit_module_interface_ref (PolKitModuleInterface *module_interface);
-void libpolkit_module_interface_unref (PolKitModuleInterface *module_interface);
-const char *libpolkit_module_get_name (PolKitModuleInterface *module_interface);
+PolKitModuleInterface *polkit_module_interface_new (void);
+PolKitModuleInterface *polkit_module_interface_ref (PolKitModuleInterface *module_interface);
+void polkit_module_interface_unref (PolKitModuleInterface *module_interface);
+const char *polkit_module_get_name (PolKitModuleInterface *module_interface);
-void libpolkit_module_set_user_data (PolKitModuleInterface *module_interface, void *user_data);
-void *libpolkit_module_get_user_data (PolKitModuleInterface *module_interface);
+void polkit_module_set_user_data (PolKitModuleInterface *module_interface, void *user_data);
+void *polkit_module_get_user_data (PolKitModuleInterface *module_interface);
-void libpolkit_module_set_func_initialize (PolKitModuleInterface *module_interface,
+void polkit_module_set_func_initialize (PolKitModuleInterface *module_interface,
PolKitModuleInitialize func);
-void libpolkit_module_set_func_shutdown (PolKitModuleInterface *module_interface,
+void polkit_module_set_func_shutdown (PolKitModuleInterface *module_interface,
PolKitModuleShutdown func);
-void libpolkit_module_set_func_get_seat_resource_association (PolKitModuleInterface *module_interface,
+void polkit_module_set_func_get_seat_resource_association (PolKitModuleInterface *module_interface,
PolKitModuleGetSeatResourceAssociation func);
-void libpolkit_module_set_func_is_resource_associated_with_seat (PolKitModuleInterface *module_interface,
+void polkit_module_set_func_is_resource_associated_with_seat (PolKitModuleInterface *module_interface,
PolKitModuleIsResourceAssociatedWithSeat func);
-void libpolkit_module_set_func_can_session_access_resource (PolKitModuleInterface *module_interface,
+void polkit_module_set_func_can_session_access_resource (PolKitModuleInterface *module_interface,
PolKitModuleCanSessionAccessResource func);
-void libpolkit_module_set_func_can_caller_access_resource (PolKitModuleInterface *module_interface,
+void polkit_module_set_func_can_caller_access_resource (PolKitModuleInterface *module_interface,
PolKitModuleCanCallerAccessResource func);
-PolKitModuleInitialize libpolkit_module_get_func_initialize (PolKitModuleInterface *module_interface);
-PolKitModuleShutdown libpolkit_module_get_func_shutdown (PolKitModuleInterface *module_interface);
-PolKitModuleGetSeatResourceAssociation libpolkit_module_get_func_get_seat_resource_association (PolKitModuleInterface *module_interface);
-PolKitModuleIsResourceAssociatedWithSeat libpolkit_module_get_func_is_resource_associated_with_seat (PolKitModuleInterface *module_interface);
-PolKitModuleCanSessionAccessResource libpolkit_module_get_func_can_session_access_resource (PolKitModuleInterface *module_interface);
-PolKitModuleCanCallerAccessResource libpolkit_module_get_func_can_caller_access_resource (PolKitModuleInterface *module_interface);
+PolKitModuleInitialize polkit_module_get_func_initialize (PolKitModuleInterface *module_interface);
+PolKitModuleShutdown polkit_module_get_func_shutdown (PolKitModuleInterface *module_interface);
+PolKitModuleGetSeatResourceAssociation polkit_module_get_func_get_seat_resource_association (PolKitModuleInterface *module_interface);
+PolKitModuleIsResourceAssociatedWithSeat polkit_module_get_func_is_resource_associated_with_seat (PolKitModuleInterface *module_interface);
+PolKitModuleCanSessionAccessResource polkit_module_get_func_can_session_access_resource (PolKitModuleInterface *module_interface);
+PolKitModuleCanCallerAccessResource polkit_module_get_func_can_caller_access_resource (PolKitModuleInterface *module_interface);
/**
* PolKitModuleControl:
- * @LIBPOLKIT_MODULE_CONTROL_ADVISE: Allow modules, marked with #LIBPOLKIT_MODULE_CONTROL_MANDATORY, down the
+ * @POLKIT_MODULE_CONTROL_ADVISE: Allow modules, marked with #POLKIT_MODULE_CONTROL_MANDATORY, down the
* stack to override results from this module. Modules down the stack that are also marked with
- * the #LIBPOLKIT_MODULE_CONTROL_ADVISE control will only take effect it they change the result to be "less strict".
- * @LIBPOLKIT_MODULE_CONTROL_MANDATORY: Always use results (unless it returns
- * #LIBPOLKIT_RESULT_UNKNOWN_ACTION for a given request) from this module, even if it changes whether the
+ * the #POLKIT_MODULE_CONTROL_ADVISE control will only take effect it they change the result to be "less strict".
+ * @POLKIT_MODULE_CONTROL_MANDATORY: Always use results (unless it returns
+ * #POLKIT_RESULT_UNKNOWN_ACTION for a given request) from this module, even if it changes whether the
* result to be "more strict". . If a later module also uses this control, results from that module will override it.
- * @LIBPOLKIT_MODULE_CONTROL_N_CONTROLS: Number of control stanzas
+ * @POLKIT_MODULE_CONTROL_N_CONTROLS: Number of control stanzas
*
* The control stanza for a PolicyKit module. This is read from the
* PolicyKit configuration file (/etc/PolicyKit/PolicyKit.conf) that
@@ -172,36 +172,36 @@ PolKitModuleCanCallerAccessResource libpolkit_module_get_func_can_caller_access_
**/
typedef enum
{
- LIBPOLKIT_MODULE_CONTROL_ADVISE,
- LIBPOLKIT_MODULE_CONTROL_MANDATORY,
- LIBPOLKIT_MODULE_CONTROL_N_CONTROLS
+ POLKIT_MODULE_CONTROL_ADVISE,
+ POLKIT_MODULE_CONTROL_MANDATORY,
+ POLKIT_MODULE_CONTROL_N_CONTROLS
} PolKitModuleControl;
const char *
-libpolkit_module_control_to_string_representation (PolKitModuleControl module_control);
+polkit_module_control_to_string_representation (PolKitModuleControl module_control);
polkit_bool_t
-libpolkit_module_control_from_string_representation (const char *string, PolKitModuleControl *out_module_control);
+polkit_module_control_from_string_representation (const char *string, PolKitModuleControl *out_module_control);
-PolKitModuleInterface *libpolkit_module_interface_load_module (const char *name,
+PolKitModuleInterface *polkit_module_interface_load_module (const char *name,
PolKitModuleControl module_control,
int argc, char *argv[]);
-PolKitModuleControl libpolkit_module_interface_get_control (PolKitModuleInterface *module_interface);
+PolKitModuleControl polkit_module_interface_get_control (PolKitModuleInterface *module_interface);
polkit_bool_t
-libpolkit_module_interface_check_builtin_confinement_for_session (PolKitModuleInterface *module_interface,
+polkit_module_interface_check_builtin_confinement_for_session (PolKitModuleInterface *module_interface,
PolKitContext *pk_context,
PolKitAction *action,
PolKitResource *resource,
PolKitSession *session);
polkit_bool_t
-libpolkit_module_interface_check_builtin_confinement_for_caller (PolKitModuleInterface *module_interface,
+polkit_module_interface_check_builtin_confinement_for_caller (PolKitModuleInterface *module_interface,
PolKitContext *pk_context,
PolKitAction *action,
PolKitResource *resource,
PolKitCaller *caller);
-#endif /* LIBPOLKIT_MODULE_H */
+#endif /* POLKIT_MODULE_H */
diff --git a/libpolkit/libpolkit-policy-cache.c b/polkit/polkit-policy-cache.c
similarity index 83%
rename from libpolkit/libpolkit-policy-cache.c
rename to polkit/polkit-policy-cache.c
index f5549d0972cb8daabcfa7d8208ddba4fd26d046d..dc9a93a14034ed0f558af02d16b1f9659f9dff83 100644
--- a/libpolkit/libpolkit-policy-cache.c
+++ b/polkit/polkit-policy-cache.c
@@ -1,7 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/***************************************************************************
*
- * libpolkit-policy-cache.c : policy cache
+ * polkit-policy-cache.c : policy cache
*
* Copyright (C) 2007 David Zeuthen,
*
@@ -37,12 +37,12 @@
#include
#include
-#include "libpolkit-debug.h"
-#include "libpolkit-policy-file.h"
-#include "libpolkit-policy-cache.h"
+#include "polkit-debug.h"
+#include "polkit-policy-file.h"
+#include "polkit-policy-cache.h"
/**
- * SECTION:libpolkit-policy-cache
+ * SECTION:polkit-policy-cache
* @short_description: Class for holding all policy objects.
*
* This class is used to hold all policy objects (stemming from policy
@@ -70,12 +70,12 @@ _append_entry (PolKitPolicyFile *policy_file,
{
PolKitPolicyCache *policy_cache = user_data;
- libpolkit_policy_file_entry_ref (policy_file_entry);
+ polkit_policy_file_entry_ref (policy_file_entry);
policy_cache->priv_entries = g_slist_append (policy_cache->priv_entries, policy_file_entry);
}
/**
- * libpolkit_policy_cache_new:
+ * polkit_policy_cache_new:
* @dirname: directory containing policy files
* @error: location to return error
*
@@ -84,7 +84,7 @@ _append_entry (PolKitPolicyFile *policy_file,
* Returns: #NULL if @error was set, otherwise the #PolKitPolicyCache object
**/
PolKitPolicyCache *
-libpolkit_policy_cache_new (const char *dirname, PolKitError **error)
+polkit_policy_cache_new (const char *dirname, PolKitError **error)
{
const char *file;
GDir *dir;
@@ -117,7 +117,7 @@ libpolkit_policy_cache_new (const char *dirname, PolKitError **error)
path = g_strdup_printf ("%s/%s", dirname, file);
_pk_debug ("Loading %s", path);
- pf = libpolkit_policy_file_new (path, error);
+ pf = polkit_policy_file_new (path, error);
g_free (path);
if (pf == NULL) {
@@ -125,20 +125,20 @@ libpolkit_policy_cache_new (const char *dirname, PolKitError **error)
}
/* steal entries */
- libpolkit_policy_file_entry_foreach (pf, _append_entry, pc);
- libpolkit_policy_file_unref (pf);
+ polkit_policy_file_entry_foreach (pf, _append_entry, pc);
+ polkit_policy_file_unref (pf);
}
g_dir_close (dir);
return pc;
out:
if (pc != NULL)
- libpolkit_policy_cache_ref (pc);
+ polkit_policy_cache_ref (pc);
return NULL;
}
/**
- * libpolkit_policy_cache_ref:
+ * polkit_policy_cache_ref:
* @policy_cache: the policy cache object
*
* Increase reference count.
@@ -146,7 +146,7 @@ out:
* Returns: the object
**/
PolKitPolicyCache *
-libpolkit_policy_cache_ref (PolKitPolicyCache *policy_cache)
+polkit_policy_cache_ref (PolKitPolicyCache *policy_cache)
{
g_return_val_if_fail (policy_cache != NULL, policy_cache);
policy_cache->refcount++;
@@ -154,7 +154,7 @@ libpolkit_policy_cache_ref (PolKitPolicyCache *policy_cache)
}
/**
- * libpolkit_policy_cache_unref:
+ * polkit_policy_cache_unref:
* @policy_cache: the policy cache object
*
* Decreases the reference count of the object. If it becomes zero,
@@ -162,7 +162,7 @@ libpolkit_policy_cache_ref (PolKitPolicyCache *policy_cache)
* objects are decresed by one.
**/
void
-libpolkit_policy_cache_unref (PolKitPolicyCache *policy_cache)
+polkit_policy_cache_unref (PolKitPolicyCache *policy_cache)
{
GSList *i;
@@ -173,7 +173,7 @@ libpolkit_policy_cache_unref (PolKitPolicyCache *policy_cache)
for (i = policy_cache->priv_entries; i != NULL; i = g_slist_next (i)) {
PolKitPolicyFileEntry *pfe = i->data;
- libpolkit_policy_file_entry_unref (pfe);
+ polkit_policy_file_entry_unref (pfe);
}
if (policy_cache->priv_entries != NULL)
g_slist_free (policy_cache->priv_entries);
@@ -182,13 +182,13 @@ libpolkit_policy_cache_unref (PolKitPolicyCache *policy_cache)
}
/**
- * libpolkit_policy_cache_debug:
+ * polkit_policy_cache_debug:
* @policy_cache: the cache
*
* Print debug information about object
**/
void
-libpolkit_policy_cache_debug (PolKitPolicyCache *policy_cache)
+polkit_policy_cache_debug (PolKitPolicyCache *policy_cache)
{
GSList *i;
g_return_if_fail (policy_cache != NULL);
@@ -199,12 +199,12 @@ libpolkit_policy_cache_debug (PolKitPolicyCache *policy_cache)
for (i = policy_cache->priv_entries; i != NULL; i = g_slist_next (i)) {
PolKitPolicyFileEntry *pfe = i->data;
- libpolkit_policy_file_entry_debug (pfe);
+ polkit_policy_file_entry_debug (pfe);
}
}
/**
- * libpolkit_policy_cache_get_entry:
+ * polkit_policy_cache_get_entry:
* @policy_cache: the cache
* @action: the action
*
@@ -217,7 +217,7 @@ libpolkit_policy_cache_debug (PolKitPolicyCache *policy_cache)
* this object.
**/
PolKitPolicyFileEntry*
-libpolkit_policy_cache_get_entry (PolKitPolicyCache *policy_cache,
+polkit_policy_cache_get_entry (PolKitPolicyCache *policy_cache,
PolKitAction *action)
{
char *priv_id;
@@ -231,12 +231,12 @@ libpolkit_policy_cache_get_entry (PolKitPolicyCache *policy_cache,
g_return_val_if_fail (policy_cache != NULL, NULL);
g_return_val_if_fail (action != NULL, NULL);
- if (!libpolkit_action_get_action_id (action, &priv_id))
+ if (!polkit_action_get_action_id (action, &priv_id))
goto out;
for (i = policy_cache->priv_entries; i != NULL; i = g_slist_next (i)) {
pfe = i->data;
- if (strcmp (libpolkit_policy_file_entry_get_id (pfe), priv_id) == 0) {
+ if (strcmp (polkit_policy_file_entry_get_id (pfe), priv_id) == 0) {
goto out;
}
}
diff --git a/libpolkit/libpolkit-policy-cache.h b/polkit/polkit-policy-cache.h
similarity index 60%
rename from libpolkit/libpolkit-policy-cache.h
rename to polkit/polkit-policy-cache.h
index 12cf00ef72ecd41137cc1169008ff96843ddd852..7ed7e4d4b0c2c9c5cc669964b1be9fcdadffa352 100644
--- a/libpolkit/libpolkit-policy-cache.h
+++ b/polkit/polkit-policy-cache.h
@@ -1,7 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/***************************************************************************
*
- * libpolkit-policy-cache.h : policy cache
+ * polkit-policy-cache.h : policy cache
*
* Copyright (C) 2007 David Zeuthen,
*
@@ -24,27 +24,27 @@
**************************************************************************/
#if !defined (POLKIT_COMPILATION) && !defined(_POLKIT_INSIDE_POLKIT_H)
-#error "Only can be included directly, this file may disappear or change contents."
+#error "Only can be included directly, this file may disappear or change contents."
#endif
-#ifndef LIBPOLKIT_POLICY_CACHE_H
-#define LIBPOLKIT_POLICY_CACHE_H
+#ifndef POLKIT_POLICY_CACHE_H
+#define POLKIT_POLICY_CACHE_H
-#include
-#include
-#include
+#include
+#include
+#include
struct PolKitPolicyCache;
typedef struct PolKitPolicyCache PolKitPolicyCache;
-PolKitPolicyCache *libpolkit_policy_cache_new (const char *dirname, PolKitError **error);
-PolKitPolicyCache *libpolkit_policy_cache_ref (PolKitPolicyCache *policy_cache);
-void libpolkit_policy_cache_unref (PolKitPolicyCache *policy_cache);
-void libpolkit_policy_cache_debug (PolKitPolicyCache *policy_cache);
+PolKitPolicyCache *polkit_policy_cache_new (const char *dirname, PolKitError **error);
+PolKitPolicyCache *polkit_policy_cache_ref (PolKitPolicyCache *policy_cache);
+void polkit_policy_cache_unref (PolKitPolicyCache *policy_cache);
+void polkit_policy_cache_debug (PolKitPolicyCache *policy_cache);
-PolKitPolicyFileEntry* libpolkit_policy_cache_get_entry (PolKitPolicyCache *policy_cache,
+PolKitPolicyFileEntry* polkit_policy_cache_get_entry (PolKitPolicyCache *policy_cache,
PolKitAction *action);
-#endif /* LIBPOLKIT_POLICY_CACHE_H */
+#endif /* POLKIT_POLICY_CACHE_H */
diff --git a/libpolkit/libpolkit-policy-default.c b/polkit/polkit-policy-default.c
similarity index 79%
rename from libpolkit/libpolkit-policy-default.c
rename to polkit/polkit-policy-default.c
index 1cba253447dbbaeb2af7380b1d4fa3f9e2f05206..8ab2110175fd461f395757ba31dcb9561c0d9721 100644
--- a/libpolkit/libpolkit-policy-default.c
+++ b/polkit/polkit-policy-default.c
@@ -1,7 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/***************************************************************************
*
- * libpolkit-policy-default.c : policy definition for the defaults
+ * polkit-policy-default.c : policy definition for the defaults
*
* Copyright (C) 2007 David Zeuthen,
*
@@ -37,12 +37,12 @@
#include
#include
-#include "libpolkit-debug.h"
-#include "libpolkit-error.h"
-#include "libpolkit-policy-default.h"
+#include "polkit-debug.h"
+#include "polkit-error.h"
+#include "polkit-policy-default.h"
/**
- * SECTION:libpolkit-policy-default
+ * SECTION:polkit-policy-default
* @short_description: Defaults policy.
*
* This class records the default policy of an action.
@@ -68,21 +68,21 @@ parse_default (const char *key, char *s, const char *group, PolKitResult* target
{
gboolean ret;
- ret = libpolkit_result_from_string_representation (s, target);
+ ret = polkit_result_from_string_representation (s, target);
if (!ret) {
int n;
char *s2;
GString *str;
str = g_string_new (NULL);
- for (n = 0; n < LIBPOLKIT_RESULT_N_RESULTS; n++) {
- if (n == LIBPOLKIT_RESULT_NOT_AUTHORIZED_TO_KNOW)
+ for (n = 0; n < POLKIT_RESULT_N_RESULTS; n++) {
+ if (n == POLKIT_RESULT_NOT_AUTHORIZED_TO_KNOW)
continue;
if (str->len > 0) {
g_string_append (str, ", ");
}
- g_string_append (str, libpolkit_result_to_string_representation (n));
+ g_string_append (str, polkit_result_to_string_representation (n));
}
s2 = g_string_free (str, FALSE);
@@ -101,10 +101,10 @@ parse_default (const char *key, char *s, const char *group, PolKitResult* target
return ret;
}
-extern PolKitPolicyDefault *_libpolkit_policy_default_new (GKeyFile *key_file, const char *action, PolKitError **error);
+extern PolKitPolicyDefault *_polkit_policy_default_new (GKeyFile *key_file, const char *action, PolKitError **error);
PolKitPolicyDefault *
-_libpolkit_policy_default_new (GKeyFile *key_file, const char *action, PolKitError **error)
+_polkit_policy_default_new (GKeyFile *key_file, const char *action, PolKitError **error)
{
const char *key;
const char *group;
@@ -151,12 +151,12 @@ error:
}
if (pd != NULL)
- libpolkit_policy_default_ref (pd);
+ polkit_policy_default_ref (pd);
return NULL;
}
/**
- * libpolkit_policy_default_ref:
+ * polkit_policy_default_ref:
* @policy_default: the policy object
*
* Increase reference count.
@@ -164,7 +164,7 @@ error:
* Returns: the object
**/
PolKitPolicyDefault *
-libpolkit_policy_default_ref (PolKitPolicyDefault *policy_default)
+polkit_policy_default_ref (PolKitPolicyDefault *policy_default)
{
g_return_val_if_fail (policy_default != NULL, policy_default);
policy_default->refcount++;
@@ -172,7 +172,7 @@ libpolkit_policy_default_ref (PolKitPolicyDefault *policy_default)
}
/**
- * libpolkit_policy_default_unref:
+ * polkit_policy_default_unref:
* @policy_default: the object
*
* Decreases the reference count of the object. If it becomes zero,
@@ -180,7 +180,7 @@ libpolkit_policy_default_ref (PolKitPolicyDefault *policy_default)
* objects are decresed by one.
**/
void
-libpolkit_policy_default_unref (PolKitPolicyDefault *policy_default)
+polkit_policy_default_unref (PolKitPolicyDefault *policy_default)
{
g_return_if_fail (policy_default != NULL);
policy_default->refcount--;
@@ -190,13 +190,13 @@ libpolkit_policy_default_unref (PolKitPolicyDefault *policy_default)
}
/**
- * libpolkit_policy_default_debug:
+ * polkit_policy_default_debug:
* @policy_default: the object
*
* Print debug details
**/
void
-libpolkit_policy_default_debug (PolKitPolicyDefault *policy_default)
+polkit_policy_default_debug (PolKitPolicyDefault *policy_default)
{
g_return_if_fail (policy_default != NULL);
_pk_debug ("PolKitPolicyDefault: refcount=%d\n"
@@ -205,15 +205,15 @@ libpolkit_policy_default_debug (PolKitPolicyDefault *policy_default)
" default_local_inactive=%s\n"
" default_local_active=%s",
policy_default->refcount,
- libpolkit_result_to_string_representation (policy_default->default_remote_inactive),
- libpolkit_result_to_string_representation (policy_default->default_remote_active),
- libpolkit_result_to_string_representation (policy_default->default_local_inactive),
- libpolkit_result_to_string_representation (policy_default->default_local_active));
+ polkit_result_to_string_representation (policy_default->default_remote_inactive),
+ polkit_result_to_string_representation (policy_default->default_remote_active),
+ polkit_result_to_string_representation (policy_default->default_local_inactive),
+ polkit_result_to_string_representation (policy_default->default_local_active));
}
/**
- * libpolkit_policy_default_can_session_access_resource:
+ * polkit_policy_default_can_session_access_resource:
* @policy_default: the object
* @action: the type of access to check for
* @resource: the resource in question
@@ -223,11 +223,11 @@ libpolkit_policy_default_debug (PolKitPolicyDefault *policy_default)
* session can access a given resource in a given way.
*
* Returns: A #PolKitResult - can only be one of
- * #LIBPOLKIT_RESULT_NOT_AUTHORIZED_TO_KNOW,
- * #LIBPOLKIT_RESULT_YES, #LIBPOLKIT_RESULT_NO.
+ * #POLKIT_RESULT_NOT_AUTHORIZED_TO_KNOW,
+ * #POLKIT_RESULT_YES, #POLKIT_RESULT_NO.
**/
PolKitResult
-libpolkit_policy_default_can_session_access_resource (PolKitPolicyDefault *policy_default,
+polkit_policy_default_can_session_access_resource (PolKitPolicyDefault *policy_default,
PolKitAction *action,
PolKitResource *resource,
PolKitSession *session)
@@ -236,15 +236,15 @@ libpolkit_policy_default_can_session_access_resource (PolKitPolicyDefault *polic
polkit_bool_t is_active;
PolKitResult ret;
- ret = LIBPOLKIT_RESULT_NO;
+ ret = POLKIT_RESULT_NO;
g_return_val_if_fail (policy_default != NULL, ret);
g_return_val_if_fail (action != NULL, ret);
g_return_val_if_fail (session != NULL, ret);
- if (!libpolkit_session_get_ck_is_local (session, &is_local))
+ if (!polkit_session_get_ck_is_local (session, &is_local))
goto out;
- if (!libpolkit_session_get_ck_is_active (session, &is_active))
+ if (!polkit_session_get_ck_is_active (session, &is_active))
goto out;
if (is_local) {
@@ -265,7 +265,7 @@ out:
}
/**
- * libpolkit_policy_default_can_caller_access_resource:
+ * polkit_policy_default_can_caller_access_resource:
* @policy_default: the object
* @action: the type of access to check for
* @resource: the resource in question
@@ -278,7 +278,7 @@ out:
* access the resource in the given way
**/
PolKitResult
-libpolkit_policy_default_can_caller_access_resource (PolKitPolicyDefault *policy_default,
+polkit_policy_default_can_caller_access_resource (PolKitPolicyDefault *policy_default,
PolKitAction *action,
PolKitResource *resource,
PolKitCaller *caller)
@@ -288,20 +288,20 @@ libpolkit_policy_default_can_caller_access_resource (PolKitPolicyDefault *policy
PolKitSession *session;
PolKitResult ret;
- ret = LIBPOLKIT_RESULT_NO;
+ ret = POLKIT_RESULT_NO;
g_return_val_if_fail (policy_default != NULL, ret);
g_return_val_if_fail (action != NULL, ret);
g_return_val_if_fail (caller != NULL, ret);
- if (!libpolkit_caller_get_ck_session (caller, &session))
+ if (!polkit_caller_get_ck_session (caller, &session))
goto out;
if (session == NULL)
goto out;
- if (!libpolkit_session_get_ck_is_local (session, &is_local))
+ if (!polkit_session_get_ck_is_local (session, &is_local))
goto out;
- if (!libpolkit_session_get_ck_is_active (session, &is_active))
+ if (!polkit_session_get_ck_is_active (session, &is_active))
goto out;
if (is_local) {
diff --git a/libpolkit/libpolkit-policy-default.h b/polkit/polkit-policy-default.h
similarity index 64%
rename from libpolkit/libpolkit-policy-default.h
rename to polkit/polkit-policy-default.h
index 19cce21d5e1db15b3202772c9fb365728535f8dc..2dda732ff0c05aef141473b3cf199a3722eaa586 100644
--- a/libpolkit/libpolkit-policy-default.h
+++ b/polkit/polkit-policy-default.h
@@ -1,7 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/***************************************************************************
*
- * libpolkit-policy-default.h : policy definition for the defaults
+ * polkit-policy-default.h : policy definition for the defaults
*
* Copyright (C) 2007 David Zeuthen,
*
@@ -24,37 +24,37 @@
**************************************************************************/
#if !defined (POLKIT_COMPILATION) && !defined(_POLKIT_INSIDE_POLKIT_H)
-#error "Only can be included directly, this file may disappear or change contents."
+#error "Only can be included directly, this file may disappear or change contents."
#endif
-#ifndef LIBPOLKIT_POLICY_DEFAULT_H
-#define LIBPOLKIT_POLICY_DEFAULT_H
+#ifndef POLKIT_POLICY_DEFAULT_H
+#define POLKIT_POLICY_DEFAULT_H
-#include
-#include
-#include
-#include
-#include
-#include
+#include
+#include
+#include
+#include
+#include
+#include
struct PolKitPolicyDefault;
typedef struct PolKitPolicyDefault PolKitPolicyDefault;
-PolKitPolicyDefault *libpolkit_policy_default_ref (PolKitPolicyDefault *policy_default);
-void libpolkit_policy_default_unref (PolKitPolicyDefault *policy_default);
-void libpolkit_policy_default_debug (PolKitPolicyDefault *policy_default);
+PolKitPolicyDefault *polkit_policy_default_ref (PolKitPolicyDefault *policy_default);
+void polkit_policy_default_unref (PolKitPolicyDefault *policy_default);
+void polkit_policy_default_debug (PolKitPolicyDefault *policy_default);
-PolKitResult libpolkit_policy_default_can_session_access_resource (PolKitPolicyDefault *policy_default,
+PolKitResult polkit_policy_default_can_session_access_resource (PolKitPolicyDefault *policy_default,
PolKitAction *action,
PolKitResource *resource,
PolKitSession *session);
-PolKitResult libpolkit_policy_default_can_caller_access_resource (PolKitPolicyDefault *policy_default,
+PolKitResult polkit_policy_default_can_caller_access_resource (PolKitPolicyDefault *policy_default,
PolKitAction *action,
PolKitResource *resource,
PolKitCaller *caller);
/* TODO: export knobs for "default policy" */
-#endif /* LIBPOLKIT_POLICY_DEFAULT_H */
+#endif /* POLKIT_POLICY_DEFAULT_H */
diff --git a/libpolkit/libpolkit-policy-file-entry.c b/polkit/polkit-policy-file-entry.c
similarity index 72%
rename from libpolkit/libpolkit-policy-file-entry.c
rename to polkit/polkit-policy-file-entry.c
index e07f46ee948a381c82f371d15fd54dd8dab4667b..8e5c172815a9f861cc82d35c084fbe79fbbc6de1 100644
--- a/libpolkit/libpolkit-policy-file-entry.c
+++ b/polkit/polkit-policy-file-entry.c
@@ -1,7 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/***************************************************************************
*
- * libpolkit-policy-file-entry.c : entries in policy files
+ * polkit-policy-file-entry.c : entries in policy files
*
* Copyright (C) 2007 David Zeuthen,
*
@@ -37,13 +37,13 @@
#include
#include
-#include "libpolkit-debug.h"
-#include "libpolkit-error.h"
-#include "libpolkit-result.h"
-#include "libpolkit-policy-file-entry.h"
+#include "polkit-debug.h"
+#include "polkit-error.h"
+#include "polkit-result.h"
+#include "polkit-policy-file-entry.h"
/**
- * SECTION:libpolkit-policy-file-entry
+ * SECTION:polkit-policy-file-entry
* @short_description: Policy files entries.
*
* This class is used to represent a entries in policy files.
@@ -63,12 +63,12 @@ struct PolKitPolicyFileEntry
};
PolKitPolicyFileEntry *
-_libpolkit_policy_file_entry_new (GKeyFile *key_file, const char *action, PolKitError **error);
+_polkit_policy_file_entry_new (GKeyFile *key_file, const char *action, PolKitError **error);
-extern PolKitPolicyDefault *_libpolkit_policy_default_new (GKeyFile *key_file, const char *action, PolKitError **error);
+extern PolKitPolicyDefault *_polkit_policy_default_new (GKeyFile *key_file, const char *action, PolKitError **error);
extern PolKitPolicyFileEntry *
-_libpolkit_policy_file_entry_new (GKeyFile *key_file, const char *action, PolKitError **error)
+_polkit_policy_file_entry_new (GKeyFile *key_file, const char *action, PolKitError **error)
{
PolKitPolicyFileEntry *pfe;
@@ -76,19 +76,19 @@ _libpolkit_policy_file_entry_new (GKeyFile *key_file, const char *action, PolKit
pfe->refcount = 1;
pfe->action = g_strdup (action);
- pfe->defaults = _libpolkit_policy_default_new (key_file, action, error);
+ pfe->defaults = _polkit_policy_default_new (key_file, action, error);
if (pfe->defaults == NULL)
goto error;
return pfe;
error:
if (pfe != NULL)
- libpolkit_policy_file_entry_unref (pfe);
+ polkit_policy_file_entry_unref (pfe);
return NULL;
}
/**
- * libpolkit_policy_file_entry_ref:
+ * polkit_policy_file_entry_ref:
* @policy_file_entry: the policy file object
*
* Increase reference count.
@@ -96,7 +96,7 @@ error:
* Returns: the object
**/
PolKitPolicyFileEntry *
-libpolkit_policy_file_entry_ref (PolKitPolicyFileEntry *policy_file_entry)
+polkit_policy_file_entry_ref (PolKitPolicyFileEntry *policy_file_entry)
{
g_return_val_if_fail (policy_file_entry != NULL, policy_file_entry);
policy_file_entry->refcount++;
@@ -104,7 +104,7 @@ libpolkit_policy_file_entry_ref (PolKitPolicyFileEntry *policy_file_entry)
}
/**
- * libpolkit_policy_file_entry_unref:
+ * polkit_policy_file_entry_unref:
* @policy_file_entry: the policy file object
*
* Decreases the reference count of the object. If it becomes zero,
@@ -112,7 +112,7 @@ libpolkit_policy_file_entry_ref (PolKitPolicyFileEntry *policy_file_entry)
* objects are decresed by one.
**/
void
-libpolkit_policy_file_entry_unref (PolKitPolicyFileEntry *policy_file_entry)
+polkit_policy_file_entry_unref (PolKitPolicyFileEntry *policy_file_entry)
{
g_return_if_fail (policy_file_entry != NULL);
policy_file_entry->refcount--;
@@ -120,28 +120,28 @@ libpolkit_policy_file_entry_unref (PolKitPolicyFileEntry *policy_file_entry)
return;
g_free (policy_file_entry->action);
if (policy_file_entry->defaults != NULL)
- libpolkit_policy_default_unref (policy_file_entry->defaults);
+ polkit_policy_default_unref (policy_file_entry->defaults);
g_free (policy_file_entry);
}
/**
- * libpolkit_policy_file_entry_debug:
+ * polkit_policy_file_entry_debug:
* @policy_file_entry: the entry
*
* Print debug information about object
**/
void
-libpolkit_policy_file_entry_debug (PolKitPolicyFileEntry *policy_file_entry)
+polkit_policy_file_entry_debug (PolKitPolicyFileEntry *policy_file_entry)
{
g_return_if_fail (policy_file_entry != NULL);
_pk_debug ("PolKitPolicyFileEntry: refcount=%d action=%s",
policy_file_entry->refcount,
policy_file_entry->action);
- libpolkit_policy_default_debug (policy_file_entry->defaults);
+ polkit_policy_default_debug (policy_file_entry->defaults);
}
/**
- * libpolkit_policy_file_entry_get_id:
+ * polkit_policy_file_entry_get_id:
* @policy_file_entry: the file entry
*
* Get the action identifier.
@@ -149,14 +149,14 @@ libpolkit_policy_file_entry_debug (PolKitPolicyFileEntry *policy_file_entry)
* Returns: A string - caller shall not free this string.
**/
const char *
-libpolkit_policy_file_entry_get_id (PolKitPolicyFileEntry *policy_file_entry)
+polkit_policy_file_entry_get_id (PolKitPolicyFileEntry *policy_file_entry)
{
g_return_val_if_fail (policy_file_entry != NULL, NULL);
return policy_file_entry->action;
}
/**
- * libpolkit_policy_file_entry_get_default:
+ * polkit_policy_file_entry_get_default:
* @policy_file_entry: the file entry
*
* Get the the default policy for this policy.
@@ -164,7 +164,7 @@ libpolkit_policy_file_entry_get_id (PolKitPolicyFileEntry *policy_file_entry)
* Returns: A #PolKitPolicyDefault object - caller shall not unref this object.
**/
PolKitPolicyDefault *
-libpolkit_policy_file_entry_get_default (PolKitPolicyFileEntry *policy_file_entry)
+polkit_policy_file_entry_get_default (PolKitPolicyFileEntry *policy_file_entry)
{
g_return_val_if_fail (policy_file_entry != NULL, NULL);
return policy_file_entry->defaults;
diff --git a/libpolkit/libpolkit-policy-file-entry.h b/polkit/polkit-policy-file-entry.h
similarity index 58%
rename from libpolkit/libpolkit-policy-file-entry.h
rename to polkit/polkit-policy-file-entry.h
index f9aeb010e8adf9330666cc77f10dba1094d631fd..1fd11b5fcf83f131c8de15c6bd2e0777d6cc3b73 100644
--- a/libpolkit/libpolkit-policy-file-entry.h
+++ b/polkit/polkit-policy-file-entry.h
@@ -1,7 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/***************************************************************************
*
- * libpolkit-policy-file-entry.h : entries in policy files
+ * polkit-policy-file-entry.h : entries in policy files
*
* Copyright (C) 2007 David Zeuthen,
*
@@ -24,26 +24,26 @@
**************************************************************************/
#if !defined (POLKIT_COMPILATION) && !defined(_POLKIT_INSIDE_POLKIT_H)
-#error "Only can be included directly, this file may disappear or change contents."
+#error "Only can be included directly, this file may disappear or change contents."
#endif
-#ifndef LIBPOLKIT_POLICY_FILE_ENTRY_H
-#define LIBPOLKIT_POLICY_FILE_ENTRY_H
+#ifndef POLKIT_POLICY_FILE_ENTRY_H
+#define POLKIT_POLICY_FILE_ENTRY_H
-#include
-#include
+#include
+#include
struct PolKitPolicyFileEntry;
typedef struct PolKitPolicyFileEntry PolKitPolicyFileEntry;
-PolKitPolicyFileEntry *libpolkit_policy_file_entry_ref (PolKitPolicyFileEntry *policy_file_entry);
-void libpolkit_policy_file_entry_unref (PolKitPolicyFileEntry *policy_file_entry);
-void libpolkit_policy_file_entry_debug (PolKitPolicyFileEntry *policy_file_entry);
+PolKitPolicyFileEntry *polkit_policy_file_entry_ref (PolKitPolicyFileEntry *policy_file_entry);
+void polkit_policy_file_entry_unref (PolKitPolicyFileEntry *policy_file_entry);
+void polkit_policy_file_entry_debug (PolKitPolicyFileEntry *policy_file_entry);
-const char *libpolkit_policy_file_entry_get_id (PolKitPolicyFileEntry *policy_file_entry);
-PolKitPolicyDefault *libpolkit_policy_file_entry_get_default (PolKitPolicyFileEntry *policy_file_entry);
+const char *polkit_policy_file_entry_get_id (PolKitPolicyFileEntry *policy_file_entry);
+PolKitPolicyDefault *polkit_policy_file_entry_get_default (PolKitPolicyFileEntry *policy_file_entry);
-#endif /* LIBPOLKIT_POLICY_FILE_ENTRY_H */
+#endif /* POLKIT_POLICY_FILE_ENTRY_H */
diff --git a/libpolkit/libpolkit-policy-file.c b/polkit/polkit-policy-file.c
similarity index 87%
rename from libpolkit/libpolkit-policy-file.c
rename to polkit/polkit-policy-file.c
index 57b6bf8caa5060079751b9ac7ad1d48f55482955..04b23dc07532d3a988e5bda942e78cebe21e6e73 100644
--- a/libpolkit/libpolkit-policy-file.c
+++ b/polkit/polkit-policy-file.c
@@ -1,7 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/***************************************************************************
*
- * libpolkit-policy-file.c : policy files
+ * polkit-policy-file.c : policy files
*
* Copyright (C) 2007 David Zeuthen,
*
@@ -37,13 +37,13 @@
#include
#include
-#include "libpolkit-error.h"
-#include "libpolkit-result.h"
-#include "libpolkit-policy-file.h"
-#include "libpolkit-policy-file-entry.h"
+#include "polkit-error.h"
+#include "polkit-result.h"
+#include "polkit-policy-file.h"
+#include "polkit-policy-file-entry.h"
/**
- * SECTION:libpolkit-policy-file
+ * SECTION:polkit-policy-file
* @short_description: Policy files.
*
* This class is used to represent a policy files.
@@ -61,12 +61,12 @@ struct PolKitPolicyFile
GSList *entries;
};
-extern PolKitPolicyFileEntry *_libpolkit_policy_file_entry_new (GKeyFile *keyfile,
+extern PolKitPolicyFileEntry *_polkit_policy_file_entry_new (GKeyFile *keyfile,
const char *action,
PolKitError **error);
/**
- * libpolkit_policy_file_new:
+ * polkit_policy_file_new:
* @path: path to policy file
* @error: return location for error
*
@@ -77,7 +77,7 @@ extern PolKitPolicyFileEntry *_libpolkit_policy_file_entry_new (GKeyFile *keyf
* Returns: the new object or #NULL if error is set
**/
PolKitPolicyFile *
-libpolkit_policy_file_new (const char *path, PolKitError **error)
+polkit_policy_file_new (const char *path, PolKitError **error)
{
GKeyFile *key_file;
PolKitPolicyFile *pf;
@@ -134,7 +134,7 @@ libpolkit_policy_file_new (const char *path, PolKitError **error)
goto error;
}
- pfe = _libpolkit_policy_file_entry_new (key_file, action, error);
+ pfe = _polkit_policy_file_entry_new (key_file, action, error);
if (pfe == NULL)
goto error;
pf->entries = g_slist_prepend (pf->entries, pfe);
@@ -149,12 +149,12 @@ error:
if (key_file != NULL)
g_key_file_free (key_file);
if (pf != NULL)
- libpolkit_policy_file_unref (pf);
+ polkit_policy_file_unref (pf);
return NULL;
}
/**
- * libpolkit_policy_file_ref:
+ * polkit_policy_file_ref:
* @policy_file: the policy file object
*
* Increase reference count.
@@ -162,7 +162,7 @@ error:
* Returns: the object
**/
PolKitPolicyFile *
-libpolkit_policy_file_ref (PolKitPolicyFile *policy_file)
+polkit_policy_file_ref (PolKitPolicyFile *policy_file)
{
g_return_val_if_fail (policy_file != NULL, policy_file);
policy_file->refcount++;
@@ -170,7 +170,7 @@ libpolkit_policy_file_ref (PolKitPolicyFile *policy_file)
}
/**
- * libpolkit_policy_file_unref:
+ * polkit_policy_file_unref:
* @policy_file: the policy file object
*
* Decreases the reference count of the object. If it becomes zero,
@@ -178,7 +178,7 @@ libpolkit_policy_file_ref (PolKitPolicyFile *policy_file)
* objects are decresed by one.
**/
void
-libpolkit_policy_file_unref (PolKitPolicyFile *policy_file)
+polkit_policy_file_unref (PolKitPolicyFile *policy_file)
{
GSList *i;
g_return_if_fail (policy_file != NULL);
@@ -186,7 +186,7 @@ libpolkit_policy_file_unref (PolKitPolicyFile *policy_file)
if (policy_file->refcount > 0)
return;
for (i = policy_file->entries; i != NULL; i = g_slist_next (i)) {
- libpolkit_policy_file_entry_unref (i->data);
+ polkit_policy_file_entry_unref (i->data);
}
if (policy_file->entries != NULL)
g_slist_free (policy_file->entries);
@@ -194,7 +194,7 @@ libpolkit_policy_file_unref (PolKitPolicyFile *policy_file)
}
/**
- * libpolkit_policy_file_entry_foreach:
+ * polkit_policy_file_entry_foreach:
* @policy_file: the policy file object
* @cb: callback to invoke for each entry
* @user_data: user data
@@ -202,7 +202,7 @@ libpolkit_policy_file_unref (PolKitPolicyFile *policy_file)
* Visits all entries in a policy file.
**/
void
-libpolkit_policy_file_entry_foreach (PolKitPolicyFile *policy_file,
+polkit_policy_file_entry_foreach (PolKitPolicyFile *policy_file,
PolKitPolicyFileEntryForeachFunc cb,
void *user_data)
{
diff --git a/libpolkit/libpolkit-policy-file.h b/polkit/polkit-policy-file.h
similarity index 69%
rename from libpolkit/libpolkit-policy-file.h
rename to polkit/polkit-policy-file.h
index cdd9096b43744e6f8e3307732fb9749ef94ec70b..3e1baf0686820c0650fccbce9edade46da03ea8a 100644
--- a/libpolkit/libpolkit-policy-file.h
+++ b/polkit/polkit-policy-file.h
@@ -1,7 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/***************************************************************************
*
- * libpolkit-policy-file.h : policy files
+ * polkit-policy-file.h : policy files
*
* Copyright (C) 2007 David Zeuthen,
*
@@ -24,14 +24,14 @@
**************************************************************************/
#if !defined (POLKIT_COMPILATION) && !defined(_POLKIT_INSIDE_POLKIT_H)
-#error "Only can be included directly, this file may disappear or change contents."
+#error "Only can be included directly, this file may disappear or change contents."
#endif
-#ifndef LIBPOLKIT_POLICY_FILE_H
-#define LIBPOLKIT_POLICY_FILE_H
+#ifndef POLKIT_POLICY_FILE_H
+#define POLKIT_POLICY_FILE_H
-#include
-#include
+#include
+#include
struct PolKitPolicyFile;
typedef struct PolKitPolicyFile PolKitPolicyFile;
@@ -42,19 +42,19 @@ typedef struct PolKitPolicyFile PolKitPolicyFile;
* @policy_file_entry: the entry
* @user_data: user data
*
- * Type for function used in libpolkit_policy_file_entry_foreach().
+ * Type for function used in polkit_policy_file_entry_foreach().
**/
typedef void (*PolKitPolicyFileEntryForeachFunc) (PolKitPolicyFile *policy_file,
PolKitPolicyFileEntry *policy_file_entry,
void *user_data);
-PolKitPolicyFile *libpolkit_policy_file_new (const char *path, PolKitError **error);
-PolKitPolicyFile *libpolkit_policy_file_ref (PolKitPolicyFile *policy_file);
-void libpolkit_policy_file_unref (PolKitPolicyFile *policy_file);
-void libpolkit_policy_file_entry_foreach (PolKitPolicyFile *policy_file,
+PolKitPolicyFile *polkit_policy_file_new (const char *path, PolKitError **error);
+PolKitPolicyFile *polkit_policy_file_ref (PolKitPolicyFile *policy_file);
+void polkit_policy_file_unref (PolKitPolicyFile *policy_file);
+void polkit_policy_file_entry_foreach (PolKitPolicyFile *policy_file,
PolKitPolicyFileEntryForeachFunc cb,
void *user_data);
-#endif /* LIBPOLKIT_POLICY_FILE_H */
+#endif /* POLKIT_POLICY_FILE_H */
diff --git a/libpolkit/libpolkit-resource.c b/polkit/polkit-resource.c
similarity index 83%
rename from libpolkit/libpolkit-resource.c
rename to polkit/polkit-resource.c
index dd68b72fbae79e095b37601a7d96f83b0bd4f4d2..70d7d53b939680fc4ac074789cb7c8ed1829f3fc 100644
--- a/libpolkit/libpolkit-resource.c
+++ b/polkit/polkit-resource.c
@@ -1,7 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/***************************************************************************
*
- * libpolkit-resource.c : resources
+ * polkit-resource.c : resources
*
* Copyright (C) 2007 David Zeuthen,
*
@@ -37,12 +37,12 @@
#include
#include
-#include "libpolkit-debug.h"
-#include "libpolkit-resource.h"
-#include "libpolkit-utils.h"
+#include "polkit-debug.h"
+#include "polkit-resource.h"
+#include "polkit-utils.h"
/**
- * SECTION:libpolkit-resource
+ * SECTION:polkit-resource
* @short_description: Resources.
*
* This class is used to represent a resource. TODO: describe what a resource really is.
@@ -62,14 +62,14 @@ struct PolKitResource
};
/**
- * libpolkit_resource_new:
+ * polkit_resource_new:
*
* Create a new #PolKitResource object.
*
* Returns: the new object
**/
PolKitResource *
-libpolkit_resource_new (void)
+polkit_resource_new (void)
{
PolKitResource *resource;
resource = g_new0 (PolKitResource, 1);
@@ -78,7 +78,7 @@ libpolkit_resource_new (void)
}
/**
- * libpolkit_resource_ref:
+ * polkit_resource_ref:
* @resource: the resource object
*
* Increase reference count
@@ -86,7 +86,7 @@ libpolkit_resource_new (void)
* Returns: the object
**/
PolKitResource *
-libpolkit_resource_ref (PolKitResource *resource)
+polkit_resource_ref (PolKitResource *resource)
{
g_return_val_if_fail (resource != NULL, resource);
resource->refcount++;
@@ -95,7 +95,7 @@ libpolkit_resource_ref (PolKitResource *resource)
/**
- * libpolkit_resource_unref:
+ * polkit_resource_unref:
* @resource: the resource object
*
* Decreases the reference count of the object. If it becomes zero,
@@ -103,7 +103,7 @@ libpolkit_resource_ref (PolKitResource *resource)
* objects are decresed by one.
**/
void
-libpolkit_resource_unref (PolKitResource *resource)
+polkit_resource_unref (PolKitResource *resource)
{
g_return_if_fail (resource != NULL);
@@ -118,7 +118,7 @@ libpolkit_resource_unref (PolKitResource *resource)
/**
- * libpolkit_resource_set_resource_type:
+ * polkit_resource_set_resource_type:
* @resource: the resource object
* @resource_type: type of resource
*
@@ -127,7 +127,7 @@ libpolkit_resource_unref (PolKitResource *resource)
* Returns: #TRUE only if the value validated and was set
**/
polkit_bool_t
-libpolkit_resource_set_resource_type (PolKitResource *resource, const char *resource_type)
+polkit_resource_set_resource_type (PolKitResource *resource, const char *resource_type)
{
g_return_val_if_fail (resource != NULL, FALSE);
g_return_val_if_fail (_pk_validate_identifier (resource_type), FALSE);
@@ -138,7 +138,7 @@ libpolkit_resource_set_resource_type (PolKitResource *resource, const char *res
}
/**
- * libpolkit_resource_set_resource_id:
+ * polkit_resource_set_resource_id:
* @resource: the resource object
* @resource_id: identifier of resource
*
@@ -147,7 +147,7 @@ libpolkit_resource_set_resource_type (PolKitResource *resource, const char *res
* Returns: #TRUE only if the value validated and was set
**/
polkit_bool_t
-libpolkit_resource_set_resource_id (PolKitResource *resource, const char *resource_id)
+polkit_resource_set_resource_id (PolKitResource *resource, const char *resource_id)
{
g_return_val_if_fail (resource != NULL, FALSE);
g_return_val_if_fail (_pk_validate_identifier (resource_id), FALSE);
@@ -158,7 +158,7 @@ libpolkit_resource_set_resource_id (PolKitResource *resource, const char *resou
}
/**
- * libpolkit_resource_get_resource_type:
+ * polkit_resource_get_resource_type:
* @resource: the resource object
* @out_resource_type: Returns the resource type. The caller shall not free this string.
*
@@ -167,7 +167,7 @@ libpolkit_resource_set_resource_id (PolKitResource *resource, const char *resou
* Returns: TRUE iff the value was returned.
**/
polkit_bool_t
-libpolkit_resource_get_resource_type (PolKitResource *resource, char **out_resource_type)
+polkit_resource_get_resource_type (PolKitResource *resource, char **out_resource_type)
{
g_return_val_if_fail (resource != NULL, FALSE);
g_return_val_if_fail (out_resource_type != NULL, FALSE);
@@ -180,7 +180,7 @@ libpolkit_resource_get_resource_type (PolKitResource *resource, char **out_resou
}
/**
- * libpolkit_resource_get_resource_id:
+ * polkit_resource_get_resource_id:
* @resource: the resource object
* @out_resource_id: Returns the resource identifier. The caller shall not free this string.
*
@@ -189,7 +189,7 @@ libpolkit_resource_get_resource_type (PolKitResource *resource, char **out_resou
* Returns: TRUE iff the value was returned.
**/
polkit_bool_t
-libpolkit_resource_get_resource_id (PolKitResource *resource, char **out_resource_id)
+polkit_resource_get_resource_id (PolKitResource *resource, char **out_resource_id)
{
g_return_val_if_fail (resource != NULL, FALSE);
g_return_val_if_fail (out_resource_id != NULL, FALSE);
@@ -202,20 +202,20 @@ libpolkit_resource_get_resource_id (PolKitResource *resource, char **out_resourc
}
/**
- * libpolkit_resource_debug:
+ * polkit_resource_debug:
* @resource: the object
*
* Print debug details
**/
void
-libpolkit_resource_debug (PolKitResource *resource)
+polkit_resource_debug (PolKitResource *resource)
{
g_return_if_fail (resource != NULL);
_pk_debug ("PolKitResource: refcount=%d type=%s id=%s", resource->refcount, resource->type, resource->id);
}
/**
- * libpolkit_resource_validate:
+ * polkit_resource_validate:
* @resource: the object
*
* Validate the object
@@ -223,7 +223,7 @@ libpolkit_resource_debug (PolKitResource *resource)
* Returns: #TRUE iff the object is valid.
**/
polkit_bool_t
-libpolkit_resource_validate (PolKitResource *resource)
+polkit_resource_validate (PolKitResource *resource)
{
g_return_val_if_fail (resource != NULL, FALSE);
g_return_val_if_fail (resource->type != NULL, FALSE);
diff --git a/libpolkit/libpolkit-resource.h b/polkit/polkit-resource.h
similarity index 52%
rename from libpolkit/libpolkit-resource.h
rename to polkit/polkit-resource.h
index 427b6e7b7ccd8451cf4086146dc6d8f83dfd1518..636e73025ab7ac62120f8916dd467daa889dec14 100644
--- a/libpolkit/libpolkit-resource.h
+++ b/polkit/polkit-resource.h
@@ -1,7 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/***************************************************************************
*
- * libpolkit-resource.h : resources
+ * polkit-resource.h : resources
*
* Copyright (C) 2007 David Zeuthen,
*
@@ -24,29 +24,29 @@
**************************************************************************/
#if !defined (POLKIT_COMPILATION) && !defined(_POLKIT_INSIDE_POLKIT_H)
-#error "Only can be included directly, this file may disappear or change contents."
+#error "Only can be included directly, this file may disappear or change contents."
#endif
-#ifndef LIBPOLKIT_RESOURCE_H
-#define LIBPOLKIT_RESOURCE_H
+#ifndef POLKIT_RESOURCE_H
+#define POLKIT_RESOURCE_H
-#include
+#include
struct PolKitResource;
typedef struct PolKitResource PolKitResource;
-PolKitResource *libpolkit_resource_new (void);
-PolKitResource *libpolkit_resource_ref (PolKitResource *resource);
-void libpolkit_resource_unref (PolKitResource *resource);
-polkit_bool_t libpolkit_resource_set_resource_type (PolKitResource *resource, const char *resource_type);
-polkit_bool_t libpolkit_resource_set_resource_id (PolKitResource *resource, const char *resource_id);
-polkit_bool_t libpolkit_resource_get_resource_type (PolKitResource *resource, char **out_resource_type);
-polkit_bool_t libpolkit_resource_get_resource_id (PolKitResource *resource, char **out_resource_id);
+PolKitResource *polkit_resource_new (void);
+PolKitResource *polkit_resource_ref (PolKitResource *resource);
+void polkit_resource_unref (PolKitResource *resource);
+polkit_bool_t polkit_resource_set_resource_type (PolKitResource *resource, const char *resource_type);
+polkit_bool_t polkit_resource_set_resource_id (PolKitResource *resource, const char *resource_id);
+polkit_bool_t polkit_resource_get_resource_type (PolKitResource *resource, char **out_resource_type);
+polkit_bool_t polkit_resource_get_resource_id (PolKitResource *resource, char **out_resource_id);
-void libpolkit_resource_debug (PolKitResource *resource);
+void polkit_resource_debug (PolKitResource *resource);
-polkit_bool_t libpolkit_resource_validate (PolKitResource *resource);
+polkit_bool_t polkit_resource_validate (PolKitResource *resource);
-#endif /* LIBPOLKIT_RESOURCE_H */
+#endif /* POLKIT_RESOURCE_H */
diff --git a/libpolkit/libpolkit-result.c b/polkit/polkit-result.c
similarity index 69%
rename from libpolkit/libpolkit-result.c
rename to polkit/polkit-result.c
index 05d787edeadc89b93175df28a1bc92bd377c39db..9193c737ec48d281f90562a3ae8e6e47cc60a521 100644
--- a/libpolkit/libpolkit-result.c
+++ b/polkit/polkit-result.c
@@ -1,7 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/***************************************************************************
*
- * libpolkit-result.c : result codes from PolicyKit
+ * polkit-result.c : result codes from PolicyKit
*
* Copyright (C) 2007 David Zeuthen,
*
@@ -24,7 +24,7 @@
**************************************************************************/
/**
- * SECTION:libpolkit-result
+ * SECTION:polkit-result
* @short_description: Result of PolicyKit queries
*
* These functions are used to manipulate PolicyKit results.
@@ -44,7 +44,7 @@
#include
#include
-#include "libpolkit-result.h"
+#include "polkit-result.h"
static const struct {
@@ -52,22 +52,22 @@ static const struct {
const char *str;
} mapping[] =
{
- {LIBPOLKIT_RESULT_UNKNOWN_ACTION, "unknown"},
- {LIBPOLKIT_RESULT_NOT_AUTHORIZED_TO_KNOW, "not_authorized"},
- {LIBPOLKIT_RESULT_NO, "no"},
- {LIBPOLKIT_RESULT_ONLY_VIA_ROOT_AUTH, "auth_root"},
- {LIBPOLKIT_RESULT_ONLY_VIA_ROOT_AUTH_KEEP_SESSION, "auth_root_keep_session"},
- {LIBPOLKIT_RESULT_ONLY_VIA_ROOT_AUTH_KEEP_ALWAYS, "auth_root_keep_always"},
- {LIBPOLKIT_RESULT_ONLY_VIA_SELF_AUTH, "auth_self"},
- {LIBPOLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_SESSION, "auth_self_keep_session"},
- {LIBPOLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_ALWAYS, "auth_self_keep_always"},
- {LIBPOLKIT_RESULT_YES, "yes"},
+ {POLKIT_RESULT_UNKNOWN_ACTION, "unknown"},
+ {POLKIT_RESULT_NOT_AUTHORIZED_TO_KNOW, "not_authorized"},
+ {POLKIT_RESULT_NO, "no"},
+ {POLKIT_RESULT_ONLY_VIA_ROOT_AUTH, "auth_root"},
+ {POLKIT_RESULT_ONLY_VIA_ROOT_AUTH_KEEP_SESSION, "auth_root_keep_session"},
+ {POLKIT_RESULT_ONLY_VIA_ROOT_AUTH_KEEP_ALWAYS, "auth_root_keep_always"},
+ {POLKIT_RESULT_ONLY_VIA_SELF_AUTH, "auth_self"},
+ {POLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_SESSION, "auth_self_keep_session"},
+ {POLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_ALWAYS, "auth_self_keep_always"},
+ {POLKIT_RESULT_YES, "yes"},
{0, NULL}
};
/**
- * libpolkit_result_to_string_representation:
+ * polkit_result_to_string_representation:
* @result: the given result to get a textual representation of
*
* Gives a textual representation of a #PolKitResult object.
@@ -75,9 +75,9 @@ static const struct {
* Returns: string representing the result (do not free) or #NULL if the given result is invalid
**/
const char *
-libpolkit_result_to_string_representation (PolKitResult result)
+polkit_result_to_string_representation (PolKitResult result)
{
- if (result < 0 || result >= LIBPOLKIT_RESULT_N_RESULTS) {
+ if (result < 0 || result >= POLKIT_RESULT_N_RESULTS) {
g_warning ("The passed result code, %d, is not valid", result);
return NULL;
}
@@ -86,7 +86,7 @@ libpolkit_result_to_string_representation (PolKitResult result)
}
/**
- * libpolkit_result_from_string_representation:
+ * polkit_result_from_string_representation:
* @string: textual representation of a #PolKitResult object
* @out_result: return location for #PolKitResult
*
@@ -95,13 +95,13 @@ libpolkit_result_to_string_representation (PolKitResult result)
* Returns: TRUE if the textual representation was valid, otherwise FALSE
**/
polkit_bool_t
-libpolkit_result_from_string_representation (const char *string, PolKitResult *out_result)
+polkit_result_from_string_representation (const char *string, PolKitResult *out_result)
{
int n;
g_return_val_if_fail (out_result != NULL, FALSE);
- for (n = 0; n < LIBPOLKIT_RESULT_N_RESULTS; n++) {
+ for (n = 0; n < POLKIT_RESULT_N_RESULTS; n++) {
if (mapping[n].str == NULL)
break;
if (strcmp (mapping[n].str, string) == 0) {
diff --git a/polkit/polkit-result.h b/polkit/polkit-result.h
new file mode 100644
index 0000000000000000000000000000000000000000..475154e6dae19e52127fb083b1e0417061d5597d
--- /dev/null
+++ b/polkit/polkit-result.h
@@ -0,0 +1,84 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
+/***************************************************************************
+ *
+ * polkit-result.h : result codes from PolicyKit
+ *
+ * Copyright (C) 2007 David Zeuthen,
+ *
+ * Licensed under the Academic Free License version 2.1
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ **************************************************************************/
+
+#if !defined (POLKIT_COMPILATION) && !defined(_POLKIT_INSIDE_POLKIT_H)
+#error "Only can be included directly, this file may disappear or change contents."
+#endif
+
+#ifndef POLKIT_RESULT_H
+#define POLKIT_RESULT_H
+
+#include
+
+/**
+ * PolKitResult:
+ * @POLKIT_RESULT_UNKNOWN_ACTION: The passed action is unknown.
+ * @POLKIT_RESULT_NOT_AUTHORIZED_TO_KNOW: The caller of polkit is not sufficiently privilege to know the answer.
+ * @POLKIT_RESULT_NO: Access denied.
+ * @POLKIT_RESULT_ONLY_VIA_ROOT_AUTH: Access denied, but authentication of the caller as
+ * root will grant access to the resource... but the access isn't permanent
+ * @POLKIT_RESULT_ONLY_VIA_ROOT_AUTH_KEEP_SESSION: Access denied, but authentication of the caller as
+ * root will grant access to the resource for the remainder of the session
+ * @POLKIT_RESULT_ONLY_VIA_ROOT_AUTH_KEEP_ALWAYS: Access denied, but authentication of the caller as
+ * root will grant access to the resource in the future.
+ * @POLKIT_RESULT_ONLY_VIA_SELF_AUTH: Access denied, but authentication of the caller as
+ * himself will grant access to the resource... but the access isn't permanent
+ * @POLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_SESSION: Access denied, but authentication of the caller as
+ * himself will grant access to the resource for the remainder of the session
+ * @POLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_ALWAYS: Access denied, but authentication of the caller as
+ * himself will grant access to the resource in the future.
+ * @POLKIT_RESULT_YES: Access granted.
+ * @POLKIT_RESULT_N_RESULTS: Number of result codes
+ *
+ * Result codes from queries to PolicyKit. These are ordered and we
+ * say that a result A is "more strict" than a result B, if A has a
+ * lower numerical value. (e.g. #POLKIT_RESULT_NO is more strict
+ * than #POLKIT_RESULT_YES).
+ */
+typedef enum
+{
+ POLKIT_RESULT_UNKNOWN_ACTION,
+ POLKIT_RESULT_NOT_AUTHORIZED_TO_KNOW,
+ POLKIT_RESULT_NO,
+
+ POLKIT_RESULT_ONLY_VIA_ROOT_AUTH,
+ POLKIT_RESULT_ONLY_VIA_ROOT_AUTH_KEEP_SESSION,
+ POLKIT_RESULT_ONLY_VIA_ROOT_AUTH_KEEP_ALWAYS,
+
+ POLKIT_RESULT_ONLY_VIA_SELF_AUTH,
+ POLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_SESSION,
+ POLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_ALWAYS,
+
+ POLKIT_RESULT_YES,
+ POLKIT_RESULT_N_RESULTS
+} PolKitResult;
+
+const char *
+polkit_result_to_string_representation (PolKitResult result);
+
+polkit_bool_t
+polkit_result_from_string_representation (const char *string, PolKitResult *out_result);
+
+#endif /* POLKIT_RESULT_H */
diff --git a/libpolkit/libpolkit-seat.c b/polkit/polkit-seat.c
similarity index 85%
rename from libpolkit/libpolkit-seat.c
rename to polkit/polkit-seat.c
index 8a519914a122d53ee93645dc1fdf2910efc2204f..507a1d472e32d06bb090228a7cb0dc2b68d641dc 100644
--- a/libpolkit/libpolkit-seat.c
+++ b/polkit/polkit-seat.c
@@ -1,7 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/***************************************************************************
*
- * libpolkit-seat.c : seat
+ * polkit-seat.c : seat
*
* Copyright (C) 2007 David Zeuthen,
*
@@ -37,12 +37,12 @@
#include
#include
-#include "libpolkit-debug.h"
-#include "libpolkit-seat.h"
-#include "libpolkit-utils.h"
+#include "polkit-debug.h"
+#include "polkit-seat.h"
+#include "polkit-utils.h"
/**
- * SECTION:libpolkit-seat
+ * SECTION:polkit-seat
* @short_description: Seats.
*
* This class is used to represent a seat. TODO: describe seat.
@@ -61,14 +61,14 @@ struct PolKitSeat
};
/**
- * libpolkit_seat_new:
+ * polkit_seat_new:
*
* Creates a new #PolKitSeat object.
*
* Returns: the new object
**/
PolKitSeat *
-libpolkit_seat_new (void)
+polkit_seat_new (void)
{
PolKitSeat *seat;
seat = g_new0 (PolKitSeat, 1);
@@ -77,7 +77,7 @@ libpolkit_seat_new (void)
}
/**
- * libpolkit_seat_ref:
+ * polkit_seat_ref:
* @seat: the seat object
*
* Increase reference count.
@@ -85,7 +85,7 @@ libpolkit_seat_new (void)
* Returns: the object
**/
PolKitSeat *
-libpolkit_seat_ref (PolKitSeat *seat)
+polkit_seat_ref (PolKitSeat *seat)
{
g_return_val_if_fail (seat != NULL, seat);
seat->refcount++;
@@ -93,7 +93,7 @@ libpolkit_seat_ref (PolKitSeat *seat)
}
/**
- * libpolkit_seat_unref:
+ * polkit_seat_unref:
* @seat: the seat object
*
* Decreases the reference count of the object. If it becomes zero,
@@ -101,7 +101,7 @@ libpolkit_seat_ref (PolKitSeat *seat)
* objects are decresed by one.
**/
void
-libpolkit_seat_unref (PolKitSeat *seat)
+polkit_seat_unref (PolKitSeat *seat)
{
g_return_if_fail (seat != NULL);
seat->refcount--;
@@ -112,7 +112,7 @@ libpolkit_seat_unref (PolKitSeat *seat)
}
/**
- * libpolkit_seat_set_ck_objref:
+ * polkit_seat_set_ck_objref:
* @seat: the seat object
* @ck_objref: the D-Bus object path to the ConsoleKit seat object
*
@@ -121,7 +121,7 @@ libpolkit_seat_unref (PolKitSeat *seat)
* Returns: #TRUE only if the value validated and was set
**/
polkit_bool_t
-libpolkit_seat_set_ck_objref (PolKitSeat *seat, const char *ck_objref)
+polkit_seat_set_ck_objref (PolKitSeat *seat, const char *ck_objref)
{
g_return_val_if_fail (seat != NULL, FALSE);
g_return_val_if_fail (_pk_validate_identifier (ck_objref), FALSE);
@@ -132,7 +132,7 @@ libpolkit_seat_set_ck_objref (PolKitSeat *seat, const char *ck_objref)
}
/**
- * libpolkit_seat_get_ck_objref:
+ * polkit_seat_get_ck_objref:
* @seat: the seat object
* @out_ck_objref: Returns the D-Bus object path to the ConsoleKit seat object. The caller shall not free this string.
*
@@ -141,7 +141,7 @@ libpolkit_seat_set_ck_objref (PolKitSeat *seat, const char *ck_objref)
* Returns: TRUE iff the value is returned
**/
polkit_bool_t
-libpolkit_seat_get_ck_objref (PolKitSeat *seat, char **out_ck_objref)
+polkit_seat_get_ck_objref (PolKitSeat *seat, char **out_ck_objref)
{
g_return_val_if_fail (seat != NULL, FALSE);
g_return_val_if_fail (out_ck_objref != NULL, FALSE);
@@ -150,20 +150,20 @@ libpolkit_seat_get_ck_objref (PolKitSeat *seat, char **out_ck_objref)
}
/**
- * libpolkit_seat_debug:
+ * polkit_seat_debug:
* @seat: the object
*
* Print debug details
**/
void
-libpolkit_seat_debug (PolKitSeat *seat)
+polkit_seat_debug (PolKitSeat *seat)
{
g_return_if_fail (seat != NULL);
_pk_debug ("PolKitSeat: refcount=%d objpath=%s", seat->refcount, seat->ck_objref);
}
/**
- * libpolkit_seat_validate:
+ * polkit_seat_validate:
* @seat: the object
*
* Validate the object
@@ -171,7 +171,7 @@ libpolkit_seat_debug (PolKitSeat *seat)
* Returns: #TRUE iff the object is valid.
**/
polkit_bool_t
-libpolkit_seat_validate (PolKitSeat *seat)
+polkit_seat_validate (PolKitSeat *seat)
{
g_return_val_if_fail (seat != NULL, FALSE);
g_return_val_if_fail (seat->ck_objref != NULL, FALSE);
diff --git a/libpolkit/libpolkit-seat.h b/polkit/polkit-seat.h
similarity index 62%
rename from libpolkit/libpolkit-seat.h
rename to polkit/polkit-seat.h
index 7de9fe928eac7de4aef7d5a40421ae207f548af1..5a0171494d5ebe7f78d82dc6db8a6872ff888be2 100644
--- a/libpolkit/libpolkit-seat.h
+++ b/polkit/polkit-seat.h
@@ -1,7 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/***************************************************************************
*
- * libpolkit-seat.h : seats
+ * polkit-seat.h : seats
*
* Copyright (C) 2007 David Zeuthen,
*
@@ -24,26 +24,26 @@
**************************************************************************/
#if !defined (POLKIT_COMPILATION) && !defined(_POLKIT_INSIDE_POLKIT_H)
-#error "Only can be included directly, this file may disappear or change contents."
+#error "Only can be included directly, this file may disappear or change contents."
#endif
-#ifndef LIBPOLKIT_SEAT_H
-#define LIBPOLKIT_SEAT_H
+#ifndef POLKIT_SEAT_H
+#define POLKIT_SEAT_H
-#include
+#include
struct PolKitSeat;
typedef struct PolKitSeat PolKitSeat;
-PolKitSeat *libpolkit_seat_new (void);
-PolKitSeat *libpolkit_seat_ref (PolKitSeat *seat);
-void libpolkit_seat_unref (PolKitSeat *seat);
-polkit_bool_t libpolkit_seat_set_ck_objref (PolKitSeat *seat, const char *ck_objref);
-polkit_bool_t libpolkit_seat_get_ck_objref (PolKitSeat *seat, char **out_ck_objref);
+PolKitSeat *polkit_seat_new (void);
+PolKitSeat *polkit_seat_ref (PolKitSeat *seat);
+void polkit_seat_unref (PolKitSeat *seat);
+polkit_bool_t polkit_seat_set_ck_objref (PolKitSeat *seat, const char *ck_objref);
+polkit_bool_t polkit_seat_get_ck_objref (PolKitSeat *seat, char **out_ck_objref);
-void libpolkit_seat_debug (PolKitSeat *seat);
-polkit_bool_t libpolkit_seat_validate (PolKitSeat *seat);
+void polkit_seat_debug (PolKitSeat *seat);
+polkit_bool_t polkit_seat_validate (PolKitSeat *seat);
-#endif /* LIBPOLKIT_SEAT_H */
+#endif /* POLKIT_SEAT_H */
diff --git a/libpolkit/libpolkit-session.c b/polkit/polkit-session.c
similarity index 80%
rename from libpolkit/libpolkit-session.c
rename to polkit/polkit-session.c
index c93019c67ab94e1fda8478cf2cdef95162844400..4a1d1180ea8501741ecc8873679e691998f7e1d6 100644
--- a/libpolkit/libpolkit-session.c
+++ b/polkit/polkit-session.c
@@ -1,7 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/***************************************************************************
*
- * libpolkit-session.c : sessions
+ * polkit-session.c : sessions
*
* Copyright (C) 2007 David Zeuthen,
*
@@ -37,12 +37,12 @@
#include
#include
-#include "libpolkit-debug.h"
-#include "libpolkit-session.h"
-#include "libpolkit-utils.h"
+#include "polkit-debug.h"
+#include "polkit-session.h"
+#include "polkit-utils.h"
/**
- * SECTION:libpolkit-session
+ * SECTION:polkit-session
* @short_description: Sessions.
*
* This class is used to represent a session. TODO: describe session.
@@ -66,14 +66,14 @@ struct PolKitSession
};
/**
- * libpolkit_session_new:
+ * polkit_session_new:
*
* Creates a new #PolKitSession object.
*
* Returns: the new object
**/
PolKitSession *
-libpolkit_session_new (void)
+polkit_session_new (void)
{
PolKitSession *session;
session = g_new0 (PolKitSession, 1);
@@ -82,7 +82,7 @@ libpolkit_session_new (void)
}
/**
- * libpolkit_session_ref:
+ * polkit_session_ref:
* @session: The session object
*
* Increase reference count.
@@ -90,7 +90,7 @@ libpolkit_session_new (void)
* Returns: the object
**/
PolKitSession *
-libpolkit_session_ref (PolKitSession *session)
+polkit_session_ref (PolKitSession *session)
{
g_return_val_if_fail (session != NULL, session);
session->refcount++;
@@ -99,7 +99,7 @@ libpolkit_session_ref (PolKitSession *session)
/**
- * libpolkit_session_unref:
+ * polkit_session_unref:
* @session: The session object
*
* Decreases the reference count of the object. If it becomes zero,
@@ -107,7 +107,7 @@ libpolkit_session_ref (PolKitSession *session)
* objects are decresed by one.
**/
void
-libpolkit_session_unref (PolKitSession *session)
+polkit_session_unref (PolKitSession *session)
{
g_return_if_fail (session != NULL);
session->refcount--;
@@ -116,12 +116,12 @@ libpolkit_session_unref (PolKitSession *session)
g_free (session->ck_objref);
g_free (session->remote_host);
if (session->seat != NULL)
- libpolkit_seat_unref (session->seat);
+ polkit_seat_unref (session->seat);
g_free (session);
}
/**
- * libpolkit_session_set_uid:
+ * polkit_session_set_uid:
* @session: The session object
* @uid: UNIX user id
*
@@ -130,7 +130,7 @@ libpolkit_session_unref (PolKitSession *session)
* Returns: #TRUE only if the value validated and was set
**/
polkit_bool_t
-libpolkit_session_set_uid (PolKitSession *session, uid_t uid)
+polkit_session_set_uid (PolKitSession *session, uid_t uid)
{
g_return_val_if_fail (session != NULL, FALSE);
session->uid = uid;
@@ -138,7 +138,7 @@ libpolkit_session_set_uid (PolKitSession *session, uid_t uid)
}
/**
- * libpolkit_session_set_ck_objref:
+ * polkit_session_set_ck_objref:
* @session: The session object
* @ck_objref: D-Bus object path
*
@@ -147,7 +147,7 @@ libpolkit_session_set_uid (PolKitSession *session, uid_t uid)
* Returns: #TRUE only if the value validated and was set
**/
polkit_bool_t
-libpolkit_session_set_ck_objref (PolKitSession *session, const char *ck_objref)
+polkit_session_set_ck_objref (PolKitSession *session, const char *ck_objref)
{
g_return_val_if_fail (session != NULL, FALSE);
g_return_val_if_fail (_pk_validate_identifier (ck_objref), FALSE);
@@ -158,7 +158,7 @@ libpolkit_session_set_ck_objref (PolKitSession *session, const char *ck_objref)
}
/**
- * libpolkit_session_set_ck_is_active:
+ * polkit_session_set_ck_is_active:
* @session: The session object
* @is_active: whether ConsoleKit reports the session as active
*
@@ -167,7 +167,7 @@ libpolkit_session_set_ck_objref (PolKitSession *session, const char *ck_objref)
* Returns: #TRUE only if the value validated and was set
**/
polkit_bool_t
-libpolkit_session_set_ck_is_active (PolKitSession *session, polkit_bool_t is_active)
+polkit_session_set_ck_is_active (PolKitSession *session, polkit_bool_t is_active)
{
g_return_val_if_fail (session != NULL, FALSE);
session->is_active = is_active;
@@ -175,7 +175,7 @@ libpolkit_session_set_ck_is_active (PolKitSession *session, polkit_bool_t is_act
}
/**
- * libpolkit_session_set_ck_is_local:
+ * polkit_session_set_ck_is_local:
* @session: The session object
* @is_local: whether ConsoleKit reports the session as local
*
@@ -184,7 +184,7 @@ libpolkit_session_set_ck_is_active (PolKitSession *session, polkit_bool_t is_act
* Returns: #TRUE only if the value validated and was set
**/
polkit_bool_t
-libpolkit_session_set_ck_is_local (PolKitSession *session, polkit_bool_t is_local)
+polkit_session_set_ck_is_local (PolKitSession *session, polkit_bool_t is_local)
{
g_return_val_if_fail (session != NULL, FALSE);
session->is_local = is_local;
@@ -192,7 +192,7 @@ libpolkit_session_set_ck_is_local (PolKitSession *session, polkit_bool_t is_loca
}
/**
- * libpolkit_session_set_ck_remote_host:
+ * polkit_session_set_ck_remote_host:
* @session: The session object
* @remote_host: hostname of the host/display that ConsoleKit reports
* the session to occur at
@@ -203,7 +203,7 @@ libpolkit_session_set_ck_is_local (PolKitSession *session, polkit_bool_t is_loca
* Returns: #TRUE only if the value validated and was set
**/
polkit_bool_t
-libpolkit_session_set_ck_remote_host (PolKitSession *session, const char *remote_host)
+polkit_session_set_ck_remote_host (PolKitSession *session, const char *remote_host)
{
g_return_val_if_fail (session != NULL, FALSE);
/* TODO: FIXME: probably need to allow a lot more here */
@@ -215,7 +215,7 @@ libpolkit_session_set_ck_remote_host (PolKitSession *session, const char *remote
}
/**
- * libpolkit_session_set_seat:
+ * polkit_session_set_seat:
* @session: The session object
* @seat: a #PolKitSeat object
*
@@ -227,18 +227,18 @@ libpolkit_session_set_ck_remote_host (PolKitSession *session, const char *remote
* Returns: #TRUE only if the value validated and was set
**/
polkit_bool_t
-libpolkit_session_set_seat (PolKitSession *session, PolKitSeat *seat)
+polkit_session_set_seat (PolKitSession *session, PolKitSeat *seat)
{
g_return_val_if_fail (session != NULL, FALSE);
- g_return_val_if_fail (libpolkit_seat_validate (seat), FALSE);
+ g_return_val_if_fail (polkit_seat_validate (seat), FALSE);
if (session->seat != NULL)
- libpolkit_seat_unref (session->seat);
- session->seat = seat != NULL ? libpolkit_seat_ref (seat) : NULL;
+ polkit_seat_unref (session->seat);
+ session->seat = seat != NULL ? polkit_seat_ref (seat) : NULL;
return TRUE;
}
/**
- * libpolkit_session_get_uid:
+ * polkit_session_get_uid:
* @session: The session object
* @out_uid: UNIX user id
*
@@ -247,7 +247,7 @@ libpolkit_session_set_seat (PolKitSession *session, PolKitSeat *seat)
* Returns: TRUE iff the value is returned
**/
polkit_bool_t
-libpolkit_session_get_uid (PolKitSession *session, uid_t *out_uid)
+polkit_session_get_uid (PolKitSession *session, uid_t *out_uid)
{
g_return_val_if_fail (session != NULL, FALSE);
g_return_val_if_fail (out_uid != NULL, FALSE);
@@ -256,7 +256,7 @@ libpolkit_session_get_uid (PolKitSession *session, uid_t *out_uid)
}
/**
- * libpolkit_session_get_ck_objref:
+ * polkit_session_get_ck_objref:
* @session: The session object
* @out_ck_objref: D-Bus object path. Shall not be freed by the caller.
*
@@ -265,7 +265,7 @@ libpolkit_session_get_uid (PolKitSession *session, uid_t *out_uid)
* Returns: TRUE iff the value is returned
**/
polkit_bool_t
-libpolkit_session_get_ck_objref (PolKitSession *session, char **out_ck_objref)
+polkit_session_get_ck_objref (PolKitSession *session, char **out_ck_objref)
{
g_return_val_if_fail (session != NULL, FALSE);
g_return_val_if_fail (out_ck_objref != NULL, FALSE);
@@ -274,7 +274,7 @@ libpolkit_session_get_ck_objref (PolKitSession *session, char **out_ck_objref)
}
/**
- * libpolkit_session_get_ck_is_active:
+ * polkit_session_get_ck_is_active:
* @session: The session object
* @out_is_active: whether ConsoleKit reports the session as active
*
@@ -283,7 +283,7 @@ libpolkit_session_get_ck_objref (PolKitSession *session, char **out_ck_objref)
* Returns: TRUE iff the value is returned
**/
polkit_bool_t
-libpolkit_session_get_ck_is_active (PolKitSession *session, polkit_bool_t *out_is_active)
+polkit_session_get_ck_is_active (PolKitSession *session, polkit_bool_t *out_is_active)
{
g_return_val_if_fail (session != NULL, FALSE);
g_return_val_if_fail (out_is_active != NULL, FALSE);
@@ -292,7 +292,7 @@ libpolkit_session_get_ck_is_active (PolKitSession *session, polkit_bool_t *out_i
}
/**
- * libpolkit_session_get_ck_is_local:
+ * polkit_session_get_ck_is_local:
* @session: The session object
* @out_is_local: whether ConsoleKit reports the session as local
*
@@ -301,7 +301,7 @@ libpolkit_session_get_ck_is_active (PolKitSession *session, polkit_bool_t *out_i
* Returns: TRUE iff the value is returned
**/
polkit_bool_t
-libpolkit_session_get_ck_is_local (PolKitSession *session, polkit_bool_t *out_is_local)
+polkit_session_get_ck_is_local (PolKitSession *session, polkit_bool_t *out_is_local)
{
g_return_val_if_fail (session != NULL, FALSE);
g_return_val_if_fail (out_is_local != NULL, FALSE);
@@ -310,7 +310,7 @@ libpolkit_session_get_ck_is_local (PolKitSession *session, polkit_bool_t *out_is
}
/**
- * libpolkit_session_get_ck_remote_host:
+ * polkit_session_get_ck_remote_host:
* @session: The session object
* @out_remote_host: hostname of the host/display that ConsoleKit
* reports the session to occur at. Shall not be freed by the caller.
@@ -321,7 +321,7 @@ libpolkit_session_get_ck_is_local (PolKitSession *session, polkit_bool_t *out_is
* Returns: TRUE iff the value is returned
**/
polkit_bool_t
-libpolkit_session_get_ck_remote_host (PolKitSession *session, char **out_remote_host)
+polkit_session_get_ck_remote_host (PolKitSession *session, char **out_remote_host)
{
g_return_val_if_fail (session != NULL, FALSE);
g_return_val_if_fail (out_remote_host != NULL, FALSE);
@@ -330,7 +330,7 @@ libpolkit_session_get_ck_remote_host (PolKitSession *session, char **out_remote_
}
/**
- * libpolkit_session_get_seat:
+ * polkit_session_get_seat:
* @session: The session object
* @out_seat: Returns the seat the session belongs to. Shall not
* be unreffed by the caller.
@@ -340,7 +340,7 @@ libpolkit_session_get_ck_remote_host (PolKitSession *session, char **out_remote_
* Returns: TRUE iff the value is returned
**/
polkit_bool_t
-libpolkit_session_get_seat (PolKitSession *session, PolKitSeat **out_seat)
+polkit_session_get_seat (PolKitSession *session, PolKitSeat **out_seat)
{
g_return_val_if_fail (session != NULL, FALSE);
g_return_val_if_fail (out_seat != NULL, FALSE);
@@ -349,25 +349,25 @@ libpolkit_session_get_seat (PolKitSession *session, PolKitSeat **out_seat)
}
/**
- * libpolkit_session_debug:
+ * polkit_session_debug:
* @session: the object
*
* Print debug details
**/
void
-libpolkit_session_debug (PolKitSession *session)
+polkit_session_debug (PolKitSession *session)
{
g_return_if_fail (session != NULL);
_pk_debug ("PolKitSession: refcount=%d uid=%d objpath=%s is_active=%d is_local=%d remote_host=%s",
session->refcount, session->uid,
session->ck_objref, session->is_active, session->is_local, session->remote_host);
if (session->seat != NULL)
- libpolkit_seat_debug (session->seat);
+ polkit_seat_debug (session->seat);
}
/**
- * libpolkit_session_validate:
+ * polkit_session_validate:
* @session: the object
*
* Validate the object
@@ -375,7 +375,7 @@ libpolkit_session_debug (PolKitSession *session)
* Returns: #TRUE iff the object is valid.
**/
polkit_bool_t
-libpolkit_session_validate (PolKitSession *session)
+polkit_session_validate (PolKitSession *session)
{
polkit_bool_t ret;
g_return_val_if_fail (session != NULL, FALSE);
diff --git a/polkit/polkit-session.h b/polkit/polkit-session.h
new file mode 100644
index 0000000000000000000000000000000000000000..3fb4ca033dbe47fa5b342319f9c5e1853c20175a
--- /dev/null
+++ b/polkit/polkit-session.h
@@ -0,0 +1,60 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
+/***************************************************************************
+ *
+ * polkit-session.h : sessions
+ *
+ * Copyright (C) 2007 David Zeuthen,
+ *
+ * Licensed under the Academic Free License version 2.1
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ **************************************************************************/
+
+#if !defined (POLKIT_COMPILATION) && !defined(_POLKIT_INSIDE_POLKIT_H)
+#error "Only can be included directly, this file may disappear or change contents."
+#endif
+
+#ifndef POLKIT_SESSION_H
+#define POLKIT_SESSION_H
+
+#include
+#include
+
+#include
+
+struct PolKitSession;
+typedef struct PolKitSession PolKitSession;
+
+PolKitSession *polkit_session_new (void);
+PolKitSession *polkit_session_ref (PolKitSession *session);
+void polkit_session_unref (PolKitSession *session);
+polkit_bool_t polkit_session_set_uid (PolKitSession *session, uid_t uid);
+polkit_bool_t polkit_session_set_seat (PolKitSession *session, PolKitSeat *seat);
+polkit_bool_t polkit_session_set_ck_objref (PolKitSession *session, const char *ck_objref);
+polkit_bool_t polkit_session_set_ck_is_active (PolKitSession *session, polkit_bool_t is_active);
+polkit_bool_t polkit_session_set_ck_is_local (PolKitSession *session, polkit_bool_t is_local);
+polkit_bool_t polkit_session_set_ck_remote_host (PolKitSession *session, const char *remote_host);
+polkit_bool_t polkit_session_get_uid (PolKitSession *session, uid_t *out_uid);
+polkit_bool_t polkit_session_get_seat (PolKitSession *session, PolKitSeat **out_seat);
+polkit_bool_t polkit_session_get_ck_objref (PolKitSession *session, char **out_ck_objref);
+polkit_bool_t polkit_session_get_ck_is_active (PolKitSession *session, polkit_bool_t *out_is_active);
+polkit_bool_t polkit_session_get_ck_is_local (PolKitSession *session, polkit_bool_t *out_is_local);
+polkit_bool_t polkit_session_get_ck_remote_host (PolKitSession *session, char **out_remote_host);
+
+void polkit_session_debug (PolKitSession *session);
+polkit_bool_t polkit_session_validate (PolKitSession *session);
+
+#endif /* POLKIT_SESSION_H */
diff --git a/libpolkit/libpolkit-types.h b/polkit/polkit-types.h
similarity index 83%
rename from libpolkit/libpolkit-types.h
rename to polkit/polkit-types.h
index 75b4679361e25cb57d2e34b7302e689d66b6ecd5..c344161c8433f80af284f76ff89053456ae6284c 100644
--- a/libpolkit/libpolkit-types.h
+++ b/polkit/polkit-types.h
@@ -1,7 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/***************************************************************************
*
- * libpolkit-types.h : fundamental types such as polkit_bool_t
+ * polkit-types.h : fundamental types such as polkit_bool_t
*
* Copyright (C) 2007 David Zeuthen,
*
@@ -24,14 +24,14 @@
**************************************************************************/
#if !defined (POLKIT_COMPILATION) && !defined(_POLKIT_INSIDE_POLKIT_H)
-#error "Only can be included directly, this file may disappear or change contents."
+#error "Only can be included directly, this file may disappear or change contents."
#endif
-#ifndef LIBPOLKIT_TYPES_H
-#define LIBPOLKIT_TYPES_H
+#ifndef POLKIT_TYPES_H
+#define POLKIT_TYPES_H
/**
- * SECTION:libpolkit-types
+ * SECTION:polkit-types
* @short_description: Basic types.
*
* Typedefs for common primitive types.
@@ -51,6 +51,6 @@ typedef int polkit_bool_t;
# define FALSE 0
#endif
-#endif /* LIBPOLKIT_TYPES_H */
+#endif /* POLKIT_TYPES_H */
diff --git a/libpolkit/libpolkit-utils.c b/polkit/polkit-utils.c
similarity index 94%
rename from libpolkit/libpolkit-utils.c
rename to polkit/polkit-utils.c
index c0aca7dd0e050ef16e5d7a194097c2895dee89bd..9b51a53a967b798c76aa5c099c5cd413463a1ff5 100644
--- a/libpolkit/libpolkit-utils.c
+++ b/polkit/polkit-utils.c
@@ -1,7 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/***************************************************************************
*
- * libpolkit-utils.c : internal utilities used in libpolkit
+ * polkit-utils.c : internal utilities used in polkit
*
* Copyright (C) 2007 David Zeuthen,
*
@@ -35,14 +35,14 @@
#include
#include
-#include "libpolkit-utils.h"
-#include "libpolkit-debug.h"
+#include "polkit-utils.h"
+#include "polkit-debug.h"
/**
- * SECTION:libpolkit-utils
- * @short_description: Internal utility functions for libpolkit.
+ * SECTION:polkit-utils
+ * @short_description: Internal utility functions for polkit.
*
- * Internal utility functions for libpolkit.
+ * Internal utility functions for polkit.
**/
/**
diff --git a/libpolkit/libpolkit-utils.h b/polkit/polkit-utils.h
similarity index 86%
rename from libpolkit/libpolkit-utils.h
rename to polkit/polkit-utils.h
index 00512c6181b3d06b9f12ea08489ea8269a098ab7..5dee85396535f3ac80877e784c45ae964ca4e7e4 100644
--- a/libpolkit/libpolkit-utils.h
+++ b/polkit/polkit-utils.h
@@ -1,7 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/***************************************************************************
*
- * libpolkit-utils.h : internal utilities used in libpolkit
+ * polkit-utils.h : internal utilities used in polkit
*
* Copyright (C) 2007 David Zeuthen,
*
@@ -23,15 +23,15 @@
*
**************************************************************************/
-#ifndef LIBPOLKIT_UTILS_H
-#define LIBPOLKIT_UTILS_H
+#ifndef POLKIT_UTILS_H
+#define POLKIT_UTILS_H
-#include
+#include
polkit_bool_t _pk_validate_identifier (const char *identifier);
polkit_bool_t _pk_validate_unique_bus_name (const char *unique_bus_name);
-#endif /* LIBPOLKIT_UTILS_H */
+#endif /* POLKIT_UTILS_H */
diff --git a/libpolkit/libpolkit.h b/polkit/polkit.h
similarity index 61%
rename from libpolkit/libpolkit.h
rename to polkit/polkit.h
index 889b00d0bb5a558ce0a9d1b008352f404c322179..3ce694793fcafed9332cd50849196e6837a3b2b8 100644
--- a/libpolkit/libpolkit.h
+++ b/polkit/polkit.h
@@ -1,7 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/***************************************************************************
*
- * libpolkit.h : library for querying system-wide policy
+ * polkit.h : library for querying system-wide policy
*
* Copyright (C) 2007 David Zeuthen,
*
@@ -23,26 +23,26 @@
*
**************************************************************************/
-#ifndef LIBPOLKIT_H
-#define LIBPOLKIT_H
+#ifndef POLKIT_H
+#define POLKIT_H
#define _POLKIT_INSIDE_POLKIT_H 1
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
#undef _POLKIT_INSIDE_POLKIT_H
-#endif /* LIBPOLKIT_H */
+#endif /* POLKIT_H */
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 4524d705c345d271d5832f19f00d7dcc16ea816f..eddca371f0caabd41bd1e8ad0e877f36ebf4925f 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -14,16 +14,16 @@ INCLUDES = \
bin_PROGRAMS = polkit-check-caller polkit-check-session polkit-policy-file-validate polkit-grant
polkit_check_caller_SOURCES = polkit-check-caller.c
-polkit_check_caller_LDADD = @GLIB_LIBS@ @DBUS_LIBS@ $(top_builddir)/libpolkit/libpolkit.la $(top_builddir)/libpolkit-dbus/libpolkit-dbus.la
+polkit_check_caller_LDADD = @GLIB_LIBS@ @DBUS_LIBS@ $(top_builddir)/polkit/libpolkit.la $(top_builddir)/polkit-dbus/libpolkit-dbus.la
polkit_check_session_SOURCES = polkit-check-session.c
-polkit_check_session_LDADD = @GLIB_LIBS@ @DBUS_LIBS@ $(top_builddir)/libpolkit/libpolkit.la $(top_builddir)/libpolkit-dbus/libpolkit-dbus.la
+polkit_check_session_LDADD = @GLIB_LIBS@ @DBUS_LIBS@ $(top_builddir)/polkit/libpolkit.la $(top_builddir)/polkit-dbus/libpolkit-dbus.la
polkit_policy_file_validate_SOURCES = polkit-policy-file-validate.c
-polkit_policy_file_validate_LDADD = $(top_builddir)/libpolkit/libpolkit.la
+polkit_policy_file_validate_LDADD = $(top_builddir)/polkit/libpolkit.la
polkit_grant_SOURCES = polkit-grant.c
-polkit_grant_LDADD = @GLIB_LIBS@ @DBUS_LIBS@ $(top_builddir)/libpolkit/libpolkit.la $(top_builddir)/libpolkit-grant/libpolkit-grant.la $(top_builddir)/libpolkit-dbus/libpolkit-dbus.la
+polkit_grant_LDADD = @GLIB_LIBS@ @DBUS_LIBS@ $(top_builddir)/polkit/libpolkit.la $(top_builddir)/polkit-grant/libpolkit-grant.la $(top_builddir)/polkit-dbus/libpolkit-dbus.la
clean-local :
rm -f *~
diff --git a/tools/polkit-check-caller.c b/tools/polkit-check-caller.c
index 304a28209ee01bd1e3598bc2dd22d90fa17f5159..bfb3ffa53ae12c0232d65e0c0f51b51243181d29 100644
--- a/tools/polkit-check-caller.c
+++ b/tools/polkit-check-caller.c
@@ -35,7 +35,7 @@
#include
#include
-#include
+#include
#include
@@ -149,30 +149,30 @@ main (int argc, char *argv[])
}
p_error = NULL;
- pol_ctx = libpolkit_context_new ();
- if (!libpolkit_context_init (pol_ctx, &p_error)) {
- fprintf (stderr, "error: libpolkit_context_init: %s\n", polkit_error_get_error_message (p_error));
+ pol_ctx = polkit_context_new ();
+ if (!polkit_context_init (pol_ctx, &p_error)) {
+ fprintf (stderr, "error: polkit_context_init: %s\n", polkit_error_get_error_message (p_error));
polkit_error_free (p_error);
return 1;
}
- action = libpolkit_action_new ();
- libpolkit_action_set_action_id (action, action_id);
+ action = polkit_action_new ();
+ polkit_action_set_action_id (action, action_id);
- resource = libpolkit_resource_new ();
- libpolkit_resource_set_resource_type (resource, resource_type);
- libpolkit_resource_set_resource_id (resource, resource_id);
+ resource = polkit_resource_new ();
+ polkit_resource_set_resource_type (resource, resource_type);
+ polkit_resource_set_resource_id (resource, resource_id);
- caller = libpolkit_caller_new_from_dbus_name (bus, dbus_name, &error);
+ caller = polkit_caller_new_from_dbus_name (bus, dbus_name, &error);
if (caller == NULL) {
if (dbus_error_is_set (&error)) {
- fprintf (stderr, "error: libpolkit_caller_new_from_dbus_name(): %s: %s\n",
+ fprintf (stderr, "error: polkit_caller_new_from_dbus_name(): %s: %s\n",
error.name, error.message);
return 1;
}
}
- allowed = libpolkit_context_can_caller_access_resource (pol_ctx, action, resource, caller);
+ allowed = polkit_context_can_caller_access_resource (pol_ctx, action, resource, caller);
if (allowed)
return 0;
diff --git a/tools/polkit-check-session.c b/tools/polkit-check-session.c
index 609e8db5775d60e97c4c7ce5a6a553c3f1e23819..b23273739181bc9e9694bf71691d26606a9c36ed 100644
--- a/tools/polkit-check-session.c
+++ b/tools/polkit-check-session.c
@@ -35,7 +35,7 @@
#include
#include
-#include
+#include
#include
@@ -152,35 +152,35 @@ main (int argc, char *argv[])
}
p_error = NULL;
- pol_ctx = libpolkit_context_new ();
- if (!libpolkit_context_init (pol_ctx, &p_error)) {
- fprintf (stderr, "error: libpolkit_context_init: %s\n", polkit_error_get_error_message (p_error));
+ pol_ctx = polkit_context_new ();
+ if (!polkit_context_init (pol_ctx, &p_error)) {
+ fprintf (stderr, "error: polkit_context_init: %s\n", polkit_error_get_error_message (p_error));
polkit_error_free (p_error);
return 1;
}
if (session_id != NULL) {
- session = libpolkit_session_new_from_objpath (bus, session_id, -1, &error);
+ session = polkit_session_new_from_objpath (bus, session_id, -1, &error);
} else {
if (cookie == NULL) {
fprintf (stderr, "Not part of a session. Try --session instead.\n");
return 1;
}
- session = libpolkit_session_new_from_cookie (bus, cookie, &error);
+ session = polkit_session_new_from_cookie (bus, cookie, &error);
}
if (session == NULL) {
- fprintf (stderr, "error: libpolkit_session_new_from_objpath: %s: %s\n", error.name, error.message);
+ fprintf (stderr, "error: polkit_session_new_from_objpath: %s: %s\n", error.name, error.message);
return 1;
}
- action = libpolkit_action_new ();
- libpolkit_action_set_action_id (action, action_id);
+ action = polkit_action_new ();
+ polkit_action_set_action_id (action, action_id);
- resource = libpolkit_resource_new ();
- libpolkit_resource_set_resource_type (resource, resource_type);
- libpolkit_resource_set_resource_id (resource, resource_id);
+ resource = polkit_resource_new ();
+ polkit_resource_set_resource_type (resource, resource_type);
+ polkit_resource_set_resource_id (resource, resource_id);
- allowed = libpolkit_context_can_session_access_resource (pol_ctx, action, resource, session);
+ allowed = polkit_context_can_session_access_resource (pol_ctx, action, resource, session);
if (allowed)
return 0;
diff --git a/tools/polkit-grant.c b/tools/polkit-grant.c
index d993b5fa7d22d606a119ebd3fe197b6c692ee3fc..0c5181df9cc6f51a5b0fa907393bd254a6f36296 100644
--- a/tools/polkit-grant.c
+++ b/tools/polkit-grant.c
@@ -37,8 +37,8 @@
#include
#include
-#include
-#include
+#include
+#include
#include
@@ -71,15 +71,15 @@ static void
conversation_type (PolKitGrant *polkit_grant, PolKitResult auth_type, void *user_data)
{
switch (auth_type) {
- case LIBPOLKIT_RESULT_ONLY_VIA_ROOT_AUTH:
- case LIBPOLKIT_RESULT_ONLY_VIA_ROOT_AUTH_KEEP_SESSION:
- case LIBPOLKIT_RESULT_ONLY_VIA_ROOT_AUTH_KEEP_ALWAYS:
+ case POLKIT_RESULT_ONLY_VIA_ROOT_AUTH:
+ case POLKIT_RESULT_ONLY_VIA_ROOT_AUTH_KEEP_SESSION:
+ case POLKIT_RESULT_ONLY_VIA_ROOT_AUTH_KEEP_ALWAYS:
printf ("Authentication as root is required.\n");
break;
- case LIBPOLKIT_RESULT_ONLY_VIA_SELF_AUTH:
- case LIBPOLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_SESSION:
- case LIBPOLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_ALWAYS:
+ case POLKIT_RESULT_ONLY_VIA_SELF_AUTH:
+ case POLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_SESSION:
+ case POLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_ALWAYS:
printf ("Authentication is required.\n");
break;
@@ -154,11 +154,11 @@ conversation_override_grant_type (PolKitGrant *polkit_grant, PolKitResult auth_t
PolKitResult overridden_auth_type;
switch (auth_type) {
- case LIBPOLKIT_RESULT_ONLY_VIA_ROOT_AUTH:
- case LIBPOLKIT_RESULT_ONLY_VIA_SELF_AUTH:
+ case POLKIT_RESULT_ONLY_VIA_ROOT_AUTH:
+ case POLKIT_RESULT_ONLY_VIA_SELF_AUTH:
break;
- case LIBPOLKIT_RESULT_ONLY_VIA_ROOT_AUTH_KEEP_SESSION:
- case LIBPOLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_SESSION:
+ case POLKIT_RESULT_ONLY_VIA_ROOT_AUTH_KEEP_SESSION:
+ case POLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_SESSION:
printf ("Keep this privilege for the session? [no/session]?\n");
getline (&lineptr, &linelen, stdin);
if (g_str_has_prefix (lineptr, "no")) {
@@ -171,8 +171,8 @@ conversation_override_grant_type (PolKitGrant *polkit_grant, PolKitResult auth_t
}
free (lineptr);
break;
- case LIBPOLKIT_RESULT_ONLY_VIA_ROOT_AUTH_KEEP_ALWAYS:
- case LIBPOLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_ALWAYS:
+ case POLKIT_RESULT_ONLY_VIA_ROOT_AUTH_KEEP_ALWAYS:
+ case POLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_ALWAYS:
printf ("Keep this privilege for the session or always? [no/session/always]?\n");
getline (&lineptr, &linelen, stdin);
if (g_str_has_prefix (lineptr, "no")) {
@@ -193,24 +193,24 @@ conversation_override_grant_type (PolKitGrant *polkit_grant, PolKitResult auth_t
}
switch (auth_type) {
- case LIBPOLKIT_RESULT_ONLY_VIA_ROOT_AUTH:
- case LIBPOLKIT_RESULT_ONLY_VIA_ROOT_AUTH_KEEP_SESSION:
- case LIBPOLKIT_RESULT_ONLY_VIA_ROOT_AUTH_KEEP_ALWAYS:
- overridden_auth_type = LIBPOLKIT_RESULT_ONLY_VIA_ROOT_AUTH;
+ case POLKIT_RESULT_ONLY_VIA_ROOT_AUTH:
+ case POLKIT_RESULT_ONLY_VIA_ROOT_AUTH_KEEP_SESSION:
+ case POLKIT_RESULT_ONLY_VIA_ROOT_AUTH_KEEP_ALWAYS:
+ overridden_auth_type = POLKIT_RESULT_ONLY_VIA_ROOT_AUTH;
if (keep_session)
- overridden_auth_type = LIBPOLKIT_RESULT_ONLY_VIA_ROOT_AUTH_KEEP_SESSION;
+ overridden_auth_type = POLKIT_RESULT_ONLY_VIA_ROOT_AUTH_KEEP_SESSION;
else if (keep_always)
- overridden_auth_type = LIBPOLKIT_RESULT_ONLY_VIA_ROOT_AUTH_KEEP_ALWAYS;
+ overridden_auth_type = POLKIT_RESULT_ONLY_VIA_ROOT_AUTH_KEEP_ALWAYS;
break;
- case LIBPOLKIT_RESULT_ONLY_VIA_SELF_AUTH:
- case LIBPOLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_SESSION:
- case LIBPOLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_ALWAYS:
- overridden_auth_type = LIBPOLKIT_RESULT_ONLY_VIA_SELF_AUTH;
+ case POLKIT_RESULT_ONLY_VIA_SELF_AUTH:
+ case POLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_SESSION:
+ case POLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_ALWAYS:
+ overridden_auth_type = POLKIT_RESULT_ONLY_VIA_SELF_AUTH;
if (keep_session)
- overridden_auth_type = LIBPOLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_SESSION;
+ overridden_auth_type = POLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_SESSION;
else if (keep_always)
- overridden_auth_type = LIBPOLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_ALWAYS;
+ overridden_auth_type = POLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_ALWAYS;
break;
default:
@@ -238,7 +238,7 @@ child_watch_func (GPid pid,
gpointer user_data)
{
PolKitGrant *polkit_grant = user_data;
- libpolkit_grant_child_func (polkit_grant, pid, WEXITSTATUS (status));
+ polkit_grant_child_func (polkit_grant, pid, WEXITSTATUS (status));
}
static int
@@ -253,7 +253,7 @@ io_watch_have_data (GIOChannel *channel, GIOCondition condition, gpointer user_d
int fd;
PolKitGrant *polkit_grant = user_data;
fd = g_io_channel_unix_get_fd (channel);
- libpolkit_grant_io_func (polkit_grant, fd);
+ polkit_grant_io_func (polkit_grant, fd);
return TRUE;
}
@@ -368,31 +368,31 @@ main (int argc, char *argv[])
}
p_error = NULL;
- pol_ctx = libpolkit_context_new ();
- if (!libpolkit_context_init (pol_ctx, &p_error)) {
- fprintf (stderr, "error: libpolkit_context_init: %s\n", polkit_error_get_error_message (p_error));
+ pol_ctx = polkit_context_new ();
+ if (!polkit_context_init (pol_ctx, &p_error)) {
+ fprintf (stderr, "error: polkit_context_init: %s\n", polkit_error_get_error_message (p_error));
polkit_error_free (p_error);
goto error;
}
- action = libpolkit_action_new ();
- libpolkit_action_set_action_id (action, action_id);
+ action = polkit_action_new ();
+ polkit_action_set_action_id (action, action_id);
- resource = libpolkit_resource_new ();
- libpolkit_resource_set_resource_type (resource, resource_type);
- libpolkit_resource_set_resource_id (resource, resource_id);
+ resource = polkit_resource_new ();
+ polkit_resource_set_resource_type (resource, resource_type);
+ polkit_resource_set_resource_id (resource, resource_id);
- caller = libpolkit_caller_new_from_dbus_name (bus, dbus_bus_get_unique_name (bus), &error);
+ caller = polkit_caller_new_from_dbus_name (bus, dbus_bus_get_unique_name (bus), &error);
if (caller == NULL) {
if (dbus_error_is_set (&error)) {
- fprintf (stderr, "error: libpolkit_caller_new_from_dbus_name(): %s: %s\n",
+ fprintf (stderr, "error: polkit_caller_new_from_dbus_name(): %s: %s\n",
error.name, error.message);
goto error;
}
}
- polkit_grant = libpolkit_grant_new ();
- libpolkit_grant_set_functions (polkit_grant,
+ polkit_grant = polkit_grant_new ();
+ polkit_grant_set_functions (polkit_grant,
add_io_watch,
add_child_watch,
remove_watch,
@@ -405,7 +405,7 @@ main (int argc, char *argv[])
conversation_done,
&ud);
- if (!libpolkit_grant_initiate_auth (polkit_grant,
+ if (!polkit_grant_initiate_auth (polkit_grant,
action,
resource,
caller)) {
@@ -414,7 +414,7 @@ main (int argc, char *argv[])
goto error;
}
g_main_loop_run (ud.loop);
- libpolkit_grant_unref (polkit_grant);
+ polkit_grant_unref (polkit_grant);
printf ("Privilege grant done.. result=%d\n", ud.gained_privilege);
diff --git a/tools/polkit-policy-file-validate.c b/tools/polkit-policy-file-validate.c
index 3d2353dc68d827b5885f4337a7ea32c8b06e9c14..4bd1d7677c406f89028e290a472d62b04d2450e8 100644
--- a/tools/polkit-policy-file-validate.c
+++ b/tools/polkit-policy-file-validate.c
@@ -36,7 +36,7 @@
#include
#include
-#include
+#include
static void
usage (int argc, char *argv[])
@@ -61,13 +61,13 @@ validate_file (const char *file)
PolKitError *error;
error = NULL;
- priv_file = libpolkit_policy_file_new (file, &error);
+ priv_file = polkit_policy_file_new (file, &error);
if (priv_file == NULL) {
printf ("%s did not validate: %s\n", file, polkit_error_get_error_message (error));
polkit_error_free (error);
return FALSE;
}
- libpolkit_policy_file_unref (priv_file);
+ polkit_policy_file_unref (priv_file);
return TRUE;
}