Commit Graph

59 Commits

Author SHA1 Message Date
akallabeth
a1a8846ad2
[utils,proxy] refactor proxy_parse_uri
* eliminate deadstore warnings
* fix missing input checks
2024-10-01 13:05:14 +02:00
akallabeth
c7efbf5b8e
[core,proxy] fix nonblocking BIO reads
* In case of non-blocking BIO layers the proxy read functions bailed
  out with an error. Retry reading in that case unless the
  TcpConnectTimeout is exceeded
* Terminate proxy read operations if rdpContext::abortEvent is set
2024-09-17 10:37:19 +02:00
akallabeth
36c3184a0f
[warnings] fix clang-tidy issues in libfreerdp 2024-08-29 15:34:22 +02:00
akallabeth
1d33095500
[warnings] fix cert-err33-c
Fix unused return values, cast to void if on purpose
2024-08-29 10:19:27 +02:00
Armin Novak
036228a294
[core,proxy] fix missing return check 2024-06-05 15:23:53 +02:00
akallabeth
3b108f1839 [core,proxy] ignore empty variable
fixes #9928: ignore a defined but empty proxy environment variable
2024-03-04 14:28:38 +01:00
akallabeth
0ba995655d [clang-tidy] cppcoreguidelines-init-variables 2024-02-15 11:49:16 +01:00
akallabeth
207def5c56 [clang-tidy] readability-isolate-declaration 2024-02-15 11:49:16 +01:00
Armin Novak
678b392e89 [warnings] fixed -Wformat 2023-12-13 13:24:22 +01:00
akallabeth
cd4d77af86 [settings] add deprecation warnings
direct struct access to rdpSettings now produces warnings if not
explicitly deactiaved by defining FREERDP_SETTINGS_INTERNAL_USE
2023-11-24 14:54:56 +01:00
akallabeth
1163cc4d5c [core] add internal settings.h include 2023-11-24 14:54:56 +01:00
akallabeth
9b51df8b10 [core,crypto] refactor certificate management
* Properly split certificate_store, certificate_data, certificate and
  private key functions to files
* Prefix all functions with freerdp_ to have a unique name
* Update certificate store to use one file per host instead of
  known_hosts2
