PolicyKit: Branch 'master'

David Zeuthen david at kemper.freedesktop.org
Tue Apr 15 18:05:35 PDT 2008


 src/polkit-dbus/Makefile.am                  |    9 ++--
 src/polkit-dbus/polkit-dbus.c                |    4 -
 src/polkit-grant/Makefile.am                 |   10 ++--
 src/polkit/Makefile.am                       |    3 -
 src/polkit/polkit-action.c                   |    2 
 src/polkit/polkit-authorization-constraint.c |    2 
 src/polkit/polkit-authorization-db.c         |    2 
 src/polkit/polkit-authorization.c            |   14 +++---
 src/polkit/polkit-caller.c                   |    4 -
 src/polkit/polkit-config.c                   |   44 ++++++++++-----------
 src/polkit/polkit-context.c                  |   56 +++++++++++++--------------
 src/polkit/polkit-debug.c                    |   10 ++--
 src/polkit/polkit-debug.h                    |    4 -
 src/polkit/polkit-policy-cache.c             |    8 +--
 src/polkit/polkit-policy-default.c           |   16 +++----
 src/polkit/polkit-policy-file-entry.c        |    6 +-
 src/polkit/polkit-policy-file.c              |    2 
 src/polkit/polkit-seat.c                     |    2 
 src/polkit/polkit-session.c                  |    6 +-
 src/polkit/polkit-utils.c                    |    6 +-
 tools/Makefile.am                            |    4 -
 21 files changed, 110 insertions(+), 104 deletions(-)

New commits:
commit 12582dad6560b2df9e3ea9e87a74419973908a47
Author: David Zeuthen <davidz at redhat.com>
Date:   Tue Apr 15 21:03:26 2008 -0400

    be careful about what symbols we export

diff --git a/src/polkit-dbus/Makefile.am b/src/polkit-dbus/Makefile.am
index 0d31275..9c2c69a 100644
--- a/src/polkit-dbus/Makefile.am
+++ b/src/polkit-dbus/Makefile.am
@@ -25,9 +25,10 @@ libpolkit_dbus_la_SOURCES =                                	\
 	polkit-dbus.h		polkit-dbus.c			\
 	polkit-simple.h		polkit-simple.c
 
-libpolkit_dbus_la_LIBADD = @DBUS_LIBS@ $(top_builddir)/src/polkit/libpolkit.la $(SELINUX_LIBS)
+libpolkit_dbus_la_LIBADD = @DBUS_LIBS@ $(top_builddir)/src/kit/libkit.la $(top_builddir)/src/polkit/libpolkit.la $(SELINUX_LIBS)
 
-libpolkit_dbus_la_LDFLAGS = -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) @R_DYNAMIC_LDFLAG@
+libpolkit_dbus_la_LDFLAGS = -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) @R_DYNAMIC_LDFLAG@ \
+		            -export-dynamic -no-undefined -export-symbols-regex '^polkit_.*'
 
 libexec_PROGRAMS = polkit-resolve-exe-helper
 
@@ -40,11 +41,11 @@ libexec_PROGRAMS += polkit-read-auth-helper polkit-set-default-helper
 
 polkit_read_auth_helper_SOURCES = polkit-read-auth-helper.c
 polkit_read_auth_helper_CFLAGS = @DBUS_CFLAGS@
-polkit_read_auth_helper_LDADD = $(top_builddir)/src/polkit/libpolkit.la libpolkit-dbus.la
+polkit_read_auth_helper_LDADD = $(top_builddir)/src/kit/libkit.la $(top_builddir)/src/polkit/libpolkit.la libpolkit-dbus.la
 
 polkit_set_default_helper_SOURCES = polkit-set-default-helper.c
 polkit_set_default_helper_CFLAGS = @DBUS_CFLAGS@
-polkit_set_default_helper_LDADD = $(top_builddir)/src/polkit/libpolkit.la libpolkit-dbus.la
+polkit_set_default_helper_LDADD = $(top_builddir)/src/kit/libkit.la $(top_builddir)/src/polkit/libpolkit.la libpolkit-dbus.la
 
 # polkit-read-auth-helper needs to be setgid $POLKIT_GROUP to be able
 # to read authorization files in /var/lib/PolicyKit and
diff --git a/src/polkit-dbus/polkit-dbus.c b/src/polkit-dbus/polkit-dbus.c
index dca4258..f7be03f 100644
--- a/src/polkit-dbus/polkit-dbus.c
+++ b/src/polkit-dbus/polkit-dbus.c
@@ -1277,8 +1277,8 @@ polkit_tracker_dbus_func (PolKitTracker *pk_tracker, DBusMessage *message)
 					    DBUS_TYPE_INVALID)) {
 
                         /* TODO: should be _pk_critical */
-                        _pk_debug ("The NameOwnerChanged signal on the " DBUS_INTERFACE_DBUS " "
-                                   "interface has the wrong signature! Your system is misconfigured.");
+                        polkit_debug ("The NameOwnerChanged signal on the " DBUS_INTERFACE_DBUS " "
+                                      "interface has the wrong signature! Your system is misconfigured.");
 			goto out;
 		}
 
diff --git a/src/polkit-grant/Makefile.am b/src/polkit-grant/Makefile.am
index e786fdb..6088ccd 100644
--- a/src/polkit-grant/Makefile.am
+++ b/src/polkit-grant/Makefile.am
@@ -32,9 +32,11 @@ if POLKIT_AUTHDB_DEFAULT
 libpolkit_grant_la_SOURCES += polkit-authorization-db-write.c
 endif
 
