[tracker] tracker-extract: Ensure extract modules are initialized on startup



commit 2d1e71046157b9afea270169250be764521c4b04
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Jan 30 11:16:48 2017 +0100

    tracker-extract: Ensure extract modules are initialized on startup
    
    This takes module initialization out of the sandbox. Modules are
    trusted bits of code, so only the extract function must be taken
    as untrusted.

 src/libtracker-extract/tracker-module-manager.c |   14 ++++++++++++++
 src/libtracker-extract/tracker-module-manager.h |    2 ++
 src/tracker-extract/tracker-main.c              |    2 ++
 3 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/src/libtracker-extract/tracker-module-manager.c b/src/libtracker-extract/tracker-module-manager.c
index 2d599e4..ea7989e 100644
--- a/src/libtracker-extract/tracker-module-manager.c
+++ b/src/libtracker-extract/tracker-module-manager.c
@@ -581,3 +581,17 @@ tracker_mimetype_info_free (TrackerMimetypeInfo *info)
 
        g_slice_free (TrackerMimetypeInfo, info);
 }
+
+void
+tracker_module_manager_load_modules (void)
+{
+       RuleInfo *rule_info;
+       guint i;
+
+       g_return_if_fail (initialized == TRUE);
+
+       for (i = 0; i < rules->len; i++) {
+               rule_info = &g_array_index (rules, RuleInfo, i);
+               load_module (rule_info, TRUE);
+       }
+}
diff --git a/src/libtracker-extract/tracker-module-manager.h b/src/libtracker-extract/tracker-module-manager.h
index e49712b..7d484cf 100644
--- a/src/libtracker-extract/tracker-module-manager.h
+++ b/src/libtracker-extract/tracker-module-manager.h
@@ -57,6 +57,8 @@ GModule * tracker_mimetype_info_get_module (TrackerMimetypeInfo          *info,
 gboolean  tracker_mimetype_info_iter_next  (TrackerMimetypeInfo          *info);
 void      tracker_mimetype_info_free       (TrackerMimetypeInfo          *info);
 
+void tracker_module_manager_load_modules (void);
+
 G_END_DECLS
 
 #endif /* __TRACKER_EXTRACT_MODULE_MANAGER_H__ */
diff --git a/src/tracker-extract/tracker-main.c b/src/tracker-extract/tracker-main.c
index d8e0f5f..51f9692 100644
--- a/src/tracker-extract/tracker-main.c
+++ b/src/tracker-extract/tracker-main.c
@@ -382,6 +382,8 @@ main (int argc, char *argv[])
                return EXIT_FAILURE;
        }
 
+       tracker_module_manager_load_modules ();
+
        decorator = tracker_extract_decorator_new (extract, NULL, &error);
 
        if (error) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]