/*
- Bacula® - The Network Backup Solution
+ Bacula(R) - The Network Backup Solution
- Copyright (C) 2001-2014 Free Software Foundation Europe e.V.
+ Copyright (C) 2000-2017 Kern Sibbald
- The main author of Bacula is Kern Sibbald, with contributions from many
- others, a complete list can be found in the file AUTHORS.
+ The original author of Bacula is Kern Sibbald, with contributions
+ from many others, a complete list can be found in the file AUTHORS.
You may use this file and others of this release according to the
license defined in the LICENSE file, which includes the Affero General
Public License, v3.0 ("AGPLv3") and some additional permissions and
terms pursuant to its AGPLv3 Section 7.
- Bacula® is a registered trademark of Kern Sibbald.
+ This notice must be preserved when any source code is
+ conveyed and/or propagated.
+
+ Bacula(R) is a registered trademark of Kern Sibbald.
*/
/*
*
#include "bacula.h"
#include "console_conf.h"
-#include "jcr.h"
/*
* Version at end of Hello
* prior to 06Aug13 no version
+ * 100 14Feb17 - added comm line compression
*/
-#define UA_VERSION 1
+#define UA_VERSION 100
void senditf(const char *fmt, ...);
void sendit(const char *buf);
/* Response from Director */
static char oldOKhello[] = "1000 OK:";
static char newOKhello[] = "1000 OK: %d";
+static char FDOKhello[] = "2000 OK Hello %d";
/* Forward referenced functions */
/*
* Authenticate Director
*/
-int authenticate_director(JCR *jcr, DIRRES *director, CONRES *cons)
+int authenticate_director(BSOCK *dir, DIRRES *director, CONRES *cons)
{
- BSOCK *dir = jcr->dir_bsock;
int tls_local_need = BNET_TLS_NONE;
int tls_remote_need = BNET_TLS_NONE;
bool tls_authenticate;
int compatible = true;
int dir_version = 0;
+ int fd_version = 0;
char bashed_name[MAX_NAME_LENGTH];
char *password;
TLS_CONTEXT *tls_ctx = NULL;
-
+
/*
* Send my name to the Director then do authentication
*/
}
Dmsg1(10, "<dird: %s", dir->msg);
- if (strncmp(dir->msg, oldOKhello, sizeof(oldOKhello)-1) != 0) {
- sendit(_("Director rejected Hello command\n"));
- goto bail_out;
- } else {
+ if (strncmp(dir->msg, oldOKhello, sizeof(oldOKhello)-1) == 0) {
/* If Dir version exists, get it */
sscanf(dir->msg, newOKhello, &dir_version);
sendit(dir->msg);
+ /* Check for hello from FD */
+ } else if (sscanf(dir->msg, FDOKhello, &fd_version) == 1) {
+ sendit(dir->msg);
+ } else {
+ sendit(_("Director rejected Hello command\n"));
+ goto bail_out;
+ }
+ /* Turn on compression for newer Directors */
+ if (dir_version >= 103 && (!cons || cons->comm_compression)) {
+ dir->set_compress();
+ } else {
+ dir->clear_compress();
}
+ /* ***FIXME*** should turn on compression for FD if possible */
stop_bsock_timer(tid);
return 1;
sendit( _("Director authorization problem.\n"
"Most likely the passwords do not agree.\n"
"If you are using TLS, there may have been a certificate validation error during the TLS handshake.\n"
- "Please see " MANUAL_AUTH_URL " for help.\n"));
+ "For help, please see " MANUAL_AUTH_URL "\n"));
return 0;
}