Skip to content

Commit

Permalink
bsock: refactored code
Browse files Browse the repository at this point in the history
- move redundant lines
- set failed status where appropriate
  • Loading branch information
franku committed Jul 30, 2018
1 parent 4475fa1 commit 05a7c9b
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions core/src/lib/bsock.cc
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ bool BareosSocket::TwoWayAuthenticate(JobControlRecord *jcr,
what, identity, MANUAL_AUTH_URL);
} else if (jcr && JobCanceled(jcr)) {
Dmsg0(debuglevel, "Failed, because job is canceled.\n");
auth_success = false;
} else if (!DoTlsHandshake(cram_md5_handshake.RemoteTlsPolicy(),
tls_configuration,
initiated_by_remote,
Expand All @@ -355,10 +356,6 @@ bool BareosSocket::TwoWayAuthenticate(JobControlRecord *jcr,
jcr)) {
auth_success = false;
}
if (tid) {
StopBsockTimer(tid);
tid = nullptr;
}
} else { /* console-director connection: start with tls handshake */
uint32_t remote_tls_policy;
auth_success = TlsPolicyHandshake(this, initiated_by_remote,
Expand All @@ -367,6 +364,7 @@ bool BareosSocket::TwoWayAuthenticate(JobControlRecord *jcr,
Dmsg1(debuglevel, "TlsPolicyHandshake failed with %s\n", what);
} else if (jcr && JobCanceled(jcr)) {
Dmsg0(debuglevel, "Failed, because job is canceled.\n");
auth_success = false;
} else if (!DoTlsHandshake(remote_tls_policy,
tls_configuration,
initiated_by_remote,
Expand All @@ -380,14 +378,13 @@ bool BareosSocket::TwoWayAuthenticate(JobControlRecord *jcr,
"Authorization key rejected by %s %s.\n"
"Please see %s for help.\n",
what, identity, MANUAL_AUTH_URL);
auth_success = false;
} else {
auth_success = true;
}

if (tid) {
StopBsockTimer(tid);
tid = nullptr;
}
}
if (tid) {
StopBsockTimer(tid);
}
}

Expand Down

0 comments on commit 05a7c9b

Please sign in to comment.