Commit 75ffd9ea authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

gnutls: kill relocations

parent a5a93926
...@@ -240,13 +240,11 @@ static int gnutls_ContinueHandshake (vlc_tls_t *session) ...@@ -240,13 +240,11 @@ static int gnutls_ContinueHandshake (vlc_tls_t *session)
} }
typedef struct static struct
{ {
int flag; int flag;
const char *msg; const char msg[44];
} error_msg_t; } cert_errs[] =
static const error_msg_t cert_errors[] =
{ {
{ GNUTLS_CERT_INVALID, { GNUTLS_CERT_INVALID,
"Certificate could not be verified" }, "Certificate could not be verified" },
...@@ -262,7 +260,6 @@ static const error_msg_t cert_errors[] = ...@@ -262,7 +260,6 @@ static const error_msg_t cert_errors[] =
"Certificate is not yet activated" }, "Certificate is not yet activated" },
{ GNUTLS_CERT_EXPIRED, { GNUTLS_CERT_EXPIRED,
"Certificate has expired" }, "Certificate has expired" },
{ 0, NULL }
}; };
...@@ -280,26 +277,23 @@ static int gnutls_HandshakeAndValidate (vlc_tls_t *session) ...@@ -280,26 +277,23 @@ static int gnutls_HandshakeAndValidate (vlc_tls_t *session)
val = gnutls_certificate_verify_peers2 (sys->session, &status); val = gnutls_certificate_verify_peers2 (sys->session, &status);
if (val) if (val)
{ {
msg_Err (session, "Certificate verification failed: %s", msg_Err (session, "Certificate verification error: %s",
gnutls_strerror (val)); gnutls_strerror (val));
return -1; return -1;
} }
if (status) if (status)
{ {
msg_Err (session, "TLS session: access denied (status 0x%X)", status); msg_Err (session, "Certificate verification failure:");
for (const error_msg_t *e = cert_errors; e->flag; e++) for (size_t i = 0; i < sizeof (cert_errs) / sizeof (cert_errs[0]); i++)
{ if (status & cert_errs[i].flag)
if (status & e->flag)
{ {
msg_Err (session, "%s", e->msg); msg_Err (session, " * %s", cert_errs[i].msg);
status &= ~e->flag; status &= ~cert_errs[i].flag;
}
} }
if (status) if (status)
msg_Err (session, msg_Err (session, " * Unknown verification error 0x%04X", status);
"unknown certificate error (you found a bug in VLC)");
return -1; return -1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment