From: Kern Sibbald Date: Tue, 22 May 2007 08:41:34 +0000 (+0000) Subject: tls fixes + add FileSet writeSettings -- doesn't work X-Git-Tag: Release-7.0.0~6275 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=6d5f5e65f113d460eb59835f1f310fe4ced3daa8;p=bacula%2Fbacula tls fixes + add FileSet writeSettings -- doesn't work git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4870 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/qt-console/bat_conf.cpp b/bacula/src/qt-console/bat_conf.cpp index c098847f8f..990c50d1cf 100644 --- a/bacula/src/qt-console/bat_conf.cpp +++ b/bacula/src/qt-console/bat_conf.cpp @@ -82,8 +82,8 @@ static RES_ITEM dir_items[] = { {"dirport", store_int, ITEM(dir_res.DIRport), 0, ITEM_DEFAULT, 9101}, {"address", store_str, ITEM(dir_res.address), 0, ITEM_REQUIRED, 0}, {"password", store_password, ITEM(dir_res.password), 0, 0, 0}, - {"tlsenable", store_bit, ITEM(dir_res.tls_enable), 1, 0, 0}, - {"tlsrequire", store_bit, ITEM(dir_res.tls_require), 1, 0, 0}, + {"tlsenable", store_bool, ITEM(dir_res.tls_enable), 1, 0, 0}, + {"tlsrequire", store_bool, ITEM(dir_res.tls_require), 1, 0, 0}, {"tlscacertificatefile", store_dir, ITEM(dir_res.tls_ca_certfile), 0, 0, 0}, {"tlscacertificatedir", store_dir, ITEM(dir_res.tls_ca_certdir), 0, 0, 0}, {"tlscertificate", store_dir, ITEM(dir_res.tls_certfile), 0, 0, 0}, @@ -96,8 +96,8 @@ static RES_ITEM con_items[] = { {"name", store_name, ITEM(con_res.hdr.name), 0, ITEM_REQUIRED, 0}, {"description", store_str, ITEM(con_res.hdr.desc), 0, 0, 0}, {"password", store_password, ITEM(con_res.password), 0, ITEM_REQUIRED, 0}, - {"tlsenable", store_bit, ITEM(con_res.tls_enable), 1, 0, 0}, - {"tlsrequire", store_bit, ITEM(con_res.tls_require), 1, 0, 0}, + {"tlsenable", store_bool, ITEM(con_res.tls_enable), 1, 0, 0}, + {"tlsrequire", store_bool, ITEM(con_res.tls_require), 1, 0, 0}, {"tlscacertificatefile", store_dir, ITEM(con_res.tls_ca_certfile), 0, 0, 0}, {"tlscacertificatedir", store_dir, ITEM(con_res.tls_ca_certdir), 0, 0, 0}, {"tlscertificate", store_dir, ITEM(con_res.tls_certfile), 0, 0, 0}, diff --git a/bacula/src/qt-console/bat_conf.h b/bacula/src/qt-console/bat_conf.h index e0e96d7d31..2ccf768063 100644 --- a/bacula/src/qt-console/bat_conf.h +++ b/bacula/src/qt-console/bat_conf.h @@ -67,8 +67,8 @@ public: int DIRport; /* UA server port */ char *address; /* UA server address */ char *password; /* UA server password */ - int tls_enable; /* Enable TLS */ - int tls_require; /* Require TLS */ + bool tls_enable; /* Enable TLS */ + bool tls_require; /* Require TLS */ char *tls_ca_certfile; /* TLS CA Certificate File */ char *tls_ca_certdir; /* TLS CA Certificate Directory */ char *tls_certfile; /* TLS Client Certificate File */ @@ -93,8 +93,8 @@ class CONRES { public: RES hdr; char *password; /* UA server password */ - int tls_enable; /* Enable TLS on all connections */ - int tls_require; /* Require TLS on all connections */ + bool tls_enable; /* Enable TLS on all connections */ + bool tls_require; /* Require TLS on all connections */ char *tls_ca_certfile; /* TLS CA Certificate File */ char *tls_ca_certdir; /* TLS CA Certificate Directory */ char *tls_certfile; /* TLS Client Certificate File */ diff --git a/bacula/src/qt-console/console/console.cpp b/bacula/src/qt-console/console/console.cpp index 3e5fdc5cc9..3d3937d160 100644 --- a/bacula/src/qt-console/console/console.cpp +++ b/bacula/src/qt-console/console/console.cpp @@ -128,8 +128,8 @@ void Console::connect() CONRES *cons = (CONRES *)GetNextRes(R_CONSOLE, NULL); UnlockRes(); - /* Initialize Console TLS context */ - if (cons && (cons->tls_enable || cons->tls_require)) { + /* Initialize Console TLS context once */ + if (cons && !cons->tls_ctx && (cons->tls_enable || cons->tls_require)) { /* Generate passphrase prompt */ bsnprintf(buf, sizeof(buf), "Passphrase for Console \"%s\" TLS private key: ", cons->name()); @@ -149,8 +149,8 @@ void Console::connect() } } - /* Initialize Director TLS context */ - if (m_dir->tls_enable || m_dir->tls_require) { + /* Initialize Director TLS context once */ + if (!m_dir->tls_ctx && (m_dir->tls_enable || m_dir->tls_require)) { /* Generate passphrase prompt */ bsnprintf(buf, sizeof(buf), "Passphrase for Director \"%s\" TLS private key: ", m_dir->name()); @@ -622,7 +622,7 @@ int Console::read() if (mainWin->m_commDebug) Pmsg0(000, "MAIN PROMPT\n"); m_at_prompt = true; m_at_main_prompt = true; - mainWin->set_status(_("At prompt waiting for input ...")); + mainWin->set_status(_("At main prompt waiting for input ...")); QApplication::restoreOverrideCursor(); break; case BNET_PROMPT: @@ -634,7 +634,7 @@ int Console::read() break; case BNET_CMD_FAILED: if (mainWin->m_commDebug) Pmsg0(000, "CMD FAILED\n"); - mainWin->set_status(_("Command failed. At prompt waiting for input ...")); + mainWin->set_status(_("Command failed.")); QApplication::restoreOverrideCursor(); break; /* We should not get this one */ diff --git a/bacula/src/qt-console/console/console.h b/bacula/src/qt-console/console/console.h index 51a8e204f7..f5a553e879 100644 --- a/bacula/src/qt-console/console/console.h +++ b/bacula/src/qt-console/console/console.h @@ -123,9 +123,11 @@ public slots: void set_font(void); void poll_messages(void); +public: + DIRRES *m_dir; /* so various pages can reference it */ + private: QTextEdit *m_textEdit; - DIRRES *m_dir; BSOCK *m_sock; bool m_at_prompt; bool m_at_main_prompt; diff --git a/bacula/src/qt-console/fileset/fileset.cpp b/bacula/src/qt-console/fileset/fileset.cpp index 70ff0d92cc..32fd4c4e96 100644 --- a/bacula/src/qt-console/fileset/fileset.cpp +++ b/bacula/src/qt-console/fileset/fileset.cpp @@ -216,3 +216,25 @@ void FileSet::currentStackItem() m_populated=true; } } + +/* + * Save user settings associated with this page + */ +void FileSet::writeSettings() +{ + QSettings settings(m_console->m_dir->name(), "bat"); + settings.beginGroup("FileSet"); + settings.setValue("geometry", saveGeometry()); + settings.endGroup(); +} + +/* + * Read and restore user settings associated with this page + */ +void FileSet::readSettings() +{ + QSettings settings(m_console->m_dir->name(), "bat"); + settings.beginGroup("FileSet"); + restoreGeometry(settings.value("geometry").toByteArray()); + settings.endGroup(); +} diff --git a/bacula/src/qt-console/fileset/fileset.h b/bacula/src/qt-console/fileset/fileset.h index f219b855fa..0b0a9b2010 100644 --- a/bacula/src/qt-console/fileset/fileset.h +++ b/bacula/src/qt-console/fileset/fileset.h @@ -45,6 +45,8 @@ class FileSet : public Pages, public Ui::FileSetForm public: FileSet(); ~FileSet(); + void writeSettings(); + void readSettings(); virtual void PgSeltreeWidgetClicked(); virtual void currentStackItem(); diff --git a/bacula/src/qt-console/mainwin.cpp b/bacula/src/qt-console/mainwin.cpp index fb11e81a6d..d2201fb86e 100644 --- a/bacula/src/qt-console/mainwin.cpp +++ b/bacula/src/qt-console/mainwin.cpp @@ -301,6 +301,7 @@ void MainWin::writeSettings() settings.beginGroup("MainWin"); settings.setValue("winSize", size()); settings.setValue("winPos", pos()); + settings.setValue("state", saveState()); settings.endGroup(); } @@ -311,6 +312,7 @@ void MainWin::readSettings() settings.beginGroup("MainWin"); resize(settings.value("winSize", QSize(1041, 801)).toSize()); move(settings.value("winPos", QPoint(200, 150)).toPoint()); + restoreState(settings.value("state").toByteArray()); settings.endGroup(); }