aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2011-12-04 19:14:29 +0000
committerWilmer van der Gaast <wilmer@gaast.net>2011-12-04 19:14:29 +0000
commitca974d7f6171a70c5484420bd6c59919383105a6 (patch)
tree874b9e25781f2174f45f53eee32236a78bdae83a
parentbd3166176fdb7ed96211eb539316f47843e0faa7 (diff)
Debug output tweaks: Try to send everything to stderr, and add ifdef to
enable printing of all SSL traffic.
-rw-r--r--lib/ssl_gnutls.c6
-rw-r--r--lib/xmltree.c18
-rw-r--r--protocols/msn/soap.c10
3 files changed, 18 insertions, 16 deletions
diff --git a/lib/ssl_gnutls.c b/lib/ssl_gnutls.c
index d72b17f5..ccab8aca 100644
--- a/lib/ssl_gnutls.c
+++ b/lib/ssl_gnutls.c
@@ -44,6 +44,8 @@ static gboolean initialized = FALSE;
#define GNUTLS_STUPID_CAST (int)
#endif
+#define SSLDEBUG 0
+
struct scd
{
ssl_input_function func;
@@ -197,7 +199,7 @@ int ssl_read( void *conn, char *buf, int len )
if( st == GNUTLS_E_AGAIN || st == GNUTLS_E_INTERRUPTED )
ssl_errno = SSL_AGAIN;
- if( 0 && getenv( "BITLBEE_DEBUG" ) && st > 0 ) len = write( 1, buf, st );
+ if( SSLDEBUG && getenv( "BITLBEE_DEBUG" ) && st > 0 ) len = write( 2, buf, st );
return st;
}
@@ -218,7 +220,7 @@ int ssl_write( void *conn, const char *buf, int len )
if( st == GNUTLS_E_AGAIN || st == GNUTLS_E_INTERRUPTED )
ssl_errno = SSL_AGAIN;
- if( 0 && getenv( "BITLBEE_DEBUG" ) && st > 0 ) len = write( 1, buf, st );
+ if( SSLDEBUG && getenv( "BITLBEE_DEBUG" ) && st > 0 ) len = write( 2, buf, st );
return st;
}
diff --git a/lib/xmltree.c b/lib/xmltree.c
index 7dd7b6a3..e2654579 100644
--- a/lib/xmltree.c
+++ b/lib/xmltree.c
@@ -329,16 +329,16 @@ void xt_print( struct xt_node *node )
/* Indentation */
for( c = node; c->parent; c = c->parent )
- printf( " " );
+ fprintf( stderr, " " );
/* Start the tag */
- printf( "<%s", node->name );
+ fprintf( stderr, "<%s", node->name );
/* Print the attributes */
for( i = 0; node->attr[i].key; i ++ )
{
char *v = g_markup_escape_text( node->attr[i].value, -1 );
- printf( " %s=\"%s\"", node->attr[i].key, v );
+ fprintf( stderr, " %s=\"%s\"", node->attr[i].key, v );
g_free( v );
}
@@ -347,13 +347,13 @@ void xt_print( struct xt_node *node )
/* If this tag doesn't have any content at all... */
if( node->text == NULL && node->children == NULL )
{
- printf( "/>\n" );
+ fprintf( stderr, "/>\n" );
return;
/* Then we're finished! */
}
/* Otherwise... */
- printf( ">" );
+ fprintf( stderr, ">" );
/* Only print the text if it contains more than whitespace (TEST). */
if( node->text_len > 0 )
@@ -362,23 +362,23 @@ void xt_print( struct xt_node *node )
if( node->text[i] )
{
char *v = g_markup_escape_text( node->text, -1 );
- printf( "%s", v );
+ fprintf( stderr, "%s", v );
g_free( v );
}
}
if( node->children )
- printf( "\n" );
+ fprintf( stderr, "\n" );
for( c = node->children; c; c = c->next )
xt_print( c );
if( node->children )
for( c = node; c->parent; c = c->parent )
- printf( " " );
+ fprintf( stderr, " " );
/* Non-empty tag is now finished. */
- printf( "</%s>\n", node->name );
+ fprintf( stderr, "</%s>\n", node->name );
}
struct xt_node *xt_dup( struct xt_node *node )
diff --git a/protocols/msn/soap.c b/protocols/msn/soap.c
index ea9a0699..ccfc1a67 100644
--- a/protocols/msn/soap.c
+++ b/protocols/msn/soap.c
@@ -217,9 +217,9 @@ static void msn_soap_debug_print( const char *headers, const char *payload )
if( headers )
{
if( ( s = strstr( headers, "\r\n\r\n" ) ) )
- st = write( 1, headers, s - headers + 4 );
+ st = write( 2, headers, s - headers + 4 );
else
- st = write( 1, headers, strlen( headers ) );
+ st = write( 2, headers, strlen( headers ) );
}
if( payload )
@@ -662,7 +662,7 @@ static xt_status msn_soap_memlist_member( struct xt_node *node, gpointer data )
bd->flags |= MSN_BUDDY_PL;
if( getenv( "BITLBEE_DEBUG" ) )
- printf( "%p %s %d\n", bu, handle, bd->flags );
+ fprintf( stderr, "%p %s %d\n", bu, handle, bd->flags );
return XT_HANDLED;
}
@@ -809,7 +809,7 @@ static xt_status msn_soap_addressbook_group( struct xt_node *node, gpointer data
}
if( getenv( "BITLBEE_DEBUG" ) )
- printf( "%s %s\n", id, name );
+ fprintf( stderr, "%s %s\n", id, name );
return XT_HANDLED;
}
@@ -870,7 +870,7 @@ static xt_status msn_soap_addressbook_contact( struct xt_node *node, gpointer da
imcb_add_buddy( ic, handle, group->name );
if( getenv( "BITLBEE_DEBUG" ) )
- printf( "%s %s %s %s\n", id, type, handle, display_name );
+ fprintf( stderr, "%s %s %s %s\n", id, type, handle, display_name );
return XT_HANDLED;
}