Skip to content

Commit

Permalink
client resource: moved connection_successful_handshake_ from jcr to C…
Browse files Browse the repository at this point in the history
…lient Resource
  • Loading branch information
franku committed Sep 23, 2018
1 parent a5a3142 commit 419a438
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion core/src/dird/backup.cc
Expand Up @@ -567,7 +567,7 @@ bool DoNativeBackup(JobControlRecord *jcr)
}
} else {

if (jcr->connection_successful_handshake_ != ClientConnectionHandshakeMode::kTlsFirst) {
if (jcr->res.client->connection_successful_handshake_ != ClientConnectionHandshakeMode::kTlsFirst) {
tls_need = GetLocalTlsPolicyFromConfiguration(client);
} else {
tls_need = TlsConfigBase::BNET_TLS_AUTO;
Expand Down
3 changes: 3 additions & 0 deletions core/src/dird/dird_conf.h
Expand Up @@ -31,6 +31,8 @@
#define BAREOS_DIRD_DIRD_CONF_H_
/* NOTE: #includes at the end of this file */

#include "dird/client_connection_handshake_mode.h"

namespace directordaemon {

static std::string default_config_filename("bareos-dir.conf");
Expand Down Expand Up @@ -279,6 +281,7 @@ class ClientResource: public TlsResource {
bool ndmp_use_lmdb; /* NDMP Protocol specific use LMDB for the FHDB or not */
int64_t max_bandwidth; /* Limit speed on this client */
runtime_client_status_t *rcs; /* Runtime Client Status */
ClientConnectionHandshakeMode connection_successful_handshake_;

ClientResource() : TlsResource() {}
};
Expand Down
4 changes: 2 additions & 2 deletions core/src/dird/fd_cmds.cc
Expand Up @@ -168,7 +168,7 @@ bool ConnectToFileDaemon(JobControlRecord *jcr, int retry_interval, int max_retr
/* try the connection mode in case a client that cannot do Tls
* immediately without cleartext md5-handshake first */
jcr->connection_handshake_try_ = ClientConnectionHandshakeMode::kTlsFirst;
jcr->connection_successful_handshake_ = ClientConnectionHandshakeMode::kUndefined;
jcr->res.client->connection_successful_handshake_ = ClientConnectionHandshakeMode::kUndefined;

do { /* while (tcp_connect_failed ...) */
/* connect the tcp socket */
Expand All @@ -187,7 +187,7 @@ bool ConnectToFileDaemon(JobControlRecord *jcr, int retry_interval, int max_retr
jcr->setJobStatus(JS_Running);
if (AuthenticateWithFileDaemon(jcr)) {
success = true;
jcr->connection_successful_handshake_ = jcr->connection_handshake_try_;
jcr->res.client->connection_successful_handshake_ = jcr->connection_handshake_try_;
} else {
/* authentication failed due to
* - tls mismatch or
Expand Down
2 changes: 1 addition & 1 deletion core/src/dird/restore.cc
Expand Up @@ -292,7 +292,7 @@ static inline bool DoNativeRestoreBootstrap(JobControlRecord *jcr)
goto bail_out;
}

if (jcr->connection_successful_handshake_ != ClientConnectionHandshakeMode::kTlsFirst) {
if (jcr->res.client->connection_successful_handshake_ != ClientConnectionHandshakeMode::kTlsFirst) {
tls_need = GetLocalTlsPolicyFromConfiguration(client);
} else {
tls_need = TlsConfigBase::BNET_TLS_AUTO;
Expand Down
2 changes: 1 addition & 1 deletion core/src/dird/verify.cc
Expand Up @@ -360,7 +360,7 @@ bool DoVerify(JobControlRecord *jcr)
uint32_t tls_need = 0;
ClientResource *client = jcr->res.client;

if (jcr->connection_successful_handshake_ != ClientConnectionHandshakeMode::kTlsFirst) {
if (jcr->res.client->connection_successful_handshake_ != ClientConnectionHandshakeMode::kTlsFirst) {
tls_need = GetLocalTlsPolicyFromConfiguration(client);
} else {
tls_need = TlsConfigBase::BNET_TLS_AUTO;
Expand Down
1 change: 0 additions & 1 deletion core/src/include/jcr.h
Expand Up @@ -533,7 +533,6 @@ class JobControlRecord {
bool HasQuota; /**< Client has quota limits */
bool HasSelectedJobs; /**< Migration/Copy Job did actually select some JobIds */
directordaemon::ClientConnectionHandshakeMode connection_handshake_try_;
directordaemon::ClientConnectionHandshakeMode connection_successful_handshake_;
#endif /* DIRECTOR_DAEMON */

#ifdef FILE_DAEMON
Expand Down

0 comments on commit 419a438

Please sign in to comment.