FreeRDP
proxy.c File Reference
#include <ctype.h>
#include <errno.h>
#include <openssl/err.h>
#include "settings.h"
#include "proxy.h"
#include <freerdp/settings.h>
#include <freerdp/utils/proxy_utils.h>
#include <freerdp/crypto/crypto.h>
#include "tcp.h"
#include <winpr/assert.h>
#include <winpr/environment.h>
#include <freerdp/log.h>

Macros

#define CRLF   "\r\n"
 
#define TAG   FREERDP_TAG("core.proxy")
 

Enumerations

enum  { AUTH_M_NO_AUTH = 0 , AUTH_M_GSSAPI = 1 , AUTH_M_USR_PASS = 2 }
 
enum  { SOCKS_CMD_CONNECT = 1 , SOCKS_CMD_BIND = 2 , SOCKS_CMD_UDP_ASSOCIATE = 3 }
 
enum  { SOCKS_ADDR_IPV4 = 1 , SOCKS_ADDR_FQDN = 3 , SOCKS_ADDR_IPV6 = 4 }
 

Functions

static BOOL http_proxy_connect (BIO *bufferedBio, const char *proxyUsername, const char *proxyPassword, const char *hostname, UINT16 port)
 
static BOOL socks_proxy_connect (BIO *bufferedBio, const char *proxyUsername, const char *proxyPassword, const char *hostname, UINT16 port)
 
static void proxy_read_environment (rdpSettings *settings, char *envname)
 
BOOL proxy_prepare (rdpSettings *settings, const char **lpPeerHostname, UINT16 *lpPeerPort, const char **lpProxyUsername, const char **lpProxyPassword)
 
static BOOL value_to_int (const char *value, LONGLONG *result, LONGLONG min, LONGLONG max)
 
static BOOL cidr4_match (const struct in_addr *addr, const struct in_addr *net, BYTE bits)
 
static BOOL cidr6_match (const struct in6_addr *address, const struct in6_addr *network, uint8_t bits)
 
static BOOL check_no_proxy (rdpSettings *settings, const char *no_proxy)
 
BOOL proxy_parse_uri (rdpSettings *settings, const char *uri_in)
 
BOOL proxy_connect (rdpSettings *settings, BIO *bufferedBio, const char *proxyUsername, const char *proxyPassword, const char *hostname, UINT16 port)
 
static const char * get_response_header (char *response)
 
static int recv_socks_reply (BIO *bufferedBio, BYTE *buf, int len, char *reason, BYTE checkVer)
 

Variables

static const char * rplstat []
 

Macro Definition Documentation

◆ CRLF

#define CRLF   "\r\n"

FreeRDP: A Remote Desktop Protocol Implementation HTTP Proxy support

Copyright 2016 Christian Plattner ccpp@.nosp@m.gmx..nosp@m.at

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

◆ TAG

#define TAG   FREERDP_TAG("core.proxy")

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
AUTH_M_NO_AUTH 
AUTH_M_GSSAPI 
AUTH_M_USR_PASS 

◆ anonymous enum

anonymous enum
Enumerator
SOCKS_CMD_CONNECT 
SOCKS_CMD_BIND 
SOCKS_CMD_UDP_ASSOCIATE 

◆ anonymous enum

anonymous enum
Enumerator
SOCKS_ADDR_IPV4 
SOCKS_ADDR_FQDN 
SOCKS_ADDR_IPV6 

Function Documentation

◆ check_no_proxy()

static BOOL check_no_proxy ( rdpSettings *  settings,
const char *  no_proxy 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cidr4_match()

static BOOL cidr4_match ( const struct in_addr *  addr,
const struct in_addr *  net,
BYTE  bits 
)
static
Here is the caller graph for this function:

◆ cidr6_match()

static BOOL cidr6_match ( const struct in6_addr *  address,
const struct in6_addr *  network,
uint8_t  bits 
)
static
Here is the caller graph for this function:

◆ get_response_header()

static const char* get_response_header ( char *  response)
static
Here is the caller graph for this function:

◆ http_proxy_connect()

static BOOL http_proxy_connect ( BIO *  bufferedBio,
const char *  proxyUsername,
const char *  proxyPassword,
const char *  hostname,
UINT16  port 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ proxy_connect()

BOOL proxy_connect ( rdpSettings *  settings,
BIO *  bufferedBio,
const char *  proxyUsername,
const char *  proxyPassword,
const char *  hostname,
UINT16  port 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ proxy_parse_uri()

BOOL proxy_parse_uri ( rdpSettings *  settings,
const char *  uri_in 
)

FreeRDP: A Remote Desktop Protocol Implementation RDP Proxy Utils

Copyright 2016 Armin Novak armin.nosp@m..nov.nosp@m.ak@gm.nosp@m.ail..nosp@m.com Copyright 2022 Adrian Vollmer adria.nosp@m.n.vo.nosp@m.llmer.nosp@m.@sys.nosp@m.s.de

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ proxy_prepare()

BOOL proxy_prepare ( rdpSettings *  settings,
const char **  lpPeerHostname,
UINT16 lpPeerPort,
const char **  lpProxyUsername,
const char **  lpProxyPassword 
)

FreeRDP: A Remote Desktop Protocol Implementation HTTP proxy support

Copyright 2014 Christian Plattner ccpp@.nosp@m.gmx..nosp@m.at

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ proxy_read_environment()

void proxy_read_environment ( rdpSettings *  settings,
char *  envname 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ recv_socks_reply()

static int recv_socks_reply ( BIO *  bufferedBio,
BYTE buf,
int  len,
char *  reason,
BYTE  checkVer 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ socks_proxy_connect()

static BOOL socks_proxy_connect ( BIO *  bufferedBio,
const char *  proxyUsername,
const char *  proxyPassword,
const char *  hostname,
UINT16  port 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ value_to_int()

static BOOL value_to_int ( const char *  value,
LONGLONG *  result,
LONGLONG  min,
LONGLONG  max 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ rplstat

const char* rplstat[]
static
Initial value:
= { "succeeded",
"general SOCKS server failure",
"connection not allowed by ruleset",
"Network unreachable",
"Host unreachable",
"Connection refused",
"TTL expired",
"Command not supported",
"Address type not supported" }