...
 
Commits (7)
Box Backup, http://www.boxbackup.org/
Copyright (c) 2003-2015, Ben Summers and contributors.
All rights reserved.
The license of the code was changed on 23-Jan-2010 in order to meet the
Fedora Project's definition of Free Software, and therefore allow inclusion
in Fedora, Red Hat Linux and CentOS. This also solves a long-standing
incompatibility with the GNU Readline library that prevented us from
distributing Box Backup binaries compiled against that library. You can
review our discussions of the change in the mailing list archives at:
http://lists.boxbackup.org/pipermail/boxbackup/2010-January/000005.html
Note that this project uses mixed licensing. Different parts of the project
may be used and distributed under different licenses, as described below.
The two licenses used are "Box Backup GPL" and a BSD-style license.
For full details of the license, please read the included COPYING.txt file.
Unless stated otherwise in the file, all files in the following directories
fall under the "Box Backup GPL" license, described below:
bin/bbackupctl
bin/bbackupd
bin/bbackupobjdump
bin/bbackupquery
bin/bbstoreaccounts
bin/bbstored
bin/s3simulator
lib/backupclient
lib/backupstore
test/backupdiff
test/backupstore
test/backupstorefix
test/backupstorepatch
test/bbackupd
contrib/bbadmin
contrib/bbreporter
contrib/cygwin
contrib/debian
contrib/mac_osx
contrib/redhat
contrib/rpm
contrib/solaris
contrib/suse
contrib/windows
distribution/boxbackup
The "Box Backup GPL" license text may be found in the file
LICENSE-GPL.txt, or online at:
[https://www.boxbackup.org/svn/box/trunk/LICENSE-GPL.txt]
Unless stated otherwise in the file, all files in the following directories
are dual licensed under the BSD and GPL licenses. You may use and distribute
them providing that you comply EITHER with the terms of the BSD license,
OR the GPL license. It is not necessary to comply with both licenses,
only one.
lib/common
lib/compress
lib/crypto
lib/httpserver
lib/intercept
lib/raidfile
lib/server
lib/win32
test/basicserver
test/common
test/compress
test/crypto
test/httpserver
test/raidfile
test/win32
infrastructure
distribution
The dual license text may be found in the file
LICENSE-DUAL.txt, or online at:
[https://www.boxbackup.org/svn/box/trunk/LICENSE-DUAL.txt]
Box Backup, http://www.boxbackup.org/
Copyright (c) 2003-2015, Ben Summers and contributors.
All rights reserved.
The license of the code was changed on 23-Jan-2010 in order to meet the
Fedora Project's definition of Free Software, and therefore allow inclusion
in Fedora, Red Hat Linux and CentOS. This also solves a long-standing
incompatibility with the GNU Readline library that prevented us from
distributing Box Backup binaries compiled against that library. You can
review our discussions of the change in the mailing list archives at:
http://lists.boxbackup.org/pipermail/boxbackup/2010-January/000005.html
Note that this project uses mixed licensing. Different parts of the project
may be used and distributed under different licenses, as described below.
The two licenses used are "Box Backup GPL" and a BSD-style license.
For full details of the license, please read the included COPYING.txt file.
Unless stated otherwise in the file, all files in the following directories
fall under the "Box Backup GPL" license, described below:
bin/bbackupctl
bin/bbackupd
bin/bbackupobjdump
bin/bbackupquery
bin/bbstoreaccounts
bin/bbstored
bin/s3simulator
lib/backupclient
lib/backupstore
test/backupdiff
test/backupstore
test/backupstorefix
test/backupstorepatch
test/bbackupd
contrib/bbadmin
contrib/bbreporter
contrib/cygwin
contrib/debian
contrib/mac_osx
contrib/redhat
contrib/rpm
contrib/solaris
contrib/suse
contrib/windows
distribution/boxbackup
The "Box Backup GPL" license text may be found in the file
LICENSE-GPL.txt, or online at:
[https://www.boxbackup.org/svn/box/trunk/LICENSE-GPL.txt]
Unless stated otherwise in the file, all files in the following directories
are dual licensed under the BSD and GPL licenses. You may use and distribute
them providing that you comply EITHER with the terms of the BSD license,
OR the GPL license. It is not necessary to comply with both licenses,
only one.
lib/common
lib/compress
lib/crypto
lib/httpserver
lib/intercept
lib/raidfile
lib/server
lib/win32
test/basicserver
test/common
test/compress
test/crypto
test/httpserver
test/raidfile
test/win32
infrastructure
distribution
The dual license text may be found in the file
LICENSE-DUAL.txt, or online at:
[https://www.boxbackup.org/svn/box/trunk/LICENSE-DUAL.txt]
......@@ -169,7 +169,7 @@ if(!-f $private_key)
if(!-f $certificate_request)
{
die "Couldn't run openssl for CSR generation" unless
open(CSR,"|openssl req -new -key $private_key -sha1 -out $certificate_request");
open(CSR,"|openssl req -new -key $private_key -sha256 -out $certificate_request");
print CSR <<__E;
.
.
......@@ -317,6 +317,21 @@ NotifyScript = $notify_script
__E
if("@HAVE_SSL_CTX_SET_SECURITY_LEVEL@" eq "1")
{
print CONFIG <<__E;
# Box Backup compiled with support for SSLSecurityLevel
SSLSecurityLevel = 2
__E
}
else
{
print CONFIG <<__E;
# Box Backup compiled without support for SSLSecurityLevel
# SSLSecurityLevel = 2
__E
}
if($backup_mode eq 'lazy')
{
# lazy mode configuration
......
......@@ -364,7 +364,9 @@ int main(int argc, const char *argv[])
std::string certFile(conf.GetKeyValue("CertificateFile"));
std::string keyFile(conf.GetKeyValue("PrivateKeyFile"));
std::string caFile(conf.GetKeyValue("TrustedCAsFile"));
tlsContext.Initialise(false /* as client */, certFile.c_str(), keyFile.c_str(), caFile.c_str());
int ssl_security_level(conf.GetKeyValueInt("SSLSecurityLevel"));
tlsContext.Initialise(false /* as client */, certFile.c_str(), keyFile.c_str(),
caFile.c_str(), ssl_security_level);
// Initialise keys
BackupClientCryptoKeys_Setup(conf.GetKeyValue("KeysFile").c_str());
......
......@@ -122,7 +122,7 @@ sub cmd_init_create_root
# make CSR
die "Couldn't run openssl for CSR generation" unless
open(CSR,"|openssl req -new -key $key -sha1 -out $csr");
open(CSR,"|openssl req -new -key $key -sha256 -out $csr");
print CSR <<__E;
.
.
......@@ -140,7 +140,7 @@ __E
die "Certificate request wasn't created.\n" unless -f $csr;
# sign it to make a self-signed root CA key
if(system("openssl x509 -req -in $csr -sha1 -extensions v3_ca -signkey $key -out $cert -days $root_sign_period") != 0)
if(system("openssl x509 -req -in $csr -sha256 -extensions v3_ca -signkey $key -out $cert -days $root_sign_period") != 0)
{
die "Couldn't generate root certificate."
}
......@@ -201,7 +201,7 @@ __E
my $out_cert = "$cert_dir/clients/$acc"."-cert.pem";
# sign it!
if(system("openssl x509 -req -in $csr -sha1 -extensions usr_crt -CA $cert_dir/roots/clientCA.pem -CAkey $cert_dir/keys/clientRootKey.pem -out $out_cert -days $sign_period") != 0)
if(system("openssl x509 -req -in $csr -sha256 -extensions usr_crt -CA $cert_dir/roots/clientCA.pem -CAkey $cert_dir/keys/clientRootKey.pem -out $out_cert -days $sign_period") != 0)
{
die "Signing failed"
}
......@@ -257,7 +257,7 @@ __E
my $out_cert = "$cert_dir/servers/$common_name"."-cert.pem";
# sign it!
if(system("openssl x509 -req -in $csr -sha1 -extensions usr_crt -CA $cert_dir/roots/serverCA.pem -CAkey $cert_dir/keys/serverRootKey.pem -out $out_cert -days $sign_period") != 0)
if(system("openssl x509 -req -in $csr -sha256 -extensions usr_crt -CA $cert_dir/roots/serverCA.pem -CAkey $cert_dir/keys/serverRootKey.pem -out $out_cert -days $sign_period") != 0)
{
die "Signing failed"
}
......
......@@ -202,11 +202,24 @@ Server
CertificateFile = $certificate
PrivateKeyFile = $private_key
TrustedCAsFile = $ca_root_cert
}
__E
if("@HAVE_SSL_CTX_SET_SECURITY_LEVEL@" eq "1")
{
print CONFIG <<__E;
# Box Backup compiled with support for SSLSecurityLevel
SSLSecurityLevel = 2
__E
}
else
{
print CONFIG <<__E;
# Box Backup compiled without support for SSLSecurityLevel
# SSLSecurityLevel = 2
__E
}
print CONFIG "}\n";
close CONFIG;
# explain to the user what they need to do next
......
service.exe -i -S GigaLock
echo off
ping 192.168.254.254 -n 5 -w 1000 > nul
service.exe -i -S GigaLock
echo off
ping 192.168.254.254 -n 5 -w 1000 > nul
control.exe terminate
echo off
ping 192.168.254.254 -n 5 -w 1000 > nul
control.exe terminate
echo off
ping 192.168.254.254 -n 5 -w 1000 > nul
@ECHO OFF
: o=old, d=deleted, s=size info, t=timestamp, r=recursive
set Queryopts=-odstr
::set Queryopts=-str
query.exe "list %Queryopts%" quit > QueryOutputAllResults.txt
@ECHO OFF
: o=old, d=deleted, s=size info, t=timestamp, r=recursive
set Queryopts=-odstr
::set Queryopts=-str
query.exe "list %Queryopts%" quit > QueryOutputAllResults.txt
@ECHO OFF
: o=old, d=deleted, s=size info, t=timestamp, r=recursive
::set Queryopts=-odstr
set Queryopts=-str
query.exe "list %Queryopts%" quit > QueryOutputCurrentResults.txt
@ECHO OFF
: o=old, d=deleted, s=size info, t=timestamp, r=recursive
::set Queryopts=-odstr
set Queryopts=-str
query.exe "list %Queryopts%" quit > QueryOutputCurrentResults.txt
control.exe reload
echo off
ping 192.168.254.254 -n 8 -w 1000 > nul
control.exe reload
echo off
ping 192.168.254.254 -n 8 -w 1000 > nul
@@SERVICEEXENAME@ -r -S GigaLock
echo off
ping 192.168.254.254 -n 5 -w 1000 > nul
@@SERVICEEXENAME@ -r -S GigaLock
echo off
ping 192.168.254.254 -n 5 -w 1000 > nul
net stop GigaLock
ping 192.168.254.254 -n 2 -w 1000 > nul
net start GigaLock
echo off
ping 192.168.254.254 -n 5 -w 1000 > nul
net stop GigaLock
ping 192.168.254.254 -n 2 -w 1000 > nul
net start GigaLock
echo off
ping 192.168.254.254 -n 5 -w 1000 > nul
query.exe usage quit
ping 192.168.254.254 -n 10 -w 1000 > nul
query.exe usage quit
ping 192.168.254.254 -n 10 -w 1000 > nul
net start GigaLock
echo off
ping 192.168.254.254 -n 5 -w 1000 > nul
net start GigaLock
echo off
ping 192.168.254.254 -n 5 -w 1000 > nul
net stop GigaLock
echo off
ping 192.168.254.254 -n 5 -w 1000 > nul
net stop GigaLock
echo off
ping 192.168.254.254 -n 5 -w 1000 > nul
control.exe sync
echo off
ping 192.168.254.254 -n 5 -w 1000 > nul
control.exe sync
echo off
ping 192.168.254.254 -n 5 -w 1000 > nul
boxbackup (0.13~~git20190527.g039c4a1-1) experimental; urgency=medium
* Taken from upstream commit 55aacf51d83c28d1046dcde84df6dc18cee808af:
Fix Debian bug 907135: weak certificates
Debian Linux have recently upgraded to OpenSSL 1.1.1, which has
increased the default global security level from 1 to 2. Level 2 does
not accept certificates with 1024-bit keys, and certificates signed
with the SHA1 algorithm, considering them to be weak and therefore
dangerous. It now requires a minimum of 2048-bit keys and SHA256
signatures. (At the time of writing, this change is only in Debian
Unstable, but it will eventually make its way into a stable release.)
This has caused the following issues with Box Backup:
* All existing certificates are signed with the SHA1 algorithm, and
can no longer be used (by default); and
* Some tests use 1024-bit certificates which can no longer be used
either.
This change implements the workarounds to enable users to continue to
use old certificates, for the time being, with a warning:
* Ensure that new installations are secure (stronger certificates
generated and required);
* Ensure that existing installations are not broken, even if they are
considered "weak";
* Warn users if their certificates are (or might be) weak;
* Allow them to disable this warning if required (not recommended);
* Provide the option to not override the system-wide security level
(which may be higher than 2 in future).
It does this by adding the new SSLSecurityLevel configuration option,
fixing the supplied scripts to generate stronger SSL certificates from
now on, replacing the old certificates used in tests, and adding tests
for the issue. If compiled with OpenSSL 1.0, existing behaviour will
not change, and the security level cannot be raised. The
SSLSecurityLevel option is recognised, but has no effect except to
show a warning that it is not supported.
More work could be done on making it easier to regenerate
certificates, however some discussion is needed to come up with a plan
that works and helps users.
See https://github.com/boxbackup/boxbackup/wiki/WeakSSLCertificates for more details.
-- Reinhard Tartler <siretart@tauware.de> Mon, 27 May 2019 18:19:12 -0400
boxbackup (0.11~rc2+r2072-1) unstable; urgency=low
* The upstream parts of this file have been renamed to a new file called
......
boxbackup (0.13~~git20190527.g039c4a1-1) experimental; urgency=medium
* QA upload.
* Update to new upstream version 0.13~~git20190527.g039c4a1 Requested by
upstream, now uses 2048bit keys by default. Keys generated with
earlier versions are considered "weak" and generate a warning for now.
(Closes: #907135)
-- Reinhard Tartler <siretart@tauware.de> Mon, 27 May 2019 18:40:14 -0400
boxbackup (0.13~~git20180819.g2f5b556-1) unstable; urgency=medium
* New upstream pre-release
......@@ -121,7 +131,7 @@ boxbackup (0.11~rc8~r2714-1) unstable; urgency=low
* New Upstream fixes Bug: "boxbackup-client complains about
/home/*/.gvfs", thanks for reporting to Sune Mølgaard.
Closes: #593401, LP: #496334
* Enhancement: "Please use newer bdb", thanks to Clint Adams
* Enhancement: "Please use newer bdb", thanks to Clint Adams
Closes: #548475
* bin/bbstored/bbstored-certs: reduce root CA expiration date to avoid
Y2k38 overflow. Thanks to Clint Adams <schizo@debian.org> for
......@@ -148,7 +158,7 @@ boxbackup (0.11~rc3~r2502-3) unstable; urgency=low
boxbackup (0.11~rc3~r2502-2.1ubuntu1) maverick; urgency=low
* fix install paths for armel (LP: #616461)
* fix install paths for armel (LP: #616461)
-- David Sugar <david.sugar@canonical.com> Mon, 16 Aug 2010 23:49:22 +0200
......@@ -168,9 +178,9 @@ boxbackup (0.11~rc3~r2502-2) unstable; urgency=low
* Bug fix: "tries to contact a server build-time", thanks to
Riku Voipio for reporting. Fix based on a patch contributed
by peter green, thanks as well! (Closes: #525277).
* Bug fix: "missing #include", thanks to Martin Michlmayr
* Bug fix: "missing #include", thanks to Martin Michlmayr
(Closes: #526152, LP: #371809)
-- Reinhard Tartler <siretart@tauware.de> Tue, 05 May 2009 07:42:40 +0200
boxbackup (0.11~rc3~r2502-1) unstable; urgency=low
......@@ -320,7 +330,7 @@ boxbackup (0.10+really0.10-1.2) unstable; urgency=low
boxbackup (0.10+really0.10-1.1) unstable; urgency=low
* Non-maintainer upload.
* iFix LSB header in init.d script (Closes: #470060).
* iFix LSB header in init.d script (Closes: #470060).
-- Amaya Rodrigo Sastre <amaya@debian.org> Mon, 31 Mar 2008 18:43:40 +0200
......@@ -342,7 +352,7 @@ boxbackup (0.10+really0.10-1ubuntu2) hardy; urgency=low
boxbackup (0.10+really0.10-1ubuntu1) hardy; urgency=low
* Rebuild for libdb4.3 -> libdb4.6 migration.
* Rebuild for libdb4.3 -> libdb4.6 migration.
* Set MOTU to maintainer.
-- Chuck Short <zulcss@ubuntu.com> Mon, 03 Mar 2008 12:37:35 -0500
......
change default syslog facility from LOG_LOCAL6 to LOG_DAEMON
From: Reinhard Tartler <siretart@tauware.de>
Date: Tue, 31 Mar 2009 21:43:58 +0200
Subject: change default syslog facility from LOG_LOCAL6 to LOG_DAEMON
--- a/lib/common/Logging.cpp
+++ b/lib/common/Logging.cpp
@@ -411,7 +411,7 @@ bool Syslog::Log(Log::Level level, const
return true;
}
-Syslog::Syslog() : mFacility(LOG_LOCAL6)
+Syslog::Syslog() : mFacility(LOG_DAEMON)
{
::openlog("Box Backup", LOG_PID, mFacility);
}
@@ -454,8 +454,8 @@ int Syslog::GetNamedFacility(const std::
#undef CASE_RETURN
BOX_ERROR("Unknown log facility '" << rFacility << "', "
- "using default LOCAL6");
- return LOG_LOCAL6;
+ "using default DAEMON");
+ return LOG_DAEMON;
}
bool FileLogger::Log(Log::Level Level, const std::string& file, int line,
---
docs/docbook/adminguide.xml | 6 ++++++
lib/bbstored/BackupStoreDaemon.cpp | 2 +-
lib/common/Logging.cpp | 6 +++---
3 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/docs/docbook/adminguide.xml b/docs/docbook/adminguide.xml
index edb0a58..440c7d4 100644
--- a/docs/docbook/adminguide.xml
+++ b/docs/docbook/adminguide.xml
@@ -286,6 +286,12 @@ local5.info /var
@@ -286,6 +286,12 @@ local5.info /var/log/raidfile</programlisting>
<para><emphasis role="bold">Note:</emphasis> Separators must be tabs,
otherwise these entries will be ignored.</para>
......@@ -37,6 +25,8 @@ change default syslog facility from LOG_LOCAL6 to LOG_DAEMON
<programlisting>touch /var/log/box
touch /var/log/raidfile</programlisting>
diff --git a/lib/bbstored/BackupStoreDaemon.cpp b/lib/bbstored/BackupStoreDaemon.cpp
index 8fddf12..37b0a6f 100644
--- a/lib/bbstored/BackupStoreDaemon.cpp
+++ b/lib/bbstored/BackupStoreDaemon.cpp
@@ -203,7 +203,7 @@ void BackupStoreDaemon::Run()
......@@ -48,3 +38,27 @@ change default syslog facility from LOG_LOCAL6 to LOG_DAEMON
// Log that housekeeping started
BOX_INFO("Housekeeping process started");
// Ignore term and hup
diff --git a/lib/common/Logging.cpp b/lib/common/Logging.cpp
index 0928a4d..1cff176 100644
--- a/lib/common/Logging.cpp
+++ b/lib/common/Logging.cpp
@@ -411,7 +411,7 @@ bool Syslog::Log(Log::Level level, const std::string& file, int line,
return true;
}
-Syslog::Syslog() : mFacility(LOG_LOCAL6)
+Syslog::Syslog() : mFacility(LOG_DAEMON)
{
::openlog("Box Backup", LOG_PID, mFacility);
}
@@ -454,8 +454,8 @@ int Syslog::GetNamedFacility(const std::string& rFacility)
#undef CASE_RETURN
BOX_ERROR("Unknown log facility '" << rFacility << "', "
- "using default LOCAL6");
- return LOG_LOCAL6;
+ "using default DAEMON");
+ return LOG_DAEMON;
}
bool FileLogger::Log(Log::Level Level, const std::string& file, int line,
From: Reinhard Tartler <siretart@tauware.de>
Date: Tue, 5 May 2009 07:34:03 +0200
Subject: prevent xsltproc from accessing the internet
Forwarded: no
=== modified file 'docs/Makefile'
--- a/docs/Makefile
+++ b/docs/Makefile
@@ -10,7 +10,7 @@
all: docs
-DBPROC_COMMAND = xsltproc
+DBPROC_COMMAND = xsltproc --nonet
MKDIR_COMMAND = mkdir
......
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:hl="java:net.sf.xslthl.ConnectorSaxon6"
xmlns:exsl="http://exslt.org/common"
exclude-result-prefixes="exsl hl"
version='1.0'>
<!-- ********************************************************************
$Id: common.xsl 7266 2007-08-22 11:58:42Z xmldoc $
********************************************************************
This file is part of the XSL DocBook Stylesheet distribution.
See ../README or http://docbook.sf.net/release/xsl/current/ for
and other information.
******************************************************************** -->
<!-- You can override this template to do more complex mapping of
language attribute to highlighter language ID (see xslthl-config.xml) -->
<xsl:template name="language.to.xslthl">
<xsl:param name="context"/>
<xsl:choose>
<xsl:when test="$context/@language != ''">
<xsl:value-of select="$context/@language"/>
</xsl:when>
<xsl:when test="$highlight.default.language != ''">
<xsl:value-of select="$highlight.default.language"/>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template name="apply-highlighting">
<xsl:choose>
<!-- Do we want syntax highlighting -->
<xsl:when test="$highlight.source != 0 and function-available('hl:highlight')">
<xsl:variable name="language">
<xsl:call-template name="language.to.xslthl">
<xsl:with-param name="context" select="."/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="$language != ''">
<xsl:variable name="content">
<xsl:apply-templates/>
</xsl:variable>
<xsl:apply-templates select="hl:highlight($language, exsl:node-set($content))"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<!-- No syntax highlighting -->
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:hl="java:net.sf.xslthl.ConnectorSaxon6"
xmlns:exsl="http://exslt.org/common"
exclude-result-prefixes="exsl hl"
version='1.0'>
<!-- ********************************************************************
$Id: common.xsl 7266 2007-08-22 11:58:42Z xmldoc $
********************************************************************
This file is part of the XSL DocBook Stylesheet distribution.
See ../README or http://docbook.sf.net/release/xsl/current/ for
and other information.
******************************************************************** -->
<!-- You can override this template to do more complex mapping of
language attribute to highlighter language ID (see xslthl-config.xml) -->
<xsl:template name="language.to.xslthl">
<xsl:param name="context"/>
<xsl:choose>
<xsl:when test="$context/@language != ''">
<xsl:value-of select="$context/@language"/>
</xsl:when>
<xsl:when test="$highlight.default.language != ''">
<xsl:value-of select="$highlight.default.language"/>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template name="apply-highlighting">
<xsl:choose>
<!-- Do we want syntax highlighting -->
<xsl:when test="$highlight.source != 0 and function-available('hl:highlight')">
<xsl:variable name="language">
<xsl:call-template name="language.to.xslthl">
<xsl:with-param name="context" select="."/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="$language != ''">
<xsl:variable name="content">
<xsl:apply-templates/>
</xsl:variable>
<xsl:apply-templates select="hl:highlight($language, exsl:node-set($content))"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<!-- No syntax highlighting -->
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
<?xml version='1.0'?>
<xslthl-config>
<highlighter id='java' file='./java-hl.xml' />
<highlighter id='delphi' file='./delphi-hl.xml'/>
<highlighter id='ini' file='./ini-hl.xml' />
<highlighter id='php' file='./php-hl.xml' />
<highlighter id='myxml' file='./myxml-hl.xml' />
<highlighter id='m2' file='./m2-hl.xml' />
<highlighter id='c' file='./c-hl.xml' />
<namespace prefix="xslthl" uri="http://xslthl.sf.net" />
</xslthl-config>
<?xml version='1.0'?>
<xslthl-config>
<highlighter id='java' file='./java-hl.xml' />
<highlighter id='delphi' file='./delphi-hl.xml'/>
<highlighter id='ini' file='./ini-hl.xml' />
<highlighter id='php' file='./php-hl.xml' />
<highlighter id='myxml' file='./myxml-hl.xml' />
<highlighter id='m2' file='./m2-hl.xml' />
<highlighter id='c' file='./c-hl.xml' />
<namespace prefix="xslthl" uri="http://xslthl.sf.net" />
</xslthl-config>
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xslthl="http://xslthl.sf.net"
exclude-result-prefixes="xslthl"
version='1.0'>
<!-- ********************************************************************
$Id: highlight.xsl 7266 2007-08-22 11:58:42Z xmldoc $
********************************************************************
This file is part of the XSL DocBook Stylesheet distribution.
See ../README or http://docbook.sf.net/release/xsl/current/ for
and other information.
******************************************************************** -->
<xsl:template match='xslthl:keyword'>
<b class="hl-keyword"><xsl:apply-templates/></b>
</xsl:template>
<xsl:template match='xslthl:string'>
<b class="hl-string"><i style="color:red"><xsl:apply-templates/></i></b>
</xsl:template>
<xsl:template match='xslthl:comment'>
<i class="hl-comment" style="color: silver"><xsl:apply-templates/></i>
</xsl:template>
<xsl:template match='xslthl:tag'>
<b class="hl-tag" style="color: blue"><xsl:apply-templates/></b>
</xsl:template>
<xsl:template match='xslthl:attribute'>
<span class="hl-attribute" style="color: blue"><xsl:apply-templates/></span>
</xsl:template>
<xsl:template match='xslthl:value'>
<span class="hl-value" style="color: blue"><xsl:apply-templates/></span>
</xsl:template>
<xsl:template match='xslthl:html'>
<b><i style="color: red"><xsl:apply-templates/></i></b>
</xsl:template>
<xsl:template match='xslthl:xslt'>
<b style="color: blue"><xsl:apply-templates/></b>
</xsl:template>
<xsl:template match='xslthl:section'>
<b><xsl:apply-templates/></b>
</xsl:template>
</xsl:stylesheet>
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xslthl="http://xslthl.sf.net"
exclude-result-prefixes="xslthl"
version='1.0'>
<!-- ********************************************************************
$Id: highlight.xsl 7266 2007-08-22 11:58:42Z xmldoc $
********************************************************************
This file is part of the XSL DocBook Stylesheet distribution.
See ../README or http://docbook.sf.net/release/xsl/current/ for
and other information.
******************************************************************** -->
<xsl:template match='xslthl:keyword'>
<b class="hl-keyword"><xsl:apply-templates/></b>
</xsl:template>
<xsl:template match='xslthl:string'>
<b class="hl-string"><i style="color:red"><xsl:apply-templates/></i></b>
</xsl:template>
<xsl:template match='xslthl:comment'>
<i class="hl-comment" style="color: silver"><xsl:apply-templates/></i>
</xsl:template>
<xsl:template match='xslthl:tag'>
<b class="hl-tag" style="color: blue"><xsl:apply-templates/></b>
</xsl:template>
<xsl:template match='xslthl:attribute'>
<span class="hl-attribute" style="color: blue"><xsl:apply-templates/></span>
</xsl:template>
<xsl:template match='xslthl:value'>
<span class="hl-value" style="color: blue"><xsl:apply-templates/></span>
</xsl:template>
<xsl:template match='xslthl:html'>
<b><i style="color: red"><xsl:apply-templates/></i></b>
</xsl:template>
<xsl:template match='xslthl:xslt'>
<b style="color: blue"><xsl:apply-templates/></b>
</xsl:template>
<xsl:template match='xslthl:section'>
<b><xsl:apply-templates/></b>
</xsl:template>
</xsl:stylesheet>
......@@ -71,13 +71,6 @@ function(move_file_if_exists source_file dest_file)
endif()
endfunction()
foreach(file_to_configure ${files_to_configure})
configure_file("${base_dir}/${file_to_configure}.in" "${base_dir}/${file_to_configure}.out" @ONLY)
replace_file_if_different(
"${base_dir}/${file_to_configure}"
"${base_dir}/${file_to_configure}.out")
endforeach()
# If BOXBACKUP_VERSION is defined when running CMake (as the AppVeyor config does), use it
# as-is, since it contains the full version number, branch, and platform (Win32/Win64):
if(BOXBACKUP_VERSION)
......@@ -375,6 +368,7 @@ file(WRITE "${boxconfig_h_file}" "// Auto-generated by CMake. Do not edit.\n")
if(WIN32)
target_link_libraries(lib_common PUBLIC ws2_32 gdi32)
list(APPEND CMAKE_REQUIRED_LIBRARIES ws2_32 gdi32)
endif()
# On Windows we want to statically link zlib to make debugging and distribution easier,
......@@ -430,6 +424,7 @@ else()
endif()
include_directories(${OPENSSL_INCLUDE_DIR})
target_link_libraries(lib_crypto PUBLIC ${OPENSSL_LIBRARIES})
list(APPEND CMAKE_REQUIRED_LIBRARIES ${OPENSSL_LIBRARIES})
# Link to PCRE
if (WIN32)
......@@ -613,6 +608,9 @@ foreach(function_name ${detect_functions})
file(APPEND "${boxconfig_h_file}" "#cmakedefine HAVE_${platform_var_name}\n")
endforeach()
check_function_exists(SSL_CTX_set_security_level HAVE_SSL_CTX_SET_SECURITY_LEVEL)
file(APPEND "${boxconfig_h_file}" "#cmakedefine HAVE_SSL_CTX_SET_SECURITY_LEVEL\n")
check_symbol_exists(dirfd "dirent.h" HAVE_DECL_DIRFD)
file(APPEND "${boxconfig_h_file}" "#cmakedefine01 HAVE_DECL_DIRFD\n")
......@@ -829,6 +827,13 @@ file(TO_NATIVE_PATH "${PERL_EXECUTABLE}" perl_executable_native)
string(REPLACE "\\" "\\\\" perl_path_escaped ${perl_executable_native})
target_compile_definitions(test_backupstorefix PRIVATE -DPERL_EXECUTABLE="${perl_path_escaped}")
foreach(file_to_configure ${files_to_configure})
configure_file("${base_dir}/${file_to_configure}.in" "${base_dir}/${file_to_configure}.out" @ONLY)
replace_file_if_different(
"${base_dir}/${file_to_configure}"
"${base_dir}/${file_to_configure}.out")
endforeach()
# Configure test timeouts:
# I've set the timeout to 4 times as long as it took to run on a particular run on Appveyor:
# https://ci.appveyor.com/project/qris/boxbackup/build/job/xm10itascygtu93j
......
......@@ -20,9 +20,9 @@ set(OPENSSL_VERSION 1.1.0g)
set(OPENSSL_HASH SHA256=de4d501267da39310905cb6dc8c6121f7a2cad45a7707f76df828fe1b85073af)
# Version of PCRE to download, build, and compile Box Backup against:
set(PCRE_VERSION 8.39)
# Hash of pcre-${PCRE_VERSION}.tar.gz, to be verified after download:
set(PCRE_HASH SHA256=ccdf7e788769838f8285b3ee672ed573358202305ee361cfec7a4a4fb005bbc7)
set(PCRE_VERSION 8.42)
# Hash of pcre-${PCRE_VERSION}.tar.bz2, to be verified after download:
set(PCRE_HASH SHA256=2cd04b7c887808be030254e8d77de11d3fe9d4505c39d4b15d2664ffe8bf9301)
# Version of Boost to download, unpack, and compile Box Backup against:
set(BOOST_VERSION 1.62.0)
......@@ -87,12 +87,11 @@ else()
endif()
ExternalProject_Add(pcre
# Temporarily use SVN repo until the PCRE_STATIC issue in 8.40 is fixed:
# https://vcs.pcre.org/pcre?view=revision&revision=1677
SVN_REPOSITORY svn://vcs.exim.org/pcre/code/trunk
SVN_REVISION -r 1677
URL "https://ftp.pcre.org/pub/pcre/pcre-${PCRE_VERSION}.tar.bz2"
URL_HASH ${PCRE_HASH}
DOWNLOAD_NO_PROGRESS 1
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${install_dir} ${SUB_CMAKE_EXTRA_ARGS}
-DPCRE_BUILD_PCREGREP=OFF
-DPCRE_SUPPORT_LIBREADLINE=OFF
-DPCRE_SUPPORT_LIBBZ2=OFF
# We need to build both versions, debug and release, because cmake requires both to be
......
......@@ -128,6 +128,7 @@ AC_CHECK_FUNCS([dlsym dladdr])
AC_SEARCH_LIBS([gethostbyname], [nsl socket resolv])
AC_SEARCH_LIBS([shutdown], [nsl socket resolv])
AX_CHECK_SSL(, [AC_MSG_ERROR([[OpenSSL is not installed but is required]])])
AC_CHECK_DECLS([SSL_R_EE_KEY_TOO_SMALL],,, [[#include <openssl/ssl.h>]])
AC_ARG_ENABLE(
[old-ssl],
[AC_HELP_STRING([--enable-old-ssl],
......@@ -142,7 +143,8 @@ AC_SEARCH_LIBS(
Upgrade or read the documentation for alternatives]])
fi
])
AC_CHECK_FUNCS([SSL_CTX_set_security_level], [HAVE_SSL_CTX_SET_SECURITY_LEVEL=1])
AC_SUBST([HAVE_SSL_CTX_SET_SECURITY_LEVEL])
### Checks for header files.
......
......@@ -8,10 +8,11 @@
// --------------------------------------------------------------------------
#include "Box.h"
#include "BackupConstants.h"
#include "BackupDaemonConfigVerify.h"
#include "Daemon.h"
#include "BoxPortsAndFiles.h"
#include "BackupConstants.h"
#include "Daemon.h"
#include "MemLeakFindOn.h"
......@@ -148,7 +149,9 @@ static const ConfigurationVerifyKey verifyrootkeys[] =
ConfigTest_IsUint32),
ConfigurationVerifyKey("CertificateFile", 0),
ConfigurationVerifyKey("PrivateKeyFile", 0),
ConfigurationVerifyKey("TrustedCAsFile", ConfigTest_LastEntry),
ConfigurationVerifyKey("TrustedCAsFile", 0),
ConfigurationVerifyKey("SSLSecurityLevel", ConfigTest_IsInt | ConfigTest_LastEntry,
BOX_DEFAULT_SSL_SECURITY_LEVEL),
};
const ConfigurationVerify BackupDaemonConfigVerify =
......
......@@ -174,9 +174,17 @@ void BackupStoreCheck::Check()
try
{
// We should be able to load a reference to the old refcount database
// (read-only) at the same time that we have a reference to the new one
// (temporary) open but not yet committed.
std::auto_ptr<BackupStoreRefCountDatabase> apOldRefs =
BackupStoreRefCountDatabase::Load(account, false);
mNumberErrorsFound += mapNewRefs->ReportChangesTo(*apOldRefs);
// If we have created a new lost+found directory (and thus allocated it a nonzero
// object ID) then it's not surprising that the previous refcount DB did not have
// a reference to this directory, and not an error, so ignore it.
mNumberErrorsFound += mapNewRefs->ReportChangesTo(*apOldRefs,
mLostAndFoundDirectoryID); // ignore_object_id
}
catch(BoxException &e)
{
......
......@@ -429,7 +429,7 @@ int64_t BackupStoreCheck::GetLostAndFoundDirID()
if(!mFixErrors)
{
// The result will never be used anyway if errors aren't being fixed
return 1;
return 0;
}
// Load up the root directory
......
......@@ -347,17 +347,22 @@ bool BackupStoreRefCountDatabase::RemoveReference(int64_t ObjectID)
return (refcount > 0);
}
int BackupStoreRefCountDatabase::ReportChangesTo(BackupStoreRefCountDatabase& rOldRefs)
int BackupStoreRefCountDatabase::ReportChangesTo(BackupStoreRefCountDatabase& rOldRefs,
int64_t ignore_object_id)
{
int ErrorCount = 0;
int64_t MaxOldObjectId = rOldRefs.GetLastObjectIDUsed();
int64_t MaxNewObjectId = GetLastObjectIDUsed();
for (int64_t ObjectID = BACKUPSTORE_ROOT_DIRECTORY_ID;
ObjectID < std::max(MaxOldObjectId, MaxNewObjectId);
ObjectID <= std::max(MaxOldObjectId, MaxNewObjectId);
ObjectID++)
{
typedef BackupStoreRefCountDatabase::refcount_t refcount_t;
if(ObjectID == ignore_object_id)
{
continue;
}
refcount_t OldRefs = (ObjectID <= MaxOldObjectId) ?
rOldRefs.GetRefCount(ObjectID) : 0;
refcount_t NewRefs = (ObjectID <= MaxNewObjectId) ?
......
......@@ -87,7 +87,8 @@ public:
void AddReference(int64_t ObjectID);
// RemoveReference returns false if refcount drops to zero
bool RemoveReference(int64_t ObjectID);
int ReportChangesTo(BackupStoreRefCountDatabase& rOldRefs);
int ReportChangesTo(BackupStoreRefCountDatabase& rOldRefs,
int64_t ignore_object_id = 0);
private:
static std::string GetFilename(const BackupStoreAccountDatabase::Entry&
......
......@@ -54,7 +54,7 @@ bool delete_account()
}
std::vector<uint32_t> ExpectedRefCounts;
int bbstored_pid = 0, bbackupd_pid = 0;
int bbstored_pid = 0, bbackupd_pid = 0, s3simulator_pid = 0;
void set_refcount(int64_t ObjectID, uint32_t RefCount)
{
......@@ -266,11 +266,11 @@ bool check_reference_counts()
return counts_ok;
}
bool StartServer()
bool StartServer(const std::string& daemon_args)
{
bbstored_pid = StartDaemon(bbstored_pid,
BBSTORED " " + bbstored_args + " testfiles/bbstored.conf",
"testfiles/bbstored.pid");
const std::string& daemon_args_final(daemon_args.size() ? daemon_args : bbstored_args);
bbstored_pid = StartDaemon(bbstored_pid, BBSTORED " " + daemon_args_final +
" testfiles/bbstored.conf", "testfiles/bbstored.pid");
return bbstored_pid != 0;
}
......@@ -282,11 +282,11 @@ bool StopServer(bool wait_for_process)
return result;
}
bool StartClient(const std::string& bbackupd_conf_file)
bool StartClient(const std::string& bbackupd_conf_file, const std::string& daemon_args)
{
bbackupd_pid = StartDaemon(bbackupd_pid,
BBACKUPD " " + bbackupd_args + " " + bbackupd_conf_file,
"testfiles/bbackupd.pid");
const std::string& daemon_args_final(daemon_args.size() ? daemon_args : bbackupd_args);
bbackupd_pid = StartDaemon(bbackupd_pid, BBACKUPD " " + daemon_args_final + " -c " +
bbackupd_conf_file, "testfiles/bbackupd.pid");
return bbackupd_pid != 0;
}
......@@ -298,3 +298,40 @@ bool StopClient(bool wait_for_process)
return result;
}
bool StartSimulator()
{
s3simulator_pid = StartDaemon(s3simulator_pid,
"../../bin/s3simulator/s3simulator " + bbstored_args +
" testfiles/s3simulator.conf", "testfiles/s3simulator.pid");
return s3simulator_pid != 0;
}
bool StopSimulator()
{
bool result = StopDaemon(s3simulator_pid, "testfiles/s3simulator.pid",
"s3simulator.memleaks", true);
s3simulator_pid = 0;
return result;
}
bool kill_running_daemons()
{
bool success = true;
if(FileExists("testfiles/bbstored.pid"))
{
TEST_THAT_OR(KillServer("testfiles/bbstored.pid", true), success = false);
}
if(FileExists("testfiles/bbackupd.pid"))
{
TEST_THAT_OR(KillServer("testfiles/bbackupd.pid", true), success = false);
}
if(FileExists("testfiles/s3simulator.pid"))
{
TEST_THAT_OR(KillServer("testfiles/s3simulator.pid", true), success = false);
}
return success;
}
......@@ -66,17 +66,24 @@ bool run_housekeeping_and_check_account();
bool check_reference_counts();
//! Starts the bbstored test server running, which must not already be running.
bool StartServer();
bool StartServer(const std::string& daemon_args = "");
//! Stops the currently running bbstored test server.
bool StopServer(bool wait_for_process = false);
//! Starts the bbackupd client running, which must not already be running.
bool StartClient(const std::string& bbackupd_conf_file = "testfiles/bbackupd.conf");
bool StartClient(const std::string& bbackupd_conf_file = "testfiles/bbackupd.conf",
const std::string& daemon_args = "");
//! Stops the currently running bbackupd client.
bool StopClient(bool wait_for_process = false);
bool StartSimulator();
bool StopSimulator();
bool kill_running_daemons();
//! Creates the standard test account, for example after delete_account().
bool create_account(int soft, int hard);
......
......@@ -579,8 +579,9 @@ void BackupDaemon::InitCrypto()
std::string certFile(conf.GetKeyValue("CertificateFile"));
std::string keyFile(conf.GetKeyValue("PrivateKeyFile"));
std::string caFile(conf.GetKeyValue("TrustedCAsFile"));
int ssl_security_level(conf.GetKeyValueInt("SSLSecurityLevel"));
mTlsContext.Initialise(false /* as client */, certFile.c_str(),
keyFile.c_str(), caFile.c_str());
keyFile.c_str(), caFile.c_str(), ssl_security_level);
// Set up the keys for various things
BackupClientCryptoKeys_Setup(conf.GetKeyValue("KeysFile"));
......
......@@ -34,6 +34,9 @@ public:
private:
};
#define EXCEPTION_IS_TYPE(exception_obj, type, subtype) \
(exception_obj.GetType() == type::ExceptionType && \
exception_obj.GetSubType() == type::subtype)
#endif // BOXEXCEPTION__H
......@@ -20,6 +20,10 @@
// directory within the RAIDFILE root for the backup store daemon
#define BOX_RAIDFILE_ROOT_BBSTORED "backup"
// default security level if SSLSecurityLevel is not specified: see
// https://github.com/boxbackup/boxbackup/wiki/WeakSSLCertificates
const int BOX_DEFAULT_SSL_SECURITY_LEVEL = -1;
// configuration file paths
#ifdef WIN32
// no default config file path, use these macros to call
......
......@@ -470,6 +470,16 @@ int Configuration::GetKeyValueInt(const std::string& rKeyName) const
}
int Configuration::GetKeyValueInt(const std::string& rKeyName, int default_value) const
{
if(!KeyExists(rKeyName))
{
return default_value;
}
return GetKeyValueInt(rKeyName);
}
// --------------------------------------------------------------------------
//
// Function
......@@ -778,8 +788,7 @@ bool Configuration::Verify(const ConfigurationVerify &rVerify,
}
else if(pvkey->HasDefaultValue())
{
mKeys[pvkey->Name()] =
pvkey->DefaultValue();
mKeys[pvkey->Name()] = pvkey->DefaultValue();
}
}
......@@ -922,5 +931,3 @@ bool Configuration::Verify(const ConfigurationVerify &rVerify,
return ok;
}
......@@ -122,6 +122,7 @@ public:
bool KeyExists(const std::string& rKeyName) const;
const std::string &GetKeyValue(const std::string& rKeyName) const;
int GetKeyValueInt(const std::string& rKeyName) const;
int GetKeyValueInt(const std::string& rKeyName, int default_value) const;
uint32_t GetKeyValueUint32(const std::string& rKeyName) const;
bool GetKeyValueBool(const std::string& rKeyName) const;
std::vector<std::string> GetKeyNames() const;
......
......@@ -42,6 +42,7 @@ public:
virtual pos_type BytesLeftToRead();
virtual void Write(const void *pBuffer, int NBytes,
int Timeout = IOStream::TimeOutInfinite);
using IOStream::Write;
virtual pos_type GetPosition() const;
virtual void Seek(IOStream::pos_type Offset, int SeekType);
virtual void Close();
......
......@@ -28,7 +28,7 @@
int num_tests_selected = 0;
int num_failures = 0;
int old_failure_count = 0;
static int old_failure_count = 0; // do not expose!
int first_fail_line;
std::string original_working_dir;
std::string first_fail_file;
......@@ -97,6 +97,8 @@ bool setUp(const char* function_name)
if(StartsWith("TestDir", filename) ||
StartsWith("0_", filename) ||
filename == "accounts.txt" ||
filename == "bbackupd-data" ||
filename == "ca" ||
StartsWith("file", filename) ||
StartsWith("notifyran", filename) ||
StartsWith("notifyscript.tag", filename) ||
......@@ -105,7 +107,9 @@ bool setUp(const char* function_name)
filename == "syncallowscript.control" ||
StartsWith("syncallowscript.notifyran.", filename) ||
filename == "test2.downloaded" ||
EndsWith("testfile", filename))
EndsWith("testfile", filename) ||
filename == "tmp" ||
EndsWith(".qdbm", filename))
{
std::string filepath = std::string("testfiles\\") + filename;
......@@ -201,7 +205,8 @@ bool setUp(const char* function_name)
"testfiles/restore* testfiles/bbackupd-data "
"testfiles/syncallowscript.control "
"testfiles/syncallowscript.notifyran.* "
"testfiles/test2.downloaded"
"testfiles/test2.downloaded "
"testfiles/tmp "
) == 0);
TEST_THAT_THROWONFAIL(system("touch testfiles/accounts.txt") == 0);
#endif
......@@ -382,133 +387,6 @@ int ReadPidFile(const char *pidFile)
return pid;
}
int LaunchServer(const std::string& rCommandLine, const char *pidFile)
{
BOX_INFO("Starting server: " << rCommandLine);
#ifdef WIN32
PROCESS_INFORMATION procInfo;
STARTUPINFO startInfo;
startInfo.cb = sizeof(startInfo);
startInfo.lpReserved = NULL;
startInfo.lpDesktop = NULL;
startInfo.lpTitle = NULL;
startInfo.dwFlags = 0;
startInfo.cbReserved2 = 0;
startInfo.lpReserved2 = NULL;
std::string cmd = ConvertPaths(rCommandLine);
CHAR* tempCmd = strdup(cmd.c_str());
DWORD result = CreateProcess
(
NULL, // lpApplicationName, naughty!
tempCmd, // lpCommandLine
NULL, // lpProcessAttributes
NULL, // lpThreadAttributes
false, // bInheritHandles
0, // dwCreationFlags
NULL, // lpEnvironment
NULL, // lpCurrentDirectory
&startInfo, // lpStartupInfo
&procInfo // lpProcessInformation
);
free(tempCmd);
TEST_THAT_OR(result != 0,
BOX_LOG_WIN_ERROR("Launch failed: " << rCommandLine);
return -1;
);
CloseHandle(procInfo.hProcess);
CloseHandle(procInfo.hThread);
return WaitForServerStartup(pidFile, (int)procInfo.dwProcessId);
#else // !WIN32
TEST_THAT_OR(RunCommand(rCommandLine) == 0,
TEST_FAIL_WITH_MESSAGE("Failed to start server: " << rCommandLine);
return -1;
)
return WaitForServerStartup(pidFile, 0);
#endif // WIN32
}
int WaitForServerStartup(const char *pidFile, int pidIfKnown)
{
#ifdef WIN32
if (pidFile == NULL)
{
return pidIfKnown;
}
#else
// on other platforms there is no other way to get
// the PID, so a NULL pidFile doesn't make sense.
ASSERT(pidFile != NULL);
#endif
// time for it to start up
BOX_TRACE("Waiting for server to start");
for (int i = 0; i < 15; i++)
{
if (TestFileNotEmpty(pidFile))
{
break;
}
if (pidIfKnown && !ServerIsAlive(pidIfKnown))
{
break;
}
::sleep(1);
}
// on Win32 we can check whether the process is alive
// without even checking the PID file
if (pidIfKnown && !ServerIsAlive(pidIfKnown))
{
TEST_FAIL_WITH_MESSAGE("Server died!");
return -1;
}
if (!TestFileNotEmpty(pidFile))
{
TEST_FAIL_WITH_MESSAGE("Server didn't save PID file");
return -1;
}
BOX_TRACE("Server started");
// wait a second for the pid to be written to the file
::sleep(1);
// read pid file
int pid = ReadPidFile(pidFile);
// On Win32 we can check whether the PID in the pidFile matches
// the one returned by the system, which it always should.
if (pidIfKnown && pid != pidIfKnown)
{
BOX_ERROR("Server wrote wrong pid to file (" << pidFile <<
"): expected " << pidIfKnown << " but found " <<
pid);
TEST_FAIL_WITH_MESSAGE("Server wrote wrong pid to file");
return -1;
}
return pid;
}
void TestRemoteProcessMemLeaksFunc(const char *filename,
const char* file, int line)
{
......
......@@ -23,6 +23,7 @@
#define BBACKUPQUERY "..\\..\\bin\\bbackupquery\\bbackupquery.exe"
#define BBSTOREACCOUNTS "..\\..\\bin\\bbstoreaccounts\\bbstoreaccounts.exe"
#define TEST_RETURN(actual, expected) TEST_EQUAL(expected, actual);
#define TEST_RETURN_COMMAND(actual, expected, command) TEST_EQUAL_LINE(expected, actual, command);
#else
#define BBACKUPCTL "../../bin/bbackupctl/bbackupctl"
#define BBACKUPD "../../bin/bbackupd/bbackupd"
......@@ -30,12 +31,16 @@
#define BBACKUPQUERY "../../bin/bbackupquery/bbackupquery"
#define BBSTOREACCOUNTS "../../bin/bbstoreaccounts/bbstoreaccounts"
#define TEST_RETURN(actual, expected) TEST_EQUAL((expected << 8), actual);
#define TEST_RETURN_COMMAND(actual, expected, command) TEST_EQUAL_LINE((expected << 8), actual, command);
#endif
#define DEFAULT_BBSTORED_CONFIG_FILE "testfiles/bbstored.conf"
#define DEFAULT_BBACKUPD_CONFIG_FILE "testfiles/bbackupd.conf"
#define DEFAULT_S3_CACHE_DIR "testfiles/bbackupd-cache"
extern int num_failures;
extern int first_fail_line;
extern int num_tests_selected;
extern int old_failure_count;
extern std::string first_fail_file;
extern std::string bbackupd_args, bbstored_args, bbackupquery_args, test_args;
extern std::list<std::string> run_only_named_tests;
......@@ -215,6 +220,7 @@ int finish_test_suite();
bool TestFileExists(const char *Filename);
bool TestDirExists(const char *Filename);
bool TestFileNotEmpty(const char *Filename);
// -1 if doesn't exist
int TestGetFileSize(const std::string& Filename);
......@@ -222,8 +228,6 @@ std::string ConvertPaths(const std::string& rOriginal);
int RunCommand(const std::string& rCommandLine);
bool ServerIsAlive(int pid);
int ReadPidFile(const char *pidFile);
int LaunchServer(const std::string& rCommandLine, const char *pidFile);
int WaitForServerStartup(const char *pidFile, int pidIfKnown);
#define TestRemoteProcessMemLeaks(filename) \
TestRemoteProcessMemLeaksFunc(filename, __FILE__, __LINE__)
......
......@@ -15,6 +15,7 @@ TLSNoPeerCertificate 36
TLSPeerCertificateInvalid 37 Check certification process
TLSClosedWhenWriting 38
TLSHandshakeTimedOut 39
TLSPeerWeakCertificate 40 The peer's certificate is too weak for the current SSL Security Level, see https://github.com/boxbackup/boxbackup/wiki/WeakSSLCertificates
Protocol_Timeout 41 Probably a network issue between client and server.
Protocol_ObjTooBig 42
Protocol_BadCommandRecieved 44
......
......@@ -42,6 +42,7 @@
#include "autogen_ConnectionException.h"
#include "autogen_ServerException.h"
#include "BoxPortsAndFiles.h"
#include "Configuration.h"
#include "Daemon.h"
#include "FileModificationTime.h"
......@@ -52,6 +53,9 @@
#include "MemLeakFindOn.h"
const ConfigurationVerifyKey ssl_security_level_key("SSLSecurityLevel",
ConfigTest_IsInt | ConfigTest_LastEntry, BOX_DEFAULT_SSL_SECURITY_LEVEL);
Daemon *Daemon::spDaemon = 0;
......
......@@ -121,5 +121,7 @@ private:
ConfigurationVerifyKey("LogFacility", 0), \
ConfigurationVerifyKey("User", ConfigTest_LastEntry)
extern const ConfigurationVerifyKey ssl_security_level_key;
#endif // DAEMON__H
......@@ -18,7 +18,9 @@
#include "BoxTime.h"
#include "IOStreamGetLine.h"
#include "ServerControl.h"
#include "SocketStream.h"
#include "Test.h"
#include "autogen_ServerException.h"
#ifdef WIN32
......@@ -227,7 +229,7 @@ bool KillServer(int pid, bool WaitForProcess)
return !ServerIsAlive(pid);
}
bool KillServer(std::string pid_file, bool WaitForProcess)
bool KillServer(const std::string& pid_file, bool WaitForProcess)
{
FileStream fs(pid_file);
IOStreamGetLine getline(fs);
......@@ -251,11 +253,174 @@ bool KillServer(std::string pid_file, bool WaitForProcess)
return status;
}
int StartDaemon(int current_pid, const std::string& cmd_line, const char* pid_file)
int LaunchServer(const std::string& rCommandLine, const char *pidFile, int port