From 0684cd7b7f815b411ea5041c021f92ca5ef42606 Mon Sep 17 00:00:00 2001 From: Daiki Ueno Date: Wed, 11 Jan 2017 09:32:19 +0100 Subject: rpc: Add PKCS#11 module that connects to socket This patch adds a PKCS#11 module that connects to the p11-kit server exposed on the filesystem. The filename of the socket is determined in the following order: - $P11_KIT_SERVER_ADDRESS, if the envvar is available - $XDG_RUNTIME_DIR/p11-kit/pkcs11, if the envvar is available - /run/$(id -u)/p11-kit/pkcs11, if /run/$(id -u) exists - /var/run/$(id -u)/p11-kit/pkcs11, if /var/run/$(id -u) exists - ~/.cache/p11-kit/pkcs11. Note that the program loading this module may have called setuid() and secure_getenv() which we use for fetching envvars could return NULL. --- p11-kit/util.c | 57 --------------------------------------------------------- 1 file changed, 57 deletions(-) (limited to 'p11-kit/util.c') diff --git a/p11-kit/util.c b/p11-kit/util.c index 325d669..1e21f80 100644 --- a/p11-kit/util.c +++ b/p11-kit/util.c @@ -44,7 +44,6 @@ #include "message.h" #include "p11-kit.h" #include "private.h" -#include "proxy.h" #include #include @@ -237,59 +236,3 @@ _p11_get_progname_unlocked (void) return NULL; return p11_my_progname; } - -#ifdef OS_UNIX - -void _p11_kit_init (void); - -void _p11_kit_fini (void); - -#ifdef __GNUC__ -__attribute__((constructor)) -#endif -void -_p11_kit_init (void) -{ - p11_library_init_once (); -} - -#ifdef __GNUC__ -__attribute__((destructor)) -#endif -void -_p11_kit_fini (void) -{ - p11_proxy_module_cleanup (); - p11_library_uninit (); -} - -#endif /* OS_UNIX */ - -#ifdef OS_WIN32 - -BOOL WINAPI DllMain (HINSTANCE, DWORD, LPVOID); - -BOOL WINAPI -DllMain (HINSTANCE instance, - DWORD reason, - LPVOID reserved) -{ - switch (reason) { - case DLL_PROCESS_ATTACH: - p11_library_init (); - break; - case DLL_THREAD_DETACH: - p11_library_thread_cleanup (); - break; - case DLL_PROCESS_DETACH: - p11_proxy_module_cleanup (); - p11_library_uninit (); - break; - default: - break; - } - - return TRUE; -} - -#endif /* OS_WIN32 */ -- cgit v1.1