[gegl] gegl: avoid loading .so's with -gpl3 in name, unless opted in



commit 750dacb85164f0f3171cd31d1a946c054ed481c1
Author: Øyvind Kolås <pippin gimp org>
Date:   Tue Sep 26 23:58:21 2017 +0200

    gegl: avoid loading .so's with -gpl3 in name, unless opted in
    
    This in conjunction with the commit splititng common.so in two, avoiding
    loadin gegl-common-gpl3.so unless/until
    gegl_config():"application-license" has been set appropriately.

 gegl/gegl-init.c           |    7 +++++++
 gegl/module/geglmoduledb.c |   12 ++++++++++++
 2 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/gegl/gegl-init.c b/gegl/gegl-init.c
index cc1195b..b6cb445 100644
--- a/gegl/gegl-init.c
+++ b/gegl/gegl-init.c
@@ -170,14 +170,21 @@ gegl_swap_dir (void)
   return swap_dir;
 }
 
+static void load_module_path(gchar *path, GeglModuleDB *db);
+
 static void
 gegl_config_application_license_notify (GObject    *gobject,
                                         GParamSpec *pspec,
                                         gpointer    user_data)
 {
   GeglConfig *cfg = GEGL_CONFIG (gobject);
+  GSList *paths = gegl_get_default_module_paths ();
 
   gegl_operations_set_licenses_from_string (cfg->application_license);
+
+  /* causes load of .so's that might have been skipped due to filename */
+  g_slist_foreach(paths, (GFunc)load_module_path, module_db);
+  g_slist_free_full (paths, g_free);
 }
 
 
diff --git a/gegl/module/geglmoduledb.c b/gegl/module/geglmoduledb.c
index 77eccec..c44ff37 100644
--- a/gegl/module/geglmoduledb.c
+++ b/gegl/module/geglmoduledb.c
@@ -22,6 +22,7 @@
 #include "geglmodule.h"
 #include "geglmoduledb.h"
 #include "gegldatafiles.h"
+#include "gegl-config.h"
 
 enum
 {
@@ -310,6 +311,17 @@ valid_module_name (const gchar *filename)
 {
   gchar *basename = g_path_get_basename (filename);
 
+  if (gegl_config()->application_license == NULL             ||
+      (strcmp (gegl_config ()->application_license, "GPL3") &&
+       strcmp (gegl_config ()->application_license, "GPL3+")))
+    {
+      if (strstr (basename, "-gpl3"))
+        {
+          g_free (basename);
+          return FALSE;
+        }
+    }
+
   if (! gegl_datafiles_check_extension (basename, "." G_MODULE_SUFFIX))
     {
       g_free (basename);


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