Commit Graph

8711 Commits

Author SHA1 Message Date
Steve Holme 73f1096335 krb5: Fixed missing client response when mutual authentication enabled
Although mutual authentication is currently turned off and can only be
enabled by changing libcurl source code, authentication using Kerberos
5 has been broken since commit 79543caf90 in this use case.
2016-04-03 17:02:44 +01:00
Steve Holme 61152e7d94 krb5_sspi: Only process challenge when present
This wouldn't cause a problem because of the way the function is called,
but prior to this change, we were processing the challenge message when
the credentials were NULL rather than when the challenge message was
populated.

This also brings this part of the Kerberos 5 code in line with the
Negotiate code.
2016-04-03 11:45:02 +01:00
Steve Holme 228cd71c6f krb5_sspi: Only generate the output token when its not allocated
Prior to this change, we were generating the output token when the
credentials were NULL rather than when the output token was NULL.

This also brings this part of the Kerberos 5 code in line with the
Negotiate code.
2016-04-03 11:25:12 +01:00
Steve Holme 2d2c67e3ed krb5: Only generate a SPN when its not known
Prior to this change, we were generating the SPN in the SSPI code when
the credentials were NULL and in the GSS-API code when the context was
empty. It is better to decouple the SPN generation from these checks
and only generate it when the SPN itself is NULL.

This also brings this part of the Kerberos 5 code in line with the
Negotiate code.
2016-04-03 11:15:03 +01:00
Daniel Stenberg c7e4266a2e checksrc.whitelist: remove fopen() uses 2016-04-03 11:57:21 +02:00
Daniel Stenberg 36b5dff030 formdata: use appropriate fopen() macros 2016-04-03 11:57:04 +02:00
Daniel Stenberg 5ea3d2ff06 checksrc: improve the fopen() parser somewhat
The quote scanner was too fragile, now look for a comma instead to find
the mode argument.
2016-04-03 11:29:14 +02:00
Daniel Stenberg eca93542d6 http2: make use of the nghttp2 error callback
It offers extra info from nghttp2 in certain error cases. Like for
example when trying prior-knowledge http2 on a server that doesn't speak
http2 at all. The error message is passed on as a verbose message to
libcurl.

Discussed in #722

The error callback was added in nghttp2 1.9.0
2016-04-02 16:27:30 +02:00
Steve Holme 2aaa63b555 spnego: Renamed the context's SPN variable
To be consistent with the Kerberos 5 context and other authentication
code.
2016-04-02 06:41:29 +01:00
Steve Holme 9173dc0682 krb5_gssapi: Renamed the status variables
For consistency with the spnego code.
2016-04-02 06:25:30 +01:00
Steve Holme ced0cbb5b7 krb5: Moved host from Curl_auth_create_gssapi_user_message() to be argument
For consistency with the spnego and oauth2 code moved the setting of
the host name outside of the Curl_auth_create_gssapi_user_messag()
function.

This will allow us to more easily override it in the future.
2016-04-02 06:15:29 +01:00
Steve Holme 0aa8da10bb http_negotiate: Corrected host and proxy host name being wrong way round
I had accidentally used the proxy server name for the host and the host
server name for the proxy in commit ad5e9bfd5d and 6d6f9ca1d9. Whilst
Windows SSPI was quite happy with this, GSS-API wasn't.

Thanks-to:  Michael Osipov
2016-04-01 21:48:35 +01:00
ehlertjd@gmail.com 8f654f29de IMAP: check pointer before dereferencing it
may be null in the CURLOPT_CONNECT_ONLY case

Fixes #747
2016-04-01 21:18:46 +02:00
Steve Holme a29a6c2ab5 curl_memory.h: Fixed typo in comment
From commit 7218b52c49.
2016-04-01 19:12:39 +01:00
Steve Holme 5bdb4c13c2 spnego: Corrected some typos in comments
Corrected typos from commit ad5e9bfd5d and 6d6f9ca1d9.
2016-04-01 19:07:49 +01:00
Steve Holme 0c331b8999 memdebug: Ensure curl/curl.h is included before curl_memory.h
Follow up to commit 7db9782dd6.
2016-04-01 13:21:12 +01:00
Daniel Stenberg 3e005a8555 upload: missing rewind call could make libcurl hang
When an upload is done, there are two places where that can be detected
and only one of them would rewind the input stream - which sometimes is
necessary for example when doing NTLM HTTP POSTs and more.

This could then end up libcurl hanging.

Figured-out-by: Isaac Boukris
Reported-by: Anatol Belski

