Commit Graph

81 Commits

Author SHA1 Message Date
Elliot Saba
ae71dd8852 Include ${MBEDTLS_INCLUDE_DIR} when compiling crypt_mbedtls.c
Without this, mbedTLS installs in non-default install locations
that are otherwise found by the `FindmbedTLS.cmake` module are not
found by the C preprocessor at compile time.
2021-06-30 08:58:12 -05:00
Edward Thomson
0d288e2a09 ntlm: update ntlm dependency for htonll
Update ntlm to include an htonll that is not dependent on system
libraries.
2021-06-30 08:58:11 -05:00
Edward Thomson
722c01b6c1 pcre: upgrade to 8.44 2020-10-04 21:07:53 +01:00
Edward Thomson
dccfaa4129 pcre: upgrade to 8.43 2020-10-04 20:38:02 +01:00
Edward Thomson
600dd54e16 pcre: include the license
We included their COPYING file, which was _not_ in fact their license.
Add the LICENSE file as well.
2020-10-04 20:19:05 +01:00
François Revol
92913621c8 deps: ntlmclient: #error out on unknown platforms
We explicitly pass win32 & macOS, although some old version might not
have it.
2020-08-21 23:43:47 +02:00
François Revol
49ce5e295b deps: ntlmclient: fix htonll for Haiku
Use B_HOST_TO_BENDIAN_INT64 for that.
2020-08-21 17:34:57 +02:00
Edward Thomson
2ffa426e1d Merge pull request #5567 from lhchavez/msan
Make the tests pass cleanly with MemorySanitizer
2020-07-09 23:02:05 +01:00
lhchavez
7c964416fb Make NTLMClient Memory and UndefinedBehavior Sanitizer-clean
This change makes the code pass the libgit2 tests cleanly when
MSan/UBSan are enabled. Notably:

* Changes malloc/memset combos into calloc for easier auditing.
* Makes `write_buf` return early if the buffer length is empty to avoid
  arithmetic with NULL pointers (which UBSan does not like).
* Initializes a few arrays that were sometimes being read before being
  written to.
2020-06-30 06:25:43 -07:00
lhchavez
3a197ea7ea Make the tests pass cleanly with MemorySanitizer
This change:

* Initializes a few variables that were being read before being
  initialized.
* Includes https://github.com/madler/zlib/pull/393. As such,
  it only works reliably with `-DUSE_BUNDLED_ZLIB=ON`.
2020-06-30 06:25:10 -07:00
Patrick Steinhardt
b85eefb460 cmake: Sort source files for reproducible builds
We currently use `FILE(GLOB ...)` in most places to find source and
header files. This is problematic in that the order of files returned
depends on the operating system's directory iteration order and may thus
not be deterministic. As a result, we link object files in unspecified
order, which may cause the linker to emit different code across runs.

Fix this issue by sorting all code used as input to the libgit2 library
to improve the reliability of reproducible builds.
2020-05-15 19:57:09 +02:00
nia
465e10ce18 deps: ntlmclient: use htobe64 on NetBSD too 2020-04-05 18:33:14 +01:00
Patrick Steinhardt
541de51516 cmake: streamline backend detection
We're currently doing unnecessary work to auto-detect backends even if
the functionality is disabled altogether. Let's fix this by removing the
extraneous FOO_BACKEND variables, instead letting auto-detection modify
the variable itself.
2020-04-01 17:36:13 +02:00
Patrick Steinhardt
f2e43a8796 ntlmclient: silence deprecation warnings for CommonCrypto backend
The `CC_MD4()` function has been deprecated in macOS 10.15. Silence this
warning for now until we implement a proper fix.
2020-03-13 22:47:42 +01:00
Patrick Steinhardt
c690136c78 deps: ntlmclient: fix htonll on big endian FreeBSD
In commit 3828ea67b (deps: ntlmclient: fix missing htonll symbols on
FreeBSD and SunOS, 2020-02-21), we've fixed compilation on BSDs due to
missing `htonll` wrappers. While we are now using `htobe64` for both
Linux and OpenBSD, we decided to use `bswap64` on FreeBSD. While correct
on little endian systems, where we will swap from little- to big-endian,
we will also do the swap on big endian systems. As a result, we do not
use network byte order on such systems.

Fix the issue by using htobe64, as well.
2020-02-26 19:34:49 +01:00
Patrick Steinhardt
3828ea67b9 deps: ntlmclient: fix missing htonll symbols on FreeBSD and SunOS
The ntlmclient dependency defines htonll on Linux-based systems, only.
As a result, non-Linux systems will run into compiler and/or linker
errors due to undefined symbols.

Fix this issue for FreeBSD, OpenBSD and SunOS/OpenSolaris by including
the proper headers and defining the symbol accordingly.
2020-02-24 21:46:41 +01:00
Josh Bleecher Snyder
93def7ad64 ntlm: prevent (spurious) compiler warnings
Pull in commit

