summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorUlf Wiger <ulf@feuerlabs.com>2016-01-13 12:13:50 -0800
committerUlf Wiger <ulf@feuerlabs.com>2016-01-13 12:13:50 -0800
commit8d5217fe0fbd2d1555bb7a7a96187029f19e1794 (patch)
treee9ec394797f529d14c1b11c22b5a8bffb1b2d9e6 /components
parent5f68c3bf4f1a0c1a863c45aaf3c20eafc6888d49 (diff)
downloadrvi_core-8d5217fe0fbd2d1555bb7a7a96187029f19e1794.tar.gz
Always use the peer address for creds
Diffstat (limited to 'components')
-rw-r--r--components/dlink_bt/src/dlink_bt_rpc.erl5
-rw-r--r--components/dlink_tcp/src/dlink_tcp_rpc.erl17
-rw-r--r--components/dlink_tls/src/dlink_tls_rpc.erl19
3 files changed, 22 insertions, 19 deletions
diff --git a/components/dlink_bt/src/dlink_bt_rpc.erl b/components/dlink_bt/src/dlink_bt_rpc.erl
index 2fc6587..74a49cc 100644
--- a/components/dlink_bt/src/dlink_bt_rpc.erl
+++ b/components/dlink_bt/src/dlink_bt_rpc.erl
@@ -343,8 +343,9 @@ process_authorize(FromPid, PeerBTAddr, PeerBTChannel,
%% from the client. We should respond with our own authorize followed by
%% a service announce
- Conn = {RemoteAddress, RemoteChannel},
- log(result, "auth ~s:~w", [RemoteAddress, RemoteChannel], CompSpec),
+ %% Conn = {RemoteAddress, RemoteChannel},
+ {NRemoteAddress, NRemoteChannel} = Conn = {PeerBTAddr, PeerBTChannel},
+ log(result, "auth ~s:~w", [NRemoteAddress, NRemoteChannel], CompSpec),
authorize_rpc:store_creds(CompSpec, Credentials, Conn),
connection_authorized(FromPid, Conn, CompSpec).
diff --git a/components/dlink_tcp/src/dlink_tcp_rpc.erl b/components/dlink_tcp/src/dlink_tcp_rpc.erl
index 9089c13..afabafe 100644
--- a/components/dlink_tcp/src/dlink_tcp_rpc.erl
+++ b/components/dlink_tcp/src/dlink_tcp_rpc.erl
@@ -708,14 +708,15 @@ deconflict_conns(APid, BPid, CsA, F) ->
process_authorize_(FromPid, PeerIP, PeerPort, RemoteAddress, RemotePort,
_ProtoVersion, Credentials, CompSpec) ->
- {NRemoteAddress, NRemotePort} = Conn =
- case { RemoteAddress, RemotePort } of
- { "0.0.0.0", 0 } ->
- ?info("dlink_tcp:authorize(): Remote is behind firewall. Will use ~p:~p",
- [ PeerIP, PeerPort]),
- { PeerIP, PeerPort };
- _ -> { RemoteAddress, RemotePort}
- end,
+ {NRemoteAddress, NRemotePort} = Conn = {PeerIP, PeerPort},
+ %% {NRemoteAddress, NRemotePort} = Conn =
+ %% case { RemoteAddress, RemotePort } of
+ %% { "0.0.0.0", 0 } ->
+ %% ?info("dlink_tcp:authorize(): Remote is behind firewall. Will use ~p:~p",
+ %% [ PeerIP, PeerPort]),
+ %% { PeerIP, PeerPort };
+ %% _ -> { RemoteAddress, RemotePort}
+ %% end,
log(result, "auth ~s:~w", [NRemoteAddress, NRemotePort], CompSpec),
authorize_rpc:store_creds(CompSpec, Credentials, Conn),
connection_authorized(FromPid, Conn, CompSpec).
diff --git a/components/dlink_tls/src/dlink_tls_rpc.erl b/components/dlink_tls/src/dlink_tls_rpc.erl
index 632008a..014d854 100644
--- a/components/dlink_tls/src/dlink_tls_rpc.erl
+++ b/components/dlink_tls/src/dlink_tls_rpc.erl
@@ -689,15 +689,16 @@ process_authorize(FromPid, PeerIP, PeerPort, RemoteAddress,
?info("dlink_tls:authorize(): Peer Address: ~s:~p", [PeerIP, PeerPort ]),
?info("dlink_tls:authorize(): Remote Address: ~s:~p", [ RemoteAddress, RemotePort ]),
- { NRemoteAddress, NRemotePort} = Conn =
- case { RemoteAddress, RemotePort } of
- { <<"0.0.0.0">>, 0 } ->
-
- ?info("dlink_tls:authorize(): Remote is behind firewall. Will use ~p:~p",
- [ PeerIP, PeerPort]),
- { PeerIP, PeerPort };
- _ -> { RemoteAddress, RemotePort}
- end,
+ {NRemoteAddress, NRemotePort} = Conn = {PeerIP, PeerPort},
+ %% { NRemoteAddress, NRemotePort} = Conn =
+ %% case { RemoteAddress, RemotePort } of
+ %% { <<"0.0.0.0">>, 0 } ->
+
+ %% ?info("dlink_tls:authorize(): Remote is behind firewall. Will use ~p:~p",
+ %% [ PeerIP, PeerPort]),
+ %% { PeerIP, PeerPort };
+ %% _ -> { RemoteAddress, RemotePort}
+ %% end,
log("auth ~s:~w", [NRemoteAddress, NRemotePort], CompSpec),
PeerCert = rvi_common:get_value(dlink_tls_peer_cert, not_found, CompSpec),
authorize_rpc:store_creds(CompSpec, Credentials, Conn, PeerCert),