Fixes #741
2016-04-01 13:57:15 +02:00
Daniel Stenberg 7db9782dd6 curl.h: define CURL_DID_MEMORY_FUNC_TYPEDEFS
So that we only do the extra typedefs in curl_memory.h when we really
need to and avoid double typedefs.

follow-up commit to 7218b52c49

Thanks-to: Steve Holme
2016-04-01 13:14:57 +02:00
Daniel Stenberg 55452ebdff curl/mprintf.h: remove support for _MPRINTF_REPLACE
The define is not in our name space and is therefore not protected by
our API promises.

It was only really used by libcurl internals but was mostly erased from
there already in 8aabbf5 (March 2015). This is supposedly the final
death blow to that define from everywhere.

As a side-effect, making sure _MPRINTF_REPLACE is gone and not used, I
made the lib tests in tests/libtest/ use curl_printf.h for its redefine
magic and then subsequently the use of sprintf() got banned in the tests
as well (as it is in libcurl internals) and I then replaced them all
with snprintf().

In the unlikely event that any users is actually using this define and
gets sad by this change, it is very easily copied to the user's own
code.
2016-04-01 10:46:36 +02:00
Daniel Stenberg 7218b52c49 curl_memory.h: avoid the curl/curl.h include
Discussed in #743
2016-04-01 10:07:38 +02:00
Steve Holme 9a8aef1365 url: Corrected get protocol family for FTP and LDAP
Fixed copy/paste error from commit a5aec58726.
2016-04-01 07:24:39 +01:00
Jay Satiro 7c314fd9f8 strerror: don't bit shift a signed integer
Bug: https://github.com/curl/curl/issues/744
Reported-by: Alexis La Goutte
2016-03-31 21:05:29 -04:00
Diego Bes 324a97ecf8 http2: support "prior knowledge", no upgrade from HTTP/1.1
Supports HTTP/2 over clear TCP

- Optimize switching to HTTP/2 by removing calls to init and setup
before switching. Switching will eventually call setup and setup calls
init.

- Supports new version to “force” the use of HTTP/2 over clean TCP

- Add common line parameter “--http2-prior-knowledge” to the Curl
  command line tool.
2016-03-31 22:23:11 +02:00
Daniel Stenberg e683182918 imap: remove duplicated function
The list and search response functions were identical! Merged into one
now. Detected by PVS Studio.

Reported-by: Alexis La Goutte
2016-03-31 15:12:22 +02:00
Daniel Stenberg 0ee0d30a9f SOCKS5_gssapi_negotiate: don't assume little-endian ints
The code copied one byte from a 32bit integer, which works fine as long
as the byte order is the same. Not a fine assumption. Reported by PVS
Studio.

Reported-by: Alexis La Goutte
2016-03-31 10:22:42 +02:00
Daniel Stenberg 541027876d http: remove ((expression)) double parentheses 2016-03-31 10:10:58 +02:00
Daniel Stenberg b22a954736 Curl_add_buffer_send: avoid possible NULL dereference
... as we check for a NULL pointer below, we move the derefence to after
the check. Detected by PVS Studio.

Reported-by: Alexis La Goutte
2016-03-31 10:10:58 +02:00
Daniel Stenberg b3912d9dd7 file: remove duplicate checks of the same variable
... as it doesn't change in between. Deteced by PVS Studio.

Reported-by: Alexis La Goutte
2016-03-31 10:10:58 +02:00
Marcel Raad 4dae049157 openssl: Fix compilation warnings
When compiling with OpenSSL 1.1.0 (so that the HAVE_X509_GET0_SIGNATURE
&& HAVE_X509_GET0_EXTENSIONS pre-processor block is active), Visual C++
14 complains:

warning C4701: potentially uninitialized local variable 'palg' used
warning C4701: potentially uninitialized local variable 'psig' used
2016-03-30 23:55:00 +01:00
Daniel Stenberg 575e885db0 multi: turn Curl_done into file local multi_done
... as it now is used by multi.c only.
2016-03-30 07:52:28 +02:00
Daniel Stenberg 93935c08c1 multi: multi_reconnect_request is the former Curl_reconnect_request
now a file local function in multi.c
2016-03-30 07:52:28 +02:00
Daniel Stenberg 6b61d8160d multi: move Curl_do and Curl_do_done to multi.c and make static
... called multi_do and multi_do_done as they're file local now.
2016-03-30 07:52:28 +02:00
Jay Satiro 7921628714 wolfssl: Use ECC supported curves extension
https://github.com/wolfSSL/wolfssl/issues/366
2016-03-29 19:06:55 -04:00
Isaac Boukris d5fc6e14b0 GSS: make Curl_gss_log_error more verbose
Also display the GSS_C_GSS_CODE (major code) when specified instead of
only GSS_C_MECH_CODE (minor code).