e7b2583e1b

to fix #5353.
2020-01-09 13:37:18 -08:00
Jason Haslam
7218cf47e1 ntlm: fix failure to find openssl headers 2019-08-29 15:03:46 -06:00
Edward Thomson
9f3441ccf5 zlib: remove unused functions 2019-06-24 17:27:23 +01:00
Edward Thomson
b292c35fef http_parser: cast pointer arithmetic safely 2019-06-24 15:00:40 +01:00
Patrick Steinhardt
358b7a9d1d deps: ntlmclient: disable implicit fallthrough warnings
The ntlmclient dependency has quite a lot of places with implicit
fallthroughs. As at least modern GCC has enabled warnings on
implicit fallthroughs by default, the developer is greeted with a
wall of warnings when compiling that dependency.

Disable implicit fallthrough warnings for ntlmclient to fix this
issue.
2019-06-14 08:44:13 +02:00
Edward Thomson
1bbdec69be http_parser: handle URLs with colon but no port
When the end of the host is reached, and we're at the colon separating
the host with the port (ie, there is no numeric port) then do not error.
This is allowed by RFC 3986.
2019-06-11 21:55:31 +01:00
Edward Thomson
a7f65f03bd ntlm: add ntlmclient as a dependency
Include https://github.com/ethomson/ntlmclient as a dependency.
2019-06-10 19:58:22 +01:00
Edward Thomson
1f9b72225d cmake: disable fallthrough warnings for PCRE
Our PCRE dependency has uncommented fallthroughs in switch statements.
Turn off warnings for those in the PCRE code.
2019-05-22 12:47:04 +02:00
Edward Thomson
e4b2ef87c7 regex: don't warn on unused functions
PCRE includes compatibility functions that may go unused.  Don't warn.
2019-05-19 11:12:13 +01:00
Edward Thomson
9ceafb57b2 regexec: use pcre as our fallback/builtin regex
Use PCRE 8.42 as the builtin regex implementation, using its POSIX
compatibility layer.  PCRE uses ASCII by default and the users locale
will not influence its behavior, so its `regcomp` implementation is
similar to `regcomp_l` with a C locale.
2019-05-19 11:12:13 +01:00
lhchavez
b5e8272fdc Attempt at fixing the MingW64 compilation
It seems like MingW64's size_t is defined differently than in Linux.
2019-01-06 08:29:56 -08:00
Patrick Steinhardt
2e0f926e1c docs: clarify and include licenses of dependencies
While our contribution guide tries to make clear the licenses that apply
to libgit2, it does not make clear that different licenses apply to our
bundled dependencies. Make this clear by listing each dependency
together with the licenses that they are governed by. Furthermore,
bundle the complete license texts next to the code they apply to.
2018-08-30 12:16:59 +02:00
Patrick Steinhardt
cacbf99889 deps: fix implicit fallthrough warning in http-parser
GCC 7 has introduced new warnings for implicit fallthrough in switch
statements. Whenever there is no branch in a case block, GCC will watch
out for some heuristics which indicate that the implicit fallthrough is
intended, like a "fallthrough" comment. The third-party http-parser code
manages to trick this heuristic in one case, even though there is a
"FALLTHROUGH" comment. Fortunately, GCC has also added a strictness
level to the -Wimplicit-fallthrough diagnostic, such that we can loosen
this heuristic and make it more lax.

Set -Wimplicit-fallthrough=1 in http-parser's CMake build instructions,
which is the strictest level that gets rid of the warning. This level
will treat any kind of comment as a "fallthrough" comment, which
silences the warning.
2018-06-22 13:48:55 +02:00
Patrick Steinhardt
4c5330cb83 deps: upgrade embedded zlib to version 1.2.11
The current version of zlib bundled with libgit2 is version 1.2.8. This
version has several CVEs assigned:

- CVE-2016-9843
- CVE-2016-9841
- CVE-2016-9842
- CVE-2016-9840

Upgrade the bundled version to the current release 1.2.11, which has
these vulnerabilities fixes.
2018-03-07 10:33:41 +00:00
Edward Thomson
8c8db98078 mingw: update TLS option flags
Include the constants for `WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_1` and
`WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_2` so that they can be used by mingw.

This updates both the `deps/winhttp` framework (for classic mingw) and
adds the defines for mingw64, which does not use that framework.
2018-02-27 11:22:34 +00:00
Patrick Steinhardt
4da74c83e4 cmake: use project-relative binary and source directories
Due to our split of CMake files into multiple modules, we had to replace
some uses of the `${CMAKE_CURRENT_SOURCE_DIR}` and
`${CMAKE_CURRENT_BINARY_DIR}` variables and replace them with
`${CMAKE_SOURCE_DIR}` and `${CMAKE_BINARY_DIR}`. This enabled us to
still be able to refer to top-level files when defining build
instructions inside of a subdirectory.

When replacing all variables, it was assumed that the absolute set of
variables is always relative to the current project. But in fact, this
is not the case, as these variables always point to the source and
binary directory as given by the top-levl project. So the change
actually broke the ability to include libgit2 directly as a subproject,
as source files cannot be found anymore.

Fix this by instead using project-specific source and binary directories
with `${libgit2_SOURCE_DIR}` and `${libgit2_BINARY_DIR}`.
2017-10-20 07:38:34 +02:00
Patrick Steinhardt
8c19969a88 cmake: fix static linking for bundled deps
Our bundled deps are being built as simple static libraries which are
then linked into the libgit2 library via `TARGET_LINK_LIBRARIES`. While
this works for a dynamically built libgit2 library, using this function
to link two static libraries does not have the expected outcome of
merging those static libraries into one big library. This leads to
symbols of our bundled deps being undefined in the resulting libgit2
archive.

As we have bumped our minimum CMake version to 2.8.11, we can now easily
make use of object libraries for our bundled dependencies. So build
instructions are still self-contained inside of the dependency
directories and the resulting object libraries can just be added to the
LIBGIT2_OBJECTS list, which will cause them to be linked into the final
resulting static library. This fixes the issue of undefined symbols.
2017-09-20 15:26:26 +02:00
Patrick Steinhardt
1f43a43dce cmake: move zlib build instructions into subdirectory
Extract code required to build the zlib library into its own
CMakeLists.txt, which is included as required.
2017-08-16 07:12:38 +02:00
Patrick Steinhardt
b751455497 cmake: move http-parser build instructions into subdirectory
Extract code required to build the http-parser library into its own
CMakeLists.txt, which is included as required.
2017-08-16 07:12:38 +02:00
Patrick Steinhardt
9e449e5214 cmake: move regex build instructions into subdirectory
Extract code required to build the regex library into its own
CMakeLists.txt, which is included as required.
2017-08-16 07:12:38 +02:00
Patrick Steinhardt
4324850015 cmake: move winhttp build instructions into subdirectory
Extract code required to build the winhttp library into its own
CMakeLists.txt, which is included as required.
2017-08-16 07:12:38 +02:00
Patrick Steinhardt
9b0482e4d4 zlib: include "git2/types.h" instead of "common.h"
The zlib dependency includes "common.h" inside of the "zconf.h" header
to make available some type declarations like e.g. git_off_t. Including
the "common.h" header does pull in quite a lot of other headers though,
which are not required at all. Instead, we can just include our public
"git2/types.h" header, which is much more limited in its scope but still
provides everything required for "zconf.h".

This fix eases the transition later on to use a separate "features.h"
header instead of defines. As we have to generate the "features.h"
header, we put it in the build directory and add an include directory.
As we are splitting out building of dependencies into subdirectories,
this would mean that the zlib dependency needs to be aware of the parent
project's build directory, which is unfortunate. By including
"git2/types.h", we avoid this problem.
2017-07-03 08:51:47 +00:00
Chris Bargren
0b1e6e42e3 Updating change to http_parser to reflect PR for nodejs/http-parser
The parser now also supports digits, '-' and '.'. https://github.com/nodejs/http-parser/pull/276
2015-12-28 07:40:15 -07:00
Chris Bargren
d900cec96c Updating http parser to accept a + in the schema 2015-12-22 10:38:16 -07:00
Edward Thomson
4f0f2b8473 Correct line endings on winhttp.def 2015-06-10 16:36:38 -04:00
Tony Kelman
547517d7f9 use a different .def file for 64 bit 2015-03-16 14:59:20 -07:00
klutzy
e613e6ebb8 patch so mingw-w64 can build 2015-03-16 13:59:02 -07:00
Philip Kelley
8f426d7dd2 Win32: Enable WinHTTP for MinGW 2015-03-16 12:59:55 -07:00
Carlos Martín Nieto
d43c7bd050 Rever spelling fixes for dependencies
This is not our code and it adds unecessary changes from the upstream
code.
2014-12-05 08:13:43 +01:00
Will Stamper
b874629b2d Spelling fixes 2014-12-04 21:06:59 -06:00
Jacques Germishuys
66d1595436 Solaris doesn't necessarily have stdint.h, use inttypes.h 2014-08-05 19:51:29 +02:00
Carlos Martín Nieto
b42ff7c016 zlib: disable warning 4142 on MSVC
This is about benign redefinition of types. We're not interested in it.
2014-06-11 18:33:55 +02:00
Carlos Martín Nieto
4f8ac2163b zlib: get rid of compress.c and uncompr.c 2014-06-11 18:33:55 +02:00
Carlos Martín Nieto
2bc76050e0 zlib: get rid of gz* 2014-06-11 18:33:55 +02:00