Only load plugins with the same version string
authorMarcel Holtmann <marcel@holtmann.org>
Wed, 7 Jan 2009 16:03:51 +0000 (17:03 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Wed, 7 Jan 2009 16:03:51 +0000 (17:03 +0100)
doc/plugin-api.txt
include/plugin.h
include/version.h.in
src/plugin.c

index e329ced..696e2c1 100644 (file)
@@ -20,5 +20,5 @@ static void example_exit(void)
 {
 }
 
-CONNMAN_PLUGIN_DEFINE(example, "Example plugin", VERSION,
+CONNMAN_PLUGIN_DEFINE(example, "Example plugin", CONNMAN_VERSION,
                                                example_init, example_exit)
index d538dc7..84e0958 100644 (file)
@@ -69,7 +69,7 @@ struct connman_plugin_desc {
  * {
  * }
  *
- * CONNMAN_PLUGIN_DEFINE(example, "Example plugin", VERSION,
+ * CONNMAN_PLUGIN_DEFINE(example, "Example plugin", CONNMAN_VERSION,
  *                                     example_init, example_exit)
  * ]|
  */
index c163f8a..5d44396 100644 (file)
@@ -26,7 +26,7 @@
 extern "C" {
 #endif
 
-#define CONNMAN_VERSION        @VERSION@
+#define CONNMAN_VERSION        "@VERSION@"
 
 #ifdef __cplusplus
 }
index 2103b66..7fb7d44 100644 (file)
@@ -43,6 +43,9 @@ static gboolean add_plugin(void *handle, struct connman_plugin_desc *desc)
        if (desc->init == NULL)
                return FALSE;
 
+       if (g_str_equal(desc->version, CONNMAN_VERSION) == FALSE)
+               return FALSE;
+
        plugin = g_try_new0(struct connman_plugin, 1);
        if (plugin == NULL)
                return FALSE;