parazyd [Sun, 15 Nov 2020 17:46:06 +0000 (18:46 +0100)]
gopher: Implement secure gopher protocol.
This commit introduces a "gophers" handler inside the gopher protocol if
USE_SSL is defined. This protocol is no different than the usual gopher
prococol, with the added TLS encapsulation upon connecting. The protocol
has been adopted in the gopher community, and many people have enabled
TLS in their gopher daemons like geomyidae(8), and clients, like clic(1)
and hurl(1).
I have not implemented test units for this protocol because my knowledge
of Perl is sub-par. However, for someone more knowledgeable it might be
fairly trivial, because the same test that tests the plain gopher
protocol can be used for "gophers" just by adding a TLS listener.
Jay Satiro [Sun, 13 Dec 2020 08:30:23 +0000 (03:30 -0500)]
digest_sspi: Show InitializeSecurityContext errors in verbose mode
The error is shown with infof rather than failf so that the user will
see the extended error message information only in verbose mode, and
will still see the standard CURLE_AUTH_ERROR message. For example:
---
* schannel: InitializeSecurityContext failed: SEC_E_QOP_NOT_SUPPORTED
(0x8009030A) - The per-message Quality of Protection is not supported by
the security package
* multi_done
* Connection #1 to host 127.0.0.1 left intact
curl: (94) An authentication function returned an error
current result:
(possible some successful data)
curl: (45) bind failed with errno 98: Address already in use
result after patch:
(complete success or few connections failing, higlhy depending on load)
Fail only when all the possible 4-tuple combinations are exhausted,
which is impossible to do when port is selected at bind() time becuse
the kernel does not know if socket will be listen()'ed on or connect'ed
yet.
connect: zero variable on stack to silence valgrind complaint
Valgrind will complain that ssrem buffer usage if not explicit
initialized, hence initialize it to zero.
This completes the change intially started in commit 2c0d7212151 ('ftp:
retry getpeername for FTP with TCP_FASTOPEN') where the ssloc buffer has
a similar memset to zero.
Daniel Stenberg [Fri, 4 Dec 2020 16:27:57 +0000 (17:27 +0100)]
urlapi: don't accept blank port number field without scheme
... as it makes the URL parser accept "very-long-hostname://" as a valid
host name and we don't want that. The parser now only accepts a blank
(no digits) after the colon if the URL starts with a scheme.
This commit also reverts the subsequent follow-ups to that commit, which
were all done within windows #ifdefs that are removed in this
change. Marc helped me verify this.
Daiki Ueno [Thu, 26 Nov 2020 08:37:03 +0000 (09:37 +0100)]
vquic/ngtcp2.h: define local_addr as sockaddr_storage
This field needs to be wide enough to hold sockaddr_in6 when
connecting via IPv6. Otherwise, ngtcp2_conn_read_pkt will drop the
packets because of the address mismatch:
I00000022 [...] con ignore packet from unknown path
We can safely assume that struct sockaddr_storage is available, as it
is used in the public interface of ngtcp2.
Daniel Stenberg [Thu, 26 Nov 2020 16:28:39 +0000 (17:28 +0100)]
socks: check for DNS entries with the right port number
The resolve call is done with the right port number, but the subsequent
check used the wrong one, which then could find a previous resolve which
would return and leave the fresh resolve "incomplete" and leaking
memory.
Daniel Stenberg [Wed, 25 Nov 2020 14:06:56 +0000 (15:06 +0100)]
tool_writeout: use off_t getinfo-types instead of doubles
Commit 3b80d3ca46b12e52342 (June 2017) introduced getinfo replacement
variables that use curl_off_t instead of doubles. Switch the --write-out
function over to use them.
Emil Engler [Wed, 25 Nov 2020 17:26:56 +0000 (18:26 +0100)]
file: avoid duplicated code sequence
file_disconnect() is identical with file_do() except the function header
but as the arguments are unused anyway so why not just return file_do()
directly!
Rikard Falkeborn [Wed, 18 Nov 2020 23:08:30 +0000 (00:08 +0100)]
examples: update .gitignore
Add files that are generated by 'make examples' and remove some that
have been renamed.
The commits that renamed the programs are e9625c5bc6c046a (imap.c and
simplesmtp.c were renamed to imap-fetch.c and smtp-send.c) and ad39e7ec01e7 (pop3slist.c and pop3s.c were renamed to pop3-list.c and
pop3-ssl.c).
Marc Hoersken [Fri, 20 Nov 2020 07:20:04 +0000 (08:20 +0100)]
CI/cirrus: simplify logic for disabled tests
The OpenSSH server instance for the testsuite cannot
be started on FreeBSD, therefore the SFTP and SCP
tests are disabled right away from the beginning.
The previous OS version specific logic for SKIP_TESTS
is no longer needed/used and can therefore be removed.
Reviewed-by: Daniel Stenberg
Follow up to #6211
Closes #6229
EVP_MD_CTX_create will allocate memory for the context and returns
NULL in case the allocation fails. Make sure to catch any allocation
failures and exit early if so.
In passing, also move to EVP_DigestInit rather than EVP_DigestInit_ex
as the latter is intended for ENGINE selection which we don't do.
Closes #6224 Reviewed-by: Daniel Stenberg <daniel@haxx.se> Reviewed-by: Emil Engler <me@emilengler.com>
Tobias Hieta [Tue, 10 Nov 2020 09:45:31 +0000 (10:45 +0100)]
cmake: correctly handle linker flags for static libs
curl CMake was setting the the EXE flags for static libraries which made
the /manifest:no flag ended up when linking the static library, which is
not a valid flag for lib.exe or llvm-lib.exe and caused llvm-lib to exit
with an error.
The better way to handle this is to make sure that we pass the correct
linker flags to CMAKE_STATIC_LINKER_FLAGS instead.
Tobias Hieta [Tue, 10 Nov 2020 09:30:29 +0000 (10:30 +0100)]
cmake: don't pass -fvisibility=hidden to clang-cl on Windows
When using clang-cl on windows -fvisibility=hidden is not an known
argument. Instead it behaves exactly like MSVC in this case. So let's
make sure we take that path.
In CMake clang-cl sets both CMAKE_C_COMPILER_ID=clang and MSVC get's
defined since clang-cl is basically a MSVC emulator. So guarding like we
do in this patch seems logical.