]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
BEE Backport bacula/src/qt-console/bcomm/dircomm.cpp
authorAlain Spineux <alain@baculasystems.com>
Sat, 16 May 2020 09:26:21 +0000 (11:26 +0200)
committerEric Bollengier <eric@baculasystems.com>
Thu, 29 Apr 2021 08:44:19 +0000 (10:44 +0200)
This commit is the result of the squash of the following main commits:

Author: Alain Spineux <alain@baculasystems.com>
Date:   Tue Apr 9 11:13:50 2019 +0200

    PSK: Add PSK to QT's applications

    - add "TLS PSK Enable" to resources
    - update hello messages
    - rename authenticatebase.c to .cc and add the file to the QT tools
      because of a RTTI compilation problem.
      I use .cc because it works best with both bacula's CORE and QT
      to be compiled as C++ and not C
    - call init_crypto() and init_signals() in tray-monitor

bacula/src/qt-console/bcomm/dircomm.cpp

index 7ef5c5e5c56ca918aa8080f4a298b1cad05c1f8d..f568f3c8c3723a4dc0fe25ae88eb12ea31d5c2b4 100644 (file)
@@ -158,7 +158,9 @@ bool DirComm::connect_dir()
          goto bail_out;
       }
    }
-
+   if (cons && !cons->psk_ctx && cons->tls_psk_enable) {
+      cons->psk_ctx = new_psk_context(NULL /* cons->password */);
+   }
    /* Initialize Director TLS context once */
    if (!m_console->m_dir->tls_ctx && (m_console->m_dir->tls_enable || m_console->m_dir->tls_require)) {
       /* Generate passphrase prompt */
@@ -182,6 +184,9 @@ bool DirComm::connect_dir()
          goto bail_out;
       }
    }
+   if (!m_console->m_dir->psk_ctx && m_console->m_dir->tls_psk_enable) {
+      m_console->m_dir->psk_ctx = new_psk_context(NULL /*m_console->m_dir->password*/);
+   }
 
    if (m_console->m_dir->heartbeat_interval) {
       heart_beat = m_console->m_dir->heartbeat_interval;