[gnome-keyring/trust-store] [pkcs11] Fix up standalone modules for use in tests.



commit a9de9b76ea6c78ece2c9ee315c30c6017c44570e
Author: Stef Walter <stefw collabora co uk>
Date:   Fri Dec 10 04:33:35 2010 +0000

    [pkcs11] Fix up standalone modules for use in tests.
    
     * Make the standalone modules always resident after loading.
     * Install modules to a path that's published in the pkg-config file.

 configure.in                                |    6 ++++++
 gcr/gcr.pc.in                               |    2 ++
 pkcs11/gnome2-store/Makefile.am             |    2 +-
 pkcs11/roots-store/Makefile.am              |    4 ++--
 pkcs11/roots-store/gkm-roots-standalone.c   |   15 +++++++++++++++
 pkcs11/rpc-layer/Makefile.am                |    2 +-
 pkcs11/secret-store/Makefile.am             |    4 ++--
 pkcs11/secret-store/gkm-secret-standalone.c |   15 +++++++++++++++
 pkcs11/ssh-store/Makefile.am                |    4 ++--
 pkcs11/ssh-store/gkm-ssh-standalone.c       |   15 +++++++++++++++
 pkcs11/xdg-store/Makefile.am                |    4 ++--
 pkcs11/xdg-store/gkm-xdg-standalone.c       |   15 +++++++++++++++
 12 files changed, 78 insertions(+), 10 deletions(-)
---
diff --git a/configure.in b/configure.in
index e9b3cd1..ba7b445 100644
--- a/configure.in
+++ b/configure.in
@@ -681,6 +681,12 @@ fi
 eval BINDIR="$bindir"
 AC_SUBST(BINDIR)
 
