summaryrefslogtreecommitdiff
path: root/common/compat.c
Commit message (Collapse)AuthorAgeFilesLines
* Add compatibility fdwalk() functionStef Walter2014-07-081-0/+73
| | | | | This is used when execing another process to close all open file descriptors that we don't wish to be inherited.
* common: Fixed implementation of strerror_r for WinXPPavel A2014-07-011-0/+15
| | | | | | ie: when streror_s is missing in msvcrt.dll https://bugs.freedesktop.org/show_bug.cgi?id=76594
* Proposed fix for compiler warnings in common/compat.cPavel A2014-06-201-19/+23
| | | | | | | | | | | | | when buliding for Windows (mingw). This issue has been reported in bug #76594 a. Moved vasprintf before asprintf b. Added prototypes for each of them Thanks, pa Signed-off-by: Pavel A <pavel.aronsky@daynix.com>
* Fix handling of mmap failure and mapping empty filesPascal Terjan2014-02-131-2/+9
| | | | | | | | | | | Check the return value of mmap() correctly. Empty files cannot be mmap'd so we implement some work around code for that. https://bugs.freedesktop.org/show_bug.cgi?id=74773 Signed-off-by: Stef Walter <stef@thewalter.net>
* Avoid multiple stat() calls for same fileStef Walter2013-08-281-11/+28
| | | | | | As a side effect we can also not use the dirent.d_type field https://bugs.freedesktop.org/show_bug.cgi?id=68525
* compat: Check return value of mmap() properlyStef Walter2013-08-281-1/+1
| | | | https://bugs.freedesktop.org/show_bug.cgi?id=68525
* Avoid using the non-thread-safe strerror() functionStef Walter2013-07-181-0/+16
| | | | https://bugzilla.redhat.com/show_bug.cgi?id=985481
* Don't load configs from user directory when setuidStef Walter2013-07-181-0/+48
| | | | | | | When running as setuid() or setgid() don't access the user's home directory, or use $HOME environment variables. https://bugzilla.redhat.com/show_bug.cgi?id=985014
* open files with O_CLOEXEC when possibleStef Walter2013-07-181-3/+15
| | | | | | | | | | | | | This helps prevent leaked file descriptors when the library is used in a process which exec's. opendir() already uses O_CLOEXEC on platforms that support O_CLOEXEC so we don't need to make changes there. In addition read config files using p11_mmap_open() so that we get the simple benefits of O_CLOEXEC with the open() call there. https://bugzilla.redhat.com/show_bug.cgi?id=984986
* p11-kit: Managed PKCS#11 module loadingStef Walter2013-05-211-0/+6
| | | | | | | | | Support a new managed style module loading for PKCS#11 modules. This allows us to better coordinate between multiple callers of the same PKCS#11 modules and provide hooks into their behavior. This meant redoing the public facing API. The old methods are now deprecated, marked and documented as such.
* Implement valgrind's hellgrind checks for threading problemsStef Walter2013-05-151-1/+1
| | | | | | | And cleanup our locks/locking model. There's no need to use recursive locks, especially since we can't use them on all platforms. In addition adjust taking of locks during initialization so that there's no chance of deadlocking here.
* More compatible path munging and handling codeStef Walter2013-04-031-34/+0
| | | | | | | | | | Centralize the path handling code, so we can remove unixy assumptions and have a chance of running on Windows. The current goal is to run all the tests on Windows. Includes some code from LRN <lrn1986@gmail.com> https://bugs.freedesktop.org/show_bug.cgi?id=63062
* Fix invalid memory accesses reported by 'make memcheck'Stef Walter2013-03-201-7/+4
| | | | These are things that showed up in valgrind while running the tests.
* trust: Don't use POSIX or GNU basename()Stef Walter2013-03-191-18/+26
| | | | | | Both are nasty. Do our own, and test it a bit https://bugs.freedesktop.org/show_bug.cgi?id=62479
* Release version 0.17.1Stef Walter2013-03-181-1/+21
| | | | * Fix distcheck bugs surrounding the strndup() workaround
* compat: Fix trivial commentStef Walter2013-03-181-1/+1
|
* Add compat gmtime_r() and timegm() functionsStef Walter2013-03-031-0/+55
| | | | Not available on Win32 or ancient unixes
* Add compat mkstemp() and mkdtemp() functionsStef Walter2013-03-031-0/+144
| | | | Not available on Win32 or ancient unixes
* Add compat vasprintf() and asprintf() functionsStef Walter2013-03-031-0/+66
| | | | These are not available on Win32 and ancient unixes
* Add compat strndup() functionStef Walter2013-03-031-0/+22
| | | | Not available on Win32 and ancient unixes
* Abstract mmap() into a compat APIStef Walter2013-03-031-34/+124
| | | | | The Win32 for mmap() is very different from Unix, so abstract this into our own p11_mmap_xxx() functions.
* Add compat implementation of basename()Stef Walter2013-03-031-0/+62
| | | | For Win32 and older unixes
* Rename p11_module_xxx() compat functions to p11_dl_xxx()Stef Walter2013-03-031-9/+9
| | | | | | | 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
* Implement stapled certificate extensions internallyStef Walter2013-02-051-1/+1
| | | | | | | | | | | | * Use stapled certificate extensions to represent loaded trust policy * Build NSS trust objects from stapled certificate extensions * Add further attribute debugging for NSS trust objects * Use a custom certificate extension for the OpenSSL reject purpose data * Use SubjectKeyIdentifier for OpenSSL keyid data * Use ExtendedKeyUsage for OpenSSL trust purpose data * Implement simple way to handle binary DER OIDs, using the DER TLV length. DER OIDs are used in the CKA_OBJECT_ID value, and elsewhere. * Split out the building of NSS trust objects from the main parser
* Add basic trust moduleStef Walter2013-02-051-0/+107
| | | | | | This is based off the roots-store from gnome-keyring and loads certificates from a root directory and exposes them as PKCS#11 objects.
* Remove the unused err() function and friendsStef Walter2013-02-051-164/+0
| | | | | We want to use p11_message in our commands anyway, since that allows us control with --verbose and --quiet.
* Move debug and library code into the common/ subdirectoryStef Walter2013-01-091-0/+95
| | | | | | | | | | | 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.
* Fix getprogname() running under wineStef Walter2012-07-171-2/+5
| | | | * Wine uses normal slashes instead of backslashes on windows
* Win32 build fixesStef Walter2012-06-291-4/+7
| | | | | | * Remove unused functions * Use getprogname() instead of calc_progname() which no longer exists * Fix up exporting of functions in the mock module
* Provide compat getprogname() implementations on other OS'sStef Walter2012-05-011-23/+64
| | | | * And use them in our replacement err() and p11_kit_set_progname()
* Move the compat.[ch] headers into common directory/Stef Walter2012-04-301-0/+228
* And the compat stuff in the p11-kit directory merged into util.c and util.h