Blob Blame History Raw
From 6b12e0d1284cac96e66780aa4aeb7c32619089fc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Pokorn=C3=BD?= <jpokorny@redhat.com>
Date: Thu, 9 Feb 2017 22:46:42 +0100
Subject: [PATCH 1/2] Refactor: lib/services: ensure *.h declare externally
 hidden functions

...following the precedent of {upstart,systemd}.h.  Note also that
since hardening-related commit 658fff944 [$LD -z now], it's even more
desirable to limit "symbol smog" as much as possible and symbols only
used within the library like these are trivially expendable (assuming
suitable toolchain).

As we use G_GNU_C_INTERNAL macro from glib2, we should care to require
at least that version that introduced it, i.e., 2.6 per documentation.
---
 lib/services/services_private.h | 14 ++++++++++++++
 1 file changed, 13 insertions(+), 0 deletions(-)

diff --git a/lib/services/services_private.h b/lib/services/services_private.h
index 60b1b14..41895a9 100644
--- a/lib/services/services_private.h
+++ b/lib/services/services_private.h
@@ -45,30 +45,44 @@ struct svc_action_private_s {
 #endif
 };
 
+G_GNUC_INTERNAL
 GList *services_os_get_directory_list(const char *root, gboolean files, gboolean executable);
 
+G_GNUC_INTERNAL
 gboolean services_os_action_execute(svc_action_t * op, gboolean synchronous);
 
+G_GNUC_INTERNAL
 GList *resources_os_list_lsb_agents(void);
 
+G_GNUC_INTERNAL
 GList *resources_os_list_ocf_providers(void);
 
+G_GNUC_INTERNAL
 GList *resources_os_list_ocf_agents(const char *provider);
 
+G_GNUC_INTERNAL
 GList *resources_os_list_nagios_agents(void);
 
+G_GNUC_INTERNAL
 gboolean cancel_recurring_action(svc_action_t * op);
 
+G_GNUC_INTERNAL
 gboolean recurring_action_timer(gpointer data);
+
+G_GNUC_INTERNAL
 gboolean operation_finalize(svc_action_t * op);
 
+G_GNUC_INTERNAL
 void services_add_inflight_op(svc_action_t *op);
 
+G_GNUC_INTERNAL
 void handle_blocked_ops(void);
 
+G_GNUC_INTERNAL
 gboolean is_op_blocked(const char *rsc);
 
 #if SUPPORT_DBUS
+G_GNUC_INTERNAL
 void services_set_op_pending(svc_action_t *op, DBusPendingCall *pending);
 #endif
 
-- 
1.8.3.1


From 31adceb587c1beb90a0d61bb3bf1b634e5516d54 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Pokorn=C3=BD?= <jpokorny@redhat.com>
Date: Fri, 10 Feb 2017 10:50:59 +0100
Subject: [PATCH 2/2] Refactor: lib/services: ensure some objects not exported
 accidentally

They are not tracked by neither public nor private API anyway.
See also a note about "symbol smog" in the previous commit.
---
 lib/services/services.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/services/services.c b/lib/services/services.c
index 4be425c..b1e3b26 100644
--- a/lib/services/services.c
+++ b/lib/services/services.c
@@ -37,11 +37,11 @@
 /* TODO: Develop a rollover strategy */
 
 static int operations = 0;
-GHashTable *recurring_actions = NULL;
+static GHashTable *recurring_actions = NULL;
 
 /* ops waiting to run async because of conflicting active
- * pending ops*/
-GList *blocked_ops = NULL;
+ * pending ops */
+static GList *blocked_ops = NULL;
 
 /* ops currently active (in-flight) */
 GList *inflight_ops = NULL;
-- 
1.8.3.1