+pkcs11dir="${libdir}/pkcs11"
+AC_SUBST(pkcs11dir)
+
+pkcs11standalonedir="${libdir}/gnome-keyring/standalone"
+AC_SUBST(pkcs11standalonedir)
+
 AC_OUTPUT([
 Makefile
 daemon/Makefile
diff --git a/gcr/gcr.pc.in b/gcr/gcr.pc.in
index c1f4309..5ba32d5 100644
--- a/gcr/gcr.pc.in
+++ b/gcr/gcr.pc.in
@@ -5,6 +5,8 @@ includedir= includedir@
 datarootdir= datarootdir@
 datadir= datadir@
 sysconfdir= sysconfdir@
+pkcs11dir= pkcs11dir@
+pkcs11standalonedir= pkcs11standalonedir@
 
 Name: gcr GCR_VERSION_SUFFIX@
 Description: GObject and GUI library for high level crypto parsing and display
diff --git a/pkcs11/gnome2-store/Makefile.am b/pkcs11/gnome2-store/Makefile.am
index 1648893..8f132a1 100644
--- a/pkcs11/gnome2-store/Makefile.am
+++ b/pkcs11/gnome2-store/Makefile.am
@@ -25,7 +25,7 @@ libgkm_gnome2_store_la_SOURCES = \
 # ------------------------------------------------------------------------------
 # The standalone module
 
-moduledir = $(libdir)/gnome-keyring/devel/
+moduledir = $(pkcs11standalonedir)
 
 module_LTLIBRARIES = \
 	gkm-gnome2-store-standalone.la
diff --git a/pkcs11/roots-store/Makefile.am b/pkcs11/roots-store/Makefile.am
index 759cff8..1e507ca 100644
--- a/pkcs11/roots-store/Makefile.am
+++ b/pkcs11/roots-store/Makefile.am
@@ -23,14 +23,14 @@ libgkm_roots_store_la_SOURCES = \
 # ------------------------------------------------------------------------------
 # The standalone module
 
-moduledir = $(libdir)/gnome-keyring/standalone/
+moduledir = $(pkcs11standalonedir)
 
 module_LTLIBRARIES = \
 	gkm-roots-store-standalone.la
 
 gkm_roots_store_standalone_la_LDFLAGS = \
 	-module -avoid-version \
-	-no-undefined -export-symbols-regex 'C_GetFunctionList'
+	-no-undefined -export-symbols-regex 'C_GetFunctionList|g_module_check_init'
 
 gkm_roots_store_standalone_la_SOURCES = \
 	gkm-roots-standalone.c
diff --git a/pkcs11/roots-store/gkm-roots-standalone.c b/pkcs11/roots-store/gkm-roots-standalone.c
index a52c4dc..469fb15 100644
--- a/pkcs11/roots-store/gkm-roots-standalone.c
+++ b/pkcs11/roots-store/gkm-roots-standalone.c
@@ -30,12 +30,27 @@
 #include "egg/egg-secure-memory.h"
 
 #include <glib-object.h>
+#include <gmodule.h>
 
 #include "pkcs11/pkcs11.h"
 
 /* Module callbacks for secure memory */
 EGG_SECURE_GLIB_DEFINITIONS ();
 
+const gchar* g_module_check_init (GModule *module);
+
+const gchar*
+g_module_check_init (GModule *module)
+{
+	/*
+	 * We can't handle being unloaded due to the gobject
+	 * types we register
+	 */
+
+	g_module_make_resident (module);
+	return NULL;
+}
+
 CK_RV
 C_GetFunctionList (CK_FUNCTION_LIST_PTR_PTR list)
 {
diff --git a/pkcs11/rpc-layer/Makefile.am b/pkcs11/rpc-layer/Makefile.am
index 2754086..dd593fe 100644
--- a/pkcs11/rpc-layer/Makefile.am
+++ b/pkcs11/rpc-layer/Makefile.am
@@ -34,7 +34,7 @@ libgkm_rpc_layer_la_CFLAGS = \
 # ------------------------------------------------------------------------------
 # The module code, built as the public gnome-keyring module
 
-moduledir = $(libdir)/pkcs11/
+moduledir = $(pkcs11dir)
 
 module_LTLIBRARIES = \
 	gnome-keyring-pkcs11.la
diff --git a/pkcs11/secret-store/Makefile.am b/pkcs11/secret-store/Makefile.am
index 5341f3c..1a6008c 100644
--- a/pkcs11/secret-store/Makefile.am
+++ b/pkcs11/secret-store/Makefile.am
@@ -29,14 +29,14 @@ libgkm_secret_store_la_SOURCES = \
 # ------------------------------------------------------------------------------
 # The standalone module
 
-moduledir = $(libdir)/gnome-keyring/standalone/
+moduledir = $(pkcs11standalonedir)
 
 module_LTLIBRARIES = \
 	gkm-secret-store-standalone.la
 
 gkm_secret_store_standalone_la_LDFLAGS = \
 	-module -avoid-version \
-	-no-undefined -export-symbols-regex 'C_GetFunctionList'
+	-no-undefined -export-symbols-regex 'C_GetFunctionList|g_module_check_init'
 
 gkm_secret_store_standalone_la_SOURCES = \
 	gkm-secret-standalone.c
diff --git a/pkcs11/secret-store/gkm-secret-standalone.c b/pkcs11/secret-store/gkm-secret-standalone.c
index 681bf4e..56b54e6 100644
--- a/pkcs11/secret-store/gkm-secret-standalone.c
+++ b/pkcs11/secret-store/gkm-secret-standalone.c
@@ -30,12 +30,27 @@
 #include "egg/egg-secure-memory.h"
 
 #include <glib-object.h>
+#include <gmodule.h>
 
 #include "pkcs11/pkcs11.h"
 
 /* Module callbacks for secure memory */
 EGG_SECURE_GLIB_DEFINITIONS ();
 
+const gchar* g_module_check_init (GModule *module);
+
+const gchar*
+g_module_check_init (GModule *module)
+{
+	/*
+	 * We can't handle being unloaded due to the gobject
+	 * types we register
+	 */
+
+	g_module_make_resident (module);
+	return NULL;
+}
+
 CK_RV
 C_GetFunctionList (CK_FUNCTION_LIST_PTR_PTR list)
 {
diff --git a/pkcs11/ssh-store/Makefile.am b/pkcs11/ssh-store/Makefile.am
index 39d0965..3626a44 100644
--- a/pkcs11/ssh-store/Makefile.am
+++ b/pkcs11/ssh-store/Makefile.am
@@ -24,14 +24,14 @@ libgkm_ssh_store_la_SOURCES = \
 # ------------------------------------------------------------------------------
 # The standalone module
 
-moduledir = $(libdir)/gnome-keyring/devel/
+moduledir = $(pkcs11standalonedir)
 
 module_LTLIBRARIES = \
 	gkm-ssh-store-standalone.la
 
 gkm_ssh_store_standalone_la_LDFLAGS = \
 	-module -avoid-version \
-	-no-undefined -export-symbols-regex 'C_GetFunctionList'
+	-no-undefined -export-symbols-regex 'C_GetFunctionList|g_module_check_init'
 
 gkm_ssh_store_standalone_la_SOURCES = \
 	gkm-ssh-standalone.c
diff --git a/pkcs11/ssh-store/gkm-ssh-standalone.c b/pkcs11/ssh-store/gkm-ssh-standalone.c
index fe0260c..a15bf0e 100644
--- a/pkcs11/ssh-store/gkm-ssh-standalone.c
+++ b/pkcs11/ssh-store/gkm-ssh-standalone.c
@@ -32,10 +32,25 @@
 #include "pkcs11/pkcs11.h"
 
 #include <glib-object.h>
+#include <gmodule.h>
 
 /* Module callbacks for secure memory */
 EGG_SECURE_GLIB_DEFINITIONS ();
 
+const gchar* g_module_check_init (GModule *module);
+
+const gchar*
+g_module_check_init (GModule *module)
+{
+	/*
+	 * We can't handle being unloaded due to the gobject
+	 * types we register
+	 */
+
+	g_module_make_resident (module);
+	return NULL;
+}
+
 CK_RV
 C_GetFunctionList (CK_FUNCTION_LIST_PTR_PTR list)
 {
diff --git a/pkcs11/xdg-store/Makefile.am b/pkcs11/xdg-store/Makefile.am
index 931613a..824c46b 100644
--- a/pkcs11/xdg-store/Makefile.am
+++ b/pkcs11/xdg-store/Makefile.am
@@ -29,14 +29,14 @@ asn1-def-xdg.c: xdg.asn
 # ------------------------------------------------------------------------------
 # The standalone module
 
-moduledir = $(libdir)/gnome-keyring/devel/
+moduledir = $(pkcs11standalonedir)
 
 module_LTLIBRARIES = \
 	gkm-xdg-store-standalone.la
 
 gkm_xdg_store_standalone_la_LDFLAGS = \
 	-module -avoid-version \
-	-no-undefined -export-symbols-regex 'C_GetFunctionList'
+	-no-undefined -export-symbols-regex 'C_GetFunctionList|g_module_check_init'
 
 gkm_xdg_store_standalone_la_SOURCES = \
 	gkm-xdg-standalone.c
diff --git a/pkcs11/xdg-store/gkm-xdg-standalone.c b/pkcs11/xdg-store/gkm-xdg-standalone.c
index a539938..dc46dc2 100644
--- a/pkcs11/xdg-store/gkm-xdg-standalone.c
+++ b/pkcs11/xdg-store/gkm-xdg-standalone.c
@@ -32,10 +32,25 @@
 #include "pkcs11/pkcs11.h"
 
 #include <glib-object.h>
+#include <gmodule.h>
 
 /* Module callbacks for secure memory */
 EGG_SECURE_GLIB_DEFINITIONS ();
 
+const gchar* g_module_check_init (GModule *module);
+
+const gchar*
+g_module_check_init (GModule *module)
+{
+	/*
+	 * We can't handle being unloaded due to the gobject
+	 * types we register
+	 */
+
+	g_module_make_resident (module);
+	return NULL;
+}
+
 CK_RV
 C_GetFunctionList (CK_FUNCTION_LIST_PTR_PTR list)
 {



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