-libpolkit_grant_la_LIBADD = @GLIB_LIBS@ @DBUS_LIBS@ $(top_builddir)/src/polkit/libpolkit.la
+libpolkit_grant_la_LIBADD = @GLIB_LIBS@ @DBUS_LIBS@ $(top_builddir)/src/kit/libkit.la $(top_builddir)/src/polkit/libpolkit.la
+
+libpolkit_grant_la_LDFLAGS = -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) @R_DYNAMIC_LDFLAG@ \
+		             -export-dynamic -no-undefined -export-symbols-regex '(^polkit_.*|_polkit_authorization_db_auth_file_add)'
 
-libpolkit_grant_la_LDFLAGS = -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) @R_DYNAMIC_LDFLAG@
 
 # Only if the authdb backend has the capability POLKIT_AUTHORIZATION_DB_CAPABILITY_CAN_OBTAIN
 # then the backend must supply the /usr/libexec/polkit-grant-helper program.. also remember to
@@ -68,11 +70,11 @@ endif
 
 polkit_explicit_grant_helper_SOURCES = polkit-explicit-grant-helper.c
 polkit_explicit_grant_helper_CFLAGS = @DBUS_CFLAGS@
-polkit_explicit_grant_helper_LDADD = $(top_builddir)/src/polkit/libpolkit.la $(top_builddir)/src/polkit-dbus/libpolkit-dbus.la libpolkit-grant.la
+polkit_explicit_grant_helper_LDADD = $(top_builddir)/src/kit/libkit.la $(top_builddir)/src/polkit/libpolkit.la $(top_builddir)/src/polkit-dbus/libpolkit-dbus.la libpolkit-grant.la
 
 polkit_revoke_helper_SOURCES = polkit-revoke-helper.c
 polkit_revoke_helper_CFLAGS = @DBUS_CFLAGS@
-polkit_revoke_helper_LDADD = $(top_builddir)/src/polkit/libpolkit.la $(top_builddir)/src/polkit-dbus/libpolkit-dbus.la
+polkit_revoke_helper_LDADD = $(top_builddir)/src/kit/libkit.la $(top_builddir)/src/polkit/libpolkit.la $(top_builddir)/src/polkit-dbus/libpolkit-dbus.la
 
 # polkit-grant-helper needs to be setgid polkituser to be able to
 # write cookies to /var/lib/PolicyKit and /var/run/PolicyKit
diff --git a/src/polkit/Makefile.am b/src/polkit/Makefile.am
index 10c6590..da9a97e 100644
--- a/src/polkit/Makefile.am
+++ b/src/polkit/Makefile.am
@@ -73,7 +73,8 @@ endif
 
 libpolkit_la_LIBADD = @EXPAT_LIBS@ $(top_builddir)/src/kit/libkit.la
 
-libpolkit_la_LDFLAGS = -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) @R_DYNAMIC_LDFLAG@
+libpolkit_la_LDFLAGS = -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) @R_DYNAMIC_LDFLAG@ \
+	               -export-dynamic -no-undefined -export-symbols-regex '(^polkit_.*|_pk_validate_unique_bus_name)'
 
 ## note that TESTS has special meaning (stuff to use in make check)
 ## so if adding tests not to be run in make check, don't add them to 
