Commit Graph

13008 Commits

Author SHA1 Message Date
Tobias Brunner 703a0b4c3e curl: Add support to return the response code 2014-05-19 14:28:40 +02:00
Tobias Brunner deb8975bd2 unit-tests: Add a test case for HTTP response codes 2014-05-19 14:24:12 +02:00
Tobias Brunner 9a18593752 fetcher: Add option to retrieve response code from a fetcher 2014-05-19 14:20:50 +02:00
Tobias Brunner 032dcb8989 unit-tests: Defer failures by worker threads
In some cases the main thread is not ready to immediately call siglongjmp(),
e.g. if it currently holds a mutex that is later required during
shutdown.

Therefore, we delay handling errors in worker threads until the main
thread performs the next check itself (or the test function ends).

The same issue remains with SIGALRM.
2014-05-19 14:06:55 +02:00
Tobias Brunner 435fecd751 unit-tests: Make sure plugins in the builddir are loaded
When running the tests in GDB the working directory apparently is
different.  With the relative path used previously the plugins would not
be found and those installed on the system would get used.
2014-05-19 14:06:43 +02:00
Tobias Brunner 7c888e0d23 unit-tests: Don't assert failures for unreadable settings files as root
The file can still be read by root even if nobody has read privileges.
2014-05-16 17:50:29 +02:00
Martin Willi 2145f0c212 Merge branch 'aead-proposal'
Encode default AEAD encryption algorithms to a proposal separate from non-AEAD
algorithms. RFC 4306 and 5282 where less explicit, but RFC 5996 requires
separate proposals for AEAD and non-AEAD algorithms. As responder we still
accept both encoding variants.

Fixes #573.
2014-05-16 16:54:04 +02:00
Martin Willi 2f893f278d proposal: Don't return a default IKE proposal without encryption/AEAD algs 2014-05-16 16:51:19 +02:00
Martin Willi 8d74ec9e80 ike: Add an additional but separate AEAD proposal to CHILD config
This currently has no effect: We don't include AEAD algorithms in the default
ESP proposal, as we don't know if it is supported by the backend. But as we
hopefully get an algorithm query mechanism on kernel interfaces some day, we
add the appropriate functionality nonetheless.
2014-05-16 16:51:19 +02:00
Martin Willi 879e3d12ca ike: Add an additional but separate AEAD proposal to IKE config, if supported 2014-05-16 16:51:19 +02:00
Martin Willi 356846db5d child-cfg: Allow passing NULL as proposal to add_proposal()
Making the API consistent to the one of ike_cfg.
2014-05-16 16:01:21 +02:00
Martin Willi 3312c447ef ike-cfg: Allow passing NULL to add_proposal()
This simplifies adding default proposals with constructors potentially
returning NULL.
2014-05-16 16:01:21 +02:00
Martin Willi 8642f8bdb7 proposal: Use an additional "default" constructor specific to AEAD algorithms
This allows a caller to create a separated proposal for supported AEAD
algorithms, as required by RFC 5996.
2014-05-16 16:01:21 +02:00
Martin Willi 0fc4dd429d proposal: Don't include AEAD algorithms in the default proposal
According to RFC 5996 3.3 we should use a separate proposal for AEAD algorithms.
This was not clear in RFC 5282, hence we previously included both AEAD and
non-AEAD algorithms in a single proposal.
2014-05-16 16:01:21 +02:00
Martin Willi 9612db648a Merge branch 'clang-fixes'
Fixes some warnings raised when compiling with clang. Some are cosmetically,
others are worth to fix.

This prepares the Travis build for -Werror, which will force us to fix all
warnings raised by all compilers.
2014-05-16 15:45:41 +02:00
Martin Willi 064fe9c963 enum: Return boolean result for enum_from_name() lookup
Handling the result for enum_from_name() is difficult, as checking for
negative return values requires a cast if the enum type is unsigned. The new
signature clearly differentiates lookup result from lookup value.

Further, this actually allows to convert real -1 enum values, which could not
be distinguished from "not-found" and the -1 return value.

