From: Kern Sibbald Date: Sun, 24 Jun 2007 09:57:59 +0000 (+0000) Subject: Change variable names in authenticate_director() to not conflict X-Git-Tag: Release-7.0.0~6086 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=f1486a3b13e5e2f87ea75f9b2bce8bc7656f38c5;p=bacula%2Fbacula Change variable names in authenticate_director() to not conflict with member names in bat. Caused great confusion with compiler, but no warnings. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@5075 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/qt-console/console/authenticate.cpp b/bacula/src/qt-console/console/authenticate.cpp index 8e9a06aea0..9ebdc12f33 100644 --- a/bacula/src/qt-console/console/authenticate.cpp +++ b/bacula/src/qt-console/console/authenticate.cpp @@ -53,7 +53,7 @@ static char OKhello[] = "1000 OK:"; * Authenticate Director */ bool Console::authenticate_director(JCR *jcr, DIRRES *director, CONRES *cons, - char *msg, int msglen) + char *errmsg, int errmsglen) { BSOCK *dir = jcr->dir_bsock; int tls_local_need = BNET_TLS_NONE; @@ -63,7 +63,7 @@ bool Console::authenticate_director(JCR *jcr, DIRRES *director, CONRES *cons, char *password; TLS_CONTEXT *tls_ctx = NULL; - msg[0] = 0; + errmsg[0] = 0; /* * Send my name to the Director then do authentication */ @@ -102,14 +102,14 @@ bool Console::authenticate_director(JCR *jcr, DIRRES *director, CONRES *cons, if (!cram_md5_respond(dir, password, &tls_remote_need, &compatible) || /* Now challenge dir */ !cram_md5_challenge(dir, password, tls_local_need, compatible)) { - bsnprintf(msg, msglen, _("Director authorization problem at \"%s:%d\"\n"), + bsnprintf(errmsg, errmsglen, _("Director authorization problem at \"%s:%d\"\n"), dir->host(), dir->port()); goto bail_out; } /* 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) { - bsnprintf(msg, msglen, _("Authorization problem:" + bsnprintf(errmsg, errmsglen, _("Authorization problem:" " Remote server at \"%s:%d\" did not advertise required TLS support.\n"), dir->host(), dir->port()); goto bail_out; @@ -117,7 +117,7 @@ bool Console::authenticate_director(JCR *jcr, DIRRES *director, CONRES *cons, /* Verify that we are willing to meet the remote host's requirements */ if (tls_remote_need > tls_local_need && tls_local_need != BNET_TLS_OK && tls_remote_need != BNET_TLS_OK) { - bsnprintf(msg, msglen, _("Authorization problem with Director at \"%s:%d\":" + bsnprintf(errmsg, errmsglen, _("Authorization problem with Director at \"%s:%d\":" " Remote server requires TLS.\n"), dir->host(), dir->port()); @@ -129,7 +129,7 @@ bool Console::authenticate_director(JCR *jcr, DIRRES *director, CONRES *cons, if (tls_local_need >= BNET_TLS_OK && tls_remote_need >= BNET_TLS_OK) { /* Engage TLS! Full Speed Ahead! */ if (!bnet_tls_client(tls_ctx, dir, NULL)) { - bsnprintf(msg, msglen, _("TLS negotiation failed with Director at \"%s:%d\"\n"), + bsnprintf(errmsg, errmsglen, _("TLS negotiation failed with Director at \"%s:%d\"\n"), dir->host(), dir->port()); goto bail_out; } @@ -139,7 +139,7 @@ bool Console::authenticate_director(JCR *jcr, DIRRES *director, CONRES *cons, Dmsg1(6, ">dird: %s", dir->msg); if (dir->recv() <= 0) { dir->stop_timer(); - bsnprintf(msg, msglen, _("Bad response to Hello command: ERR=%s\n" + bsnprintf(errmsg, errmsglen, _("Bad response to Hello command: ERR=%s\n" "The Director at \"%s:%d\" is probably not running.\n"), dir->bstrerror(), dir->host(), dir->port()); return false; @@ -148,17 +148,17 @@ bool Console::authenticate_director(JCR *jcr, DIRRES *director, CONRES *cons, dir->stop_timer(); Dmsg1(10, "msg); if (strncmp(dir->msg, OKhello, sizeof(OKhello)-1) != 0) { - bsnprintf(msg, msglen, _("Director at \"%s:%d\" rejected Hello command\n"), + bsnprintf(errmsg, errmsglen, _("Director at \"%s:%d\" rejected Hello command\n"), dir->host(), dir->port()); return false; } else { - bsnprintf(msg, msglen, "%s", dir->msg); + bsnprintf(errmsg, errmsglen, "%s", dir->errmsg); } return true; bail_out: dir->stop_timer(); - bsnprintf(msg, msglen, _("Authorization problem with Director at \"%s:%d\"\n" + bsnprintf(errmsg, errmsglen, _("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/rel-manual/faq.html#AuthorizationErrors for help.\n"), diff --git a/bacula/src/qt-console/console/console.cpp b/bacula/src/qt-console/console/console.cpp index e62a0d6d43..6dea290108 100644 --- a/bacula/src/qt-console/console/console.cpp +++ b/bacula/src/qt-console/console/console.cpp @@ -115,22 +115,23 @@ void Console::terminate() */ void Console::connect_dir() { - JCR jcr; + JCR *jcr = new JCR; utime_t heart_beat; char buf[1024]; + CONRES *cons; m_textEdit = textEdit; /* our console screen */ if (!m_dir) { mainWin->set_status("No Director found."); - return; + goto bail_out; } if (m_sock) { mainWin->set_status("Already connected."); - return; + goto bail_out; } - memset(&jcr, 0, sizeof(jcr)); + memset(jcr, 0, sizeof(JCR)); mainWin->set_statusf(_("Connecting to Director %s:%d"), m_dir->address, m_dir->DIRport); display_textf(_("Connecting to Director %s:%d\n\n"), m_dir->address, m_dir->DIRport); @@ -140,7 +141,7 @@ void Console::connect_dir() LockRes(); /* If cons==NULL, default console will be used */ - CONRES *cons = (CONRES *)GetNextRes(R_CONSOLE, NULL); + cons = (CONRES *)GetNextRes(R_CONSOLE, NULL); UnlockRes(); /* Initialize Console TLS context once */ @@ -160,7 +161,7 @@ void Console::connect_dir() if (!cons->tls_ctx) { display_textf(_("Failed to initialize TLS context for Console \"%s\".\n"), m_dir->name()); - return; + goto bail_out; } } @@ -181,7 +182,7 @@ void Console::connect_dir() display_textf(_("Failed to initialize TLS context for Director \"%s\".\n"), m_dir->name()); mainWin->set_status("Connection failed"); - return; + goto bail_out; } } @@ -198,7 +199,7 @@ void Console::connect_dir() NULL, m_dir->DIRport, 0); if (m_sock == NULL) { mainWin->set_status("Connection failed"); - return; + goto bail_out; } else { /* Update page selector to green to indicate that Console is connected */ mainWin->actionConnect->setIcon(QIcon(":images/connected.png")); @@ -207,11 +208,11 @@ void Console::connect_dir() item->setForeground(0, greenBrush); } - jcr.dir_bsock = m_sock; + jcr->dir_bsock = m_sock; - if (!authenticate_director(&jcr, m_dir, cons, buf, sizeof(buf))) { + if (!authenticate_director(jcr, m_dir, cons, buf, sizeof(buf))) { display_text(buf); - return; + goto bail_out; } if (buf[0]) { display_text(buf); @@ -250,6 +251,9 @@ void Console::connect_dir() mainWin->set_status(_("Connected")); startTimer(); /* start message timer */ + +bail_out: + delete jcr; return; } diff --git a/bacula/src/version.h b/bacula/src/version.h index 5476016a83..9467de874d 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -4,8 +4,8 @@ #undef VERSION #define VERSION "2.1.21" -#define BDATE "23 June 2007" -#define LSMDATE "23Jun07" +#define BDATE "24 June 2007" +#define LSMDATE "24Jun07" #define PROG_COPYRIGHT "Copyright (C) %d-2007 Free Software Foundation Europe e.V.\n" #define BYEAR "2007" /* year for copyright messages in progs */ diff --git a/bacula/technotes-2.1 b/bacula/technotes-2.1 index 4fcf83b984..808fe337db 100644 --- a/bacula/technotes-2.1 +++ b/bacula/technotes-2.1 @@ -1,6 +1,10 @@ Technical notes on version 2.1 General: +24Jun07 +kes Change variable names in authenticate_director() to not conflict + with member names in bat. Caused great confusion with compiler, + but no warnings. 23Jun07 kes Queue openssl error messages in case of comm problem. kes Do shutdown() call if socket terminated.