*
*/
/*
- Copyright (C) 2001-2005 Kern Sibbald
+ Copyright (C) 2001-2006 Kern Sibbald
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
- version 2 as ammended with additional clauses defined in the
+ version 2 as amended with additional clauses defined in the
file LICENSE in the main source directory.
This program is distributed in the hope that it will be useful,
#include "dird.h"
extern DIRRES *director;
-extern char my_name[];
/* Commands sent to Storage daemon and File daemon and received
* from the User Agent */
char dirname[MAX_NAME_LENGTH];
int tls_local_need = BNET_TLS_NONE;
int tls_remote_need = BNET_TLS_NONE;
+ int compatible = true;
bool auth_success = false;
/*
}
}
- auth_success = cram_md5_get_auth(sd, store->password, &tls_remote_need);
+ auth_success = cram_md5_respond(sd, store->password, &tls_remote_need, &compatible);
if (auth_success) {
- auth_success = cram_md5_auth(sd, store->password, tls_local_need);
+ auth_success = cram_md5_challenge(sd, store->password, tls_local_need, compatible);
if (!auth_success) {
- Dmsg1(50, "cram_auth failed for %s\n", sd->who);
+ Dmsg1(50, "cram_challenge failed for %s\n", sd->who);
}
} else {
- Dmsg1(50, "cram_get_auth failed for %s\n", sd->who);
+ Dmsg1(50, "cram_respond failed for %s\n", sd->who);
}
if (!auth_success) {
stop_bsock_timer(tid);
Dmsg0(50, _("Director and Storage daemon passwords or names not the same.\n"));
Jmsg0(jcr, M_FATAL, 0,
- _("Unable to authenticate with Storage daemon. Possible causes:\n"
+ _("Director unable to authenticate with Storage daemon. Possible causes:\n"
"Passwords or names not the same or\n"
"Maximum Concurrent Jobs exceeded on the SD or\n"
"SD networking messed up (restart daemon).\n"
return 0;
}
-#ifdef HAVE_TLS
/* Is TLS Enabled? */
if (tls_local_need >= BNET_TLS_OK && tls_remote_need >= BNET_TLS_OK) {
/* Engage TLS! Full Speed Ahead! */
return 0;
}
}
-#endif
Dmsg1(116, ">stored: %s", sd->msg);
if (bnet_recv(sd) <= 0) {
char dirname[MAX_NAME_LENGTH];
int tls_local_need = BNET_TLS_NONE;
int tls_remote_need = BNET_TLS_NONE;
+ int compatible = true;
bool auth_success = false;
/*
Jmsg(jcr, M_FATAL, 0, _("Error sending Hello to File daemon. ERR=%s\n"), bnet_strerror(fd));
return 0;
}
+ Dmsg1(50, "Sent: %s", fd->msg);
-#ifdef HAVE_TLS
/* TLS Requirement */
if (client->tls_enable) {
if (client->tls_require) {
tls_local_need = BNET_TLS_OK;
}
}
-#endif
- auth_success = cram_md5_get_auth(fd, client->password, &tls_remote_need);
+ auth_success = cram_md5_respond(fd, client->password, &tls_remote_need, &compatible);
if (auth_success) {
- auth_success = cram_md5_auth(fd, client->password, tls_local_need);
+ 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);
}
return 0;
}
-#ifdef HAVE_TLS
/* Is TLS Enabled? */
if (tls_local_need >= BNET_TLS_OK && tls_remote_need >= BNET_TLS_OK) {
/* Engage TLS! Full Speed Ahead! */
return 0;
}
}
-#endif
Dmsg1(116, ">filed: %s", fd->msg);
if (bnet_recv(fd) <= 0) {
char name[MAX_NAME_LENGTH];
int tls_local_need = BNET_TLS_NONE;
int tls_remote_need = BNET_TLS_NONE;
+ int compatible = true;
CONRES *cons = NULL;
BSOCK *ua = uac->UA_sock;
bool auth_success = false;
-#ifdef HAVE_TLS
TLS_CONTEXT *tls_ctx = NULL;
alist *verify_list = NULL;
-#endif /* HAVE_TLS */
// Emsg4(M_INFO, 0, _("UA Hello from %s:%s:%d is invalid. Len=%d\n"), ua->who,
name[sizeof(name)-1] = 0; /* terminate name */
if (strcmp(name, "*UserAgent*") == 0) { /* default console */
-#ifdef HAVE_TLS
/* TLS Requirement */
if (director->tls_enable) {
if (director->tls_require) {
if (director->tls_verify_peer) {
verify_list = director->tls_allowed_cns;
}
-#endif /* HAVE_TLS */
- auth_success = cram_md5_auth(ua, director->password, tls_local_need) &&
- cram_md5_get_auth(ua, director->password, &tls_remote_need);
+ auth_success = cram_md5_challenge(ua, director->password, tls_local_need,
+ compatible) &&
+ cram_md5_respond(ua, director->password, &tls_remote_need, &compatible);
} else {
unbash_spaces(name);
cons = (CONRES *)GetResWithName(R_CONSOLE, name);
if (cons) {
-#ifdef HAVE_TLS
/* TLS Requirement */
if (cons->tls_enable) {
if (cons->tls_require) {
if (cons->tls_verify_peer) {
verify_list = cons->tls_allowed_cns;
}
-#endif /* HAVE_TLS */
- auth_success = cram_md5_auth(ua, cons->password, tls_local_need) &&
- cram_md5_get_auth(ua, cons->password, &tls_remote_need);
+ auth_success = cram_md5_challenge(ua, cons->password, tls_local_need,
+ compatible) &&
+ cram_md5_respond(ua, cons->password, &tls_remote_need, &compatible);
if (auth_success) {
uac->cons = cons; /* save console resource pointer */
goto auth_done;
}
-#ifdef HAVE_TLS
if (tls_local_need >= BNET_TLS_OK && tls_remote_need >= BNET_TLS_OK) {
if (cons) {
tls_ctx = cons->tls_ctx;
/* Engage TLS! Full Speed Ahead! */
if (!bnet_tls_server(tls_ctx, ua, verify_list)) {
- Emsg0(M_ERROR, 0, "TLS negotiation failed.\n");
+ Emsg0(M_ERROR, 0, _("TLS negotiation failed.\n"));
auth_success = false;
goto auth_done;
}
}
-#endif /* HAVE_TLS */
/* Authorization Completed */
sleep(5);
return 0;
}
- bnet_fsend(ua, "1000 OK: %s Version: " VERSION " (" BDATE ")\n", my_name);
+ bnet_fsend(ua, _("1000 OK: %s Version: %s (%s)\n"), my_name, VERSION, BDATE);
return 1;
}