OpenSSL: more info on accept zero-error
authorJeremy Harris <jgh146exb@wizmail.org>
Sun, 7 Jun 2020 15:38:28 +0000 (16:38 +0100)
committerJeremy Harris <jgh146exb@wizmail.org>
Sun, 7 Jun 2020 15:38:28 +0000 (16:38 +0100)
src/src/tls-openssl.c

index a1d299b69d39fc7827d9a5a25e7c422e01254f2b..3d0e84f6d2d64d843f4631760b98ac7986f482d5 100644 (file)
@@ -2738,6 +2738,7 @@ SSL_set_accept_state(server_ssl);
 
 DEBUG(D_tls) debug_printf("Calling SSL_accept\n");
 
 
 DEBUG(D_tls) debug_printf("Calling SSL_accept\n");
 
+ERR_clear_error();
 sigalrm_seen = FALSE;
 if (smtp_receive_timeout > 0) ALARM(smtp_receive_timeout);
 rc = SSL_accept(server_ssl);
 sigalrm_seen = FALSE;
 if (smtp_receive_timeout > 0) ALARM(smtp_receive_timeout);
 rc = SSL_accept(server_ssl);
@@ -2787,7 +2788,10 @@ if (rc <= 0)
          }
        DEBUG(D_tls) debug_printf(" - syscall %s\n", strerror(errno));
        }
          }
        DEBUG(D_tls) debug_printf(" - syscall %s\n", strerror(errno));
        }
-      (void) tls_error(US"SSL_accept", NULL, sigalrm_seen ? US"timed out" : NULL, errstr);
+      (void) tls_error(US"SSL_accept", NULL,
+                     sigalrm_seen ? US"timed out"
+                     : ERR_peek_error() ? NULL : string_sprintf("ret %d", error),
+                     errstr);
       return FAIL;
     }
   }
       return FAIL;
     }
   }