]> Untitled Git - dockapps/wmnotify.git/commitdiff
Added more verbose messages for SSL read operations
authorHugo Villeneuve <hugo@hugovil.com>
Sat, 25 May 2013 21:49:29 +0000 (17:49 -0400)
committerHugo Villeneuve <hugo@hugovil.com>
Sat, 25 May 2013 21:52:57 +0000 (17:52 -0400)
The ChangeLog erroneously states that:
  Fixed a bug which closed the application if there was a network
  problem in the WmnotifyGetResponse() function.

ChangeLog
src/imap.c
src/network.c

index 5c636ac61510dc7998ba4b296aba3fd400ef91e7..0168c930f86c27269b4c14e7e25704f6d5851f16 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+
+2005-09-27  Hugo Villeneuve  <hugo@hugovil.com>
+       * Fixed a bug which closed the application if there was a network
+       problem in the WmnotifyGetResponse() function.
+       
 2005-06-22  Hugo Villeneuve  <hugo@hugovil.com>
        * Now using the same Tx and Rx buffers for POP3 and IMAP4.
        * Removed autogenerated files from subversion repository.
index 3fc2e4fe88159b87c3ae786f3cb4c56c38270f1c..bb800827d5bdb044eefd348f00e33e1df66f009b 100644 (file)
@@ -67,11 +67,8 @@ IMAP4_ReceiveResponse( void )
   
  get_packet:
   len = WmnotifyGetResponse( rx_buffer, WMNOTIFY_BUFSIZE );
-
   if( len < 0 ) {
-    /* An error occured. */
-    perror( PACKAGE );
-    ErrorLocation( __FILE__, __LINE__ );
+    /* An error occured. WmnotifyGetResponse() should have printed an error message. */
     goto error;
   }
   else if( len == 0 ) {
index caa1c28098d79898e55a1ca101119491d0f154f0..c85ea4fd07133a727bbd9ad45f112e164e68ea1f 100644 (file)
@@ -195,12 +195,28 @@ WmnotifyGetResponse( char *buffer, int max_size )
 #if HAVE_SSL
   if( wmnotify_infos.use_ssl == TRUE ) {
     len = SSL_read( ssl_infos.ssl, buffer, max_size ); /* Get reply & decrypt */
-    if( len <= 0 ) {
-      SSL_get_error( ssl_infos.ssl, len );
-      len = -1;
+    switch( SSL_get_error( ssl_infos.ssl, len ) ) {
+    case SSL_ERROR_NONE:
+      /* Success. */
+      break;
+    case SSL_ERROR_ZERO_RETURN:
+      fprintf( stderr, "%s: SSL_read() connection closed.\n", PACKAGE );
+      break;
+    case SSL_ERROR_SYSCALL:
+      fprintf( stderr, "%s: SSL_read() I/O error.\n", PACKAGE );
+      goto ssl_error;
+    case SSL_ERROR_SSL:
+      fprintf( stderr, "%s: SSL_read() protocol error.\n", PACKAGE );
+      goto ssl_error;
+    default:
+      fprintf( stderr, "%s: SSL_read() error.\n", PACKAGE );
+      goto ssl_error;
     }
-    
+
     return len;
+
+  ssl_error:
+    return -1;
   }
 #endif /* HAVE_SSL */