Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
1348cb1c
Commit
1348cb1c
authored
Jan 11, 2016
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ftp: load and unload X.509 certs only once
parent
5f40a878
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
8 deletions
+18
-8
modules/access/ftp.c
modules/access/ftp.c
+18
-8
No files found.
modules/access/ftp.c
View file @
1348cb1c
...
@@ -286,7 +286,8 @@ static int ftp_RecvCommand( vlc_object_t *obj, access_sys_t *sys,
...
@@ -286,7 +286,8 @@ static int ftp_RecvCommand( vlc_object_t *obj, access_sys_t *sys,
static
int
ftp_StartStream
(
vlc_object_t
*
,
access_sys_t
*
,
uint64_t
,
bool
);
static
int
ftp_StartStream
(
vlc_object_t
*
,
access_sys_t
*
,
uint64_t
,
bool
);
static
int
ftp_StopStream
(
vlc_object_t
*
,
access_sys_t
*
);
static
int
ftp_StopStream
(
vlc_object_t
*
,
access_sys_t
*
);
static
void
readTLSMode
(
access_sys_t
*
p_sys
,
const
char
*
psz_access
)
static
int
readTLSMode
(
vlc_object_t
*
obj
,
access_sys_t
*
p_sys
,
const
char
*
psz_access
)
{
{
if
(
!
strncmp
(
psz_access
,
"ftps"
,
4
)
)
if
(
!
strncmp
(
psz_access
,
"ftps"
,
4
)
)
p_sys
->
tlsmode
=
IMPLICIT
;
p_sys
->
tlsmode
=
IMPLICIT
;
...
@@ -294,15 +295,19 @@ static void readTLSMode( access_sys_t *p_sys, const char * psz_access )
...
@@ -294,15 +295,19 @@ static void readTLSMode( access_sys_t *p_sys, const char * psz_access )
if
(
!
strncmp
(
psz_access
,
"ftpes"
,
5
)
)
if
(
!
strncmp
(
psz_access
,
"ftpes"
,
5
)
)
p_sys
->
tlsmode
=
EXPLICIT
;
p_sys
->
tlsmode
=
EXPLICIT
;
else
else
{
p_sys
->
p_creds
=
NULL
;
p_sys
->
tlsmode
=
NONE
;
p_sys
->
tlsmode
=
NONE
;
return
0
;
}
p_sys
->
p_creds
=
vlc_tls_ClientCreate
(
obj
);
return
(
p_sys
->
p_creds
!=
NULL
)
?
0
:
-
1
;
}
}
static
int
createCmdTLS
(
vlc_object_t
*
p_access
,
access_sys_t
*
p_sys
,
int
fd
,
static
int
createCmdTLS
(
vlc_object_t
*
p_access
,
access_sys_t
*
p_sys
,
int
fd
,
const
char
*
psz_session_name
)
const
char
*
psz_session_name
)
{
{
p_sys
->
p_creds
=
vlc_tls_ClientCreate
(
p_access
);
if
(
p_sys
->
p_creds
==
NULL
)
return
-
1
;
/* TLS/SSL handshake */
/* TLS/SSL handshake */
p_sys
->
cmd
.
p_tls
=
vlc_tls_ClientSessionCreate
(
p_sys
->
p_creds
,
fd
,
p_sys
->
cmd
.
p_tls
=
vlc_tls_ClientSessionCreate
(
p_sys
->
p_creds
,
fd
,
p_sys
->
url
.
psz_host
,
p_sys
->
url
.
psz_host
,
...
@@ -320,9 +325,7 @@ static int createCmdTLS( vlc_object_t *p_access, access_sys_t *p_sys, int fd,
...
@@ -320,9 +325,7 @@ static int createCmdTLS( vlc_object_t *p_access, access_sys_t *p_sys, int fd,
static
void
clearCmdTLS
(
access_sys_t
*
p_sys
)
static
void
clearCmdTLS
(
access_sys_t
*
p_sys
)
{
{
if
(
p_sys
->
cmd
.
p_tls
)
vlc_tls_SessionDelete
(
p_sys
->
cmd
.
p_tls
);
if
(
p_sys
->
cmd
.
p_tls
)
vlc_tls_SessionDelete
(
p_sys
->
cmd
.
p_tls
);
if
(
p_sys
->
p_creds
)
vlc_tls_Delete
(
p_sys
->
p_creds
);
p_sys
->
cmd
.
p_tls
=
NULL
;
p_sys
->
cmd
.
p_tls
=
NULL
;
p_sys
->
p_creds
=
NULL
;
}
}
static
int
Login
(
vlc_object_t
*
p_access
,
access_sys_t
*
p_sys
)
static
int
Login
(
vlc_object_t
*
p_access
,
access_sys_t
*
p_sys
)
...
@@ -650,7 +653,9 @@ static int InOpen( vlc_object_t *p_this )
...
@@ -650,7 +653,9 @@ static int InOpen( vlc_object_t *p_this )
p_sys
->
out
=
false
;
p_sys
->
out
=
false
;
p_sys
->
offset
=
0
;
p_sys
->
offset
=
0
;
p_sys
->
size
=
UINT64_MAX
;
p_sys
->
size
=
UINT64_MAX
;
readTLSMode
(
p_sys
,
p_access
->
psz_access
);
if
(
readTLSMode
(
p_this
,
p_sys
,
p_access
->
psz_access
)
)
goto
exit_error
;
if
(
parseURL
(
&
p_sys
->
url
,
p_access
->
psz_location
,
p_sys
->
tlsmode
)
)
if
(
parseURL
(
&
p_sys
->
url
,
p_access
->
psz_location
,
p_sys
->
tlsmode
)
)
goto
exit_error
;
goto
exit_error
;
...
@@ -707,6 +712,7 @@ error:
...
@@ -707,6 +712,7 @@ error:
exit_error:
exit_error:
vlc_UrlClean
(
&
p_sys
->
url
);
vlc_UrlClean
(
&
p_sys
->
url
);
vlc_tls_Delete
(
p_sys
->
p_creds
);
free
(
p_sys
);
free
(
p_sys
);
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
...
@@ -724,7 +730,9 @@ static int OutOpen( vlc_object_t *p_this )
...
@@ -724,7 +730,9 @@ static int OutOpen( vlc_object_t *p_this )
/* Init p_access */
/* Init p_access */
p_sys
->
data
.
fd
=
-
1
;
p_sys
->
data
.
fd
=
-
1
;
p_sys
->
out
=
true
;
p_sys
->
out
=
true
;
readTLSMode
(
p_sys
,
p_access
->
psz_access
);
if
(
readTLSMode
(
p_this
,
p_sys
,
p_access
->
psz_access
)
)
goto
exit_error
;
if
(
parseURL
(
&
p_sys
->
url
,
p_access
->
psz_path
,
p_sys
->
tlsmode
)
)
if
(
parseURL
(
&
p_sys
->
url
,
p_access
->
psz_path
,
p_sys
->
tlsmode
)
)
goto
exit_error
;
goto
exit_error
;
...
@@ -754,6 +762,7 @@ static int OutOpen( vlc_object_t *p_this )
...
@@ -754,6 +762,7 @@ static int OutOpen( vlc_object_t *p_this )
exit_error:
exit_error:
vlc_UrlClean
(
&
p_sys
->
url
);
vlc_UrlClean
(
&
p_sys
->
url
);
vlc_tls_Delete
(
p_sys
->
p_creds
);
free
(
p_sys
);
free
(
p_sys
);
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
...
@@ -781,6 +790,7 @@ static void Close( vlc_object_t *p_access, access_sys_t *p_sys )
...
@@ -781,6 +790,7 @@ static void Close( vlc_object_t *p_access, access_sys_t *p_sys )
/* free memory */
/* free memory */
vlc_UrlClean
(
&
p_sys
->
url
);
vlc_UrlClean
(
&
p_sys
->
url
);
vlc_tls_Delete
(
p_sys
->
p_creds
);
free
(
p_sys
);
free
(
p_sys
);
}
}
...
...
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