mirror of
https://github.com/uroni/urbackup_backend.git
synced 2025-10-26 11:36:50 +00:00
Updated copyright
This commit is contained in:
parent
cc45bcfcae
commit
9ee64e650a
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,18 +1,18 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
281
Database.cpp
281
Database.cpp
@ -1,36 +1,36 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
**************************************************************************/
|
||||
#ifndef NO_SQLITE
|
||||
|
||||
#if defined(_WIN32) || defined(WIN32)
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#endif
|
||||
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
**************************************************************************/
|
||||
#ifndef NO_SQLITE
|
||||
|
||||
#if defined(_WIN32) || defined(WIN32)
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#endif
|
||||
|
||||
#include "vld.h"
|
||||
#ifndef BDBPLUGIN
|
||||
#include "Server.h"
|
||||
#else
|
||||
#ifdef LINUX
|
||||
#include "bdbplugin/config.h"
|
||||
#include DB_HEADER
|
||||
#else
|
||||
#ifdef LINUX
|
||||
#include "bdbplugin/config.h"
|
||||
#include DB_HEADER
|
||||
#else
|
||||
#include <db.h>
|
||||
#endif
|
||||
#endif
|
||||
#include "Interface/Server.h"
|
||||
#endif
|
||||
#include "Query.h"
|
||||
@ -110,32 +110,33 @@ bool CDatabase::Open(std::string pFile, const std::vector<std::pair<std::string,
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
#ifdef BDBPLUGIN
|
||||
/*db_results res=Read("PRAGMA multiversion");
|
||||
if(!res.empty() && res[0][L"multiversion"]!=L"1")
|
||||
{
|
||||
Write("PRAGMA multiversion=ON");
|
||||
}*/
|
||||
|
||||
#ifdef BDBPLUGIN
|
||||
/*db_results res=Read("PRAGMA multiversion");
|
||||
if(!res.empty() && res[0][L"multiversion"]!=L"1")
|
||||
{
|
||||
Write("PRAGMA multiversion=ON");
|
||||
}*/
|
||||
Write("PRAGMA synchronous=ON");
|
||||
//Write("PRAGMA snapshot_isolation=ON");
|
||||
//Write("PRAGMA bdbsql_error_file='urbackup/bdb_errors.log'");
|
||||
#else
|
||||
Write("PRAGMA synchronous=NORMAL");
|
||||
#endif
|
||||
Write("PRAGMA foreign_keys = ON");
|
||||
Write("PRAGMA threads = 2");
|
||||
|
||||
if(allocation_chunk_size!=std::string::npos)
|
||||
{
|
||||
int chunk_size = static_cast<int>(allocation_chunk_size);
|
||||
sqlite3_file_control(db, NULL, SQLITE_FCNTL_CHUNK_SIZE, &chunk_size);
|
||||
}
|
||||
|
||||
static size_t sqlite_cache_size = get_sqlite_cache_size();
|
||||
Write("PRAGMA cache_size = -"+convert(sqlite_cache_size));
|
||||
|
||||
sqlite3_busy_timeout(db, c_sqlite_busy_timeout_default);
|
||||
//Write("PRAGMA snapshot_isolation=ON");
|
||||
//Write("PRAGMA bdbsql_error_file='urbackup/bdb_errors.log'");
|
||||
#else
|
||||
Write("PRAGMA synchronous=NORMAL");
|
||||
#endif
|
||||
Write("PRAGMA foreign_keys = ON");
|
||||
Write("PRAGMA threads = 2");
|
||||
|
||||
if(allocation_chunk_size!=std::string::npos)
|
||||
{
|
||||
int chunk_size = static_cast<int>(allocation_chunk_size);
|
||||
sqlite3_file_control(db, NULL, SQLITE_FCNTL_CHUNK_SIZE, &chunk_size);
|
||||
}
|
||||
|
||||
static size_t sqlite_cache_size = get_sqlite_cache_size();
|
||||
Write("PRAGMA cache_size = -"+convert(sqlite_cache_size));
|
||||
|
||||
sqlite3_busy_timeout(db, c_sqlite_busy_timeout_default);
|
||||
|
||||
AttachDBs();
|
||||
|
||||
return true;
|
||||
@ -220,17 +221,17 @@ bool CDatabase::EndTransaction(void)
|
||||
Write("END;");
|
||||
in_transaction=false;
|
||||
IScopedLock lock(lock_mutex);
|
||||
bool waited=false;
|
||||
bool waited=false;
|
||||
while(lock_count>0)
|
||||
{
|
||||
unlock_cond->wait(&lock);
|
||||
waited=true;
|
||||
waited=true;
|
||||
}
|
||||
if(waited)
|
||||
{
|
||||
Server->wait(50);
|
||||
}
|
||||
transaction_read_lock.reset();
|
||||
if(waited)
|
||||
{
|
||||
Server->wait(50);
|
||||
}
|
||||
transaction_read_lock.reset();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -477,35 +478,41 @@ bool CDatabase::Dump(const std::string &pFile)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string CDatabase::getEngineName(void)
|
||||
{
|
||||
#ifndef BDBPLUGIN
|
||||
return "sqlite";
|
||||
#else
|
||||
return "bdb";
|
||||
#endif
|
||||
}
|
||||
|
||||
void CDatabase::AttachDBs(void)
|
||||
{
|
||||
for(size_t i=0;i<attached_dbs.size();++i)
{
Write("ATTACH DATABASE '"+attached_dbs[i].first+"' AS "+attached_dbs[i].second);
}
|
||||
}
|
||||
|
||||
void CDatabase::DetachDBs(void)
|
||||
{
|
||||
for(size_t i=0;i<attached_dbs.size();++i)
{
Write("DETACH DATABASE "+attached_dbs[i].second);
}
|
||||
}
|
||||
|
||||
bool CDatabase::backup_db(const std::string &pFile, const std::string &pDB)
|
||||
{
|
||||
|
||||
std::string CDatabase::getEngineName(void)
|
||||
{
|
||||
#ifndef BDBPLUGIN
|
||||
return "sqlite";
|
||||
#else
|
||||
return "bdb";
|
||||
#endif
|
||||
}
|
||||
|
||||
void CDatabase::AttachDBs(void)
|
||||
{
|
||||
for(size_t i=0;i<attached_dbs.size();++i)
|
||||
{
|
||||
Write("ATTACH DATABASE '"+attached_dbs[i].first+"' AS "+attached_dbs[i].second);
|
||||
}
|
||||
}
|
||||
|
||||
void CDatabase::DetachDBs(void)
|
||||
{
|
||||
for(size_t i=0;i<attached_dbs.size();++i)
|
||||
{
|
||||
Write("DETACH DATABASE "+attached_dbs[i].second);
|
||||
}
|
||||
}
|
||||
|
||||
bool CDatabase::backup_db(const std::string &pFile, const std::string &pDB)
|
||||
{
|
||||
IScopedReadLock lock(NULL);
|
||||
|
||||
if (!in_transaction)
|
||||
{
|
||||
lock.relock(single_user_mutex);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int rc; /* Function return code */
|
||||
sqlite3 *pBackupDB; /* Database connection opened on zFilename */
|
||||
sqlite3_backup *pBackup; /* Backup handle used to copy data */
|
||||
@ -547,61 +554,61 @@ bool CDatabase::backup_db(const std::string &pFile, const std::string &pDB)
|
||||
/* Close the database connection opened on database file zFilename
|
||||
** and return the result of this function. */
|
||||
(void)sqlite3_close(pBackupDB);
|
||||
return rc==0;
|
||||
}
|
||||
|
||||
bool CDatabase::Backup(const std::string &pFile)
|
||||
{
|
||||
std::string path=ExtractFilePath(pFile);
|
||||
bool b=backup_db(pFile, "main");
|
||||
if(!b)
|
||||
return false;
|
||||
|
||||
for(size_t i=0;i<attached_dbs.size();++i)
|
||||
{
|
||||
b=backup_db(path+"/"+ExtractFileName(attached_dbs[i].first), attached_dbs[i].second);
|
||||
if(!b)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CDatabase::freeMemory()
|
||||
{
|
||||
sqlite3_db_release_memory(db);
|
||||
}
|
||||
|
||||
int CDatabase::getLastChanges()
|
||||
{
|
||||
return sqlite3_changes(db);
|
||||
}
|
||||
|
||||
std::string CDatabase::getTempDirectoryPath()
|
||||
{
|
||||
char* tmpfn = NULL;
|
||||
if(sqlite3_file_control(db, NULL, SQLITE_FCNTL_TEMPFILENAME, &tmpfn)==SQLITE_OK && tmpfn!=NULL)
|
||||
{
|
||||
std::string ret = ExtractFilePath(tmpfn);
|
||||
sqlite3_free(tmpfn);
|
||||
return ret;
|
||||
}
|
||||
else
|
||||
{
|
||||
return std::string();
|
||||
}
|
||||
return rc==0;
|
||||
}
|
||||
|
||||
bool CDatabase::Backup(const std::string &pFile)
|
||||
{
|
||||
std::string path=ExtractFilePath(pFile);
|
||||
bool b=backup_db(pFile, "main");
|
||||
if(!b)
|
||||
return false;
|
||||
|
||||
for(size_t i=0;i<attached_dbs.size();++i)
|
||||
{
|
||||
b=backup_db(path+"/"+ExtractFileName(attached_dbs[i].first), attached_dbs[i].second);
|
||||
if(!b)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CDatabase::freeMemory()
|
||||
{
|
||||
sqlite3_db_release_memory(db);
|
||||
}
|
||||
|
||||
int CDatabase::getLastChanges()
|
||||
{
|
||||
return sqlite3_changes(db);
|
||||
}
|
||||
|
||||
std::string CDatabase::getTempDirectoryPath()
|
||||
{
|
||||
char* tmpfn = NULL;
|
||||
if(sqlite3_file_control(db, NULL, SQLITE_FCNTL_TEMPFILENAME, &tmpfn)==SQLITE_OK && tmpfn!=NULL)
|
||||
{
|
||||
std::string ret = ExtractFilePath(tmpfn);
|
||||
sqlite3_free(tmpfn);
|
||||
return ret;
|
||||
}
|
||||
else
|
||||
{
|
||||
return std::string();
|
||||
}
|
||||
}
|
||||
|
||||
void CDatabase::lockForSingleUse()
|
||||
{
|
||||
write_lock.reset(new IScopedWriteLock(single_user_mutex));
|
||||
}
|
||||
|
||||
void CDatabase::unlockForSingleUse()
|
||||
{
|
||||
write_lock.reset();
|
||||
}
|
||||
|
||||
void CDatabase::lockForSingleUse()
|
||||
{
|
||||
write_lock.reset(new IScopedWriteLock(single_user_mutex));
|
||||
}
|
||||
|
||||
void CDatabase::unlockForSingleUse()
|
||||
{
|
||||
write_lock.reset();
|
||||
}
|
||||
|
||||
ISharedMutex* CDatabase::getSingleUseMutex()
|
||||
{
|
||||
return single_user_mutex;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,18 +1,18 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
58
Query.cpp
58
Query.cpp
@ -1,35 +1,35 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
**************************************************************************/
|
||||
#ifndef NO_SQLITE
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
**************************************************************************/
|
||||
#ifndef NO_SQLITE
|
||||
|
||||
|
||||
#include "vld.h"
|
||||
#include "Query.h"
|
||||
#ifndef BDBPLUGIN
|
||||
#include "Server.h"
|
||||
#else
|
||||
#include "Interface/Server.h"
|
||||
#ifdef LINUX
|
||||
#include "bdbplugin/config.h"
|
||||
#include DB_HEADER
|
||||
#else
|
||||
#include <db.h>
|
||||
#endif
|
||||
#ifdef LINUX
|
||||
#include "bdbplugin/config.h"
|
||||
#include DB_HEADER
|
||||
#else
|
||||
#include <db.h>
|
||||
#endif
|
||||
#endif
|
||||
#include "sqlite/sqlite3.h"
|
||||
#include "Database.h"
|
||||
@ -183,11 +183,11 @@ bool CQuery::Execute(int timeoutms)
|
||||
Server->Log("SQLITE: Long running query Stmt: ["+stmt_str+"]", LL_ERROR);
|
||||
showActiveQueries(LL_ERROR);
|
||||
}
|
||||
else if(tries>=0)
|
||||
{
|
||||
else if(tries>=0)
|
||||
{
|
||||
Server->Log("SQLITE_BUSY in CQuery::Execute Stmt: ["+stmt_str+"]", LL_INFO);
|
||||
showActiveQueries(LL_INFO);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(err==SQLITE_LOCKED)
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
29
Server.cpp
29
Server.cpp
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
@ -609,17 +609,18 @@ int64 CServer::getTimeMS(void)
|
||||
gettimeofday(&tp, NULL);
|
||||
static long start_t=tp.tv_sec;
|
||||
tp.tv_sec-=start_t;
|
||||
return tp.tv_sec*1000+tp.tv_usec/1000;
*/
|
||||
timespec tp;
|
||||
if(clock_gettime(CLOCK_MONOTONIC, &tp)!=0)
|
||||
{
|
||||
return tp.tv_sec*1000+tp.tv_usec/1000;
|
||||
*/
|
||||
timespec tp;
|
||||
if(clock_gettime(CLOCK_MONOTONIC, &tp)!=0)
|
||||
{
|
||||
timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
static long start_t=tv.tv_sec;
|
||||
tv.tv_sec-=start_t;
|
||||
return tv.tv_sec*1000+tv.tv_usec/1000;
|
||||
}
|
||||
return static_cast<int64>(tp.tv_sec)*1000+tp.tv_nsec/1000000;
|
||||
return tv.tv_sec*1000+tv.tv_usec/1000;
|
||||
}
|
||||
return static_cast<int64>(tp.tv_sec)*1000+tp.tv_nsec/1000000;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -1750,11 +1751,11 @@ void CServer::secureRandomFill(char *buf, size_t blen)
|
||||
|
||||
std::string CServer::secureRandomString(size_t len)
|
||||
{
|
||||
std::string rchars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||
std::string key;
|
||||
std::vector<unsigned int> rnd_n=Server->getSecureRandomNumbers(len);
|
||||
for(size_t j=0;j<len;++j)
|
||||
key+=rchars[rnd_n[j]%rchars.size()];
|
||||
std::string rchars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||
std::string key;
|
||||
std::vector<unsigned int> rnd_n=Server->getSecureRandomNumbers(len);
|
||||
for(size_t j=0;j<len;++j)
|
||||
key+=rchars[rnd_n[j]%rchars.size()];
|
||||
return key;
|
||||
}
|
||||
|
||||
@ -1842,7 +1843,7 @@ void CServer::LoadStaticPlugins()
|
||||
LOADACTIONS loadfunc = staticplugins[i].loadactions;
|
||||
loadfunc(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CServer::setLogConsoleTime(bool b)
|
||||
{
|
||||
|
||||
@ -1,21 +1,21 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
**************************************************************************/
|
||||
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
**************************************************************************/
|
||||
|
||||
#include "vld.h"
|
||||
#include "Server.h"
|
||||
#include "stringtools.h"
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,3 +1,21 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
**************************************************************************/
|
||||
|
||||
#include "SharedMutex_lin.h"
|
||||
#include "Server.h"
|
||||
#include "stringtools.h"
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,18 +1,18 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
@ -1,18 +1,18 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
**************************************************************************/
|
||||
|
||||
@ -23,43 +23,43 @@
|
||||
#include "../stringtools.h"
|
||||
#include "../tclap/CmdLine.h"
|
||||
|
||||
#ifndef _WIN32
|
||||
#include "../config.h"
|
||||
#define PWFILE VARDIR "/urbackup/pw.txt"
|
||||
#else
|
||||
#define PACKAGE_VERSION "$version_full_numeric$"
|
||||
#define VARDIR ""
|
||||
#define PWFILE "pw.txt"
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32
|
||||
#include "../config.h"
|
||||
#define PWFILE VARDIR "/urbackup/pw.txt"
|
||||
#else
|
||||
#define PACKAGE_VERSION "$version_full_numeric$"
|
||||
#define VARDIR ""
|
||||
#define PWFILE "pw.txt"
|
||||
#endif
|
||||
|
||||
const std::string cmdline_version = PACKAGE_VERSION;
|
||||
|
||||
void show_version()
|
||||
{
|
||||
std::cout << "UrBackup Client Controller v" << cmdline_version << std::endl;
|
||||
std::cout << "Copyright (C) 2011-2015 Martin Raiber" << std::endl;
|
||||
std::cout << "This is free software; see the source for copying conditions. There is NO"<< std::endl;
|
||||
std::cout << "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."<< std::endl;
|
||||
void show_version()
|
||||
{
|
||||
std::cout << "UrBackup Client Controller v" << cmdline_version << std::endl;
|
||||
std::cout << "Copyright (C) 2011-2016 Martin Raiber" << std::endl;
|
||||
std::cout << "This is free software; see the source for copying conditions. There is NO"<< std::endl;
|
||||
std::cout << "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."<< std::endl;
|
||||
}
|
||||
|
||||
void action_help(std::string cmd)
|
||||
{
|
||||
std::cout << std::endl;
|
||||
std::cout << "USAGE:" << std::endl;
|
||||
std::cout << std::endl;
|
||||
std::cout << "\t" << cmd << " [--help] [--version] <command> [<args>]" << std::endl;
|
||||
std::cout << std::endl;
|
||||
std::cout << "Get specific command help with " << cmd << " <command> --help" << std::endl;
|
||||
std::cout << std::endl;
|
||||
std::cout << "\t" << cmd << " start" << std::endl;
|
||||
std::cout << "\t\t" "Start an incremental/full image/file backup" << std::endl;
|
||||
std::cout << std::endl;
|
||||
std::cout << "\t" << cmd << " status" << std::endl;
|
||||
std::cout << "\t\t" "Get current backup status" << std::endl;
|
||||
std::cout << std::endl;
|
||||
std::cout << "\t" << cmd << " list" << std::endl;
|
||||
std::cout << "\t\t" "List backups and files/folders in backups" << std::endl;
|
||||
std::cout << std::endl;
|
||||
void action_help(std::string cmd)
|
||||
{
|
||||
std::cout << std::endl;
|
||||
std::cout << "USAGE:" << std::endl;
|
||||
std::cout << std::endl;
|
||||
std::cout << "\t" << cmd << " [--help] [--version] <command> [<args>]" << std::endl;
|
||||
std::cout << std::endl;
|
||||
std::cout << "Get specific command help with " << cmd << " <command> --help" << std::endl;
|
||||
std::cout << std::endl;
|
||||
std::cout << "\t" << cmd << " start" << std::endl;
|
||||
std::cout << "\t\t" "Start an incremental/full image/file backup" << std::endl;
|
||||
std::cout << std::endl;
|
||||
std::cout << "\t" << cmd << " status" << std::endl;
|
||||
std::cout << "\t\t" "Get current backup status" << std::endl;
|
||||
std::cout << std::endl;
|
||||
std::cout << "\t" << cmd << " list" << std::endl;
|
||||
std::cout << "\t\t" "List backups and files/folders in backups" << std::endl;
|
||||
std::cout << std::endl;
|
||||
}
|
||||
|
||||
typedef int(*action_fun)(std::vector<std::string> args);
|
||||
@ -69,11 +69,11 @@ class PwClientCmd
|
||||
public:
|
||||
PwClientCmd(TCLAP::CmdLine& cmd)
|
||||
: cmd(cmd),
|
||||
pw_file_arg("p", "pw-file",
|
||||
"Use password in file",
|
||||
pw_file_arg("p", "pw-file",
|
||||
"Use password in file",
|
||||
false, PWFILE, "path", cmd),
|
||||
client_arg("c", "client",
|
||||
"Start backup on this client",
|
||||
client_arg("c", "client",
|
||||
"Start backup on this client",
|
||||
false, "127.0.0.1", "hostname/IP", cmd)
|
||||
{
|
||||
|
||||
@ -92,7 +92,7 @@ private:
|
||||
TCLAP::ValueArg<std::string> client_arg;
|
||||
};
|
||||
|
||||
int action_start(std::vector<std::string> args)
|
||||
int action_start(std::vector<std::string> args)
|
||||
{
|
||||
TCLAP::CmdLine cmd("Start an incremental/full image/file backup", ' ', cmdline_version);
|
||||
|
||||
@ -173,12 +173,12 @@ int action_list(std::vector<std::string> args)
|
||||
|
||||
PwClientCmd pw_client_cmd(cmd);
|
||||
|
||||
TCLAP::ValueArg<int> backupid_arg("b", "backupid",
|
||||
"Backupid of backup from which to list files/folders",
|
||||
TCLAP::ValueArg<int> backupid_arg("b", "backupid",
|
||||
"Backupid of backup from which to list files/folders",
|
||||
false, 0, "id", cmd);
|
||||
|
||||
TCLAP::ValueArg<std::string> path_arg("d", "path",
|
||||
"Path of folder/file of which to list backups/contents",
|
||||
TCLAP::ValueArg<std::string> path_arg("d", "path",
|
||||
"Path of folder/file of which to list backups/contents",
|
||||
false, "", "path", cmd);
|
||||
|
||||
cmd.parse(args);
|
||||
@ -246,12 +246,12 @@ int action_start_restore(std::vector<std::string> args)
|
||||
|
||||
PwClientCmd pw_client_cmd(cmd);
|
||||
|
||||
TCLAP::ValueArg<int> backupid_arg("b", "backupid",
|
||||
"Backupid of backup from which to restore files/folders",
|
||||
TCLAP::ValueArg<int> backupid_arg("b", "backupid",
|
||||
"Backupid of backup from which to restore files/folders",
|
||||
true, 0, "id", cmd);
|
||||
|
||||
TCLAP::ValueArg<std::string> path_arg("d", "path",
|
||||
"Path of folder/file to restore",
|
||||
TCLAP::ValueArg<std::string> path_arg("d", "path",
|
||||
"Path of folder/file to restore",
|
||||
true, "", "path", cmd);
|
||||
|
||||
cmd.parse(args);
|
||||
@ -283,13 +283,13 @@ int action_start_restore(std::vector<std::string> args)
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
if(argc==0)
|
||||
{
|
||||
std::cout << "Not enough arguments (zero arguments) -- no program name" << std::endl;
|
||||
return 1;
|
||||
if(argc==0)
|
||||
{
|
||||
std::cout << "Not enough arguments (zero arguments) -- no program name" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
std::vector<std::string> actions;
|
||||
std::vector<std::string> actions;
|
||||
std::vector<action_fun> action_funs;
|
||||
actions.push_back("start");
|
||||
action_funs.push_back(action_start);
|
||||
@ -300,77 +300,77 @@ int main(int argc, char *argv[])
|
||||
actions.push_back("restore-start");
|
||||
action_funs.push_back(action_start_restore);
|
||||
|
||||
bool has_help=false;
|
||||
bool has_version=false;
|
||||
size_t action_idx=std::string::npos;
|
||||
std::vector<std::string> args;
|
||||
args.push_back(argv[0]);
|
||||
for(int i=1;i<argc;++i)
|
||||
{
|
||||
std::string arg = argv[i];
|
||||
|
||||
if(arg=="--help" || arg=="-h")
|
||||
{
|
||||
has_help=true;
|
||||
}
|
||||
|
||||
if(arg=="--version")
|
||||
{
|
||||
has_version=true;
|
||||
}
|
||||
|
||||
if(!arg.empty() && arg[0]=='-')
|
||||
{
|
||||
args.push_back(arg);
|
||||
continue;
|
||||
}
|
||||
|
||||
bool found_action=false;
|
||||
for(size_t j=0;j<actions.size();++j)
|
||||
{
|
||||
if(next(actions[j], 0, arg))
|
||||
{
|
||||
if(action_idx!=std::string::npos)
|
||||
{
|
||||
action_help(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
action_idx=j;
|
||||
found_action=true;
|
||||
}
|
||||
}
|
||||
|
||||
if(!found_action)
|
||||
{
|
||||
args.push_back(arg);
|
||||
}
|
||||
}
|
||||
|
||||
if(action_idx==std::string::npos)
|
||||
{
|
||||
if(has_help)
|
||||
{
|
||||
action_help(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
if(has_version)
|
||||
{
|
||||
show_version();
|
||||
exit(1);
|
||||
}
|
||||
action_help(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
args[0]+=" "+actions[action_idx];
|
||||
int rc = action_funs[action_idx](args);
|
||||
return rc;
|
||||
}
|
||||
catch (TCLAP::ArgException &e)
|
||||
{
|
||||
std::cerr << "error: " << e.error() << " for arg " << e.argId() << std::endl;
|
||||
return 1;
|
||||
bool has_help=false;
|
||||
bool has_version=false;
|
||||
size_t action_idx=std::string::npos;
|
||||
std::vector<std::string> args;
|
||||
args.push_back(argv[0]);
|
||||
for(int i=1;i<argc;++i)
|
||||
{
|
||||
std::string arg = argv[i];
|
||||
|
||||
if(arg=="--help" || arg=="-h")
|
||||
{
|
||||
has_help=true;
|
||||
}
|
||||
|
||||
if(arg=="--version")
|
||||
{
|
||||
has_version=true;
|
||||
}
|
||||
|
||||
if(!arg.empty() && arg[0]=='-')
|
||||
{
|
||||
args.push_back(arg);
|
||||
continue;
|
||||
}
|
||||
|
||||
bool found_action=false;
|
||||
for(size_t j=0;j<actions.size();++j)
|
||||
{
|
||||
if(next(actions[j], 0, arg))
|
||||
{
|
||||
if(action_idx!=std::string::npos)
|
||||
{
|
||||
action_help(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
action_idx=j;
|
||||
found_action=true;
|
||||
}
|
||||
}
|
||||
|
||||
if(!found_action)
|
||||
{
|
||||
args.push_back(arg);
|
||||
}
|
||||
}
|
||||
|
||||
if(action_idx==std::string::npos)
|
||||
{
|
||||
if(has_help)
|
||||
{
|
||||
action_help(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
if(has_version)
|
||||
{
|
||||
show_version();
|
||||
exit(1);
|
||||
}
|
||||
action_help(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
args[0]+=" "+actions[action_idx];
|
||||
int rc = action_funs[action_idx](args);
|
||||
return rc;
|
||||
}
|
||||
catch (TCLAP::ArgException &e)
|
||||
{
|
||||
std::cerr << "error: " << e.error() << " for arg " << e.argId() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,18 +1,18 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,21 +1,21 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
**************************************************************************/
|
||||
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
**************************************************************************/
|
||||
|
||||
#include "AESDecryption.h"
|
||||
|
||||
AESDecryption::AESDecryption(const std::string &password, bool hash_password)
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,21 +1,21 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
**************************************************************************/
|
||||
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
**************************************************************************/
|
||||
|
||||
#include "../vld.h"
|
||||
#include "CryptoFactory.h"
|
||||
#include "../Interface/Server.h"
|
||||
@ -29,7 +29,7 @@
|
||||
#include "AESGCMEncryption.h"
|
||||
|
||||
#include "cryptopp_inc.h"
|
||||
#include "ECDHKeyExchange.h"
|
||||
#include "ECDHKeyExchange.h"
|
||||
|
||||
IAESEncryption* CryptoFactory::createAESEncryption(const std::string &password)
|
||||
{
|
||||
@ -227,10 +227,10 @@ IZlibCompression* CryptoFactory::createZlibCompression(int compression_level)
|
||||
IZlibDecompression* CryptoFactory::createZlibDecompression(void)
|
||||
{
|
||||
return new ZlibDecompression;
|
||||
}
|
||||
|
||||
bool CryptoFactory::signData(const std::string &pubkey, const std::string &data, std::string &signature)
|
||||
{
|
||||
}
|
||||
|
||||
bool CryptoFactory::signData(const std::string &pubkey, const std::string &data, std::string &signature)
|
||||
{
|
||||
CryptoPP::ECDSA<CryptoPP::EC2N, CryptoPP::SHA256>::PrivateKey PrivateKey;
|
||||
CryptoPP::AutoSeededRandomPool rnd;
|
||||
|
||||
@ -252,11 +252,11 @@ bool CryptoFactory::signData(const std::string &pubkey, const std::string &data,
|
||||
Server->Log("Exception occured in CryptoFactory::signDataDSA: " + e.GetWhat(), LL_ERROR);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CryptoFactory::signDataDSA(const std::string &pubkey, const std::string &data, std::string &signature)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CryptoFactory::signDataDSA(const std::string &pubkey, const std::string &data, std::string &signature)
|
||||
{
|
||||
CryptoPP::DSA::PrivateKey PrivateKey;
|
||||
CryptoPP::AutoSeededRandomPool rnd;
|
||||
|
||||
@ -278,11 +278,11 @@ bool CryptoFactory::signDataDSA(const std::string &pubkey, const std::string &da
|
||||
Server->Log("Exception occured in CryptoFactory::signData: " + e.GetWhat(), LL_ERROR);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CryptoFactory::verifyData( const std::string &pubkey, const std::string &data, const std::string &signature )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CryptoFactory::verifyData( const std::string &pubkey, const std::string &data, const std::string &signature )
|
||||
{
|
||||
CryptoPP::ECDSA<CryptoPP::EC2N, CryptoPP::SHA256>::PublicKey PublicKey;
|
||||
CryptoPP::AutoSeededRandomPool rnd;
|
||||
|
||||
@ -303,11 +303,11 @@ bool CryptoFactory::verifyData( const std::string &pubkey, const std::string &da
|
||||
Server->Log("Exception occured in CryptoFactory::verifyData: " + e.GetWhat(), LL_ERROR);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CryptoFactory::verifyDataDSA( const std::string &pubkey, const std::string &data, const std::string &signature )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CryptoFactory::verifyDataDSA( const std::string &pubkey, const std::string &data, const std::string &signature )
|
||||
{
|
||||
CryptoPP::DSA::PublicKey PublicKey;
|
||||
CryptoPP::AutoSeededRandomPool rnd;
|
||||
|
||||
@ -328,13 +328,13 @@ bool CryptoFactory::verifyDataDSA( const std::string &pubkey, const std::string
|
||||
Server->Log("Exception occured in CryptoFactory::verifyDataDSA: " + e.GetWhat(), LL_ERROR);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string CryptoFactory::encryptAuthenticatedAES(const std::string& data, const std::string &password, size_t iterations/*=20000*/ )
|
||||
{
|
||||
const size_t iv_size=CryptoPP::AES::BLOCKSIZE;
|
||||
std::string ciphertext;
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string CryptoFactory::encryptAuthenticatedAES(const std::string& data, const std::string &password, size_t iterations/*=20000*/ )
|
||||
{
|
||||
const size_t iv_size=CryptoPP::AES::BLOCKSIZE;
|
||||
std::string ciphertext;
|
||||
ciphertext.resize(iv_size);
|
||||
|
||||
Server->secureRandomFill(&ciphertext[0], iv_size);
|
||||
@ -347,51 +347,51 @@ std::string CryptoFactory::encryptAuthenticatedAES(const std::string& data, cons
|
||||
reinterpret_cast<const byte*>(ciphertext.data()), iv_size, static_cast<unsigned int>(iterations), 0);
|
||||
|
||||
CryptoPP::EAX<CryptoPP::AES>::Encryption enc;
|
||||
enc.SetKeyWithIV(key.BytePtr(), CryptoPP::AES::BLOCKSIZE, reinterpret_cast<const byte*>(ciphertext.data()), iv_size);
|
||||
|
||||
|
||||
enc.SetKeyWithIV(key.BytePtr(), CryptoPP::AES::BLOCKSIZE, reinterpret_cast<const byte*>(ciphertext.data()), iv_size);
|
||||
|
||||
|
||||
CryptoPP::ArraySource( reinterpret_cast<const byte*>(data.data()), data.size(), true,
|
||||
new CryptoPP::AuthenticatedEncryptionFilter( enc,
|
||||
new CryptoPP::StringSink( ciphertext )
|
||||
) );
|
||||
|
||||
return ciphertext;
|
||||
}
|
||||
|
||||
std::string CryptoFactory::decryptAuthenticatedAES(const std::string& data, const std::string &password, size_t iterations)
|
||||
{
|
||||
const size_t iv_size=CryptoPP::AES::BLOCKSIZE;
|
||||
if(data.size()<iv_size)
|
||||
{
|
||||
return std::string();
|
||||
}
|
||||
|
||||
) );
|
||||
|
||||
return ciphertext;
|
||||
}
|
||||
|
||||
std::string CryptoFactory::decryptAuthenticatedAES(const std::string& data, const std::string &password, size_t iterations)
|
||||
{
|
||||
const size_t iv_size=CryptoPP::AES::BLOCKSIZE;
|
||||
if(data.size()<iv_size)
|
||||
{
|
||||
return std::string();
|
||||
}
|
||||
|
||||
CryptoPP::SecByteBlock key;
|
||||
key.resize(CryptoPP::SHA256::DIGESTSIZE);
|
||||
|
||||
CryptoPP::PKCS5_PBKDF2_HMAC<CryptoPP::SHA512> gen;
|
||||
gen.DeriveKey(key.BytePtr(), CryptoPP::SHA256::DIGESTSIZE, 0, reinterpret_cast<const byte*>(password.c_str()), password.size(),
|
||||
reinterpret_cast<const byte*>(data.data()), iv_size, static_cast<unsigned int>(iterations), 0);
|
||||
|
||||
reinterpret_cast<const byte*>(data.data()), iv_size, static_cast<unsigned int>(iterations), 0);
|
||||
|
||||
CryptoPP::EAX<CryptoPP::AES>::Decryption dec;
|
||||
dec.SetKeyWithIV(key.BytePtr(), CryptoPP::AES::BLOCKSIZE, reinterpret_cast<const byte*>(data.data()), iv_size);
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
std::string ret;
|
||||
dec.SetKeyWithIV(key.BytePtr(), CryptoPP::AES::BLOCKSIZE, reinterpret_cast<const byte*>(data.data()), iv_size);
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
std::string ret;
|
||||
CryptoPP::ArraySource( reinterpret_cast<const byte*>(data.data()+iv_size), data.size()-iv_size, true,
|
||||
new CryptoPP::AuthenticatedDecryptionFilter( dec,
|
||||
new CryptoPP::StringSink( ret ) ) );
|
||||
return ret;
|
||||
}
|
||||
new CryptoPP::StringSink( ret ) ) );
|
||||
return ret;
|
||||
}
|
||||
catch(const CryptoPP::HashVerificationFilter::HashVerificationFailed&)
|
||||
{
|
||||
return std::string();
|
||||
}
|
||||
}
|
||||
|
||||
IECDHKeyExchange* CryptoFactory::createECDHKeyExchange()
|
||||
{
|
||||
return new ECDHKeyExchange();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IECDHKeyExchange* CryptoFactory::createECDHKeyExchange()
|
||||
{
|
||||
return new ECDHKeyExchange();
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
@ -145,4 +145,4 @@ namespace
|
||||
{
|
||||
static RegisterPluginHelper register_plugin(LoadActions, UnloadActions, 0);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
@ -37,9 +37,9 @@
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#ifndef FALLOC_FL_KEEP_SIZE
|
||||
#define FALLOC_FL_KEEP_SIZE 0x1
|
||||
#endif
|
||||
#ifndef FALLOC_FL_PUNCH_HOLE
|
||||
#define FALLOC_FL_KEEP_SIZE 0x1
|
||||
#endif
|
||||
#ifndef FALLOC_FL_PUNCH_HOLE
|
||||
#define FALLOC_FL_PUNCH_HOLE 0x2
|
||||
#endif
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
@ -146,11 +146,11 @@ _u32 PipeFileBase::Write(const char* buffer, _u32 bsiz, bool *has_error/*=NULL*/
|
||||
bool PipeFileBase::Seek(_i64 spos)
|
||||
{
|
||||
_i64 seek_off = spos - curr_pos;
|
||||
|
||||
if(seek_off==0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if(seek_off==0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
IScopedLock lock(buffer_mutex.get());
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,3 +1,21 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef _GNU_SOURCE
|
||||
#define _GNU_SOURCE
|
||||
#endif
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,21 +1,21 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
**************************************************************************/
|
||||
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
**************************************************************************/
|
||||
|
||||
#include "HTTPAction.h"
|
||||
|
||||
#include "../Interface/Server.h"
|
||||
@ -36,11 +36,11 @@ namespace
|
||||
{
|
||||
}
|
||||
|
||||
virtual void write(const std::string &tw)
|
||||
{
|
||||
write(tw.c_str(), tw.size(), STDOUT);
|
||||
}
|
||||
|
||||
virtual void write(const std::string &tw)
|
||||
{
|
||||
write(tw.c_str(), tw.size(), STDOUT);
|
||||
}
|
||||
|
||||
virtual void write(const char* buf, size_t count, ostream_type_t stream)
|
||||
{
|
||||
if(count==0)
|
||||
@ -96,10 +96,10 @@ void CHTTPAction::operator()(void)
|
||||
return;
|
||||
}
|
||||
|
||||
if( tid==0 )
|
||||
{
|
||||
std::string error="Error: Unknown action ["+name+"]";
|
||||
Server->Log(error, LL_WARNING);
|
||||
output->Write("Content-type: text/html; charset=UTF-8\r\n\r\n"+error);
|
||||
if( tid==0 )
|
||||
{
|
||||
std::string error="Error: Unknown action ["+name+"]";
|
||||
Server->Log(error, LL_WARNING);
|
||||
output->Write("Content-type: text/html; charset=UTF-8\r\n\r\n"+error);
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,21 +1,21 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
**************************************************************************/
|
||||
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
**************************************************************************/
|
||||
|
||||
#include "HTTPFile.h"
|
||||
#include "MIMEType.h"
|
||||
#include "IndexFiles.h"
|
||||
@ -42,7 +42,7 @@ std::string CHTTPFile::getContentType(void)
|
||||
|
||||
void CHTTPFile::operator ()(void)
|
||||
{
|
||||
Server->Log("Sending file \""+filename+"\"", LL_DEBUG);
|
||||
Server->Log("Sending file \""+filename+"\"", LL_DEBUG);
|
||||
IFile *fp=Server->openFile(filename);
|
||||
|
||||
if( fp==NULL )
|
||||
|
||||
@ -1,23 +1,23 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
**************************************************************************/
|
||||
|
||||
#include <memory.h>
|
||||
#include <cstring>
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
**************************************************************************/
|
||||
|
||||
#include <memory.h>
|
||||
#include <cstring>
|
||||
#include "HTTPProxy.h"
|
||||
#include "HTTPService.h"
|
||||
#include "../Interface/Server.h"
|
||||
@ -41,18 +41,18 @@ void CHTTPProxy::operator()(void)
|
||||
if(http_version==10)html_ver=" HTTP/1.0";
|
||||
|
||||
std::string request=http_method+" "+http_query+html_ver+"\r\n";
|
||||
request+="Host: "+http_service->getProxyServer()+":"+convert(http_service->getProxyPort())+"\r\n";
|
||||
request+="Host: "+http_service->getProxyServer()+":"+convert(http_service->getProxyPort())+"\r\n";
|
||||
for(str_map::iterator it=RawPARAMS.begin();it!=RawPARAMS.end();++it)
|
||||
{
|
||||
if(strlower(it->first)!="host")
|
||||
{
|
||||
if(it->first.size()>0)
|
||||
{
|
||||
std::string c=it->first.substr(0,1);
|
||||
strupper(&c);
|
||||
std::string c=it->first.substr(0,1);
|
||||
strupper(&c);
|
||||
request+=c;
|
||||
request+=strlower(it->first.substr(1,it->first.size()-1))+": "+it->second+"\r\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!POSTStr.empty())
|
||||
@ -73,26 +73,26 @@ void CHTTPProxy::operator()(void)
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Server->Log("Starting streaming for url: \""+http_query+"\"");
|
||||
|
||||
Server->Log("Starting streaming for url: \""+http_query+"\"");
|
||||
|
||||
srv->Write(request);
|
||||
|
||||
char *buf=new char[1500];
|
||||
unsigned int nbuffers=0;
|
||||
unsigned int nbuffers=0;
|
||||
size_t rc;
|
||||
while((rc=srv->Read(buf,1500, 30000))>0 )
|
||||
{
|
||||
CBuffer nb(buf, rc);
|
||||
nb.rcount=new int;
|
||||
++nbuffers;
|
||||
++nbuffers;
|
||||
*(nb.rcount)=1;
|
||||
if(notify!=NULL)
|
||||
{
|
||||
IPipe *np;
|
||||
if(notify->Read((char*)&np, sizeof(IPipe*), 0))
|
||||
{
|
||||
Server->Log("New streaming client for url: \""+http_query+"\" "+convert(output.size())+" streaming clients.");
|
||||
Server->Log("New streaming client for url: \""+http_query+"\" "+convert(output.size())+" streaming clients.");
|
||||
output_buffer.push_back(std::queue<CBuffer>());
|
||||
output.push_back(np);
|
||||
sync.push_back(0);
|
||||
@ -131,9 +131,9 @@ void CHTTPProxy::operator()(void)
|
||||
CBuffer b(msg, vv_len);
|
||||
b.rcount=new int;
|
||||
*b.rcount=1;
|
||||
++nbuffers;
|
||||
++nbuffers;
|
||||
output_buffer[j].push(b);
|
||||
Server->Log("Synced client");
|
||||
Server->Log("Synced client");
|
||||
}
|
||||
|
||||
nb.offset=(int)i;
|
||||
@ -158,7 +158,7 @@ void CHTTPProxy::operator()(void)
|
||||
{
|
||||
delete output_buffer[i].front().rcount;
|
||||
delete [] output_buffer[i].front().buf;
|
||||
--nbuffers;
|
||||
--nbuffers;
|
||||
}
|
||||
output_buffer[i].pop();
|
||||
}
|
||||
@ -169,7 +169,7 @@ void CHTTPProxy::operator()(void)
|
||||
}
|
||||
if(output_buffer[i].size()>100000)
|
||||
{
|
||||
Server->Log("Buffer overflow for client. Emptying buffer and resyncing.");
|
||||
Server->Log("Buffer overflow for client. Emptying buffer and resyncing.");
|
||||
while(!output_buffer[i].empty())
|
||||
{
|
||||
--(*output_buffer[i].front().rcount);
|
||||
@ -177,7 +177,7 @@ void CHTTPProxy::operator()(void)
|
||||
{
|
||||
delete output_buffer[i].front().rcount;
|
||||
delete [] output_buffer[i].front().buf;
|
||||
--nbuffers;
|
||||
--nbuffers;
|
||||
}
|
||||
output_buffer[i].pop();
|
||||
}
|
||||
@ -193,7 +193,7 @@ void CHTTPProxy::operator()(void)
|
||||
{
|
||||
if(Server->getTimeMS()-timeouts[i]>10000)
|
||||
{
|
||||
Server->Log("Client timeout");
|
||||
Server->Log("Client timeout");
|
||||
c=true;
|
||||
while(!output_buffer[i].empty())
|
||||
{
|
||||
@ -202,7 +202,7 @@ void CHTTPProxy::operator()(void)
|
||||
{
|
||||
delete output_buffer[i].front().rcount;
|
||||
delete [] output_buffer[i].front().buf;
|
||||
--nbuffers;
|
||||
--nbuffers;
|
||||
}
|
||||
output_buffer[i].pop();
|
||||
}
|
||||
@ -218,23 +218,23 @@ void CHTTPProxy::operator()(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
--(*nb.rcount);
|
||||
if(*nb.rcount<=0)
|
||||
{
|
||||
delete nb.rcount;
|
||||
delete [] nb.buf;
|
||||
--nbuffers;
|
||||
}
|
||||
--(*nb.rcount);
|
||||
if(*nb.rcount<=0)
|
||||
{
|
||||
delete nb.rcount;
|
||||
delete [] nb.buf;
|
||||
--nbuffers;
|
||||
}
|
||||
if(output.empty())
|
||||
{
|
||||
Server->Log("No streaming clients left. nbuffers="+convert(nbuffers));
|
||||
{
|
||||
Server->Log("No streaming clients left. nbuffers="+convert(nbuffers));
|
||||
break;
|
||||
}
|
||||
}
|
||||
buf=new char[1500];
|
||||
}
|
||||
if(rc==0)
|
||||
{
|
||||
Server->Log("Server closed connection.");
|
||||
}
|
||||
if(rc==0)
|
||||
{
|
||||
Server->Log("Server closed connection.");
|
||||
}
|
||||
Server->Log("Streaming done.");
|
||||
}
|
||||
@ -1,21 +1,21 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
**************************************************************************/
|
||||
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
**************************************************************************/
|
||||
|
||||
#include "../vld.h"
|
||||
#include "HTTPService.h"
|
||||
#include "HTTPClient.h"
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,21 +1,21 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
**************************************************************************/
|
||||
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
**************************************************************************/
|
||||
|
||||
#include "../vld.h"
|
||||
#include <stdlib.h>
|
||||
#ifdef _WIN32
|
||||
@ -52,7 +52,7 @@ extern IServer* Server;
|
||||
#endif
|
||||
|
||||
CHTTPService* http_service=NULL;
|
||||
std::vector<std::string> allowed_urls;
|
||||
std::vector<std::string> allowed_urls;
|
||||
|
||||
DLLEXPORT void LoadActions(IServer* pServer)
|
||||
{
|
||||
@ -91,17 +91,17 @@ DLLEXPORT void LoadActions(IServer* pServer)
|
||||
std::string p=Server->getServerParameter("http_port");
|
||||
if(p!="" )
|
||||
port=atoi(p.c_str());
|
||||
|
||||
std::string allow_file=Server->getServerParameter("allowed_urls");
|
||||
if(!allow_file.empty())
|
||||
{
|
||||
std::string data=getFile(allow_file);
|
||||
int lines=linecount(data);
|
||||
for(int i=0;i<lines;++i)
|
||||
{
|
||||
allowed_urls.push_back(getline(i, data));
|
||||
}
|
||||
}
|
||||
|
||||
std::string allow_file=Server->getServerParameter("allowed_urls");
|
||||
if(!allow_file.empty())
|
||||
{
|
||||
std::string data=getFile(allow_file);
|
||||
int lines=linecount(data);
|
||||
for(int i=0;i<lines;++i)
|
||||
{
|
||||
allowed_urls.push_back(getline(i, data));
|
||||
}
|
||||
}
|
||||
|
||||
Server->Log("Starting HTTP-Server on port "+convert(port), LL_INFO);
|
||||
|
||||
@ -115,9 +115,9 @@ DLLEXPORT void UnloadActions(void)
|
||||
return;
|
||||
}
|
||||
|
||||
if(Server->getServerParameter("leak_check")=="true")
|
||||
{
|
||||
CHTTPClient::destroy_mutex();
|
||||
if(Server->getServerParameter("leak_check")=="true")
|
||||
{
|
||||
CHTTPClient::destroy_mutex();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
6
main.cpp
6
main.cpp
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
@ -542,8 +542,8 @@ int main_fkt(int argc, char *argv[])
|
||||
|
||||
Server->Log("Deleting server...");
|
||||
delete Server;
|
||||
|
||||
sqlite3_free(sqlite3_temp_directory);
|
||||
|
||||
sqlite3_free(sqlite3_temp_directory);
|
||||
|
||||
#endif
|
||||
return 0;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
@ -765,11 +765,11 @@ bool FileMetadataDownloadThread::applyOsMetadata( IFile* metadata_f, const std::
|
||||
|
||||
#endif //_WIN32
|
||||
|
||||
|
||||
void FileMetadataDownloadThread::shutdown()
|
||||
{
|
||||
fc.Shutdown();
|
||||
}
|
||||
|
||||
void FileMetadataDownloadThread::shutdown()
|
||||
{
|
||||
fc.Shutdown();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
@ -235,7 +235,7 @@ void InternetClient::doUpdateSettings(void)
|
||||
if( !settings->getValue("internet_mode_enabled_def", &internet_mode_enabled) || internet_mode_enabled=="false" )
|
||||
{
|
||||
Server->destroy(settings);
|
||||
if(Server->getServerParameter("internet_only_mode")=="true")
|
||||
if(Server->getServerParameter("internet_only_mode")=="true")
|
||||
{
|
||||
Server->Log("Internet mode not enabled. Please set \"internet_mode_enabled\" to \"true\".", LL_ERROR);
|
||||
exit(2);
|
||||
@ -255,7 +255,7 @@ void InternetClient::doUpdateSettings(void)
|
||||
if(!settings->getValue("internet_authkey", &authkey) && !settings->getValue("internet_authkey_def", &authkey))
|
||||
{
|
||||
Server->destroy(settings);
|
||||
if(Server->getServerParameter("internet_only_mode")=="true")
|
||||
if(Server->getServerParameter("internet_only_mode")=="true")
|
||||
{
|
||||
Server->Log("Internet authentication key not configured. Please configure \"internet_authkey\".", LL_ERROR);
|
||||
exit(2);
|
||||
@ -302,7 +302,7 @@ void InternetClient::doUpdateSettings(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
if(Server->getServerParameter("internet_only_mode")=="true")
|
||||
if(Server->getServerParameter("internet_only_mode")=="true")
|
||||
{
|
||||
Server->Log("Internet server not configured. Please configure \"internet_server\".", LL_ERROR);
|
||||
exit(2);
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* UrBackup - Client/Server backup system
|
||||
* Copyright (C) 2011-2015 Martin Raiber
|
||||
* Copyright (C) 2011-2016 Martin Raiber
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user