PolicyKit: Branch 'master'

David Zeuthen david at kemper.freedesktop.org
Sun Oct 28 19:08:04 PDT 2007


 polkit-dbus/Makefile.am                    |    1 
 polkit-dbus/polkit-explicit-grant-helper.c |    4 -
 polkit/Makefile.am                         |    3 
 polkit/polkit-authorization-constraint.c   |    3 
 polkit/polkit-authorization-db-dummy.c     |    3 
 polkit/polkit-authorization-db.c           |   12 ---
 polkit/polkit-authorization.c              |    5 -
 polkit/polkit-context.c                    |    6 -
 polkit/polkit-policy-cache.c               |    3 
 polkit/polkit-policy-default.c             |    5 -
 polkit/polkit-policy-file-entry.c          |   17 -----
 polkit/polkit-policy-file.c                |   12 ---
 polkit/polkit-private.h                    |   92 +++++++++++++++++++++++++++++
 13 files changed, 105 insertions(+), 61 deletions(-)

New commits:
commit f2bc78386792a32f47a688029245d5ba2a1ecae5
Author: David Zeuthen <davidz at redhat.com>
Date:   Sun Oct 28 22:06:25 2007 -0400

    move all private functions into a private header file

diff --git a/polkit-dbus/Makefile.am b/polkit-dbus/Makefile.am
index 194bf02..754cbd2 100644
--- a/polkit-dbus/Makefile.am
+++ b/polkit-dbus/Makefile.am
@@ -10,6 +10,7 @@ INCLUDES = \
 	-DPACKAGE_LOCALE_DIR=\""$(localedir)"\" \
 	-DPACKAGE_LIB_DIR=\""$(libdir)"\" \
 	-D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT	\
+	-DPOLKIT_COMPILATION \
 	@GLIB_CFLAGS@ @DBUS_CFLAGS@
 
 lib_LTLIBRARIES=libpolkit-dbus.la
diff --git a/polkit-dbus/polkit-explicit-grant-helper.c b/polkit-dbus/polkit-explicit-grant-helper.c
index 401f1c5..45f2bc4 100644
--- a/polkit-dbus/polkit-explicit-grant-helper.c
+++ b/polkit-dbus/polkit-explicit-grant-helper.c
@@ -45,6 +45,7 @@
 #include <fcntl.h>
 
 #include <polkit-dbus/polkit-dbus.h>
+#include <polkit/polkit-private.h>
 
 static polkit_bool_t
 check_pid_for_authorization (pid_t caller_pid, const char *action_id)
@@ -108,9 +109,6 @@ out:
         return ret;
 }
 
