0
0
mirror of https://github.com/OpenVPN/openvpn3.git synced 2024-09-20 20:13:05 +02:00
Commit Graph

1300 Commits

Author SHA1 Message Date
James Yonan
6477e0d59f In sslctx.hpp (both OpenSSL and PolarSSL versions), allow
CA to be omitted if SSLConst::NO_VERIFY_PEER flag is set.
2015-10-15 23:38:28 -07:00
James Yonan
d0dcfe759c In file.hpp, added write_binary_list() method. 2015-10-15 23:37:00 -07:00
James Yonan
3e42c09790 In zlib.hpp, make verbosity setting (verbose) into an
optional run-time parameter, but retain the compile-time
setting (OPENVPN_GZIP_DEBUG) to determine the default.
2015-10-15 23:34:16 -07:00
James Yonan
59c5950949 In ZLib::decompress_gzip(), allow max_size to be disabled
(i.e. no limit on size) by setting to zero.
2015-10-15 23:31:21 -07:00
James Yonan
eaae86a144 In timestr.hpp, add Windows implementation for
date_time_rfc822().
2015-10-08 21:56:00 -06:00
James Yonan
508d6858ac Ported runcontext.hpp to Windows. 2015-10-08 21:54:22 -06:00
James Yonan
b2769db93a In format.hpp, work around a Windows symbol conflict
by renaming template var OUT to OUTPUT.
2015-10-08 21:52:59 -06:00
James Yonan
0268d210dd Added Windows implementation for n_cores(). 2015-10-08 21:51:29 -06:00
James Yonan
c90eb0b74b Made n_cores() portable between Linux and Mac OS X and
moved it to new file openvpn/common/core.hpp
2015-10-08 00:30:35 -07:00
James Yonan
c26f8d7375 Make PThreadCondBase portable between Linux and Mac OS X. 2015-10-08 00:25:06 -07:00
James Yonan
6b92002fde Make peercreds() portable between Linux or Mac OS X. 2015-10-08 00:23:19 -07:00
James Yonan
97c967be57 In unicode.hpp, added Unicode::UTF8Iterator. 2015-10-01 17:34:13 -07:00
James Yonan
8b6b2015a0 Fixed issue where utf8_length() was not properly reducing
the length passed to isLegalUTF8() for characters near the
end of the string.
2015-10-01 16:35:45 -07:00
James Yonan
0710d1f327 Added string::is_empty() method that returns true if
passed string is empty or contains only space chars.
2015-10-01 16:33:19 -07:00
James Yonan
07bcab9ab3 Extend is_close_tag() in options.hpp to search for
wildcard close tag if tag string is empty.
2015-10-01 16:29:38 -07:00
James Yonan
2df4f44711 Added/changed printfmt() format specifiers:
* %r formats any argument regardless of type
     and single-quotes it.
* %R formats any argument regardless of type
     and double-quotes it.
2015-10-01 16:21:21 -07:00
James Yonan
f3e9dbde86 Added OPENVPN_FMT(...) macro. 2015-10-01 16:20:15 -07:00
James Yonan
e6d27bc57e In format.hpp, added specializations for bool. 2015-10-01 16:18:45 -07:00
James Yonan
96866ac7e1 format.hpp:
* Added static polymorphic sink for print formatting in
  print_formatted_detail::Output<T> where T can be
  std::string or std::ostringstream

* By default printfmt() uses:

  PrintFormatted<std::string> pf(fmt, 256);

* prune openvpn::to_string() methods prior to removal
  (obsoleted by C++11 std::to_string())
2015-09-25 11:39:12 -07:00
James Yonan
a30cd2f689 Added jsoncpp to Windows build scripts as an
optional dependency.
2015-09-24 20:31:48 -06:00
James Yonan
4901f4d552 Updated Asio in Windows build config to asio-20150924. 2015-09-24 20:30:26 -06:00
James Yonan
4d3e015c6b Updated Asio to asio-20150924. 2015-09-24 14:53:58 -07:00
James Yonan
d0b570bd7e In userpass.hpp:
* Added new parse method that parses creds out
  of a file.

* Added dedicated exception creds_error.
2015-09-24 14:28:15 -07:00
James Yonan
5885b35731 In format.hpp:
(1) Create new versions of to_string() method:
    (a) for numeric types, dispatch to std::to_string()
    (b) for string, char, and nullptr_t types, handle directly
    (c) for other types, use std::ostringstream

(2) Create vararg methods prints, print, and printd
    for printing argument lists.

(3) Create method printfmt() with string formatting
    similar to sprintf but fully type-safe.
    usage: printfmt(<format_string>, args...)
    options:
      %s formats any argument regardless of type.
      %r formats any argument regardless of type and quotes it.
      %% formats '%'
2015-09-24 13:52:24 -07:00
James Yonan
6378339776 Changes to hash.hpp and users:
1. Hash code is now compatible with VS 2015, so
   HAVE_HASH_COMBINE can be removed.

2. Added OPENVPN_HASH_METHOD macro for defining std::hash<>
   classes.

