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
551ad114
Commit
551ad114
authored
Nov 07, 2004
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix and simplify client-side API
(failed to release allocated data in some error cases)
parent
d68b6075
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
9 deletions
+14
-9
include/vlc_tls.h
include/vlc_tls.h
+1
-2
src/misc/tls.c
src/misc/tls.c
+13
-7
No files found.
include/vlc_tls.h
View file @
551ad114
...
@@ -98,13 +98,12 @@ VLC_EXPORT( void, tls_ServerDelete, ( tls_server_t * ) );
...
@@ -98,13 +98,12 @@ VLC_EXPORT( void, tls_ServerDelete, ( tls_server_t * ) );
# define tls_ServerSessionPrepare( a ) (((tls_server_t *)a)->pf_session_prepare (a))
# define tls_ServerSessionPrepare( a ) (((tls_server_t *)a)->pf_session_prepare (a))
# define __tls_ClientCreate( a, b ) (((tls_t *)a)->pf_client_create (a, b ))
# define __tls_ClientCreate( a, b ) (((tls_t *)a)->pf_client_create (a, b ))
VLC_EXPORT
(
tls_session_t
*
,
tls_ClientCreate
,
(
vlc_object_t
*
,
const
char
*
)
);
VLC_EXPORT
(
tls_session_t
*
,
tls_ClientCreate
,
(
vlc_object_t
*
,
const
char
*
,
int
)
);
VLC_EXPORT
(
void
,
tls_ClientDelete
,
(
tls_session_t
*
)
);
VLC_EXPORT
(
void
,
tls_ClientDelete
,
(
tls_session_t
*
)
);
# define tls_SessionHandshake( a, b ) (((tls_session_t *)a)->pf_handshake (a, b))
# define tls_SessionHandshake( a, b ) (((tls_session_t *)a)->pf_handshake (a, b))
# define tls_SessionClose( a ) (((tls_session_t *)a)->pf_close (a))
# define tls_SessionClose( a ) (((tls_session_t *)a)->pf_close (a))
# define __tls_ClientDelete( a ) tls_SessionClose( a )
/* NOTE: It is assumed that a->sock.p_sys = a */
/* NOTE: It is assumed that a->sock.p_sys = a */
# define tls_Send( a, b, c ) (((tls_session_t *)a)->sock.pf_send (a, b, c ))
# define tls_Send( a, b, c ) (((tls_session_t *)a)->sock.pf_send (a, b, c ))
...
...
src/misc/tls.c
View file @
551ad114
...
@@ -78,7 +78,7 @@ tls_ServerCreate( vlc_object_t *p_this, const char *psz_cert,
...
@@ -78,7 +78,7 @@ tls_ServerCreate( vlc_object_t *p_this, const char *psz_cert,
/*****************************************************************************
/*****************************************************************************
* tls_ServerDelete:
* tls_ServerDelete:
*****************************************************************************
*****************************************************************************
* Releases data allocated with tls_ServerCreate
* Releases data allocated with tls_ServerCreate
.
*****************************************************************************/
*****************************************************************************/
void
void
tls_ServerDelete
(
tls_server_t
*
p_server
)
tls_ServerDelete
(
tls_server_t
*
p_server
)
...
@@ -96,11 +96,11 @@ tls_ServerDelete( tls_server_t *p_server )
...
@@ -96,11 +96,11 @@ tls_ServerDelete( tls_server_t *p_server )
/*****************************************************************************
/*****************************************************************************
* tls_ClientCreate:
* tls_ClientCreate:
*****************************************************************************
*****************************************************************************
* Allocates a client's TLS credentials.
* Allocates a client's TLS credentials
and shakes hands through the network
.
* Returns NULL on error.
* Returns NULL on error.
*****************************************************************************/
*****************************************************************************/
tls_session_t
*
tls_session_t
*
tls_ClientCreate
(
vlc_object_t
*
p_this
,
const
char
*
psz_ca
)
tls_ClientCreate
(
vlc_object_t
*
p_this
,
const
char
*
psz_ca
,
int
fd
)
{
{
tls_t
*
p_tls
;
tls_t
*
p_tls
;
tls_session_t
*
p_session
;
tls_session_t
*
p_session
;
...
@@ -113,10 +113,16 @@ tls_ClientCreate( vlc_object_t *p_this, const char *psz_ca )
...
@@ -113,10 +113,16 @@ tls_ClientCreate( vlc_object_t *p_this, const char *psz_ca )
{
{
p_session
=
__tls_ClientCreate
(
p_tls
,
psz_ca
);
p_session
=
__tls_ClientCreate
(
p_tls
,
psz_ca
);
if
(
p_session
!=
NULL
)
if
(
p_session
!=
NULL
)
{
p_session
=
tls_SessionHandshake
(
p_session
,
fd
);
if
(
p_session
!=
NULL
)
{
{
msg_Dbg
(
p_this
,
"TLS/SSL provider initialized"
);
msg_Dbg
(
p_this
,
"TLS/SSL provider initialized"
);
return
p_session
;
return
p_session
;
}
}
else
msg_Err
(
p_this
,
"TLS/SSL session handshake error"
);
}
else
else
msg_Err
(
p_this
,
"TLS/SSL provider error"
);
msg_Err
(
p_this
,
"TLS/SSL provider error"
);
module_Unneed
(
p_tls
,
p_tls
->
p_module
);
module_Unneed
(
p_tls
,
p_tls
->
p_module
);
...
@@ -133,14 +139,14 @@ tls_ClientCreate( vlc_object_t *p_this, const char *psz_ca )
...
@@ -133,14 +139,14 @@ tls_ClientCreate( vlc_object_t *p_this, const char *psz_ca )
/*****************************************************************************
/*****************************************************************************
* tls_ClientDelete:
* tls_ClientDelete:
*****************************************************************************
*****************************************************************************
* Releases data allocated with tls_ClientCreate
* Releases data allocated with tls_ClientCreate
.
*****************************************************************************/
*****************************************************************************/
void
void
tls_ClientDelete
(
tls_session_t
*
p_session
)
tls_ClientDelete
(
tls_session_t
*
p_session
)
{
{
tls_t
*
p_tls
=
p_session
->
p_tls
;
tls_t
*
p_tls
=
p_session
->
p_tls
;
__tls_ClientDelet
e
(
p_session
);
tls_SessionClos
e
(
p_session
);
module_Unneed
(
p_tls
,
p_tls
->
p_module
);
module_Unneed
(
p_tls
,
p_tls
->
p_module
);
vlc_object_detach
(
p_tls
);
vlc_object_detach
(
p_tls
);
...
...
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