-/* this function is in polkit/polkit-authorization-db.c */
-extern polkit_bool_t _polkit_authorization_db_auth_file_add (const char *root, polkit_bool_t transient, uid_t uid, char *str_to_add);
-
 int
 main (int argc, char *argv[])
 {
diff --git a/polkit/Makefile.am b/polkit/Makefile.am
index 7c409d5..b507125 100644
--- a/polkit/Makefile.am
+++ b/polkit/Makefile.am
@@ -38,7 +38,8 @@ libpolkitinclude_HEADERS =              		\
 
 libpolkit_la_SOURCES =                                					\
 	polkit.h									\
-						polkit-types.h				\
+	polkit-private.h								\
+	polkit-types.h									\
 	polkit-error.h				polkit-error.c				\
 	polkit-result.h				polkit-result.c				\
 	polkit-context.h			polkit-context.c			\
diff --git a/polkit/polkit-authorization-constraint.c b/polkit/polkit-authorization-constraint.c
index db82896..633ac48 100644
--- a/polkit/polkit-authorization-constraint.c
+++ b/polkit/polkit-authorization-constraint.c
@@ -41,6 +41,7 @@
 #include "polkit-debug.h"
 #include "polkit-authorization-constraint.h"
 #include "polkit-utils.h"
+#include "polkit-private.h"
 
 /**
  * SECTION:polkit-authorization-constraint
@@ -80,8 +81,6 @@ static PolKitAuthorizationConstraint _local_active_constraint = {-1,
                                                                  POLKIT_AUTHORIZATION_CONSTRAINT_REQUIRE_LOCAL |
                                                                  POLKIT_AUTHORIZATION_CONSTRAINT_REQUIRE_ACTIVE};
 
-extern PolKitAuthorizationConstraint *_polkit_authorization_constraint_new (const char *entry_in_auth_file);
-
 PolKitAuthorizationConstraint *
 _polkit_authorization_constraint_new (const char *entry_in_auth_file)
 {
diff --git a/polkit/polkit-authorization-db-dummy.c b/polkit/polkit-authorization-db-dummy.c
index ed79de5..6fc093c 100644
--- a/polkit/polkit-authorization-db-dummy.c
+++ b/polkit/polkit-authorization-db-dummy.c
@@ -45,9 +45,6 @@
 #include "polkit-authorization-db.h"
 #include "polkit-utils.h"
 
-extern PolKitAuthorizationDB *_polkit_authorization_db_new              (void);
-extern void                   _polkit_authorization_db_invalidate_cache (PolKitAuthorizationDB *authdb);
-
 struct _PolKitAuthorizationDB
 {
         int refcount;
diff --git a/polkit/polkit-authorization-db.c b/polkit/polkit-authorization-db.c
index 37a5c05..0afe466 100644
--- a/polkit/polkit-authorization-db.c
+++ b/polkit/polkit-authorization-db.c
@@ -44,9 +44,7 @@
 #include "polkit-debug.h"
 #include "polkit-authorization-db.h"
 #include "polkit-utils.h"
-
-extern PolKitAuthorizationDB *_polkit_authorization_db_new            (void);
-extern void                   _polkit_authorization_db_invalidate_cache (PolKitAuthorizationDB *authdb);
+#include "polkit-private.h"
 
 /**
  * SECTION:polkit-authorization-db
@@ -272,8 +270,6 @@ out:
         return start_time;
 }
 
-extern PolKitAuthorization *_polkit_authorization_new_for_uid (const char *entry_in_auth_file, uid_t uid);
-
 /**
  * _authdb_get_auths_for_uid:
  * @authdb: authorization database
@@ -819,9 +815,6 @@ out:
         return ret;
 }
 
-/* this function is also used by polkit-dbus/polkit-explicit-grant-helper */
-extern polkit_bool_t _polkit_authorization_db_auth_file_add (const char *root, polkit_bool_t transient, uid_t uid, char *str_to_add);
-
 polkit_bool_t 
 _polkit_authorization_db_auth_file_add (const char *root, polkit_bool_t transient, uid_t uid, char *str_to_add)
 {
@@ -1181,9 +1174,6 @@ polkit_authorization_db_add_entry_always           (PolKitAuthorizationDB *authd
         return ret;
 }
 
-
-extern const char *_polkit_authorization_get_authfile_entry (PolKitAuthorization *auth);
-
 /**
  * polkit_authorization_db_revoke_entry:
  * @authdb: the authorization database
diff --git a/polkit/polkit-authorization.c b/polkit/polkit-authorization.c
index beb0394..1cd961d 100644
--- a/polkit/polkit-authorization.c
+++ b/polkit/polkit-authorization.c
@@ -41,6 +41,7 @@
 #include "polkit-debug.h"
 #include "polkit-authorization.h"
 #include "polkit-utils.h"
+#include "polkit-private.h"
 
 /**
  * SECTION:polkit-authorization
@@ -84,10 +85,6 @@ struct _PolKitAuthorization
         char *session_id;
 };
 
-extern PolKitAuthorization *_polkit_authorization_new_for_uid (const char *entry_in_auth_file, uid_t uid);
-
-extern const char *_polkit_authorization_get_authfile_entry (PolKitAuthorization *auth);
-
 const char *
 _polkit_authorization_get_authfile_entry (PolKitAuthorization *auth)
 {
diff --git a/polkit/polkit-context.c b/polkit/polkit-context.c
index 4c52cf8..07b69eb 100644
--- a/polkit/polkit-context.c
+++ b/polkit/polkit-context.c
@@ -43,9 +43,7 @@
 #include "polkit-debug.h"
 #include "polkit-context.h"
 #include "polkit-policy-cache.h"
-
-extern PolKitAuthorizationDB *_polkit_authorization_db_new            (void);
-extern void                   _polkit_authorization_db_invalidate_cache (PolKitAuthorizationDB *authdb);
+#include "polkit-private.h"
 
 /**
  * SECTION:polkit
@@ -388,8 +386,6 @@ polkit_context_set_load_descriptions  (PolKitContext *pk_context)
         pk_context->load_descriptions = TRUE;
 }
 
-extern PolKitPolicyCache     *_polkit_policy_cache_new       (const char *dirname, polkit_bool_t load_descriptions, PolKitError **error);
-
 /**
  * polkit_context_get_policy_cache:
  * @pk_context: the context
diff --git a/polkit/polkit-policy-cache.c b/polkit/polkit-policy-cache.c
index a786262..fb81fab 100644
--- a/polkit/polkit-policy-cache.c
+++ b/polkit/polkit-policy-cache.c
@@ -41,6 +41,7 @@
 #include "polkit-debug.h"
 #include "polkit-policy-file.h"
 #include "polkit-policy-cache.h"
+#include "polkit-private.h"
 
 /**
  * SECTION:polkit-policy-cache
@@ -76,8 +77,6 @@ _append_entry (PolKitPolicyFile       *policy_file,
         policy_cache->priv_entries = g_slist_append (policy_cache->priv_entries, policy_file_entry);
 }
 
-extern PolKitPolicyCache *_polkit_policy_cache_new       (const char *dirname, polkit_bool_t load_descriptions, PolKitError **error);
-
 PolKitPolicyCache *
 _polkit_policy_cache_new (const char *dirname, polkit_bool_t load_descriptions, PolKitError **error)
 {
diff --git a/polkit/polkit-policy-default.c b/polkit/polkit-policy-default.c
index 566b82d..f51a966 100644
--- a/polkit/polkit-policy-default.c
+++ b/polkit/polkit-policy-default.c
@@ -40,6 +40,7 @@
 #include "polkit-debug.h"
 #include "polkit-error.h"
 #include "polkit-policy-default.h"
+#include "polkit-private.h"
 
 /**
  * SECTION:polkit-policy-default
@@ -63,10 +64,6 @@ struct _PolKitPolicyDefault
         PolKitResult default_active;
 };
 
-extern PolKitPolicyDefault *_polkit_policy_default_new (PolKitResult defaults_allow_any,
-                                                        PolKitResult defaults_allow_inactive,
-                                                        PolKitResult defaults_allow_active);
-
 PolKitPolicyDefault *
 _polkit_policy_default_new (PolKitResult defaults_allow_any,
                             PolKitResult defaults_allow_inactive,
diff --git a/polkit/polkit-policy-file-entry.c b/polkit/polkit-policy-file-entry.c
index d9c62ae..71dbca4 100644
--- a/polkit/polkit-policy-file-entry.c
+++ b/polkit/polkit-policy-file-entry.c
@@ -42,6 +42,7 @@
 #include "polkit-result.h"
 #include "polkit-policy-file-entry.h"
 #include "polkit-authorization-db.h"
+#include "polkit-private.h"
 
 /**
  * SECTION:polkit-policy-file-entry
@@ -68,23 +69,9 @@ struct _PolKitPolicyFileEntry
         GHashTable *annotations;
 };
 
-extern void _polkit_policy_file_entry_set_descriptions (PolKitPolicyFileEntry *pfe,
-                                                        const char *policy_description,
-                                                        const char *policy_message);
-
-
-extern PolKitPolicyDefault *_polkit_policy_default_new (PolKitResult defaults_allow_any,
-                                                        PolKitResult defaults_allow_inactive,
-                                                        PolKitResult defaults_allow_active);
-
-extern PolKitPolicyFileEntry *_polkit_policy_file_entry_new   (const char *action_id, 
-                                                               PolKitResult defaults_allow_any,
-                                                               PolKitResult defaults_allow_inactive,
-                                                               PolKitResult defaults_allow_active,
-                                                               GHashTable *annotations);
 
 /* NOTE: we take ownership of the annotations object */
-extern PolKitPolicyFileEntry *
+PolKitPolicyFileEntry *
 _polkit_policy_file_entry_new   (const char *action_id, 
                                  PolKitResult defaults_allow_any,
                                  PolKitResult defaults_allow_inactive,
diff --git a/polkit/polkit-policy-file.c b/polkit/polkit-policy-file.c
index 73ca781..1ee1cd5 100644
--- a/polkit/polkit-policy-file.c
+++ b/polkit/polkit-policy-file.c
@@ -45,6 +45,7 @@
 #include "polkit-policy-file.h"
 #include "polkit-policy-file-entry.h"
 #include "polkit-debug.h"
+#include "polkit-private.h"
 
 /**
  * SECTION:polkit-policy-file
@@ -66,12 +67,6 @@ struct _PolKitPolicyFile
         GSList *entries;
 };
 
-extern PolKitPolicyFileEntry *_polkit_policy_file_entry_new   (const char *action_id, 
-                                                               PolKitResult defaults_allow_any,
-                                                               PolKitResult defaults_allow_inactive,
-                                                               PolKitResult defaults_allow_active,
-                                                               GHashTable *annotations);
-
 enum {
         STATE_NONE,
         STATE_UNKNOWN_TAG,
@@ -308,11 +303,6 @@ error:
         XML_StopParser (pd->parser, FALSE);
 }
 
-
-extern void _polkit_policy_file_entry_set_descriptions (PolKitPolicyFileEntry *pfe,
-                                                        const char *policy_description,
-                                                        const char *policy_message);
-
 /**
  * _localize:
  * @translations: a mapping from xml:lang to the value, e.g. 'da' -> 'Smadre', 'en_CA' -> 'Punch, Aye!'
diff --git a/polkit/polkit-private.h b/polkit/polkit-private.h
new file mode 100644
index 0000000..3fd504b
--- /dev/null
+++ b/polkit/polkit-private.h
@@ -0,0 +1,92 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
+/***************************************************************************
+ *
+ * polkit-private.h : Private functions
+ *
+ * Copyright (C) 2007 David Zeuthen, <david at fubar.dk>
+ *
+ * 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)
+#error "This is a private file and shouldn't be included outside PolicyKit."
+#endif
+
+#ifndef POLKIT_PRIVATE_H
+#define POLKIT_PRIVATE_H
+
+#include <glib.h>
+#include <polkit/polkit.h>
+
+POLKIT_BEGIN_DECLS
+
+PolKitAuthorization *_polkit_authorization_new_for_uid (const char *entry_in_auth_file, uid_t uid);
+const char *_polkit_authorization_get_authfile_entry (PolKitAuthorization *auth);
+
+PolKitAuthorizationConstraint *_polkit_authorization_constraint_new (const char *entry_in_auth_file);
+
+PolKitAuthorizationDB *_polkit_authorization_db_new            (void);
+void                   _polkit_authorization_db_invalidate_cache (PolKitAuthorizationDB *authdb);
+
+PolKitAuthorization *_polkit_authorization_new_for_uid (const char *entry_in_auth_file, uid_t uid);
+
+polkit_bool_t _polkit_authorization_db_auth_file_add (const char *root, polkit_bool_t transient, uid_t uid, char *str_to_add);
+
+const char *_polkit_authorization_get_authfile_entry (PolKitAuthorization *auth);
+
+PolKitAuthorizationDB *_polkit_authorization_db_new            (void);
+void                   _polkit_authorization_db_invalidate_cache (PolKitAuthorizationDB *authdb);
+
+PolKitPolicyCache     *_polkit_policy_cache_new       (const char *dirname, polkit_bool_t load_descriptions, PolKitError **error);
+
+PolKitPolicyCache *_polkit_policy_cache_new       (const char *dirname, polkit_bool_t load_descriptions, PolKitError **error);
+
+PolKitPolicyDefault *_polkit_policy_default_new (PolKitResult defaults_allow_any,
+                                                 PolKitResult defaults_allow_inactive,
+                                                 PolKitResult defaults_allow_active);
+
+PolKitPolicyFileEntry *_polkit_policy_file_entry_new   (const char *action_id, 
+                                                        PolKitResult defaults_allow_any,
+                                                        PolKitResult defaults_allow_inactive,
+                                                        PolKitResult defaults_allow_active,
+                                                        GHashTable *annotations);
+
+void _polkit_policy_file_entry_set_descriptions (PolKitPolicyFileEntry *pfe,
+                                                 const char *policy_description,
+                                                 const char *policy_message);
+
+
+PolKitPolicyDefault *_polkit_policy_default_new (PolKitResult defaults_allow_any,
+                                                 PolKitResult defaults_allow_inactive,
+                                                 PolKitResult defaults_allow_active);
+
+PolKitPolicyFileEntry *_polkit_policy_file_entry_new   (const char *action_id, 
+                                                        PolKitResult defaults_allow_any,
+                                                        PolKitResult defaults_allow_inactive,
+                                                        PolKitResult defaults_allow_active,
+                                                        GHashTable *annotations);
+
+void _polkit_policy_file_entry_set_descriptions (PolKitPolicyFileEntry *pfe,
+                                                 const char *policy_description,
+                                                 const char *policy_message);
+
+
+POLKIT_END_DECLS
+
+#endif /* POLKIT_PRIVATE_H */
+


More information about the hal-commit mailing list