From: Eric Bollengier Date: Mon, 20 Apr 2020 15:09:41 +0000 (+0200) Subject: BEE Backport bacula/src/lib/bsock.c X-Git-Tag: Release-11.3.2~1818 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dff498fcc80b6e33b703443088ad28e7ca8015d2;p=thirdparty%2Fbacula.git BEE Backport bacula/src/lib/bsock.c This commit is the result of the squash of the following main commits: Author: Eric Bollengier Date: Tue Mar 31 16:41:25 2020 +0200 Fix #6089 about SD spooling error message not sent to the Director Author: Eric Bollengier Date: Wed Feb 26 09:50:29 2020 +0100 Use Bacula Systems copyright for bcollector/bsock files Author: Eric Bollengier Date: Fri Apr 12 15:08:11 2019 +0200 Add some debug to BSOCK objects Author: Alain Spineux Date: Mon Apr 8 17:43:44 2019 +0200 PSK: bacula "lib" files cleanup - remove Dmsg() - add comment Author: Alain Spineux 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 --- diff --git a/bacula/src/lib/bsock.c b/bacula/src/lib/bsock.c index f3001e87fb..b8a03f4ac7 100644 --- a/bacula/src/lib/bsock.c +++ b/bacula/src/lib/bsock.c @@ -44,12 +44,13 @@ #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; }