Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
7fb5f55e
Commit
7fb5f55e
authored
Jan 21, 2014
by
Lukasz Marek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavf/libssh: factorize create_sftp_session function
Signed-off-by:
Lukasz Marek
<
lukasz.m.luki@gmail.com
>
parent
77fadab1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
10 deletions
+16
-10
libssh.c
libavformat/libssh.c
+16
-10
No files found.
libavformat/libssh.c
View file @
7fb5f55e
...
...
@@ -108,6 +108,21 @@ static av_cold int libssh_authentication(LIBSSHContext *libssh, const char *user
return
0
;
}
static
av_cold
int
libssh_create_sftp_session
(
LIBSSHContext
*
libssh
)
{
if
(
!
(
libssh
->
sftp
=
sftp_new
(
libssh
->
session
)))
{
av_log
(
libssh
,
AV_LOG_ERROR
,
"SFTP session creation failed: %s
\n
"
,
ssh_get_error
(
libssh
->
session
));
return
AVERROR
(
ENOMEM
);
}
if
(
sftp_init
(
libssh
->
sftp
)
!=
SSH_OK
)
{
av_log
(
libssh
,
AV_LOG_ERROR
,
"Error initializing sftp session: %s
\n
"
,
ssh_get_error
(
libssh
->
session
));
return
AVERROR
(
EIO
);
}
return
0
;
}
static
av_cold
int
libssh_open_file
(
LIBSSHContext
*
libssh
,
int
flags
,
const
char
*
file
)
{
int
access
;
...
...
@@ -186,17 +201,8 @@ static int libssh_open(URLContext *h, const char *url, int flags)
if
((
ret
=
libssh_authentication
(
s
,
user
,
pass
))
<
0
)
goto
fail
;
if
(
!
(
s
->
sftp
=
sftp_new
(
s
->
session
)))
{
av_log
(
h
,
AV_LOG_ERROR
,
"SFTP session creation failed: %s
\n
"
,
ssh_get_error
(
s
->
session
));
ret
=
AVERROR
(
ENOMEM
);
if
((
ret
=
libssh_create_sftp_session
(
s
))
<
0
)
goto
fail
;
}
if
(
sftp_init
(
s
->
sftp
)
!=
SSH_OK
)
{
av_log
(
h
,
AV_LOG_ERROR
,
"Error initializing sftp session: %s
\n
"
,
ssh_get_error
(
s
->
session
));
ret
=
AVERROR
(
EIO
);
goto
fail
;
}
if
((
ret
=
libssh_open_file
(
s
,
flags
,
path
))
<
0
)
goto
fail
;
...
...
Write
Preview
Markdown
is supported
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