]> git.sur5r.net Git - bacula/bacula/blob - bacula/patches/2.0.3-tls-disconnect.patch
kes Start work on new more efficient DBId subroutine. First use
[bacula/bacula] / bacula / patches / 2.0.3-tls-disconnect.patch
1
2 This patch should fix the spurious connection drops that fail jobs
3 as reported in bug #888.
4 Apply it to version 2.0.3 (possibly earlier versions of 2.0) with:
5
6   cd <bacula-source>
7   patch -p0 <2.0.3-tls-disconnect.patch
8   make
9   ...
10   make install
11
12 Index: src/lib/tls.c
13 ===================================================================
14 --- src/lib/tls.c       (revision 4668)
15 +++ src/lib/tls.c       (working copy)
16 @@ -540,14 +540,6 @@
17      * The first time to initiate the shutdown handshake, and the second to
18      * receive the peer's reply.
19      *
20 -    * However, it is valid to close the SSL connection after the initial
21 -    * shutdown notification is sent to the peer, without waiting for the
22 -    * peer's reply, as long as you do not plan to re-use that particular
23 -    * SSL connection object.
24 -    *
25 -    * Because we do not re-use SSL connection objects, I do not bother
26 -    * calling SSL_shutdown a second time.
27 -    *
28      * In addition, if the underlying socket is blocking, SSL_shutdown()
29      * will not return until the current stage of the shutdown process has
30      * completed or an error has occured. By setting the socket blocking
31 @@ -560,6 +552,10 @@
32     flags = bnet_set_blocking(bsock);
33  
34     err = SSL_shutdown(bsock->tls->openssl);
35 +   if (err == 0) {
36 +      /* Finish up the closing */
37 +      err = SSL_shutdown(bsock->tls->openssl);
38 +   }
39  
40     switch (SSL_get_error(bsock->tls->openssl, err)) {
41        case SSL_ERROR_NONE:
42 @@ -574,8 +570,6 @@
43           break;
44     }
45  
46 -   /* Restore saved flags */
47 -   bnet_restore_blocking(bsock, flags);
48  }
49  
50  /* Does all the manual labor for tls_bsock_readn() and tls_bsock_writen() */