Some profiles are expected to not contain each of the key/ca/cert
material and sometimes an encrypted key might be provided.
In these cases the ParseClientConfig object would trigger an exception
as the underlying SSLConfig object was not able to be fully
instantiated.
However this is expected with some profiles, therefore catch such
exceptions and continue the execution normally.
Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
since the introduction of the unified headers, the API level
has to be specified on the command line, otherwise a development
API level (1000) will be used and will mess up older Android
releases.
On top of that, circumvent a bug in pthread.h by defining __LP32__.
This problem was causing crashes on Android 5 as it wasn't able to
provide libc functions expected by the precompiled ovpn3-core.
Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
With this method it is possible to convert the internal
config representation of a ParseClientConfig object
to json.
Any user needs to define HAVE_CONFIG_JSONCPP in order
to compile this method.
Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
With this new method it is possible to convert a
ParseClientConfig object to an equivalent ovpn config
file.
The output is compliant with the config parser and could be
used to configure an OpenVPN client process.
Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
This constructor takes only the profile content as argument.
It is quite useful when a user wants to create
a ParseClientConfig object starting from a plain .ovpn file,
without providing any other pre-parsed information.
Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
Extend the ParseClientConfig class so that it can store
an entire OpenVPN profile. This way this class can basically
be mapped one-to-one with a user provided config file.
Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
Add function to convert the current compress context
type to the string that was used to configure it.
Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
These new API functions allow the user to retrieve the
type and the length of the private key.
An helper function to convert the type to a human readable
string is also provided.
Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
Users may want to print already parsed key material.
Extend the SSLAPI to accommodate methods for extracting
CA, CRL, CERT, KEY and DH data.
Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
Allow source files that require JSON library functionality
to include a single file (openvpn/common/jsonlib.hpp) which
will then draw in the appropriate JSON library header based
on configuration #defines.
Code can #ifdef on HAVE_JSON to test whether or not JSON
functionality is available (previously, HAVE_JSONCPP
was used).
Currently supports JsonCpp and an OpenVPN-internal JSON
implementation.
This model assumes that alternative JSON implementations
are API-compatible with JsonCpp.
Signed-off-by: James Yonan <james@openvpn.net>
logdatetime.hpp is a drop-in replacement for logsimple.hpp, which
implements the OPENVPN_LOG() macro and variants using trivial
output to std::cout. This version will prepend the date/time
to each log line.
Signed-off-by: James Yonan <james@openvpn.net>
CoarseTime objects that track an AsioTimer must always be
reset when the AsioTimer is cancelled. Not doing so can
cause a bug if the AsioTimer is reused after cancellation.
Signed-off-by: James Yonan <james@openvpn.net>
Change the OPENVPN_EXIT_IN compile-time flag to be
a run-time option instead, controllable via the
EXIT_IN env var. Set EXIT_IN to the number of
seconds to run before exiting.
Signed-off-by: James Yonan <james@openvpn.net>
and use it in ProtoContext::promote_secondary_to_primary()
since it more accurately reflects the underlying
implementation.
Note that this only affects DCO (data channel offload)
implementations.
Signed-off-by: James Yonan <james@openvpn.net>