Skip to content

Commit

Permalink
Merge pull request #19 from boxbackup/bbstored_certs
Browse files Browse the repository at this point in the history
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!
  • Loading branch information
qris authored Oct 17, 2017
2 parents b1f5642 + a631c82 commit 24aca3f
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 36 deletions.
2 changes: 1 addition & 1 deletion bin/bbstored/bbstored-certs.in
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 0 additions & 2 deletions lib/bbackupd/BackupDaemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 0 additions & 24 deletions lib/common/Timer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,26 +120,6 @@ void Timers::Cleanup(bool throw_exception_if_not_initialised)
spTimers = NULL;
}

// --------------------------------------------------------------------------
//
// 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
Expand All @@ -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();
Expand All @@ -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 "
Expand Down Expand Up @@ -343,7 +320,6 @@ void Timers::Reschedule()
// --------------------------------------------------------------------------
void Timers::SignalHandler(int unused)
{
// ASSERT(spTimers);
Timers::RequestReschedule();
}

Expand Down
1 change: 0 additions & 1 deletion lib/common/Timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
10 changes: 2 additions & 8 deletions test/common/testcommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 24aca3f

Please sign in to comment.