X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=bacula%2Fsrc%2Fqt-console%2Fbcomm%2Fdircomm_auth.cpp;h=8c24ca31b7e9dce84da2c6e8d7265c789c07cf53;hb=513c2c6cf9c7991273cf3330404575aafae6d8a2;hp=c1bba06d2c8da7371f5d953ab7eeb9a49ee7276f;hpb=57149b4eb3a15757cbcf4bef6bc6b95b2300d55c;p=bacula%2Fbacula diff --git a/bacula/src/qt-console/bcomm/dircomm_auth.cpp b/bacula/src/qt-console/bcomm/dircomm_auth.cpp index c1bba06d2c..8c24ca31b7 100644 --- a/bacula/src/qt-console/bcomm/dircomm_auth.cpp +++ b/bacula/src/qt-console/bcomm/dircomm_auth.cpp @@ -1,29 +1,20 @@ /* - Bacula® - The Network Backup Solution - - Copyright (C) 2001-2009 Free Software Foundation Europe e.V. - - The main author of Bacula is Kern Sibbald, with contributions from - many others, a complete list can be found in the file AUTHORS. - This program is Free Software; you can redistribute it and/or - modify it under the terms of version three of the GNU Affero General Public - License as published by the Free Software Foundation and included - in the file LICENSE. - - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. - - Bacula® is a registered trademark of Kern Sibbald. - The licensor of Bacula is the Free Software Foundation Europe - (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, - Switzerland, email:ftf@fsfeurope.org. + Bacula(R) - The Network Backup Solution + + Copyright (C) 2000-2016 Kern Sibbald + + 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. + + This notice must be preserved when any source code is + conveyed and/or propagated. + + Bacula(R) is a registered trademark of Kern Sibbald. */ /* @@ -33,19 +24,25 @@ * * Kern Sibbald, June MMI adapted to bat, Jan MMVI * - * Version $Id$ - * */ #include "bat.h" +/* + * Version at end of Hello + * prior to 06Aug13 no version + * 1 21Oct13 - added comm line compression + */ +#define BAT_VERSION 1 + /* Commands sent to Director */ -static char hello[] = "Hello %s calling\n"; +static char hello[] = "Hello %s calling %d\n"; /* Response from Director */ -static char OKhello[] = "1000 OK:"; +static char oldOKhello[] = "1000 OK:"; +static char newOKhello[] = "1000 OK: %d"; /* Forward referenced functions */ @@ -58,6 +55,7 @@ bool DirComm::authenticate_director(JCR *jcr, DIRRES *director, CONRES *cons, BSOCK *dir = jcr->dir_bsock; int tls_local_need = BNET_TLS_NONE; int tls_remote_need = BNET_TLS_NONE; + int dir_version = 0; bool tls_authenticate; int compatible = true; char bashed_name[MAX_NAME_LENGTH]; @@ -103,7 +101,7 @@ bool DirComm::authenticate_director(JCR *jcr, DIRRES *director, CONRES *cons, /* Timeout Hello after 15 secs */ dir->start_timer(15); - dir->fsend(hello, bashed_name); + dir->fsend(hello, bashed_name, BAT_VERSION); /* respond to Dir challenge */ if (!cram_md5_respond(dir, password, &tls_remote_need, &compatible) || @@ -155,14 +153,17 @@ bool DirComm::authenticate_director(JCR *jcr, DIRRES *director, CONRES *cons, dir->stop_timer(); Dmsg1(10, "msg); - if (strncmp(dir->msg, OKhello, sizeof(OKhello)-1) != 0) { + if (strncmp(dir->msg, oldOKhello, sizeof(oldOKhello)-1) != 0) { bsnprintf(errmsg, errmsg_len, _("Director at \"%s:%d\" rejected Hello command\n"), dir->host(), dir->port()); return false; } else { - if (m_conn == 0) { - bsnprintf(errmsg, errmsg_len, "%s", dir->msg); - } + /* If Dir version exists, get it */ + sscanf(dir->msg, newOKhello, &dir_version); + } + + if (m_conn == 0) { + bsnprintf(errmsg, errmsg_len, "%s", dir->msg); } return true; @@ -171,7 +172,7 @@ bail_out: bsnprintf(errmsg, errmsg_len, _("Authorization problem with Director at \"%s:%d\"\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 http://www.bacula.org/en/rel-manual/Bacula_Freque_Asked_Questi.html#SECTION003760000000000000000 for help.\n"), + "For help, please see " MANUAL_AUTH_URL "\n"), dir->host(), dir->port()); return false; }