[vlc-commits] gnutls: remove the run-time version check
Rémi Denis-Courmont
git at videolan.org
Sun Nov 18 16:57:14 CET 2018
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Nov 18 10:29:49 2018 +0200| [1a757762f365f4d8239fe757968ad82a1e9063c5] | committer: Rémi Denis-Courmont
gnutls: remove the run-time version check
This was wrong. If VLC is built with GnuTLS 3.5.0+, then it needs
GnuTLS 3.5.0+ at run-time, even if VLC can be built with GnuTLS 3.3.0.
In practice, this check is obviously pointless if GnuTLS is statically
linked. And if GnuTLS is dynamically linked, the packaging system shall
take care not to downgrade it to a run-time incompatible version (as
any other library). So just remove the check.
Instead, print the run-time and compile-time version numbers.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1a757762f365f4d8239fe757968ad82a1e9063c5
---
modules/misc/gnutls.c | 22 ++++++----------------
1 file changed, 6 insertions(+), 16 deletions(-)
diff --git a/modules/misc/gnutls.c b/modules/misc/gnutls.c
index 87bd5c049b..5f8bb1b8c3 100644
--- a/modules/misc/gnutls.c
+++ b/modules/misc/gnutls.c
@@ -49,16 +49,10 @@ typedef struct vlc_tls_gnutls
vlc_object_t *obj;
} vlc_tls_gnutls_t;
-static int gnutls_Init (vlc_object_t *obj)
+static void gnutls_Banner(vlc_object_t *obj)
{
- const char *version = gnutls_check_version ("3.3.0");
- if (version == NULL)
- {
- msg_Err (obj, "unsupported GnuTLS version");
- return -1;
- }
- msg_Dbg (obj, "using GnuTLS version %s", version);
- return 0;
+ msg_Dbg(obj, "using GnuTLS v%s (built with v"GNUTLS_VERSION")",
+ gnutls_check_version(NULL));
}
static int gnutls_Error(vlc_tls_gnutls_t *priv, int val)
@@ -555,8 +549,7 @@ static int OpenClient (vlc_tls_creds_t *crd)
{
gnutls_certificate_credentials_t x509;
- if (gnutls_Init (VLC_OBJECT(crd)))
- return VLC_EGENERIC;
+ gnutls_Banner(VLC_OBJECT(crd));
int val = gnutls_certificate_allocate_credentials (&x509);
if (val != 0)
@@ -646,17 +639,14 @@ static int gnutls_ServerHandshake(vlc_tls_creds_t *crd, vlc_tls_t *tls,
*/
static int OpenServer (vlc_tls_creds_t *crd, const char *cert, const char *key)
{
- int val;
-
- if (gnutls_Init (VLC_OBJECT(crd)))
- return VLC_EGENERIC;
+ gnutls_Banner(VLC_OBJECT(crd));
vlc_tls_creds_sys_t *sys = malloc (sizeof (*sys));
if (unlikely(sys == NULL))
return VLC_ENOMEM;
/* Sets server's credentials */
- val = gnutls_certificate_allocate_credentials (&sys->x509_cred);
+ int val = gnutls_certificate_allocate_credentials (&sys->x509_cred);
if (val != 0)
{
msg_Err (crd, "cannot allocate credentials: %s",
More information about the vlc-commits
mailing list