diff --git a/src/polkit/polkit-action.c b/src/polkit/polkit-action.c
index 6a81e6a..01c054d 100644
--- a/src/polkit/polkit-action.c
+++ b/src/polkit/polkit-action.c
@@ -248,7 +248,7 @@ void
 polkit_action_debug (PolKitAction *action)
 {
         kit_return_if_fail (action != NULL);
-        _pk_debug ("PolKitAction: refcount=%d id=%s", action->refcount, action->id);
+        polkit_debug ("PolKitAction: refcount=%d id=%s", action->refcount, action->id);
 }
 
 /**
diff --git a/src/polkit/polkit-authorization-constraint.c b/src/polkit/polkit-authorization-constraint.c
index cf2b0d2..b12d467 100644
--- a/src/polkit/polkit-authorization-constraint.c
+++ b/src/polkit/polkit-authorization-constraint.c
@@ -171,7 +171,7 @@ void
 polkit_authorization_constraint_debug (PolKitAuthorizationConstraint *authc)
 {
         kit_return_if_fail (authc != NULL);
-        _pk_debug ("PolKitAuthorizationConstraint: refcount=%d type=%d", authc->refcount, authc->type);
+        polkit_debug ("PolKitAuthorizationConstraint: refcount=%d type=%d", authc->refcount, authc->type);
 }
 
 /**
diff --git a/src/polkit/polkit-authorization-db.c b/src/polkit/polkit-authorization-db.c
index 7ffdfe6..1e339b6 100644
--- a/src/polkit/polkit-authorization-db.c
+++ b/src/polkit/polkit-authorization-db.c
@@ -202,7 +202,7 @@ void
 polkit_authorization_db_debug (PolKitAuthorizationDB *authdb)
 {
         kit_return_if_fail (authdb != NULL);
-        _pk_debug ("PolKitAuthorizationDB: refcount=%d", authdb->refcount);
+        polkit_debug ("PolKitAuthorizationDB: refcount=%d", authdb->refcount);
 }
 
 /**
diff --git a/src/polkit/polkit-authorization.c b/src/polkit/polkit-authorization.c
index 5feda23..431fbb2 100644
--- a/src/polkit/polkit-authorization.c
+++ b/src/polkit/polkit-authorization.c
@@ -378,13 +378,13 @@ void
 polkit_authorization_debug (PolKitAuthorization *auth)
 {
         kit_return_if_fail (auth != NULL);
-        _pk_debug ("PolKitAuthorization: refcount=%d", auth->refcount);
-        _pk_debug (" scope          = %d",  auth->scope);
-        _pk_debug (" pid            = %d",  auth->pid);
-        _pk_debug (" pid_start_time = %Lu", auth->pid_start_time);
-        _pk_debug (" action_id      = %s",  auth->action_id);
-        _pk_debug (" when           = %Lu", (polkit_uint64_t) auth->when);
-        _pk_debug (" auth_as_uid    = %d",  auth->authenticated_as_uid);
+        polkit_debug ("PolKitAuthorization: refcount=%d", auth->refcount);
+        polkit_debug (" scope          = %d",  auth->scope);
+        polkit_debug (" pid            = %d",  auth->pid);
+        polkit_debug (" pid_start_time = %Lu", auth->pid_start_time);
+        polkit_debug (" action_id      = %s",  auth->action_id);
+        polkit_debug (" when           = %Lu", (polkit_uint64_t) auth->when);
+        polkit_debug (" auth_as_uid    = %d",  auth->authenticated_as_uid);
 }
 
 /**
diff --git a/src/polkit/polkit-caller.c b/src/polkit/polkit-caller.c
index e11659a..147bcdc 100644
--- a/src/polkit/polkit-caller.c
+++ b/src/polkit/polkit-caller.c
@@ -348,8 +348,8 @@ void
 polkit_caller_debug (PolKitCaller *caller)
 {
         kit_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);
+        polkit_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)
                 polkit_session_debug (caller->session);
 }
diff --git a/src/polkit/polkit-config.c b/src/polkit/polkit-config.c
index fd2ae30..1ae67e7 100644
--- a/src/polkit/polkit-config.c
+++ b/src/polkit/polkit-config.c
@@ -176,26 +176,26 @@ config_node_dump_real (ConfigNode *node, unsigned int indent)
         
         switch (node->node_type) {
         case NODE_TYPE_NOP:
-                _pk_debug ("%sNOP", buf);
+                polkit_debug ("%sNOP", buf);
                 break;
         case NODE_TYPE_TOP:
-                _pk_debug ("%sTOP", buf);
+                polkit_debug ("%sTOP", buf);
                 break;
         case NODE_TYPE_MATCH:
-                _pk_debug ("%sMATCH %s (%d) with '%s'", 
+                polkit_debug ("%sMATCH %s (%d) with '%s'", 
                            buf, 
                            match_names[node->data.node_match.match_type],
                            node->data.node_match.match_type,
                            node->data.node_match.data);
                 break;
         case NODE_TYPE_RETURN:
-                _pk_debug ("%sRETURN %s (%d)",
+                polkit_debug ("%sRETURN %s (%d)",
                            buf,
                            polkit_result_to_string_representation (node->data.node_return.result),
                            node->data.node_return.result);
                 break;
         case NODE_TYPE_DEFINE_ADMIN_AUTH:
-                _pk_debug ("%sDEFINE_ADMIN_AUTH %s (%d) with '%s'", 
+                polkit_debug ("%sDEFINE_ADMIN_AUTH %s (%d) with '%s'", 
                            buf, 
                            define_admin_auth_names[node->data.node_define_admin_auth.admin_type],
                            node->data.node_define_admin_auth.admin_type,
@@ -254,7 +254,7 @@ _start (void *data, const char *el, const char **attr)
         ParserData *pd = data;
         ConfigNode *node;
 
-        _pk_debug ("_start for node '%s' (at depth=%d)", el, pd->stack_depth);
+        polkit_debug ("_start for node '%s' (at depth=%d)", el, pd->stack_depth);
 
         for (num_attr = 0; attr[num_attr] != NULL; num_attr++)
                 ;
@@ -267,10 +267,10 @@ _start (void *data, const char *el, const char **attr)
         case STATE_NONE:
                 if (strcmp (el, "config") == 0) {
                         state = STATE_IN_CONFIG;
-                        _pk_debug ("parsed config node");
+                        polkit_debug ("parsed config node");
 
                         if (pd->pk_config->top_config_node != NULL) {
-                                _pk_debug ("Multiple config nodes?");
+                                polkit_debug ("Multiple config nodes?");
                                 goto error;
                         }
 
@@ -288,18 +288,18 @@ _start (void *data, const char *el, const char **attr)
                         } else if (strcmp (attr[0], "user") == 0) {
                                 node->data.node_match.match_type = MATCH_TYPE_USER;
                         } else {
-                                _pk_debug ("Unknown match rule '%s'", attr[0]);
+                                polkit_debug ("Unknown match rule '%s'", attr[0]);
                                 goto error;
                         }
 
                         node->data.node_match.data = kit_strdup (attr[1]);
                         if (regcomp (&(node->data.node_match.preq), node->data.node_match.data, REG_NOSUB|REG_EXTENDED) != 0) {
-                                _pk_debug ("Invalid expression '%s'", node->data.node_match.data);
+                                polkit_debug ("Invalid expression '%s'", node->data.node_match.data);
                                 goto error;
                         }
 
                         state = STATE_IN_MATCH;
-                        _pk_debug ("parsed match node ('%s' (%d) -> '%s')", 
+                        polkit_debug ("parsed match node ('%s' (%d) -> '%s')", 
                                    attr[0], 
                                    node->data.node_match.match_type,
                                    node->data.node_match.data);
@@ -311,17 +311,17 @@ _start (void *data, const char *el, const char **attr)
                         if (strcmp (attr[0], "result") == 0) {
                                 PolKitResult r;
                                 if (!polkit_result_from_string_representation (attr[1], &r)) {
-                                        _pk_debug ("Unknown return result '%s'", attr[1]);
+                                        polkit_debug ("Unknown return result '%s'", attr[1]);
                                         goto error;
                                 }
                                 node->data.node_return.result = r;
                         } else {
-                                _pk_debug ("Unknown return rule '%s'", attr[0]);
+                                polkit_debug ("Unknown return rule '%s'", attr[0]);
                                 goto error;
                         }
 
                         state = STATE_IN_RETURN;
-                        _pk_debug ("parsed return node ('%s' (%d))",
+                        polkit_debug ("parsed return node ('%s' (%d))",
                                    attr[1],
                                    node->data.node_return.result);
                 } else if ((strcmp (el, "define_admin_auth") == 0) && (num_attr == 2)) {
@@ -332,14 +332,14 @@ _start (void *data, const char *el, const char **attr)
                         } else if (strcmp (attr[0], "group") == 0) {
                                 node->data.node_define_admin_auth.admin_type = POLKIT_CONFIG_ADMIN_AUTH_TYPE_GROUP;
                         } else {
-                                _pk_debug ("Unknown define_admin_auth rule '%s'", attr[0]);
+                                polkit_debug ("Unknown define_admin_auth rule '%s'", attr[0]);
                                 goto error;
                         }
 
                         node->data.node_define_admin_auth.data = kit_strdup (attr[1]);
 
                         state = STATE_IN_DEFINE_ADMIN_AUTH;
-                        _pk_debug ("parsed define_admin_auth node ('%s' (%d) -> '%s')", 
+                        polkit_debug ("parsed define_admin_auth node ('%s' (%d) -> '%s')", 
                                    attr[0], 
                                    node->data.node_define_admin_auth.admin_type,
                                    node->data.node_define_admin_auth.data);
@@ -356,7 +356,7 @@ _start (void *data, const char *el, const char **attr)
         }
 
         if (pd->stack_depth < 0 || pd->stack_depth >= PARSER_MAX_DEPTH) {
-                _pk_debug ("reached max depth?");
+                polkit_debug ("reached max depth?");
                 goto error;
         }
         pd->state = state;
@@ -369,7 +369,7 @@ _start (void *data, const char *el, const char **attr)
         }
 
         pd->stack_depth++;
-        _pk_debug ("now in state=%d (after _start, depth=%d)", pd->state, pd->stack_depth);
+        polkit_debug ("now in state=%d (after _start, depth=%d)", pd->state, pd->stack_depth);
         return;
 
 error:
@@ -389,18 +389,18 @@ _end (void *data, const char *el)
 {
         ParserData *pd = data;
 
-        _pk_debug ("_end for node '%s' (at depth=%d)", el, pd->stack_depth);
+        polkit_debug ("_end for node '%s' (at depth=%d)", el, pd->stack_depth);
 
         --pd->stack_depth;
         if (pd->stack_depth < 0 || pd->stack_depth >= PARSER_MAX_DEPTH) {
-                _pk_debug ("reached max depth?");
+                polkit_debug ("reached max depth?");
                 goto error;
         }
         if (pd->stack_depth > 0)
                 pd->state = pd->state_stack[pd->stack_depth - 1];
         else
                 pd->state = STATE_NONE;
-        _pk_debug ("now in state=%d (after _end, depth=%d)", pd->state, pd->stack_depth);
+        polkit_debug ("now in state=%d (after _end, depth=%d)", pd->state, pd->stack_depth);
         return;
 error:
         XML_StopParser (pd->parser, FALSE);
@@ -471,7 +471,7 @@ polkit_config_new (const char *path, PolKitError **error)
 	XML_ParserFree (pd.parser);
 	kit_free (buf);
 
-        _pk_debug ("Loaded configuration file %s", path);
+        polkit_debug ("Loaded configuration file %s", path);
 
         if (pk_config->top_config_node != NULL)
                 config_node_dump (pk_config->top_config_node);
diff --git a/src/polkit/polkit-context.c b/src/polkit/polkit-context.c
index 2b6c1f5..f1d4b11 100644
--- a/src/polkit/polkit-context.c
+++ b/src/polkit/polkit-context.c
@@ -152,7 +152,7 @@ polkit_context_init (PolKitContext *pk_context, PolKitError **error)
         kit_return_val_if_fail (pk_context != NULL, FALSE);
 
         pk_context->policy_dir = kit_strdup (PACKAGE_DATA_DIR "/PolicyKit/policy");
-        _pk_debug ("Using policy files from directory %s", pk_context->policy_dir);
+        polkit_debug ("Using policy files from directory %s", pk_context->policy_dir);
 
         /* NOTE: we don't populate the cache until it's needed.. */
 
@@ -162,7 +162,7 @@ polkit_context_init (PolKitContext *pk_context, PolKitError **error)
         if (pk_context->io_add_watch_func != NULL) {
                 pk_context->inotify_fd = port_create ();
                 if (pk_context->inotify_fd < 0) {
-                        _pk_debug ("failed to port_create: %s", strerror (errno));
+                        polkit_debug ("failed to port_create: %s", strerror (errno));
                         /* TODO: set error */
                         goto error;
                 }
@@ -172,7 +172,7 @@ polkit_context_init (PolKitContext *pk_context, PolKitError **error)
                                                                    PACKAGE_SYSCONF_DIR "/PolicyKit/PolicyKit.conf",
                                                                    FILE_MODIFIED | FILE_ATTRIB);
                 if (pk_context->inotify_config_wd < 0) {
-                        _pk_debug ("failed to add watch on file '" PACKAGE_SYSCONF_DIR "/PolicyKit/PolicyKit.conf': %s",
+                        polkit_debug ("failed to add watch on file '" PACKAGE_SYSCONF_DIR "/PolicyKit/PolicyKit.conf': %s",
                                    strerror (errno));
                         /* TODO: set error */
                         goto error;
@@ -183,7 +183,7 @@ polkit_context_init (PolKitContext *pk_context, PolKitError **error)
                                                                    PACKAGE_DATA_DIR "/PolicyKit/policy",
                                                                    FILE_MODIFIED | FILE_ATTRIB);
                 if (pk_context->inotify_policy_wd < 0) {
-                        _pk_debug ("failed to add watch on directory '" PACKAGE_DATA_DIR "/PolicyKit/policy': %s",
+                        polkit_debug ("failed to add watch on directory '" PACKAGE_DATA_DIR "/PolicyKit/policy': %s",
                                    strerror (errno));
                         /* TODO: set error */
                         goto error;
@@ -195,7 +195,7 @@ polkit_context_init (PolKitContext *pk_context, PolKitError **error)
                                                                        PACKAGE_LOCALSTATE_DIR "/lib/misc/PolicyKit.reload",
                                                                        FILE_MODIFIED | FILE_ATTRIB);
                 if (pk_context->inotify_grant_perm_wd < 0) {
-                        _pk_debug ("failed to add watch on file '" PACKAGE_LOCALSTATE_DIR "/lib/misc/PolicyKit.reload': %s",
+                        polkit_debug ("failed to add watch on file '" PACKAGE_LOCALSTATE_DIR "/lib/misc/PolicyKit.reload': %s",
                                    strerror (errno));
                         /* TODO: set error */
                         goto error;
@@ -204,7 +204,7 @@ polkit_context_init (PolKitContext *pk_context, PolKitError **error)
 
                 pk_context->inotify_fd_watch_id = pk_context->io_add_watch_func (pk_context, pk_context->inotify_fd);
                 if (pk_context->inotify_fd_watch_id == 0) {
-                        _pk_debug ("failed to add io watch");
+                        polkit_debug ("failed to add io watch");
                         /* TODO: set error */
                         goto error;
                 }
@@ -214,7 +214,7 @@ polkit_context_init (PolKitContext *pk_context, PolKitError **error)
         if (pk_context->io_add_watch_func != NULL) {
                 pk_context->inotify_fd = inotify_init ();
                 if (pk_context->inotify_fd < 0) {
-                        _pk_debug ("failed to initialize inotify: %s", strerror (errno));
+                        polkit_debug ("failed to initialize inotify: %s", strerror (errno));
                         /* TODO: set error */
                         goto error;
                 }
@@ -224,7 +224,7 @@ polkit_context_init (PolKitContext *pk_context, PolKitError **error)
                                                                    PACKAGE_SYSCONF_DIR "/PolicyKit/PolicyKit.conf", 
                                                                    IN_MODIFY | IN_CREATE | IN_ATTRIB);
                 if (pk_context->inotify_config_wd < 0) {
-                        _pk_debug ("failed to add watch on file '" PACKAGE_SYSCONF_DIR "/PolicyKit/PolicyKit.conf': %s",
+                        polkit_debug ("failed to add watch on file '" PACKAGE_SYSCONF_DIR "/PolicyKit/PolicyKit.conf': %s",
                                    strerror (errno));
                         /* TODO: set error */
                         goto error;
@@ -235,7 +235,7 @@ polkit_context_init (PolKitContext *pk_context, PolKitError **error)
                                                                    PACKAGE_DATA_DIR "/PolicyKit/policy", 
                                                                    IN_MODIFY | IN_CREATE | IN_DELETE | IN_ATTRIB);
                 if (pk_context->inotify_policy_wd < 0) {
-                        _pk_debug ("failed to add watch on directory '" PACKAGE_DATA_DIR "/PolicyKit/policy': %s",
+                        polkit_debug ("failed to add watch on directory '" PACKAGE_DATA_DIR "/PolicyKit/policy': %s",
                                    strerror (errno));
                         /* TODO: set error */
                         goto error;
@@ -247,7 +247,7 @@ polkit_context_init (PolKitContext *pk_context, PolKitError **error)
                                                                        PACKAGE_LOCALSTATE_DIR "/lib/misc/PolicyKit.reload", 
                                                                        IN_MODIFY | IN_CREATE | IN_ATTRIB);
                 if (pk_context->inotify_grant_perm_wd < 0) {
-                        _pk_debug ("failed to add watch on file '" PACKAGE_LOCALSTATE_DIR "/lib/misc/PolicyKit.reload': %s",
+                        polkit_debug ("failed to add watch on file '" PACKAGE_LOCALSTATE_DIR "/lib/misc/PolicyKit.reload': %s",
                                    strerror (errno));
                         /* TODO: set error */
                         goto error;
@@ -256,7 +256,7 @@ polkit_context_init (PolKitContext *pk_context, PolKitError **error)
 
                 pk_context->inotify_fd_watch_id = pk_context->io_add_watch_func (pk_context, pk_context->inotify_fd);
                 if (pk_context->inotify_fd_watch_id == 0) {
-                        _pk_debug ("failed to add io watch");
+                        polkit_debug ("failed to add io watch");
                         /* TODO: set error */
                         goto error;
                 }
@@ -292,7 +292,7 @@ port_add_watch (int port, const char *name, uint32_t events)
         struct fileportinfo *fpi;
 
         if ( (fpi = kit_malloc (sizeof(struct fileportinfo)) ) == NULL ) {
-                _pk_debug ("Faile to kit_malloc!");
+                polkit_debug ("Faile to kit_malloc!");
                 /* TODO: set error */
                 return -1;
         }
@@ -302,7 +302,7 @@ port_add_watch (int port, const char *name, uint32_t events)
         fpi->port = port;
 
         if ( file_associate (fpi, events) < 0 ) {
-                _pk_debug ("Failed to associate with file %s: %s", fpi->fobj.fo_name, strerror (errno));
+                polkit_debug ("Failed to associate with file %s: %s", fpi->fobj.fo_name, strerror (errno));
                 /* TODO: set error */
                 return -1;
         }
@@ -315,7 +315,7 @@ file_associate (struct fileportinfo *fpinfo, int events)
         struct stat sb;
 
         if ( stat (fpinfo->fobj.fo_name, &sb) == -1) {
-                _pk_debug ("Failed to stat file %s: %s", fpinfo->fobj.fo_name, strerror (errno));
+                polkit_debug ("Failed to stat file %s: %s", fpinfo->fobj.fo_name, strerror (errno));
                 /* TODO: set error */
                 return -1;
         }
@@ -325,7 +325,7 @@ file_associate (struct fileportinfo *fpinfo, int events)
         fpinfo->fobj.fo_ctime = sb.st_ctim;
 
         if ( port_associate (fpinfo->port, PORT_SOURCE_FILE, (uintptr_t)&(fpinfo->fobj), events, (void *)fpinfo ) == -1) {
-                _pk_debug ("Failed to register file %s: %s", fpinfo->fobj.fo_name, strerror (errno));
+                polkit_debug ("Failed to register file %s: %s", fpinfo->fobj.fo_name, strerror (errno));
                 /* TODO: set error */
                 return -1;
         }
@@ -416,7 +416,7 @@ polkit_context_io_func (PolKitContext *pk_context, int fd)
 
         kit_return_if_fail (pk_context != NULL);
 
-        _pk_debug ("polkit_context_io_func: data on fd %d", fd);
+        polkit_debug ("polkit_context_io_func: data on fd %d", fd);
 
         config_changed = FALSE;
 
@@ -431,13 +431,13 @@ polkit_context_io_func (PolKitContext *pk_context, int fd)
                         case PORT_SOURCE_FILE:
                                 fpip = (struct fileportinfo *)pe.portev_object;
                                 fobjp = &fpip->fobj;
-                                _pk_debug ("filename = %s, events = %d", fobjp->fo_name, pe.portev_events);
+                                polkit_debug ("filename = %s, events = %d", fobjp->fo_name, pe.portev_events);
                                 config_changed = TRUE;
-                                _pk_debug ("Config changed");
+                                polkit_debug ("Config changed");
                                 file_associate ((struct fileportinfo *)pe.portev_object, pe.portev_events);
                                 break;
                         default:
-                                _pk_debug ("Event from unexpected source");
+                                polkit_debug ("Event from unexpected source");
                         }
                         if ( config_changed )
                                 break;
@@ -459,7 +459,7 @@ again:
                         if (errno == EINTR) {
                                 goto again;
                         } else {
-                                _pk_debug ("read: %s", strerror (errno));
+                                polkit_debug ("read: %s", strerror (errno));
                         }
                 } else if (len > 0) {
                         /* BUF_LEN too small? */
@@ -467,10 +467,10 @@ again:
                 while (i < len) {
                         struct inotify_event *event;
                         event = (struct inotify_event *) &buf[i];
-                        _pk_debug ("wd=%d mask=%u cookie=%u len=%u",
+                        polkit_debug ("wd=%d mask=%u cookie=%u len=%u",
                                    event->wd, event->mask, event->cookie, event->len);
 
-                        _pk_debug ("config changed!");
+                        polkit_debug ("config changed!");
                         config_changed = TRUE;
 
                         i += EVENT_SIZE + event->len;
@@ -505,14 +505,14 @@ polkit_context_force_reload (PolKitContext *pk_context)
         kit_return_if_fail (pk_context != NULL);
 
         /* purge existing policy files */
-        _pk_debug ("purging policy files");
+        polkit_debug ("purging policy files");
         if (pk_context->priv_cache != NULL) {
                 polkit_policy_cache_unref (pk_context->priv_cache);
                 pk_context->priv_cache = NULL;
         }
         
         /* Purge existing old config file */
-        _pk_debug ("purging configuration file");
+        polkit_debug ("purging configuration file");
         if (pk_context->config != NULL) {
                 polkit_config_unref (pk_context->config);
                 pk_context->config = NULL;
@@ -576,7 +576,7 @@ polkit_context_get_policy_cache (PolKitContext *pk_context)
         if (pk_context->priv_cache == NULL) {
                 PolKitError *error;
 
-                _pk_debug ("Populating cache from directory %s", pk_context->policy_dir);
+                polkit_debug ("Populating cache from directory %s", pk_context->policy_dir);
 
                 error = NULL;
                 pk_context->priv_cache = _polkit_policy_cache_new (pk_context->policy_dir, 
@@ -708,7 +708,7 @@ found:
                 result = POLKIT_RESULT_NO;
 
 out:
-        _pk_debug ("... result was %s", polkit_result_to_string_representation (result));
+        polkit_debug ("... result was %s", polkit_result_to_string_representation (result));
         return result;
 }
 
@@ -848,7 +848,7 @@ found:
         if (result == POLKIT_RESULT_UNKNOWN)
                 result = POLKIT_RESULT_NO;
 out:
-        _pk_debug ("... result was %s", polkit_result_to_string_representation (result));
+        polkit_debug ("... result was %s", polkit_result_to_string_representation (result));
         return result;
 }
 
@@ -923,7 +923,7 @@ polkit_context_get_config (PolKitContext *pk_context, PolKitError **error)
                 else
                         pk_error = &pk_error2;
 
-                _pk_debug ("loading configuration file");
+                polkit_debug ("loading configuration file");
                 pk_context->config = polkit_config_new (PACKAGE_SYSCONF_DIR "/PolicyKit/PolicyKit.conf", pk_error);
                 /* if configuration file was bad, log it */
                 if (pk_context->config == NULL) {
diff --git a/src/polkit/polkit-debug.c b/src/polkit/polkit-debug.c
index 778e734..72ef71a 100644
--- a/src/polkit/polkit-debug.c
+++ b/src/polkit/polkit-debug.c
@@ -31,7 +31,7 @@
  * SECTION:polkit-debug
  * @short_description: Internal debug functions for polkit.
  *
- * These functions are used for debug purposes
+ * These functions are used for debug purposes.
  **/
 
 #ifdef HAVE_CONFIG_H
@@ -48,13 +48,15 @@
 #include "polkit-debug.h"
 
 /**
- * pk_debug:
+ * polkit_debug:
  * @format: format
  * 
- * Print debug message
+ * Prints a debug message to stdout if the environment variable
+ * POLKIT_DEBUG is set. In production builds this function may
+ * be a no-op.
  **/
 void 
-_pk_debug (const char *format, ...)
+polkit_debug (const char *format, ...)
 {
         va_list args;
         static polkit_bool_t show_debug = FALSE;
diff --git a/src/polkit/polkit-debug.h b/src/polkit/polkit-debug.h
index 8fee7f8..4a8256f 100644
--- a/src/polkit/polkit-debug.h
+++ b/src/polkit/polkit-debug.h
@@ -31,9 +31,9 @@
 #define POLKIT_DEBUG_H
 
 #ifdef __sun
-void _pk_debug (const char *format, ...);
+void polkit_debug (const char *format, ...);
 #else
-void _pk_debug (const char *format, ...) __attribute__((__format__ (__printf__, 1, 2)));
+void polkit_debug (const char *format, ...) __attribute__((__format__ (__printf__, 1, 2)));
 #endif
 
 #endif /* POLKIT_DEBUG_H */
diff --git a/src/polkit/polkit-policy-cache.c b/src/polkit/polkit-policy-cache.c
index 4723359..a349e04 100644
--- a/src/polkit/polkit-policy-cache.c
+++ b/src/polkit/polkit-policy-cache.c
@@ -155,7 +155,7 @@ _polkit_policy_cache_new (const char *dirname, polkit_bool_t load_descriptions,
                         continue;
                 }
 
-                _pk_debug ("Loading %s", path);
+                polkit_debug ("Loading %s", path);
                 pk_error = NULL;
                 pf = polkit_policy_file_new (path, load_descriptions, &pk_error);
                 kit_free (path);
@@ -252,9 +252,9 @@ polkit_policy_cache_debug (PolKitPolicyCache *policy_cache)
         KitList *i;
         kit_return_if_fail (policy_cache != NULL);
 
-        _pk_debug ("PolKitPolicyCache: refcount=%d num_entries=%d ...", 
-                   policy_cache->refcount,
-                   policy_cache->priv_entries == NULL ? 0 : kit_list_length (policy_cache->priv_entries));
+        polkit_debug ("PolKitPolicyCache: refcount=%d num_entries=%d ...", 
+                      policy_cache->refcount,
+                      policy_cache->priv_entries == NULL ? 0 : kit_list_length (policy_cache->priv_entries));
 
         for (i = policy_cache->priv_entries; i != NULL; i = i->next) {
                 PolKitPolicyFileEntry *pfe = i->data;
diff --git a/src/polkit/polkit-policy-default.c b/src/polkit/polkit-policy-default.c
index 4a7dd01..f331669 100644
--- a/src/polkit/polkit-policy-default.c
+++ b/src/polkit/polkit-policy-default.c
@@ -213,14 +213,14 @@ void
 polkit_policy_default_debug (PolKitPolicyDefault *policy_default)
 {
         kit_return_if_fail (policy_default != NULL);
-        _pk_debug ("PolKitPolicyDefault: refcount=%d\n"
-                   "        default_any=%s\n"
-                   "   default_inactive=%s\n"
-                   "     default_active=%s", 
-                   policy_default->refcount,
-                   polkit_result_to_string_representation (policy_default->default_any),
-                   polkit_result_to_string_representation (policy_default->default_inactive),
-                   polkit_result_to_string_representation (policy_default->default_active));
+        polkit_debug ("PolKitPolicyDefault: refcount=%d\n"
+                      "        default_any=%s\n"
+                      "   default_inactive=%s\n"
+                      "     default_active=%s", 
+                      policy_default->refcount,
+                      polkit_result_to_string_representation (policy_default->default_any),
+                      polkit_result_to_string_representation (policy_default->default_inactive),
+                      polkit_result_to_string_representation (policy_default->default_active));
 }
 
 
diff --git a/src/polkit/polkit-policy-file-entry.c b/src/polkit/polkit-policy-file-entry.c
index 4de3d50..a9be4f6 100644
--- a/src/polkit/polkit-policy-file-entry.c
+++ b/src/polkit/polkit-policy-file-entry.c
@@ -392,9 +392,9 @@ void
 polkit_policy_file_entry_debug (PolKitPolicyFileEntry *policy_file_entry)
 {
         kit_return_if_fail (policy_file_entry != NULL);
-        _pk_debug ("PolKitPolicyFileEntry: refcount=%d action=%s",
-                   policy_file_entry->refcount,
-                   policy_file_entry->action);
+        polkit_debug ("PolKitPolicyFileEntry: refcount=%d action=%s",
+                      policy_file_entry->refcount,
+                      policy_file_entry->action);
         polkit_policy_default_debug (policy_file_entry->defaults);
 }
 
diff --git a/src/polkit/polkit-policy-file.c b/src/polkit/polkit-policy-file.c
index 7f942a8..28b6647 100644
--- a/src/polkit/polkit-policy-file.c
+++ b/src/polkit/polkit-policy-file.c
@@ -586,7 +586,7 @@ _end (void *data, const char *el)
 
         --pd->stack_depth;
         if (pd->stack_depth < 0 || pd->stack_depth >= PARSER_MAX_DEPTH) {
-                _pk_debug ("reached max depth?");
+                polkit_debug ("reached max depth?");
                 goto error;
         }
         if (pd->stack_depth > 0)
diff --git a/src/polkit/polkit-seat.c b/src/polkit/polkit-seat.c
index d06aff3..b7880dd 100644
--- a/src/polkit/polkit-seat.c
+++ b/src/polkit/polkit-seat.c
@@ -171,7 +171,7 @@ void
 polkit_seat_debug (PolKitSeat *seat)
 {
         kit_return_if_fail (seat != NULL);
-        _pk_debug ("PolKitSeat: refcount=%d objpath=%s", seat->refcount, seat->ck_objref);
+        polkit_debug ("PolKitSeat: refcount=%d objpath=%s", seat->refcount, seat->ck_objref);
 }
 
 /**
diff --git a/src/polkit/polkit-session.c b/src/polkit/polkit-session.c
index d72b48f..1900209 100644
--- a/src/polkit/polkit-session.c
+++ b/src/polkit/polkit-session.c
@@ -373,9 +373,9 @@ void
 polkit_session_debug (PolKitSession *session)
 {
         kit_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);
+        polkit_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)
                 polkit_seat_debug (session->seat);
 }
diff --git a/src/polkit/polkit-utils.c b/src/polkit/polkit-utils.c
index 5427b16..be68086 100644
--- a/src/polkit/polkit-utils.c
+++ b/src/polkit/polkit-utils.c
@@ -73,7 +73,7 @@ _pk_validate_identifier (const char *identifier)
                 char c = identifier[n];
 
                 if (n >= 255) {
-                        _pk_debug ("identifier too long");
+                        polkit_debug ("identifier too long");
                         goto out;
                 }
 
@@ -87,7 +87,7 @@ _pk_validate_identifier (const char *identifier)
                     c == '/')
                         continue;
 
-                _pk_debug ("invalid character in identifier");
+                polkit_debug ("invalid character in identifier");
                 goto out;
         }
 
@@ -153,7 +153,7 @@ _pk_validate_unique_bus_name (const char *unique_bus_name)
 
 error:
         if (!ret)
-                _pk_debug ("name '%s' did not validate", unique_bus_name);
+                polkit_debug ("name '%s' did not validate", unique_bus_name);
         return ret;
 }
 
diff --git a/tools/Makefile.am b/tools/Makefile.am
index a76e9fc..3f0a200 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -14,10 +14,10 @@ INCLUDES = \
 bin_PROGRAMS = polkit-config-file-validate polkit-policy-file-validate polkit-action polkit-auth
 
 polkit_config_file_validate_SOURCES = polkit-config-file-validate.c
-polkit_config_file_validate_LDADD = $(top_builddir)/src/polkit/libpolkit.la
+polkit_config_file_validate_LDADD = $(top_builddir)/src/kit/libkit.la $(top_builddir)/src/polkit/libpolkit.la
 
 polkit_policy_file_validate_SOURCES = polkit-policy-file-validate.c
-polkit_policy_file_validate_LDADD = $(top_builddir)/src/polkit/libpolkit.la
+polkit_policy_file_validate_LDADD = $(top_builddir)/src/kit/libkit.la $(top_builddir)/src/polkit/libpolkit.la
 
 polkit_auth_SOURCES = polkit-auth.c
 polkit_auth_LDADD = @GLIB_LIBS@ @DBUS_LIBS@ $(top_builddir)/src/polkit/libpolkit.la $(top_builddir)/src/polkit-grant/libpolkit-grant.la $(top_builddir)/src/polkit-dbus/libpolkit-dbus.la


More information about the hal-commit mailing list