summaryrefslogtreecommitdiff
path: root/p11-kit/modules.c
Commit message (Collapse)AuthorAgeFilesLines
* Rename p11_module_xxx() compat functions to p11_dl_xxx()Stef Walter2013-03-031-5/+10
| | | | | | | For clarity. In addition, make p11_dl_close() able to be used as a destroyer callback. Also make p11_dl_error() return an allocated string
* Add a /usr/share/p11-kit/modules directory for package module configsStef Walter2013-02-051-1/+3
| | | | | | * Try to make /etc/pkcs11/modules for administrator use * Override the old pkg-config variables to help packages start using the new location
* Use the stdbool.h C99 bool typeStef Walter2013-01-231-16/+16
| | | | | | It was getting really wild knowing whether a function returning an int would return -1 on failure or 0 or whether the int return value was actually a number etc..
* Move debug and library code into the common/ subdirectoryStef Walter2013-01-091-158/+160
| | | | | | | | | | | Start using p11_ as our internal prefix rather than _p11_. We explicitly export p11_kit_ so this is fine as far as visibility. Move the threading, mutex, and module compat, dict, and array code into the common directory too. Take this opportunity to clean up a bit of internal API as well, since so many lines are being touched internally.
* Guarantee that the key is freed when replacedStef Walter2013-01-071-1/+5
| | | | | | | | | * When setting a key in a map that already exists, then free the old key and replace with the new one. * Fix related bug where key was not properly allocated * Add tests for this https://bugs.freedesktop.org/show_bug.cgi?id=59087
* Refuse to load the p11-kit-proxy.so as a registered moduleStef Walter2012-09-181-4/+10
| | | | | | | | | | * Since p11-kit-proxy.so is a symlink to the libp11-kit.so library we check that we are not calling into our known CK_FUNCTION_LIST for the proxy code. * Although such a configuration is invalid, detecting this directly prevents strange initialization loop issues that are hard to debug. https://bugs.freedesktop.org/show_bug.cgi?id=55052
* Don't fail initialization if last initialized module failsStef Walter2012-09-181-4/+6
| | | | | | | | | | * We weren't resetting the result code after a failure, so even though failures for critical modules didn't interrupt the initialization loop, the result still leaked to callers. * Also print an error message clearly indicating that a module failed to initialize, regardless of whether critical or not. https://bugs.freedesktop.org/show_bug.cgi?id=55051
* Use Windows thread ids instead of handles for comparisonsStef Walter2012-07-261-3/+3
| | | | | | | | | | * It seems that the HANDLE's returned from GetCurrentThread are often equal for two threads. GetCurrentThreadID doesn't have this problem. * Separate our cross platform thread_t and thread_id_t types even though on unix they're the same thing. https://bugzilla.gnome.org/show_bug.cgi?id=44740
* Fix compiler warning about uninitialized variableStef Walter2012-07-241-1/+1
|
* If a module is not marked 'critical' then ignore failureStef Walter2012-06-271-3/+11
| | | | | * Ignore failure when initializing registered modules when 'critical' is not set on a module.
* Preconditions to check for input probs and out of memoryStef Walter2012-05-131-43/+42
| | | | | | * We don't try to guarantee completely robust and problem free behavior in cases where the caller or process isn't behaving. We consider these to be outside of our control.
* Use gcc extensions to check varargs during compileStef Walter2012-05-131-2/+5
| | | | | * Add macros GNUC_PRINTF and GNUC_NULL_TERMINATED to check correct printf and NULL terminated style varargs
* Add tests for enable-in and disable-inStef Walter2012-04-021-2/+2
|
* Fix crasher when a duplicate module is presentStef Walter2012-04-011-6/+7
|
* Add enable-in and disable-in options to module configStef Walter2012-04-011-1/+74
| | | | | | | | * These can be used to load certain modules in certain programs, or prevent loading in others. * Useful for a key manager like seahorse, so we can load extra modules (think NSS) that other modules shouldn't load.
* Remove automatic reinitialization of PKCS#11 after forkStef Walter2012-01-231-9/+2
| | | | | | | | | | | | | | * First of all one should only call async-signal-safe functions from the callbacks of pthread_atfork(), and so we cannot reinitialize directly. * Some modules use pthread_atfork() to detect forking and setup their internal state. If we call into them in our pthread_atfork() callback then this is inherently racy. * There was danger of endless loops and deadlocks which are caused by handlers which fork in their C_Initialize * Many processes do fork/exec, reinitializing PKCS#11 for these forks is quite resourc intensive when the child process won't use PKCS#11 at all.
* More fixes for non-static function namesStef Walter2011-10-241-31/+31
| | | | | * See previous commit * Initialize library before debug statements
* Rename non-static functions to have a _p11_xxx prefix.Stef Walter2011-10-241-55/+55
| | | | | | | * Work around issues with brain-dead linkers not respecting the libtool -export-symbol-regex argument https://bugs.freedesktop.org/show_bug.cgi?id=42020
* Initial port to win32Stef Walter2011-10-171-57/+47
| | | | | | | | * Tests do not all yet pass, at least not on wine * Added abstraction of some non-portable functions in compat.h/c * Build with an argument like this for win32 support: ./autogen.sh --host=i586-mingw32msvc * This win32 port needs more work from interested parties
* Only call C_Initialize and C_Finalize once per moduleStef Walter2011-10-101-55/+62
| | | | | | | | * Do not concurretnly call C_Initialize or C_Finalize in a module * The PKCS#11 spec indicates that mone thread should call those functions. * It's reasonable for a module to expect to only be initialized or finalized in one thread. * In particular NSS does not lock its C_Initialize or C_Finalize.
* Don't allow recursive calling of C_Initialize on a given module.Stef Walter2011-10-101-1/+8
|
* Don't use PATH_MAX unless its definedPino Toscano2011-09-301-1/+6
| | | | | | * Fixes build on GNU/Hurd https://bugs.freedesktop.org/show_bug.cgi?id=41303
* Add #include <limits.h> for PATH_MAX to fix compilation on FreeBSD.Roman Bogorodskiy2011-09-161-1/+2
| | | | https://bugs.freedesktop.org/show_bug.cgi?id=40923
* When a module has a relative path, load it from $libdir/pkcs11Kalev Lember2011-09-141-3/+58
| | | | | | | So far we have only supported full paths to the pkcs11 modules in config files. This change adds relative path support, so that for modules installed under the standard $libdir/pkcs11, the config file won't have to spell out the full path.
* Rename pkgconfig configuration directory variablesKalev Lember2011-09-141-2/+3
| | | | | | | | | | | | Renamed them to reduce ambiguity and to pave the way for exposing some additional parameters. p11_system_modules -> p11_system_config_modules p11_user_modules -> p11_user_config_modules configure --with-pkcs11-dir => configure --with-system-config
* Don't crash if p11_kit_registered_modules() called after failed initStef Walter2011-08-301-2/+3
|
* Add 'critical' setting for modulesStef Walter2011-08-301-1/+6
| | | | | | * When a module has critical set to 'yes', and that module fails to init then it aborts the entire init process. * Defaults to 'no'
* Fix endless loop if module forks during initialization.Stef Walter2011-08-141-5/+7
| | | | | | | * If a module forks during its C_Initialize, previously our fork handler would try to initialize it again, ad nauseum. Reported by Nikos on the mailing list.
* Safer initialization of individually initialized module.Stef Walter2011-08-141-6/+30
| | | | | | | * More checks for out of memory. * Take more of the same code paths when initializing a single module as when initializing registered, or loading from file. * Cleanup halfway initialized globals if fail during init.
* Don't fail when duplicate modules are configured.Stef Walter2011-08-031-1/+1
| | | | | | * Duplicate modules may be caused by editor backups, misconfigurations or a multitude of other sources. Failing dead is a bit harsh. * After discussing gnutls needs with Nikos
* Better debug output for initialization and loading modules.Stef Walter2011-08-031-4/+7
|
* Fix broken debug argumentsStef Walter2011-08-031-1/+1
|
* Reimplement and remove apache licensed bits of code.Stef Walter2011-07-271-31/+31
| | | | | | | | | | * Reimplement the various bits of the hash table that were still based on the apache apr code. Use different algorithms for hashing, lookup and other stuff. * Use this as an opportunity to cleanup that code and make it more legible. https://bugzilla.redhat.com/show_bug.cgi?id=725905
* Fix logic error loading registered modules.Stef Walter2011-06-161-1/+1
| | | | Thanks to Richard Bellgrim.
* Complete documentation for message functionality.Stef Walter2011-06-091-0/+15
|
* Store last failure message per thread.Stef Walter2011-06-091-12/+34
| | | | * Add p11_kit_message() function to get last message.
* Refactor configurationStef Walter2011-06-081-305/+61
| | | | | * Move configuration loading into conf.c * Have user modules with same name merge/override modules in system.
* Ignore files without a 'module' value.Stef Walter2011-06-081-7/+4
| | | | * Just skip loading these.
* Fix more memory errors and leaks in module code.Stef Walter2011-06-071-4/+12
|
* Set the return value properly in p11_kit_load_initialize_module()Stef Walter2011-05-301-0/+3
|
* Add p11_kit_load_initialize_module() function.Stef Walter2011-05-271-24/+143
| | | | | * This function will load a module from a file path, and then initialize it.
* Rename module arguments from 'funcs' to 'module'Stef Walter2011-05-271-122/+122
|
* Change around installation of headers, pkg-config, and file namesStef Walter2011-05-271-0/+1195
* Install headers to ${prefix}/include/p11-kit-1/p11-kit/ * This solves problems with other projects that have their own pkcs11.h files. * Change the pkg-config file name to p11-kit-1.pc * Change the source file names.