aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssh/src/ssh_sftp.erl
diff options
context:
space:
mode:
authorHans Nilsson <[email protected]>2016-05-26 15:33:18 +0200
committerHans Nilsson <[email protected]>2016-05-30 17:09:55 +0200
commit84051a76ee4c07f7453ba2bf24fe32c8cf8c7b48 (patch)
tree8c814b74304069d5a027afbe7cb4f27e71f1cddd /lib/ssh/src/ssh_sftp.erl
parent7a03eab1dd3ce2a1f9b4f7eae09d62f1ea48f401 (diff)
downloadotp-84051a76ee4c07f7453ba2bf24fe32c8cf8c7b48.tar.gz
otp-84051a76ee4c07f7453ba2bf24fe32c8cf8c7b48.tar.bz2
otp-84051a76ee4c07f7453ba2bf24fe32c8cf8c7b48.zip
ssh: ssh:connect, ssh:shell and ssh_sftp:start_subsystem supports client tcp-socket as input
Diffstat (limited to 'lib/ssh/src/ssh_sftp.erl')
-rw-r--r--lib/ssh/src/ssh_sftp.erl23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/ssh/src/ssh_sftp.erl b/lib/ssh/src/ssh_sftp.erl
index b03652a136..afc2fb88ff 100644
--- a/lib/ssh/src/ssh_sftp.erl
+++ b/lib/ssh/src/ssh_sftp.erl
@@ -95,8 +95,31 @@
%%====================================================================
start_channel(Cm) when is_pid(Cm) ->
start_channel(Cm, []);
+start_channel(Socket) when is_port(Socket) ->
+ start_channel(Socket, []);
start_channel(Host) when is_list(Host) ->
start_channel(Host, []).
+
+start_channel(Socket, Options) when is_port(Socket) ->
+ Timeout =
+ %% A mixture of ssh:connect and ssh_sftp:start_channel:
+ case proplists:get_value(connect_timeout, Options, undefined) of
+ undefined ->
+ proplists:get_value(timeout, Options, infinity);
+ TO ->
+ TO
+ end,
+ case ssh:connect(Socket, Options, Timeout) of
+ {ok,Cm} ->
+ case start_channel(Cm, Options) of
+ {ok, Pid} ->
+ {ok, Pid, Cm};
+ Error ->
+ Error
+ end;
+ Error ->
+ Error
+ end;
start_channel(Cm, Opts) when is_pid(Cm) ->
Timeout = proplists:get_value(timeout, Opts, infinity),
{_, ChanOpts, SftpOpts} = handle_options(Opts, [], [], []),