This also fixes several clang warnings where enums are unsigned.
2014-05-16 15:42:07 +02:00
Martin Willi 9ee8b3b41f enum: Don't directly include enum.h
To allow enum.h to depend on utils.h definitions, avoid its direct inclusion.
Instead include utils.h, which includes enum.h as well.
2014-05-16 15:42:07 +02:00
Martin Willi 8584e62368 libtps: Silence GCC set-but-unused warning in incomplete code 2014-05-16 15:42:07 +02:00
Martin Willi ed9bdfee41 scepclient: Cast OID_UNKNOWN before comparing it to unsigned hash_algorithm_t
clang uses unsigned enums and complains about the always-false -1 check.
2014-05-16 15:42:07 +02:00
Martin Willi 78db68cecf swanctl: Properly initialize return value of --install command 2014-05-16 15:42:07 +02:00
Martin Willi f5bbbd480c xauth-pam: Fix header include guard 2014-05-16 15:42:07 +02:00
Martin Willi 2cf5e97dd2 eap-peap: Remove dead SoH code from PEAP
clang complains about the unused variables.
2014-05-16 15:42:07 +02:00
Martin Willi e2bf45a491 tls: Move variable sized tls_record_t struct to end of tls_t data
clang complains about the the non-last variable length member.
2014-05-16 15:42:07 +02:00
Martin Willi 6eff96f543 kernel-klips: Pass a pointer to a properly sized integer for algorithm lookup 2014-05-16 15:42:07 +02:00
Martin Willi e163427d9f auth-cfg: Cast literal default value to pointer type
Fixes a clang warning.
2014-05-16 15:42:07 +02:00
Martin Willi 0746e38c51 unbound: Explicitly cast from ldns RR type/class to our types
These definitions are directly derived from the RFC, so it should be safe
to cast them. clang complains about the different types, so cast them
explicitly.
2014-05-16 15:42:06 +02:00
Martin Willi fb515325cc x509: Remove some unused ASN1 OID constants 2014-05-16 15:42:06 +02:00
Martin Willi d3cf9ca322 aes: Remove unused build variants
The AES code historically has different build options for various size/speed
trade-offs. We never made use of them, so just drop the obsolete code. The code
now has four hard-coded fixed tables, both inverse and original.
2014-05-16 15:42:06 +02:00
Andreas Steffen 0f000cdd6c Minor changes in the test environment 2014-05-15 21:30:42 +02:00
Tobias Brunner ff4a2acbe6 Merge branch 'settings-parser'
Adds a flex/bison based parser for settings_t.  It provides several
improvements over the previous parser e.g. quoted strings (with escape
sequences), unlimited includes, more relaxed newline handling, better
syntax error reporting, and a distinction between empty and unset
values (key = vs. key = "").
2014-05-15 12:15:16 +02:00
Tobias Brunner b3dd0168f1 settings: Properly match } and # in include statements
Found due to %option nodefault.  A match for } was actually missing
and # was not properly matched if it was part of an include statement
on the last line of a file that did not end with a newline.
2014-05-15 12:03:07 +02:00
Tobias Brunner c92d44f2cf settings: Eliminate performance warning
This was useful during development, but we accept that matching \n together
with %option yylineno impacts performance.
2014-05-15 12:03:07 +02:00
Tobias Brunner 5b64c04046 scripts: Add test script for settings_t 2014-05-15 12:03:07 +02:00
Tobias Brunner 4102fc9c09 parser-helper: Define debug macros depending on DEBUG_LEVEL 2014-05-15 11:28:10 +02:00
Tobias Brunner 66248396c6 parser-helper: Make parser_helper_file_t private 2014-05-15 11:28:10 +02:00
Tobias Brunner c976cc7d33 parser-helper: Make parser_helper_log a function 2014-05-15 11:28:10 +02:00
Tobias Brunner 4b670a20a9 settings: strongswan.conf must be loaded explicitly 2014-05-15 11:28:10 +02:00
Tobias Brunner da45f9e994 settings: Replace deprecated YYLEX_PARAM with %lex-param
With Bison 3.x support for YYLEX_PARAM has been removed and %lex-param
should be used.  Unfortunately, that option does not take expressions.
Instead we use a wrapper function that calls the lexer with the proper
scanner object, which should also be backward compatible to older Bison
versions.
2014-05-15 11:28:09 +02:00
Tobias Brunner 813e510d69 settings: Include generated header after others
Newer Bison versions declare the parser function in the header, which
requires custom types.
2014-05-15 11:28:09 +02:00
Tobias Brunner f65ac98c64 settings: Reduce log verbosity if files can't be opened
Basically reintroducing 2a38b4556e.
2014-05-15 11:28:09 +02:00
Tobias Brunner 8b43c9ba34 settings: Adopt the new order of sections and settings when replacing configs 2014-05-15 11:28:09 +02:00
Tobias Brunner 5ac20cbb87 settings: Only purge sections if necessary
Instead of removing and caching all values of a previous config, we only
do this for actually removed sections/settings.
2014-05-15 11:28:08 +02:00
Tobias Brunner b98551c74a coverage: Make genhtml not fail if sources are not found
For some reason the .y and .l files of the settings parser are searched in
the wrong directory.
2014-05-15 11:28:08 +02:00
Tobias Brunner f5dd274ab8 settings: Maintain order of sections and settings while enumerating 2014-05-15 11:28:08 +02:00
Tobias Brunner 2fbbea55c5 settings: Don't overwrite values in-place
This is not thread safe.  If threads are reading from pointers to existing
values they could get a partially updated invalid value.

Refactored assignment to a separate function.
2014-05-15 11:28:08 +02:00
Tobias Brunner 725c479f8b settings: Add functions to add sections and key/value pairs to a section 2014-05-15 11:28:07 +02:00
Tobias Brunner 2fe04fb312 unit-tests: Update settings tests to match new parser
Empty settings are now ignored, strings are supported, newlines are
handled properly (e.g. at the end of files) etc.
2014-05-15 11:28:07 +02:00
Tobias Brunner 3855dc01ec settings: Don't enumerate key/value pairs with NULL value 2014-05-15 11:28:07 +02:00
Tobias Brunner 47a3ed979b settings: Use generated parser instead of our own 2014-05-15 11:28:07 +02:00
Tobias Brunner 073d72cf49 settings: Optionally keep track of removed/replaced values 2014-05-15 11:28:06 +02:00