X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=bacula%2Fsrc%2Fdird%2Fauthenticate.c;h=23b5d5f4f570005e6b78f6e049a52f6f9419fc78;hb=db05f326a4e98069ab685b3447a3e87037d1b7d8;hp=799f8e255f79c7aad5c016dca6e8cd46498502f0;hpb=7cefbfdacb1d394f034d4bee6e7a96af1f06df95;p=bacula%2Fbacula diff --git a/bacula/src/dird/authenticate.c b/bacula/src/dird/authenticate.c index 799f8e255f..23b5d5f4f5 100644 --- a/bacula/src/dird/authenticate.c +++ b/bacula/src/dird/authenticate.c @@ -95,10 +95,10 @@ bool authenticate_storage_daemon(JCR *jcr, STORE *store) if (auth_success) { auth_success = cram_md5_challenge(sd, store->password, tls_local_need, compatible); if (!auth_success) { - Dmsg1(50, "cram_challenge failed for %s\n", sd->who); + Dmsg1(50, "cram_challenge failed for %s\n", sd->who()); } } else { - Dmsg1(50, "cram_respond failed for %s\n", sd->who); + Dmsg1(50, "cram_respond failed for %s\n", sd->who()); } if (!auth_success) { @@ -110,7 +110,7 @@ bool authenticate_storage_daemon(JCR *jcr, STORE *store) "Maximum Concurrent Jobs exceeded on the SD or\n" "SD networking messed up (restart daemon).\n" "Please see http://www.bacula.org/rel-manual/faq.html#AuthorizationErrors for help.\n"), - sd->host, sd->port); + sd->host(), sd->port()); return 0; } @@ -131,10 +131,10 @@ bool authenticate_storage_daemon(JCR *jcr, STORE *store) /* Is TLS Enabled? */ if (tls_local_need >= BNET_TLS_OK && tls_remote_need >= BNET_TLS_OK) { /* Engage TLS! Full Speed Ahead! */ - if (!bnet_tls_client(store->tls_ctx, sd)) { + if (!bnet_tls_client(store->tls_ctx, sd, NULL)) { stop_bsock_timer(tid); Jmsg(jcr, M_FATAL, 0, _("TLS negotiation failed with SD on \"%s:%d\"\n"), - sd->host, sd->port); + sd->host(), sd->port()); return 0; } } @@ -143,7 +143,7 @@ bool authenticate_storage_daemon(JCR *jcr, STORE *store) if (bnet_recv(sd) <= 0) { stop_bsock_timer(tid); Jmsg3(jcr, M_FATAL, 0, _("bdirdwho, sd->host, bnet_strerror(sd)); + sd->who(), sd->host(), bnet_strerror(sd)); return 0; } Dmsg1(110, "msg); @@ -151,7 +151,7 @@ bool authenticate_storage_daemon(JCR *jcr, STORE *store) if (strncmp(sd->msg, OKhello, sizeof(OKhello)) != 0) { Dmsg0(50, _("Storage daemon rejected Hello command\n")); Jmsg2(jcr, M_FATAL, 0, _("Storage daemon on \"%s:%d\" rejected Hello command\n"), - sd->host, sd->port); + sd->host(), sd->port()); return 0; } return 1; @@ -180,7 +180,7 @@ int authenticate_file_daemon(JCR *jcr) if (!bnet_fsend(fd, hello, dirname)) { stop_bsock_timer(tid); Jmsg(jcr, M_FATAL, 0, _("Error sending Hello to File daemon on \"%s:%d\". ERR=%s\n"), - fd->host, fd->port, bnet_strerror(fd)); + fd->host(), fd->port(), bnet_strerror(fd)); return 0; } Dmsg1(50, "Sent: %s", fd->msg); @@ -198,10 +198,10 @@ int authenticate_file_daemon(JCR *jcr) 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); + Dmsg1(50, "cram_auth failed for %s\n", fd->who()); } } else { - Dmsg1(50, "cram_get_auth failed for %s\n", fd->who); + Dmsg1(50, "cram_get_auth failed for %s\n", fd->who()); } if (!auth_success) { stop_bsock_timer(tid); @@ -212,7 +212,7 @@ int authenticate_file_daemon(JCR *jcr) "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); + fd->host(), fd->port()); return 0; } @@ -220,7 +220,7 @@ int authenticate_file_daemon(JCR *jcr) if (tls_remote_need < tls_local_need && tls_local_need != BNET_TLS_OK && tls_remote_need != BNET_TLS_OK) { stop_bsock_timer(tid); Jmsg(jcr, M_FATAL, 0, _("Authorization problem: FD \"%s:%s\" did not advertise required TLS support.\n"), - fd->who, fd->host); + fd->who(), fd->host()); return 0; } @@ -228,17 +228,18 @@ int authenticate_file_daemon(JCR *jcr) if (tls_remote_need > tls_local_need && tls_local_need != BNET_TLS_OK && tls_remote_need != BNET_TLS_OK) { stop_bsock_timer(tid); Jmsg(jcr, M_FATAL, 0, _("Authorization problem: FD on \"%s:%d\" requires TLS.\n"), - fd->host, fd->port); + fd->host(), fd->port()); return 0; } /* Is TLS Enabled? */ if (tls_local_need >= BNET_TLS_OK && tls_remote_need >= BNET_TLS_OK) { /* Engage TLS! Full Speed Ahead! */ - if (!bnet_tls_client(client->tls_ctx, fd)) { + if (!bnet_tls_client(client->tls_ctx, fd, client->tls_allowed_cns)) { + stop_bsock_timer(tid); Jmsg(jcr, M_FATAL, 0, _("TLS negotiation failed with FD on \"%s:%d\".\n"), - fd->host, fd->port); + fd->host(), fd->port()); return 0; } } @@ -249,7 +250,7 @@ int authenticate_file_daemon(JCR *jcr) Dmsg1(50, _("Bad response from File daemon to Hello command: ERR=%s\n"), bnet_strerror(fd)); Jmsg(jcr, M_FATAL, 0, _("Bad response from File daemon on \"%s:%d\" to Hello command: ERR=%s\n"), - fd->host, fd->port, bnet_strerror(fd)); + fd->host(), fd->port(), bnet_strerror(fd)); return 0; } Dmsg1(110, "msg); @@ -257,7 +258,7 @@ int authenticate_file_daemon(JCR *jcr) if (strncmp(fd->msg, FDOKhello, sizeof(FDOKhello)) != 0) { Dmsg0(50, _("File daemon rejected Hello command\n")); Jmsg(jcr, M_FATAL, 0, _("File daemon on \"%s:%d\" rejected Hello command\n"), - fd->host, fd->port); + fd->host(), fd->port()); return 0; } return 1; @@ -279,18 +280,18 @@ int authenticate_user_agent(UAContext *uac) alist *verify_list = NULL; -// Emsg4(M_INFO, 0, _("UA Hello from %s:%s:%d is invalid. Len=%d\n"), ua->who, -// ua->host, ua->port, ua->msglen); +// Emsg4(M_INFO, 0, _("UA Hello from %s:%s:%d is invalid. Len=%d\n"), ua->who(), +// ua->host(), ua->port(), ua->msglen); if (ua->msglen < 16 || ua->msglen >= MAX_NAME_LENGTH + 15) { - Emsg4(M_ERROR, 0, _("UA Hello from %s:%s:%d is invalid. Len=%d\n"), ua->who, - ua->host, ua->port, ua->msglen); + Emsg4(M_ERROR, 0, _("UA Hello from %s:%s:%d is invalid. Len=%d\n"), ua->who(), + ua->host(), ua->port(), ua->msglen); return 0; } if (sscanf(ua->msg, "Hello %127s calling\n", name) != 1) { ua->msg[100] = 0; /* terminate string */ - Emsg4(M_ERROR, 0, _("UA Hello from %s:%s:%d is invalid. Got: %s\n"), ua->who, - ua->host, ua->port, ua->msg); + Emsg4(M_ERROR, 0, _("UA Hello from %s:%s:%d is invalid. Got: %s\n"), ua->who(), + ua->host(), ua->port(), ua->msg); return 0; } @@ -379,7 +380,7 @@ auth_done: if (!auth_success) { bnet_fsend(ua, "%s", _(Dir_sorry)); Emsg4(M_ERROR, 0, _("Unable to authenticate console \"%s\" at %s:%s:%d.\n"), - name, ua->who, ua->host, ua->port); + name, ua->who(), ua->host(), ua->port()); sleep(5); return 0; }