[libvirt] [PATCH] Add env variable for debugging gnutls usage
Daniel Veillard
veillard at redhat.com
Fri May 7 13:48:05 UTC 2010
On Fri, May 07, 2010 at 01:43:24PM +0100, Daniel P. Berrange wrote:
> 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
> ---
> src/remote/remote_driver.c | 13 +++++++++++++
> 1 files changed, 13 insertions(+), 0 deletions(-)
>
> diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
> index 72cf292..9e90e5c 100644
> --- a/src/remote/remote_driver.c
> +++ b/src/remote/remote_driver.c
> @@ -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 *gnudebug;
>
> if (initialized) return 0;
>
> gnutls_global_init ();
>
> + if ((gnudebug = getenv("LIBVIRT_GNUTLS_DEBUG")) != NULL) {
> + int val;
> + if (virStrToLong_i(gnudebug, 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) {
ACK, useful !
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
daniel at veillard.com | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library http://libvirt.org/
More information about the libvir-list
mailing list