mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 12:35:17 +00:00
Add env variable for debugging gnutls usage
Allow debugging of GNUTLS interactions by setting LIBVIRT_GNUTLS_DEBUG=10 LIBVIRT_DEBUG=1 virsh * src/remote/remote_driver.c: Use LIBVIRT_GNUTLS_DEBUG to enable gnutls debugging
This commit is contained in:
parent
c5be8bcb8f
commit
36a03bd2ee
@ -1138,16 +1138,29 @@ check_cert_file(const char *type, const char *file)
|
||||
}
|
||||
|
||||
|
||||
static void remote_debug_gnutls_log(int level, const char* str) {
|
||||
DEBUG("%d %s", level, str);
|
||||
}
|
||||
|
||||
static int
|
||||
initialize_gnutls(void)
|
||||
{
|
||||
static int initialized = 0;
|
||||
int err;
|
||||
char *gnutlsdebug;
|
||||
|
||||
if (initialized) return 0;
|
||||
|
||||
gnutls_global_init ();
|
||||
|
||||
if ((gnutlsdebug = getenv("LIBVIRT_GNUTLS_DEBUG")) != NULL) {
|
||||
int val;
|
||||
if (virStrToLong_i(gnutlsdebug, NULL, 10, &val) < 0)
|
||||
val = 10;
|
||||
gnutls_global_set_log_level(val);
|
||||
gnutls_global_set_log_function(remote_debug_gnutls_log);
|
||||
}
|
||||
|
||||
/* X509 stuff */
|
||||
err = gnutls_certificate_allocate_credentials (&x509_cred);
|
||||
if (err) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user