In addition, the old code was printing a colon twice after the prefix
and also miscalculated the length of the buffer in between calls to
gss_display_status (the length of ": " was missing).

Also, gss_buffer is not guaranteed to be NULL terminated and thus need
to restrict reading by its length.

Closes #738
2016-03-29 16:51:29 +02:00
Daniel Stenberg 1fc767210c http2: set correct scheme in handler structs [regression]
Since commit a5aec58 the handler schemes need to match for the
connections to be reused and for HTTP/2 multiplexing to work, reusing
connections is very important!

Closes #736
2016-03-29 16:08:38 +02:00
Daniel Stenberg 2505fbbdb5 hostip.c: minor white space edit for style 2016-03-29 15:19:21 +02:00
Jay Satiro a43b22e05b wolfssl: Add ALPN support 2016-03-28 18:18:09 -04:00
Steve Holme f0bdd72c10 http_ntlm: Renamed from curl_ntlm.[c|h]
Renamed the header and source files for this module as they are HTTP
specific and as such, they should use the naming convention as other
HTTP authentication source files do - this revert commit 260ee6b7bf.

Note: We could also rename curl_ntlm_wb.[c|h], however, the Winbind
code needs separating from the HTTP protocol and migrating into the
vauth directory, thus adding support for Winbind to the SASL based
protocols such as IMAP, POP3 and SMTP.
2016-03-27 17:58:50 +01:00
marquis-de-muesli 39bb73665c SSH: new CURLOPT_QUOTE command "statvfs"
usage: "statvfs path"
returns remote file system statistics
2016-03-27 17:52:16 +02:00
marquis-de-muesli f9d27e0f8e SSH: support CURLINFO_FILETIME 2016-03-27 17:52:16 +02:00
Jay Satiro 3d144ab99b url: don't use bad offset in tld_check_name to show error
libidn's tld_check_lz returns an error offset of the first character
that it failed to process, however that offset is not a byte offset and
may not even be in the locale encoding therefore we can't use it to show
the user the character that failed to process.

Bug: https://github.com/curl/curl/issues/731
Reported-by: Karlson2k
2016-03-26 14:41:35 -04:00
Steve Holme 4adee1947c http_negotiate: Combine GSS-API and SSPI source files
As the GSS-API and SSPI based source files are no longer library/API
specific, following the extraction of that authentication code to the
vauth directory, combine these files rather than maintain two separate
versions.
2016-03-26 17:21:22 +00:00
Steve Holme 6d6f9ca1d9 vauth: Moved the Negotiate authentication code to the new vauth directory
Part 2 of 2 - Moved the GSS-API based Negotiate authentication code.
2016-03-26 17:21:22 +00:00
Steve Holme ad5e9bfd5d vauth: Moved the Negotiate authentication code to the new vauth directory
Part 1 of 2 - Moved the SSPI based Negotiate authentication code.
2016-03-26 17:21:22 +00:00
Steve Holme 65f972b2e8 warnless.h: Removed spurious character from commit 696bc6b9c9
Not picked up by checksrc or Visual Studio but my own code review, this
would haven broken Intel based Unix builds - Perhaps I should learn to
type on my laptop's keyboard before committing!
2016-03-26 11:35:07 +00:00
Steve Holme 107cb78487 schannel: Fixed compilation warning from commit f8d88a4913
warning C4244: '=': conversion from 'int' to 'unsigned short', possible
                    loss of data
2016-03-26 11:14:07 +00:00
Steve Holme 696bc6b9c9 warnless?: Added some integer based conversion functions 2016-03-26 11:09:01 +00:00
Steve Holme e04f5c576d build: Corrected typos from commit 70e56939aa 2016-03-25 18:23:07 +00:00
Steve Holme 58a7bc96ec vauth: Refactored function names after move to new vauth directory
Renamed all the SASL functions that moved to the new vauth directory to
include the correct module name.
2016-03-25 17:40:12 +00:00
Steve Holme 7d2a5a05f6 vauth: Updated the copyright year after recent changes
As most of this work was performed in 2015 but not pushed until 2016
updated the copyright year to reflect the public facing changes.
2016-03-25 17:40:12 +00:00