summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <qris@users.noreply.github.com>2017-10-17 20:03:13 +0100
committerGitHub <noreply@github.com>2017-10-17 20:03:13 +0100
commit24aca3fc618e36e2feb448bd7b5c05b31a064bd3 (patch)
treeb0ae4a2304e386aef4ef031b9d565116e0fa7f02
parentb1f564266c64b48b99cce410e33d8287bf444d2a (diff)
parenta631c82882b039f8467a2ef9abeb343f2ec5b3da (diff)
Merge pull request #19 from boxbackup/bbstored_certs
Fix parsing of OpenSSL 1.1 output in bbstored-certs. Fixes #18. Thanks to Dean Hamstead (@djzort on GitHub) for the bug report and the patch!
-rwxr-xr-xbin/bbstored/bbstored-certs.in2
-rw-r--r--lib/bbackupd/BackupDaemon.cpp2
-rw-r--r--lib/common/Timer.cpp24
-rw-r--r--lib/common/Timer.h1
-rw-r--r--test/common/testcommon.cpp10
5 files changed, 3 insertions, 36 deletions
diff --git a/bin/bbstored/bbstored-certs.in b/bin/bbstored/bbstored-certs.in
index 85560748..00085662 100755
--- a/bin/bbstored/bbstored-certs.in
+++ b/bin/bbstored/bbstored-certs.in
@@ -288,7 +288,7 @@ sub get_csr_common_name
my $subject;
while(<CSRTEXT>)
{
- $subject = $1 if m/Subject:.+?CN=([-\.\w]+)/
+ $subject = $1 if m/Subject:.+?CN\s?=\s?([-\.\w]+)/;
}
close CSRTEXT;
diff --git a/lib/bbackupd/BackupDaemon.cpp b/lib/bbackupd/BackupDaemon.cpp
index 3427a722..996c1919 100644
--- a/lib/bbackupd/BackupDaemon.cpp
+++ b/lib/bbackupd/BackupDaemon.cpp
@@ -922,8 +922,6 @@ std::auto_ptr<BackupClientContext> BackupDaemon::GetNewContext
// it, let it be destroyed and close the connection.
std::auto_ptr<BackupClientContext> BackupDaemon::RunSyncNow()
{
- Timers::AssertInitialised();
-
// Delete the serialised store object file,
// so that we don't try to reload it after a
// partially completed backup
diff --git a/lib/common/Timer.cpp b/lib/common/Timer.cpp
index 6ce84b7d..4f8c989e 100644
--- a/lib/common/Timer.cpp
+++ b/lib/common/Timer.cpp
@@ -123,26 +123,6 @@ void Timers::Cleanup(bool throw_exception_if_not_initialised)
// --------------------------------------------------------------------------
//
// Function
-// Name: static void Timers::AssertInitialised()
-// Purpose: Throw an assertion error if timers are not ready
-// NOW. It's a common mistake (for me) when writing
-// tests to forget to initialise timers first.
-// Created: 15/05/2014
-//
-// --------------------------------------------------------------------------
-
-void Timers::AssertInitialised()
-{
- if (!spTimers)
- {
- THROW_EXCEPTION(CommonException, TimersNotInitialised);
- }
- ASSERT(spTimers);
-}
-
-// --------------------------------------------------------------------------
-//
-// Function
// Name: static void Timers::Add(Timer&)
// Purpose: Add a new timer to the set, and reschedule next wakeup
// Created: 5/11/2006
@@ -151,7 +131,6 @@ void Timers::AssertInitialised()
void Timers::Add(Timer& rTimer)
{
ASSERT(spTimers);
- ASSERT(&rTimer);
BOX_TRACE(TIMER_ID_OF(rTimer) " added to global queue, rescheduling");
spTimers->push_back(&rTimer);
Reschedule();
@@ -168,8 +147,6 @@ void Timers::Add(Timer& rTimer)
// --------------------------------------------------------------------------
void Timers::Remove(Timer& rTimer)
{
- ASSERT(&rTimer);
-
if(!spTimers)
{
BOX_WARNING(TIMER_ID_OF(rTimer) " was still active after "
@@ -343,7 +320,6 @@ void Timers::Reschedule()
// --------------------------------------------------------------------------
void Timers::SignalHandler(int unused)
{
- // ASSERT(spTimers);
Timers::RequestReschedule();
}
diff --git a/lib/common/Timer.h b/lib/common/Timer.h
index 68592aaa..17233203 100644
--- a/lib/common/Timer.h
+++ b/lib/common/Timer.h
@@ -44,7 +44,6 @@ class Timers
public:
static void Init();
static void Cleanup(bool throw_exception_if_not_initialised = true);
- static void AssertInitialised();
static void Add (Timer& rTimer);
static void Remove(Timer& rTimer);
static void RequestReschedule();
diff --git a/test/common/testcommon.cpp b/test/common/testcommon.cpp
index bd75ac37..bcfc92e1 100644
--- a/test/common/testcommon.cpp
+++ b/test/common/testcommon.cpp
@@ -312,14 +312,8 @@ int test(int argc, const char *argv[])
// Check that using timer methods without initialisation
// throws an assertion failure. Can only do this in debug mode
#ifndef BOX_RELEASE_BUILD
- TEST_CHECK_THROWS(Timers::Add(*(Timer*)NULL),
- CommonException, AssertFailed);
- TEST_CHECK_THROWS(Timers::Remove(*(Timer*)NULL),
- CommonException, AssertFailed);
- #endif
-
- // TEST_CHECK_THROWS(Timers::Signal(), CommonException, AssertFailed);
- #ifndef BOX_RELEASE_BUILD
+ TEST_CHECK_THROWS(Timer t1(900, "t1"), CommonException,
+ AssertFailed);
TEST_CHECK_THROWS(Timers::Cleanup(), CommonException,
AssertFailed);
#endif