From 01bb498fbbe35a33c89ad9ffe4a02fd260e7cd61 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Fri, 2 Jun 2000 19:07:21 +0000 Subject: moved some debug print statements to better locations svn path=/trunk/; revision=3395 --- camel/ChangeLog | 7 +++++ camel/providers/smtp/camel-smtp-transport.c | 41 +++++++++++++++-------------- 2 files changed, 28 insertions(+), 20 deletions(-) diff --git a/camel/ChangeLog b/camel/ChangeLog index 661a4f8d2c..00d1515fc4 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,10 @@ +2000-06-02 Jeffrey Stedfast + + * providers/smtp/camel-smtp-transport.c: Rearanged where debug + fprintf statements we placed so that any data the server sends + back is printed out before an exception is set and the function + returns. + 2000-06-02 Not Zed * camel-mime-utils.c (header_decode_date): If we get a funny diff --git a/camel/providers/smtp/camel-smtp-transport.c b/camel/providers/smtp/camel-smtp-transport.c index b6fd8a7abc..c1523f4142 100644 --- a/camel/providers/smtp/camel-smtp-transport.c +++ b/camel/providers/smtp/camel-smtp-transport.c @@ -502,6 +502,9 @@ smtp_helo (CamelSmtpTransport *transport, CamelException *ex) /* Check for "250" */ g_free(respbuf); respbuf = camel_stream_buffer_read_line (CAMEL_STREAM_BUFFER (transport->istream)); + + fprintf(stderr, "received: %s\n", respbuf ? respbuf : "(null)"); + if ( !respbuf || strncmp(respbuf, "250", 3) ) { camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, "HELO response error: " @@ -509,9 +512,6 @@ smtp_helo (CamelSmtpTransport *transport, CamelException *ex) g_strerror (errno)); return FALSE; } - - fprintf(stderr, "received: %s\n", respbuf); - if (transport->smtp_is_esmtp && strstr(respbuf, "AUTH")) { /* parse for supported AUTH types */ g_strchomp(respbuf); @@ -548,6 +548,9 @@ smtp_mail (CamelSmtpTransport *transport, gchar *sender, CamelException *ex) /* Check for "250 Sender OK..." */ g_free(respbuf); respbuf = camel_stream_buffer_read_line (CAMEL_STREAM_BUFFER (transport->istream)); + + fprintf(stderr, "received: %s\n", respbuf ? respbuf : "(null)"); + if ( !respbuf || strncmp(respbuf, "250", 3) ) { camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, "MAIL FROM response error: " @@ -555,9 +558,6 @@ smtp_mail (CamelSmtpTransport *transport, gchar *sender, CamelException *ex) g_strerror (errno)); return FALSE; } - - fprintf(stderr, "received: %s\n", respbuf); - } while ( *(respbuf+3) == '-' ); /* if we got "250-" then loop again */ g_free(respbuf); @@ -590,6 +590,9 @@ smtp_rcpt (CamelSmtpTransport *transport, gchar *recipient, CamelException *ex) /* Check for "250 Sender OK..." */ g_free(respbuf); respbuf = camel_stream_buffer_read_line (CAMEL_STREAM_BUFFER (transport->istream)); + + fprintf(stderr, "received: %s\n", respbuf ? respbuf : "(null)"); + if ( !respbuf || strncmp(respbuf, "250", 3) ) { camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, "RCPT TO response error: " @@ -597,9 +600,6 @@ smtp_rcpt (CamelSmtpTransport *transport, gchar *recipient, CamelException *ex) g_strerror (errno)); return FALSE; } - - fprintf(stderr, "received: %s\n", respbuf); - } while ( *(respbuf+3) == '-' ); /* if we got "250-" then loop again */ g_free(respbuf); @@ -631,6 +631,9 @@ smtp_data (CamelSmtpTransport *transport, CamelMedium *message, CamelException * g_free(cmdbuf); respbuf = camel_stream_buffer_read_line (CAMEL_STREAM_BUFFER (transport->istream)); + + fprintf(stderr, "received: %s\n", respbuf ? respbuf : "(null)"); + if ( !respbuf || strncmp(respbuf, "354", 3) ) { /* we should have gotten instructions on how to use the DATA command: * 354 Enter mail, end with "." on a line by itself @@ -642,8 +645,6 @@ smtp_data (CamelSmtpTransport *transport, CamelMedium *message, CamelException * g_strerror (errno)); return FALSE; } - - fprintf(stderr, "received: %s\n", respbuf); /* setup stream filtering */ mimefilter = camel_mime_filter_smtp_new(); @@ -678,6 +679,9 @@ smtp_data (CamelSmtpTransport *transport, CamelMedium *message, CamelException * /* Check for "250 Sender OK..." */ g_free(respbuf); respbuf = camel_stream_buffer_read_line (CAMEL_STREAM_BUFFER (transport->istream)); + + fprintf(stderr, "received: %s\n", respbuf ? respbuf : "(null)"); + if ( !respbuf || strncmp(respbuf, "250", 3) ) { camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, "DATA response error: message termination: " @@ -685,9 +689,6 @@ smtp_data (CamelSmtpTransport *transport, CamelMedium *message, CamelException * g_strerror (errno)); return FALSE; } - - fprintf(stderr, "received: %s\n", respbuf); - } while ( *(respbuf+3) == '-' ); /* if we got "250-" then loop again */ g_free(respbuf); @@ -718,6 +719,9 @@ smtp_rset (CamelSmtpTransport *transport, CamelException *ex) /* Check for "250" */ g_free(respbuf); respbuf = camel_stream_buffer_read_line (CAMEL_STREAM_BUFFER (transport->istream)); + + fprintf(stderr, "received: %s\n", respbuf ? respbuf : "(null)"); + if ( !respbuf || strncmp(respbuf, "250", 3) ) { camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, "RSET response error: " @@ -725,9 +729,6 @@ smtp_rset (CamelSmtpTransport *transport, CamelException *ex) g_strerror (errno)); return FALSE; } - - fprintf(stderr, "received: %s\n", respbuf); - } while ( *(respbuf+3) == '-' ); /* if we got "250-" then loop again */ g_free(respbuf); @@ -758,6 +759,9 @@ smtp_quit (CamelSmtpTransport *transport, CamelException *ex) /* Check for "221" */ g_free(respbuf); respbuf = camel_stream_buffer_read_line (CAMEL_STREAM_BUFFER (transport->istream)); + + fprintf(stderr, "received: %s\n", respbuf ? respbuf : "(null)"); + if ( !respbuf || strncmp(respbuf, "221", 3) ) { camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, "QUIT response error: " @@ -765,9 +769,6 @@ smtp_quit (CamelSmtpTransport *transport, CamelException *ex) g_strerror (errno)); return FALSE; } - - fprintf(stderr, "received: %s\n", respbuf); - } while ( *(respbuf+3) == '-' ); /* if we got "221-" then loop again */ g_free(respbuf); -- cgit