Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Mike Perry
Tor
Commits
ded6bbf7
Commit
ded6bbf7
authored
Jul 02, 2011
by
Nick Mathewson
🐻
Browse files
Style and grammar tweaks on 2841 branch
parent
c4b831e9
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/or/circuitbuild.c
View file @
ded6bbf7
...
...
@@ -4611,7 +4611,7 @@ transport_get_by_name(const char *name)
if
(
!
transport_list
)
return
NULL
;
SMARTLIST_FOREACH_BEGIN
(
transport_list
,
transport_t
*
,
transport
)
{
SMARTLIST_FOREACH_BEGIN
(
transport_list
,
const
transport_t
*
,
transport
)
{
if
(
!
strcmp
(
transport
->
name
,
name
))
return
transport
;
}
SMARTLIST_FOREACH_END
(
transport
);
...
...
@@ -4628,14 +4628,15 @@ int
transport_add_from_config
(
const
tor_addr_t
*
addr
,
uint16_t
port
,
const
char
*
name
,
int
socks_ver
)
{
transport_t
*
t
=
tor_malloc_zero
(
sizeof
(
transport_t
))
;
transport_t
*
t
;
if
(
transport_get_by_name
(
name
))
{
/* check for duplicate names */
log_
notice
(
LD_CONFIG
,
"More than one transport
s
ha
ve
'%s' as "
"their
name."
,
name
);
goto
err
;
log_
warn
(
LD_CONFIG
,
"More than one transport ha
s
'%s' as "
"its
name."
,
name
);
return
-
1
;
}
t
=
tor_malloc_zero
(
sizeof
(
transport_t
));
tor_addr_copy
(
&
t
->
addr
,
addr
);
t
->
port
=
port
;
t
->
name
=
tor_strdup
(
name
);
...
...
@@ -4646,10 +4647,6 @@ transport_add_from_config(const tor_addr_t *addr, uint16_t port,
smartlist_add
(
transport_list
,
t
);
return
0
;
err:
tor_free
(
t
);
return
-
1
;
}
/** Warns the user of possible pluggable transport misconfiguration. */
...
...
@@ -4657,20 +4654,19 @@ void
validate_pluggable_transports_config
(
void
)
{
if
(
bridge_list
)
{
SMARTLIST_FOREACH_BEGIN
(
bridge_list
,
bridge_info_t
*
,
b
)
{
/* Skip bridges without transports. */
if
(
!
b
->
transport_name
)
continue
;
/* See if the user has Bridges that specify nonexistent
pluggable transports. We should warn the user in such case,
since it's probably misconfiguration. */
if
(
!
transport_get_by_name
(
b
->
transport_name
))
log_warn
(
LD_CONFIG
,
"You have a Bridge line using the %s "
"pluggable transport, but there doesn't seem to be a "
"corresponding ClientTransportPlugin line."
,
b
->
transport_name
);
}
SMARTLIST_FOREACH_END
(
b
);
SMARTLIST_FOREACH_BEGIN
(
bridge_list
,
bridge_info_t
*
,
b
)
{
/* Skip bridges without transports. */
if
(
!
b
->
transport_name
)
continue
;
/* See if the user has Bridges that specify nonexistent
pluggable transports. We should warn the user in such case,
since it's probably misconfiguration. */
if
(
!
transport_get_by_name
(
b
->
transport_name
))
log_warn
(
LD_CONFIG
,
"You have a Bridge line using the %s "
"pluggable transport, but there doesn't seem to be a "
"corresponding ClientTransportPlugin line."
,
b
->
transport_name
);
}
SMARTLIST_FOREACH_END
(
b
);
}
}
...
...
@@ -4811,7 +4807,7 @@ find_bridge_by_digest(const char *digest)
}
/** If <b>addr</b> and <b>port</b> match the address and port of a
* bridge of ours that uses pluggable transports, place it
'
s transport
* bridge of ours that uses pluggable transports, place its transport
* in <b>transport</b>.
*
* Return:
...
...
@@ -4827,22 +4823,21 @@ find_transport_by_bridge_addrport(const tor_addr_t *addr, uint16_t port,
if
(
!
bridge_list
)
return
1
;
SMARTLIST_FOREACH_BEGIN
(
bridge_list
,
bridge_info_t
*
,
bridge
)
{
if
(
tor_addr_eq
(
&
bridge
->
addr
,
addr
)
&&
(
bridge
->
port
==
port
))
{
/* bridge matched */
if
(
bridge
->
transport_name
)
{
/* it also uses pluggable transports */
*
transport
=
transport_get_by_name
(
bridge
->
transport_name
);
if
(
*
transport
==
NULL
)
{
/* it uses pluggable transports, but
the transport could not be found! */
return
-
1
;
}
return
0
;
}
else
{
/* bridge matched, but it doesn't use transports. */
break
;
SMARTLIST_FOREACH_BEGIN
(
bridge_list
,
const
bridge_info_t
*
,
bridge
)
{
if
(
tor_addr_eq
(
&
bridge
->
addr
,
addr
)
&&
(
bridge
->
port
==
port
))
{
/* bridge matched */
if
(
bridge
->
transport_name
)
{
/* it also uses pluggable transports */
*
transport
=
transport_get_by_name
(
bridge
->
transport_name
);
if
(
*
transport
==
NULL
)
{
/* it uses pluggable transports, but
the transport could not be found! */
return
-
1
;
}
return
0
;
}
else
{
/* bridge matched, but it doesn't use transports. */
break
;
}
}
SMARTLIST_FOREACH_END
(
bridge
);
}
}
SMARTLIST_FOREACH_END
(
bridge
);
return
1
;
}
...
...
src/or/circuitbuild.h
View file @
ded6bbf7
...
...
@@ -14,13 +14,13 @@
/** Represents a pluggable transport proxy used by a bridge. */
typedef
struct
{
/* SOCKS version */
/*
*
SOCKS version
: One of PROXY_SOCKS4, PROXY_SOCKS5.
*/
int
socks_version
;
/* Name of pluggable transport protocol */
/*
*
Name of pluggable transport protocol */
char
*
name
;
/* Address of proxy */
/*
*
Address of proxy */
tor_addr_t
addr
;
/* Port of proxy */
/*
*
Port of proxy */
uint16_t
port
;
}
transport_t
;
...
...
src/or/config.c
View file @
ded6bbf7
...
...
@@ -205,7 +205,7 @@ static config_var_t _option_vars[] = {
V
(
ClientDNSRejectInternalAddresses
,
BOOL
,
"1"
),
V
(
ClientOnly
,
BOOL
,
"0"
),
V
(
ClientRejectInternalAddresses
,
BOOL
,
"1"
),
V
AR
(
"
ClientTransportPlugin
"
,
LINELIST
,
ClientTransportPlugin
,
NULL
),
V
(
ClientTransportPlugin
,
LINELIST
,
NULL
),
V
(
ConsensusParams
,
STRING
,
NULL
),
V
(
ConnLimit
,
UINT
,
"1000"
),
V
(
ConnDirectionStatistics
,
BOOL
,
"0"
),
...
...
@@ -3565,7 +3565,7 @@ options_validate(or_options_t *old_options, or_options_t *options,
/* Check if more than one proxy type has been enabled. */
if
(
!!
options
->
Socks4Proxy
+
!!
options
->
Socks5Proxy
+
!!
options
->
HTTPSProxy
+
!!
options
->
ClientTransportPlugin
>
1
)
REJECT
(
"You have configured more than one proxy type
s
. "
REJECT
(
"You have configured more than one proxy type. "
"(Socks4Proxy|Socks5Proxy|HTTPSProxy|ClientTransportPlugin)"
);
if
(
options
->
Socks5ProxyUsername
)
{
...
...
@@ -3686,18 +3686,14 @@ options_validate(or_options_t *old_options, or_options_t *options,
if
(
options
->
UseBridges
&&
!
options
->
TunnelDirConns
)
REJECT
(
"TunnelDirConns set to 0 only works with UseBridges set to 0"
);
if
(
options
->
ClientTransportPlugin
)
{
for
(
cl
=
options
->
ClientTransportPlugin
;
cl
;
cl
=
cl
->
next
)
{
if
(
parse_client_transport_line
(
cl
->
value
,
1
)
<
0
)
REJECT
(
"Transport line did not parse. See logs for details."
);
}
for
(
cl
=
options
->
ClientTransportPlugin
;
cl
;
cl
=
cl
->
next
)
{
if
(
parse_client_transport_line
(
cl
->
value
,
1
)
<
0
)
REJECT
(
"Transport line did not parse. See logs for details."
);
}
if
(
options
->
Bridges
)
{
for
(
cl
=
options
->
Bridges
;
cl
;
cl
=
cl
->
next
)
{
if
(
parse_bridge_line
(
cl
->
value
,
1
)
<
0
)
REJECT
(
"Bridge line did not parse. See logs for details."
);
}
for
(
cl
=
options
->
Bridges
;
cl
;
cl
=
cl
->
next
)
{
if
(
parse_bridge_line
(
cl
->
value
,
1
)
<
0
)
REJECT
(
"Bridge line did not parse. See logs for details."
);
}
if
(
options
->
ConstrainedSockets
)
{
...
...
@@ -4605,8 +4601,9 @@ parse_bridge_line(const char *line, int validate_only)
transport_name
=
field1
;
addrport
=
smartlist_get
(
items
,
0
);
smartlist_del_keeporder
(
items
,
0
);
}
else
}
else
{
addrport
=
field1
;
}
if
(
tor_addr_port_parse
(
addrport
,
&
addr
,
&
port
)
<
0
)
{
log_warn
(
LD_CONFIG
,
"Error parsing Bridge address '%s'"
,
addrport
);
...
...
@@ -4632,21 +4629,21 @@ parse_bridge_line(const char *line, int validate_only)
}
if
(
!
validate_only
)
{
log_debug
(
LD_DIR
,
"Bridge at %s:%d (transport: %s) (%s)"
,
fmt_addr
(
&
addr
),
(
int
)
port
,
transport_name
?
transport_name
:
"no transport"
,
fingerprint
?
fingerprint
:
"no key listed"
);
bridge_add_from_config
(
&
addr
,
port
,
fingerprint
?
digest
:
NULL
,
transport_name
);
log_debug
(
LD_DIR
,
"Bridge at %s:%d (transport: %s) (%s)"
,
fmt_addr
(
&
addr
),
(
int
)
port
,
transport_name
?
transport_name
:
"no transport"
,
fingerprint
?
fingerprint
:
"no key listed"
);
bridge_add_from_config
(
&
addr
,
port
,
fingerprint
?
digest
:
NULL
,
transport_name
);
}
r
=
0
;
goto
done
;
err:
err:
r
=
-
1
;
done:
done:
SMARTLIST_FOREACH
(
items
,
char
*
,
s
,
tor_free
(
s
));
smartlist_free
(
items
);
tor_free
(
addrport
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment