]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
BEE Backport bacula/src/lib/bsock.c
authorEric Bollengier <eric@baculasystems.com>
Mon, 20 Apr 2020 15:09:41 +0000 (17:09 +0200)
committerEric Bollengier <eric@baculasystems.com>
Thu, 29 Apr 2021 08:44:16 +0000 (10:44 +0200)
This commit is the result of the squash of the following main commits:

Author: Eric Bollengier <eric@baculasystems.com>
Date:   Tue Mar 31 16:41:25 2020 +0200

    Fix #6089 about SD spooling error message not sent to the Director

Author: Eric Bollengier <eric@baculasystems.com>
Date:   Wed Feb 26 09:50:29 2020 +0100

    Use Bacula Systems copyright for bcollector/bsock files

Author: Eric Bollengier <eric@baculasystems.com>
Date:   Fri Apr 12 15:08:11 2019 +0200

    Add some debug to BSOCK objects

Author: Alain Spineux <alain@baculasystems.com>
Date:   Mon Apr 8 17:43:44 2019 +0200

    PSK: bacula "lib" files cleanup

    - remove Dmsg()
    - add comment

Author: Alain Spineux <alain@baculasystems.com>
Date:   Mon Apr 8 17:42:28 2019 +0200

    PSK: modify bnet_tls_(client|server) to pass the shared key via the SSL*

    - instead of the CTX, because for SD <-> FD the auth_key is generated by
       the director

bacula/src/lib/bsock.c

index f3001e87fba851c1c639e85f57cda3e1d3ba652d..b8a03f4ac7682ab540c5c56a36f7064f99dc6d07 100644 (file)
 #define ENODATA  EPIPE
 #endif
 
+#if 0 /* used by commented out BSOCK::authenticated_director() */
 /* Commands sent to Director */
 static char hello[]    = "Hello %s calling\n";
 
 /* Response from Director */
 static char OKhello[]   = "1000 OK:";
-
+#endif
 
 /*
  * BSOCK default constructor - initializes object.
@@ -113,6 +114,9 @@ void BSOCK::_destroy()
    }
 };
 
+#if 0
+// This function holds some authentication code that need to be updated
+// to support TLS-PSK
 /*
  * Authenticate Director
  */
@@ -205,6 +209,7 @@ bail_out:
              dir->host(), dir->port());
    return false;
 }
+#endif
 
 /*
  * Send a message over the network. Everything is sent in one
@@ -369,7 +374,10 @@ bool BSOCK::send(int aflags)
    if (chk_dbglvl(DT_NETWORK|1900)) dump_bsock_msg(m_fd, *pout_msg_no, "SEND", rc, msglen, m_flags, save_msg, save_msglen);
    timer_start = 0;         /* clear timer */
    if (rc != pktsiz) {
-      errors++;
+      if (!is_spooling()) {
+         /* After this point, nothing will be sent to the other side */
+         errors++; /* Very likely some I/O error with the disk (like ESPACE), not a real socket error */
+      }
       if (errno == 0) {
          b_errno = EIO;
       } else {
@@ -799,7 +807,7 @@ bool BSOCK::comm_compress()
  */
 void BSOCK::close()
 {
-   Dmsg0(BSOCK_DEBUG_LVL, "BSOCK::close()\n");
+   Dmsg1(BSOCK_DEBUG_LVL, "0x%p BSOCK::close()\n", this);
    BSOCKCORE::close();
    return;
 }