3. Make Hash::combine() into a varargs method.
2015-09-24 13:43:38 -07:00
James Yonan
29e427241b In exception.hpp, optimize Exception() constructor for
string move.

Also added noexcept qualifier to most Exception methods.
2015-09-23 23:26:30 -07:00
James Yonan
415dc9067b In splitlines.hpp, rename S_OK to S_OKAY due to Windows symbol
conflict.
2015-09-23 23:11:55 -07:00
James Yonan
a9ed9d47f2 ovpn3 client API now supports adding user-defined peer-info
data to the OpenVPN handshake (peer-info is a client -> server
key/value list that is part of the OpenVPN protocol).  To
add peer-info key/value pairs, use ClientAPI::Config::peerInfo.

Incremented core OPENVPN_VERSION to "3.0.6".
2015-09-21 19:42:24 -07:00
James Yonan
99c0f064ef ServerPushList::parse() now accepts directive name. 2015-09-21 11:43:01 -07:00
James Yonan
9023c34929 Changes to vpnservnetblock.hpp and vpnservpool.hpp to
allow the use of multiple server-side VPN IP address
pools.
2015-09-20 20:58:35 -07:00
James Yonan
24a66b140c RouteType class template changes (route.hpp):
* Added optional mark value.

* Added new constructor that accepts title parameter as
  as std::string.
2015-09-20 20:55:45 -07:00
James Yonan
ab153997c2 Added new IP::Addr constructor that accepts title parameter as
a std::string.
2015-09-20 20:54:37 -07:00
James Yonan
ba91532554 In merge.hpp, detect multiline breakout attempt. 2015-09-18 21:25:40 -07:00
James Yonan
d3d45937dc Added write_private() method, for writing a string to a file
that is created with access bits limited to owner access.
2015-09-18 10:26:21 -07:00
James Yonan
9fdff61e07 Added new virtual methods to SSLConfigAPI for standalone
validation:

  virtual std::string validate_cert(const std::string& cert_txt) const = 0;
  virtual std::string validate_cert_list(const std::string& certs_txt) const = 0;
  virtual std::string validate_crl(const std::string& crl_txt) const = 0;
  virtual std::string validate_private_key(const std::string& key_txt) const = 0;
  virtual std::string validate_dh(const std::string& dh_txt) const = 0;
2015-09-18 10:25:20 -07:00
James Yonan
9c2fa0a6e5 In namespace string::, added new methods:
* ends_with_newline()
* spaces()
* indent()
* is_empty()
2015-09-18 10:23:18 -07:00
James Yonan
a8e8881510 In splitlines.hpp, added a const line_ref() method. 2015-09-18 10:22:47 -07:00
James Yonan
8dcf7dc828 Asio async_wait() lambdas should always check error status. 2015-09-18 10:22:11 -07:00
James Yonan
48a9d237d7 In options.hpp, added detect_multiline_breakout() method as
a security check to ensure that untrusted content pasted into
multiline config file directives such as:

<cert>
. . .
</cert>

doesn't try to break out of the pseudo-XML block
by inserting its own </cert>.
2015-09-18 10:19:38 -07:00
James Yonan
ecfd16e432 In hostport.hpp, when validating host/port, include the bad
host/port string in the thrown exception by sanitizing it
with Unicode::utf8_printable().
2015-09-18 10:18:22 -07:00
James Yonan
50118b0444 Extended UserPass methods with new flags:
OPT_REQUIRED
  USERNAME_REQUIRED
  PASSWORD_REQUIRED
  TRY_FILE
2015-09-18 10:16:37 -07:00
James Yonan
d38101d5c2 In buflist.hpp:
* Added explicit flag to turn on size=1 optimization.
* Added join() method without arguments.
* Added copy() method.
2015-09-18 10:14:03 -07:00
James Yonan
8870b2477e Added linux-specific is_daemon_alive() function to determine
if a particular daemon is running.
2015-09-08 22:21:26 -07:00
James Yonan
685c7601e2 In common/file.hpp, added read_binary_linear() to read a
file without seeking to determine its length.
2015-09-08 22:16:46 -07:00
James Yonan
1b913b16f1 Added PersistentFile::stat() method to return
struct stat of active file.
2015-09-08 22:14:52 -07:00
James Yonan
b4dea33463 Renamed PersistentOutputFile to PersistentFile, since class
will soon have input methods as well.
2015-09-08 11:37:55 -07:00
James Yonan
276a52d811 Added SSL switch (on/off/unspecified) to Listen::Item.
When parsing listen directives, "ssl" or "!ssl" may
be specified as the last parameter to set the ssl
switch.  By default, the switch is set to unspecified.
2015-09-08 05:58:32 -07:00
James Yonan
494cf8bd2d Added string::is_digit() method. 2015-09-08 05:57:51 -07:00
James Yonan
40bc68bb74 Added SockOpt::Creds::root_or_self_uid() method to test if
local socket client is root or has our own UID.
2015-09-08 05:55:08 -07:00
James Yonan
1c67469856 In AsioPolySock::Base, add boolean is_local() method to
test if socket is a unix domain socket.
2015-09-08 05:52:56 -07:00