* Merge CryptoCert and rdpCertificate
2023-02-12 20:17:11 +01:00
akarl
f40522e34f fix HTTP proxy CONNECT header
also replace ARRAYSIZE with strlen and use that instead of ugly things
like const char x[2] = "ok";
2022-11-05 09:01:17 +01:00
akallabeth
1849632c43
Fixed format strings to match arguments (#8254)
* Fixed format strings to match arguments

Reviewed and replaced all %d specifiers to match proper type

* Added proxy dynamic channel command type to log messages.
2022-09-29 14:55:27 +02:00
akallabeth
51f4c374c4 Clear OpenSSL error queue before BIO_read/BIO_write 2022-07-02 16:32:50 +02:00
fifthdegree
85f7cb8916 clear openssl error queue after nla_client_begin 2022-07-02 16:32:50 +02:00
akallabeth
fb90ac280a Refactored color.h
* Remove implementations from header
* Rename functions to be FreeRDP specific
* Add deprecation define for old names
* Fixed missing includes
2022-04-28 08:40:47 +02:00
Adrian Vollmer
bfea66d5e9 Set default ports for http and socks proxies 2022-04-05 09:22:48 +02:00
Adrian Vollmer
2f1003c257 Move function declaration before first use 2022-04-05 09:22:48 +02:00
Adrian Vollmer
167a29a41f Move function back to original position
This is merely done so that the diff looks nicer.
2022-04-05 09:22:48 +02:00
Adrian Vollmer
a19de01fe3 Applied requested changes
* Add `proxy_utils.h`
* Move `proxy_parse_uri()` back to `proxy.c`
* Copy function `value_to_int` to `proxy.c`
* Remove memory leak (`uri_copy`)
2022-04-05 09:22:48 +02:00
Adrian Vollmer
28923ddd75 Fixed parsing of https_proxy environment variable
A proxy URI was parsed both in the function `proxy_read_environment()` in
`libfreerdp/core/proxy.c` and in the function
`freerdp_client_settings_parse_command_line_arguments()` in
`client/common/cmdline.c`. But only the latter was taking into account
that the URI can contain a user and password, which made it impossible
to use a proxy with authentication by just using an environment
variable like `https_proxy`.

The function `proxy_parse_uri()` in `libfreerdp/core/proxy.c` was
clearly not parsing the optional username and password.

This commit moves the code from `client/common/cmdline.c` to
`libfreerdp/common/settings.c` into a function `proxy_parse_uri()` so
redundant code is avoided. This function is then called in both
instances where a proxy URI is parsed.

Some minor adjustment were made to the code, so the `WLog_INFO()`
statement at the end works in both cases, where credentials were either
provided or not. Also, some error messages were added or clarified.

If the parsing of the environment variable fails, we ignore it entirely
(with a warning) and proceed.
2022-04-05 09:22:48 +02:00
Armin Novak
edeea86dd1 Improved http_proxy_connect checks
* Assert function arguments
* Unify error handling
* Additional buffer size checks
2022-02-07 08:22:19 +00:00
Ayose
b43942a348 HTTP Basic authentication for HTTP proxy connections
This patch adds support for authentication when the connection is done
through a HTTP proxy.

It only supports HTTP Basic Authentication (like `curl --proxy`).

It is tested against Apache 2.4.
2022-02-07 08:22:19 +00:00
Armin Novak
5fb59a23a9 Fixed lots of compilation warnings and type mismatches 2021-06-16 15:21:56 +02:00
akallabeth
3c237fd687 Fixed #6656: invalid read of proxy port. 2020-12-10 07:38:25 +01:00
akallabeth
44ea09e7ad Use freerdp_settings_[s|g]et* api to access proxy vaiables.
Fixes #6414
2020-08-05 11:29:00 +02:00
Kobi Mizrachi
fddda159d9 change use of strtok to strtok_s 2020-05-18 11:08:20 +02:00
Martin Fleisz
4e06855826 proxy: Add received response in case of an error 2020-01-08 17:45:10 +01:00
Armin Novak
7c243da6e1 Remove symbols exported by accident. 2019-12-02 10:57:31 +01:00
Armin Novak
72ca88f49c Reformatted to new style 2019-11-07 10:53:54 +01:00
Armin Novak
f01e042211 Code cleanups (strlen, casts, size_t, ...) 2019-10-29 11:58:43 +01:00
asapelkin
82eadad4a4 Fix some static analizer warnings 2019-10-22 15:39:54 +02:00
Louis Sautier
60152291b3 client: proxy: allow passing SOCKS5 proxies as env. vars 2019-08-20 14:06:38 +02:00
Armin Novak
f51a9bafcc Fixed sign-compare warnings 2019-04-05 09:13:24 +02:00
Armin Novak
941213f504 Fixed domain and regex match. 2018-09-24 12:24:15 +02:00
Armin Novak
3a2bfa183f Fixed #4878: Added cidr support for proxy exception check. 2018-09-24 11:51:40 +02:00
Armin Novak
b5df39756d Added option to ignore proxy env. 2018-08-23 17:02:43 +02:00
Armin Novak
4bea9934cf Added patch from #4697 2018-08-23 17:02:43 +02:00
Ondrej Holy
7e4fa67026 core/proxy: Fix leak found by covscan
leaked_storage: Variable "s" going out of scope leaks the storage it points to.
2018-08-22 14:34:02 +02:00
Armin Novak
46a62aa1a4 Fixed missing NULL pointer checks. 2018-05-04 12:35:51 +02:00
David Fort
0f968b782c proxy: cleanup SOCKS support and add user/password support 2018-05-02 10:51:16 +02:00
Jiri Sasek
1ba31551a6 socks proxy reply fix 2018-05-02 09:43:03 +02:00
Jiri Sasek
b1c1549ad1 SOCKS proxy support 2018-04-23 21:01:01 +02:00
Armin Novak
4eb5b8e349 Replaced atoi 2017-11-15 15:52:16 +01:00
Armin Novak
0490aeb018 Fixed clang malloc integer overflow warnings. 2017-07-20 09:29:48 +02:00
Armin Novak
99c45405cb Fixed GetEnvironmentVariable. 2017-03-03 12:43:00 +01:00
Armin Novak
b2c29158be Scanbuild warning, argument checks and leak fixes.
* Added Stream_GetRemainingCapacity to check remaining stream size
  before writes.
* Fixed shadow server memory leak.
* Fixed lots of scanbuild warnings
* Added missing argument checks in many functions
* Added missing static function declarations
2017-03-02 18:13:43 +01:00
Christian Plattner
8658f04f42 Code reformatting of proxy.c, proxy.h 2016-12-13 12:12:04 +01:00
Christian Plattner
3cc39b2dcd Dynamic environment variable length of $https_proxy 2016-12-12 17:16:12 +01:00