aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan/utils
Commit message (Collapse)AuthorAgeFilesLines
...
* utils: Directly use syscall() to close open FDs in closefrom()Tobias Brunner2015-08-171-5/+53
| | | | | | | This avoids any allocations, since calling malloc() after fork() is potentially unsafe. Fixes #990.
* utils: Don't use directory enumerator to close open FDs in closefrom()Tobias Brunner2015-08-171-24/+36
| | | | | | | | | | Calling malloc() after fork() is potentially unsafe, so we should avoid it if possible. opendir() will still require an allocation but that's less than the variant using the enumerator wrapper, thus, decreasing the conflict potential. This way we can also avoid closing the FD for the enumerated directory itself. References #990.
* Initialize variables that some compilers seem to warn aboutTobias Brunner2015-08-131-1/+1
|
* identification: Use UTF8String instead of the legacy T61String to encode DNsTobias Brunner2015-08-061-1/+1
| | | | | | | When strings in RDNs contain characters outside the character set for PrintableString use UTF8String as the passed string is most likely in that encoding (RFC 5280 actually recommends to use only those two string types).
* identification: Add hash() methodTobias Brunner2015-08-062-2/+45
| | | | | | | Compared to hashing the encoding we can ignore string types of RDNs when hashing DNs, making hash() compatible to equals() that does the same. Fixes #991.
* printf-hook-builtin: Fix invalid memory accessTobias Brunner2015-08-041-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When precision is given for a string, we must not run unbounded strlen() as it will read beyond the given length. It might even cause a crash if the given pointer is near end of heap or mapping. Fixes numerous valgrind errors such as: ==19215== Invalid read of size 1 ==19215== at 0x52D36C6: builtin_vsnprintf (printf_hook_builtin.c:853) ==19215== by 0x52D40A8: builtin_snprintf (printf_hook_builtin.c:1084) ==19215== by 0x52CE464: dntoa (identification.c:337) ==19215== by 0x52CE464: identification_printf_hook (identification.c:837) ==19215== by 0x52D3DAA: builtin_vsnprintf (printf_hook_builtin.c:1010) ==19215== by 0x57040EB: vlog (bus.c:388) ==19215== by 0x570427D: log_ (bus.c:430) ==19215== by 0xA8445D3: load_x509_ca (stroke_cred.c:416) ==19215== by 0xA8445D3: load_certdir (stroke_cred.c:537) ==19215== by 0xA846A95: load_certs (stroke_cred.c:1353) ==19215== by 0xA846A95: stroke_cred_create (stroke_cred.c:1475) ==19215== by 0xA84073E: stroke_socket_create (stroke_socket.c:782) ==19215== by 0xA83F27C: register_stroke (stroke_plugin.c:53) ==19215== by 0x52C3125: load_feature (plugin_loader.c:716) ==19215== by 0x52C3125: load_provided (plugin_loader.c:778) ==19215== by 0x52C3A20: load_features (plugin_loader.c:799) ==19215== by 0x52C3A20: load_plugins (plugin_loader.c:1159) ==19215== Address 0x50cdb42 is 0 bytes after a block of size 2 alloc'd ==19215== at 0x4C919FE: malloc (vg_replace_malloc.c:296) ==19215== by 0x52CD198: chunk_printable (chunk.c:759) ==19215== by 0x52CE442: dntoa (identification.c:334) ==19215== by 0x52CE442: identification_printf_hook (identification.c:837) ==19215== by 0x52D3DAA: builtin_vsnprintf (printf_hook_builtin.c:1010) ==19215== by 0x57040EB: vlog (bus.c:388) ==19215== by 0x570427D: log_ (bus.c:430) ==19215== by 0xA8445D3: load_x509_ca (stroke_cred.c:416) ==19215== by 0xA8445D3: load_certdir (stroke_cred.c:537) ==19215== by 0xA846A95: load_certs (stroke_cred.c:1353) ==19215== by 0xA846A95: stroke_cred_create (stroke_cred.c:1475) ==19215== by 0xA84073E: stroke_socket_create (stroke_socket.c:782) ==19215== by 0xA83F27C: register_stroke (stroke_plugin.c:53) ==19215== by 0x52C3125: load_feature (plugin_loader.c:716) ==19215== by 0x52C3125: load_provided (plugin_loader.c:778) ==19215== by 0x52C3A20: load_features (plugin_loader.c:799) ==19215== by 0x52C3A20: load_plugins (plugin_loader.c:1159)
* capabilities: Handle ERANGE in user and group lookupsTobias Brunner2015-06-231-12/+48
| | | | | | | | | | | | | | As it turns out, getpwnam_r, getgrnam_r, and friends will return ERANGE if _any_ user or group on the system is larger than will fit into the scratch buffer you pass to them. This reworks the resolve_uid and resolve_gid methods plus init_supplementary_groups to use a variable-size buffer that is grown until the results fit. Based on a patch by Evan Broder. Closes strongswan/strongswan#12.
* leak-detective: Use passed callback to report leaksTobias Brunner2015-04-201-2/+2
| | | | | | | | This prevented `stroke memusage` from reporting the leaks on the console. Instead, they were sent to the callbacks set up by libstrongswan. Fixes a426851f6362 ("leak-detective: Use callback functions to report leaks and usage information").
* strerror: Move to its own Doxygen subgroupMartin Willi2015-04-161-1/+2
|
* utils: Clean up includesMartin Willi2015-04-162-36/+31
|
* align: Move min/max/padding/alignment functions to separate filesMartin Willi2015-04-164-106/+149
|
* time: Move time related functions to separate filesMartin Willi2015-04-164-188/+235
|
* object: Move OO programming helper macros to a separate header fileMartin Willi2015-04-162-106/+127
|
* status: Move status_t type and functions to separate filesMartin Willi2015-04-164-113/+121
|
* path: Move path related utility functions to separate filesMartin Willi2015-04-164-198/+246
|
* tty: Move tty related functions to separate filesMartin Willi2015-04-164-107/+152
|
* memory: Move memory manipulation related functions to separate filesMartin Willi2015-04-164-377/+421
|
* string: Move string related utility functions to separate filesMartin Willi2015-04-164-152/+195
|
* byteorder: Move byte order related functions to separate header fileMartin Willi2015-04-162-136/+162
|
* types: Use generic type definitions to separate header fileMartin Willi2015-04-162-62/+88
|
* atomics: Move atomics/recounting support to separate filesMartin Willi2015-04-164-180/+245
|
* enum-names: Fail gracefully when passing a NULL value as enum namesMartin Willi2015-04-151-1/+5
|
* leak-detective: Whitelist gcrypt_plugin_create()Martin Willi2015-04-151-0/+1
| | | | | | gcry_check_version() does not free statically allocated resources. However, we can't whitelist it in some versions, as it is not a resolvable symbol name. Instead, whitelist our own plugin constructor function.
* utils: Provide aligning variants of INIT/INIT_EXTRA macrosMartin Willi2015-04-151-0/+29
|
* utils: Add malloc/free wrappers returning aligned dataMartin Willi2015-04-152-0/+62
| | | | | | | | | | | | | While we could use posix_memalign(3), that is not fully portable. Further, it might be difficult on some platforms to properly catch it in leak-detective, which results in invalid free()s when releasing such memory. We instead use a simple wrapper, which allocates larger data, and saves the padding size in the allocated header. This requires that memory is released using a dedicated function. To reduce the risk of invalid free() when working on corrupted data, we fill up all the padding with the padding length, and verify it during free_align().
* utils: Provide an INIT_EXTRA() macro, that allocates extra data to INIT()Martin Willi2015-04-151-0/+15
|
* utils: Define MAX_(U)INT_TYPE to the maximum size integer type availableMartin Willi2015-04-141-0/+6
|
* utils: Typedef int128_t and u_int128_t types if supportedMartin Willi2015-04-141-0/+11
|
* utils: Add a constant time chunk_equals() variant for cryptographic purposesMartin Willi2015-04-141-0/+13
|
* utils: Add a constant time memeq() variant for cryptographic purposesMartin Willi2015-04-142-0/+24
|
* cpu-feature: Support Via Padlock security featuresMartin Willi2015-04-132-0/+56
|
* cpu-feature: Add a common class to query available CPU featuresMartin Willi2015-04-132-0/+164
| | | | Currently supported is x86/x64 via cpuid() for some common features.
* utils: Fix enum_flags_to_string parameter name to match Doxygen descriptionMartin Willi2015-03-191-1/+1
|
* enum: Extend printf hook to print flagsThomas Egerer2015-03-032-6/+122
| | | | Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
* apple: Redefine some additional clashing Mach typesMartin Willi2014-12-161-0/+6
| | | | | | While they usually are not included in a normal strongSwan build, the XPC header indirectly defines these Mach types. To build charon-xpc, which uses both XPC and strongSwan includes, we have to redefine these types.
* apple: Use precancelable poll() to wrap accept/recvmsg callsMartin Willi2014-12-121-1/+5
| | | | | | To make accept/recvmsg cancelable, we wrap them with poll. As poll itself does not honor pending cancellations when entering the function, we use our variant that checks for pending cancellation requests before entering poll().
* windows: Properly set errno for read/write functions using WinsockMartin Willi2014-11-281-4/+4
|
* windows: Move the compatibility header to the compat subfolderMartin Willi2014-11-213-3/+3
|
* apple: Wrap accept() and recvfrom() with poll(2) instead of selectMartin Willi2014-11-211-5/+11
|
* apple: Introduce a central compatibility header with all __APPLE__ quirksMartin Willi2014-11-212-0/+106
|
* windows: Provide a write(2) wrapper that uses send(2) on socketsMartin Willi2014-11-212-0/+22
|
* windows: Provide a read(2) wrapper that uses recv(2) on socketsMartin Willi2014-11-212-0/+25
|
* windows: Provide a poll(2) wrapper calling WSAPoll()Martin Willi2014-11-213-0/+40
|
* identification: Support custom types in string constructor prefixesMartin Willi2014-10-302-0/+42
|
* identification: Support prefixes in string constructors for an explicit typeMartin Willi2014-10-302-0/+54
|
* chunk: Fix internet checksum calculation on big-endian systemsTobias Brunner2014-10-231-1/+1
| | | | | | | ntohs() might be defined as noop (#define ntohs(x) (x)) so we have to manually shorten the negated value (gets promoted to an int). Fixes #747.
* backtrace: Fix symbol lookup in dynamic symtab via libbfdTobias Brunner2014-10-141-0/+1
|
* process: Include missing <signal.h> for raise(3)Martin Willi2014-10-141-0/+1
| | | | Fixes OS X build.
* process: Add a wrapper to invoke a command under the system default shellMartin Willi2014-10-062-0/+94
|
* process: Port child process spawning to the Windows platformMartin Willi2014-10-061-1/+283
|