summaryrefslogtreecommitdiff
path: root/tests/anonself.c
diff options
context:
space:
mode:
authorSimon Josefsson <simon@josefsson.org>2006-11-26 15:41:57 +0000
committerSimon Josefsson <simon@josefsson.org>2006-11-26 15:41:57 +0000
commitef138aca8e7ee27a6d605d789acf78793716713d (patch)
tree5ab6fe1c8ebf434f9c37bd861c4d58b30eb5364a /tests/anonself.c
parentb2eac3854c4012f337fad9b4e8f01f20c98cc5e0 (diff)
downloadgnutls-ef138aca8e7ee27a6d605d789acf78793716713d.tar.gz
More debugging.
Diffstat (limited to 'tests/anonself.c')
-rw-r--r--tests/anonself.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/tests/anonself.c b/tests/anonself.c
index d22d5d6304..f897d5c3bb 100644
--- a/tests/anonself.c
+++ b/tests/anonself.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004, 2005 Free Software Foundation
+ * Copyright (C) 2004, 2005, 2006 Free Software Foundation
*
* Author: Simon Josefsson
*
@@ -38,6 +38,12 @@
#include "utils.h"
+static void
+tls_log_func (int level, const char *str)
+{
+ fprintf (stderr, "|<%d>| %s", level, str);
+}
+
/* A very basic TLS client, with anonymous authentication.
*/
@@ -95,6 +101,9 @@ client (void)
gnutls_global_init ();
+ gnutls_global_set_log_function (tls_log_func);
+ gnutls_global_set_log_level (4711);
+
gnutls_anon_allocate_client_credentials (&anoncred);
/* Initialize TLS session
@@ -144,15 +153,12 @@ client (void)
goto end;
}
- if (debug)
+ printf ("- Received %d bytes: ", ret);
+ for (ii = 0; ii < ret; ii++)
{
- printf ("- Received %d bytes: ", ret);
- for (ii = 0; ii < ret; ii++)
- {
- fputc (buffer[ii], stdout);
- }
- fputs ("\n", stdout);
+ fputc (buffer[ii], stdout);
}
+ fputs ("\n", stdout);
gnutls_bye (session, GNUTLS_SHUT_RDWR);
@@ -233,6 +239,9 @@ server_start (void)
*/
gnutls_global_init ();
+ gnutls_global_set_log_function (tls_log_func);
+ gnutls_global_set_log_level (4711);
+
gnutls_anon_allocate_server_credentials (&anoncred);
success ("Launched, generating DH parameters...\n");