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
e41e95ea
Commit
e41e95ea
authored
Dec 07, 2006
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backport [18309]: handle TLS fatal errors
parent
d3552d57
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
5 deletions
+27
-5
modules/misc/gnutls.c
modules/misc/gnutls.c
+27
-5
No files found.
modules/misc/gnutls.c
View file @
e41e95ea
...
...
@@ -181,6 +181,30 @@ _get_Bool( vlc_object_t *p_this, const char *var )
#define get_Bool( a, b ) _get_Bool( (vlc_object_t *)(a), (b) )
static
int
gnutls_Error
(
vlc_object_t
*
obj
,
int
val
)
{
switch
(
val
)
{
case
GNUTLS_E_AGAIN
:
errno
=
EAGAIN
;
break
;
case
GNUTLS_E_INTERRUPTED
:
errno
=
EINTR
;
break
;
default:
msg_Err
(
obj
,
"%s"
,
gnutls_strerror
(
val
));
#ifdef DEBUG
if
(
!
gnutls_error_is_fatal
(
val
))
msg_Err
(
obj
,
"Error above should be handled"
);
#endif
errno
=
ECONNRESET
;
}
return
-
1
;
}
/**
* Sends data through a TLS session.
*/
...
...
@@ -193,8 +217,7 @@ gnutls_Send( void *p_session, const void *buf, int i_length )
p_sys
=
(
tls_session_sys_t
*
)(((
tls_session_t
*
)
p_session
)
->
p_sys
);
val
=
gnutls_record_send
(
p_sys
->
session
,
buf
,
i_length
);
/* TODO: handle fatal error */
return
val
<
0
?
-
1
:
val
;
return
(
val
<
0
)
?
gnutls_Error
((
vlc_object_t
*
)
p_session
,
val
)
:
val
;
}
...
...
@@ -210,8 +233,7 @@ gnutls_Recv( void *p_session, void *buf, int i_length )
p_sys
=
(
tls_session_sys_t
*
)(((
tls_session_t
*
)
p_session
)
->
p_sys
);
val
=
gnutls_record_recv
(
p_sys
->
session
,
buf
,
i_length
);
/* TODO: handle fatal error */
return
val
<
0
?
-
1
:
val
;
return
(
val
<
0
)
?
gnutls_Error
((
vlc_object_t
*
)
p_session
,
val
)
:
val
;
}
...
...
@@ -244,7 +266,7 @@ gnutls_ContinueHandshake( tls_session_t *p_session)
#ifdef WIN32
msg_Dbg
(
p_session
,
"Winsock error %d"
,
WSAGetLastError
(
)
);
#endif
msg_Err
(
p_session
,
"TLS handshake
failed
: %s"
,
msg_Err
(
p_session
,
"TLS handshake
error
: %s"
,
gnutls_strerror
(
val
)
);
p_session
->
pf_close
(
p_session
);
return
-
1
;
...
...
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