- if (!cram_md5_get_auth(fd, jcr->client->password, ssl_need) ||
- !cram_md5_auth(fd, jcr->client->password, ssl_need)) {
+ Dmsg1(50, "Sent: %s", fd->msg);
+
+ /* TLS Requirement */
+ if (client->tls_enable) {
+ if (client->tls_require) {
+ tls_local_need = BNET_TLS_REQUIRED;
+ } else {
+ tls_local_need = BNET_TLS_OK;
+ }
+ }
+
+ auth_success = cram_md5_respond(fd, client->password, &tls_remote_need, &compatible);
+ if (auth_success) {
+ auth_success = cram_md5_challenge(fd, client->password, tls_local_need, compatible);
+ if (!auth_success) {
+ Dmsg1(50, "cram_auth failed for %s\n", fd->who());
+ }
+ } else {
+ Dmsg1(50, "cram_get_auth failed for %s\n", fd->who());
+ }
+ if (!auth_success) {
+ stop_bsock_timer(tid);
+ Dmsg0(50, _("Director and File daemon passwords or names not the same.\n"));
+ Jmsg(jcr, M_FATAL, 0,
+ _("Unable to authenticate with File daemon on \"%s:%d\". Possible causes:\n"
+ "Passwords or names not the same or\n"
+ "Maximum Concurrent Jobs exceeded on the FD or\n"
+ "FD networking messed up (restart daemon).\n"
+ "Please see http://www.bacula.org/rel-manual/faq.html#AuthorizationErrors for help.\n"),
+ fd->host(), fd->port());
+ return 0;
+ }
+
+ /* Verify that the remote host is willing to meet our TLS requirements */
+ if (tls_remote_need < tls_local_need && tls_local_need != BNET_TLS_OK && tls_remote_need != BNET_TLS_OK) {