]> git.sur5r.net Git - bacula/bacula/commitdiff
Fix for TLS bugs #1568 and #1599
authorKern Sibbald <kern@sibbald.com>
Wed, 7 Jul 2010 05:49:48 +0000 (07:49 +0200)
committerEric Bollengier <eric@eb.homelinux.org>
Mon, 2 Aug 2010 14:53:57 +0000 (16:53 +0200)
bacula/src/lib/tls.c

index e67f75818eee1b0de3b24698260b106d1d5ef869..1dd53152e0cfcb5a711cfda64df7a992130ca39d 100644 (file)
@@ -637,6 +637,19 @@ static inline int openssl_bsock_readwrite(BSOCK *bsock, char *ptr, int nbytes, b
          }
          break;
 
+      case SSL_ERROR_SYSCALL:
+         if (nwritten == -1) {
+            if (errno == EINTR) {
+               continue;
+            }
+            if (errno == EAGAIN) {
+               bmicrosleep(0, 20000); /* try again in 20 ms */
+               continue;
+            }
+         }
+         openssl_post_errors(bsock->get_jcr(), M_FATAL, _("TLS read/write failure."));
+         goto cleanup;
+
       case SSL_ERROR_WANT_READ:
          /* If we timeout on a select, this will be unset */
          FD_SET((unsigned)bsock->m_fd, &fdset);