|
From: <asf...@us...> - 2012-06-03 03:00:32
|
Revision: 54580
http://firebird.svn.sourceforge.net/firebird/?rev=54580&view=rev
Author: asfernandes
Date: 2012-06-03 03:00:24 +0000 (Sun, 03 Jun 2012)
Log Message:
-----------
Misc.
Modified Paths:
--------------
firebird/trunk/examples/dbcrypt/CryptApplication.cpp
firebird/trunk/examples/dbcrypt/CryptKeyHolder.cpp
firebird/trunk/examples/dbcrypt/DbCrypt.cpp
firebird/trunk/src/dsql/DdlNodes.epp
firebird/trunk/src/dsql/DdlNodes.h
firebird/trunk/src/include/firebird/Crypt.h
firebird/trunk/src/isql/isql.epp
firebird/trunk/src/jrd/CryptoManager.cpp
firebird/trunk/src/jrd/CryptoManager.h
firebird/trunk/src/jrd/Database.cpp
Modified: firebird/trunk/examples/dbcrypt/CryptApplication.cpp
===================================================================
--- firebird/trunk/examples/dbcrypt/CryptApplication.cpp 2012-06-02 03:21:48 UTC (rev 54579)
+++ firebird/trunk/examples/dbcrypt/CryptApplication.cpp 2012-06-03 03:00:24 UTC (rev 54580)
@@ -96,7 +96,7 @@
enum Action {NONE, ENC, DEC};
- void Execute(const char* dbName, const Action a)
+ void execute(const char* dbName, const Action a)
{
status->init();
@@ -181,10 +181,12 @@
if (ac < 2 || ac > 3)
return usage();
+
if (ac == 3)
{
if (av[1][0] != '-')
return usage();
+
switch(av[1][1])
{
case 'e':
@@ -205,9 +207,9 @@
App app;
try
{
- app.Execute(av[1], act);
+ app.execute(av[1], act);
}
- catch(const char* where)
+ catch (const char* where)
{
app.print(where);
return 1;
Modified: firebird/trunk/examples/dbcrypt/CryptKeyHolder.cpp
===================================================================
--- firebird/trunk/examples/dbcrypt/CryptKeyHolder.cpp 2012-06-02 03:21:48 UTC (rev 54579)
+++ firebird/trunk/examples/dbcrypt/CryptKeyHolder.cpp 2012-06-03 03:00:24 UTC (rev 54580)
@@ -195,7 +195,7 @@
vector[0] = isc_arg_gds;
vector[1] = isc_random;
vector[2] = isc_arg_string;
- vector[3] = (ISC_STATUS)"Key not set";
+ vector[3] = (ISC_STATUS) "Key not set";
vector[4] = isc_arg_end;
status->set(vector);
}
@@ -212,6 +212,7 @@
IConfig* def = config->getDefaultConfig();
IConfigEntry* confEntry = def->find("Auto");
def->release();
+
if (confEntry)
{
char v = *(confEntry->getValue());
@@ -267,7 +268,7 @@
} // anonymous namespace
-extern "C" void FB_PLUGIN_ENTRY_POINT(Firebird::IMaster* m)
+extern "C" void FB_PLUGIN_ENTRY_POINT(IMaster* m)
{
master = m;
pluginManager = master->getPluginManager();
Modified: firebird/trunk/examples/dbcrypt/DbCrypt.cpp
===================================================================
--- firebird/trunk/examples/dbcrypt/DbCrypt.cpp 2012-06-02 03:21:48 UTC (rev 54579)
+++ firebird/trunk/examples/dbcrypt/DbCrypt.cpp 2012-06-03 03:00:24 UTC (rev 54580)
@@ -124,7 +124,7 @@
return &module;
}
- void FB_CARG setOwner(Firebird::IRefCounted* o)
+ void FB_CARG setOwner(IRefCounted* o)
{
owner = o;
}
@@ -167,7 +167,8 @@
const UCHAR* f = static_cast<const UCHAR*>(from);
UCHAR* t = static_cast<UCHAR*>(to);
- while(length--)
+
+ while (length--)
{
*t++ = (*f++) + key;
}
@@ -185,7 +186,8 @@
const UCHAR* f = static_cast<const UCHAR*>(from);
UCHAR* t = static_cast<UCHAR*>(to);
- while(length--)
+
+ while (length--)
{
*t++ = (*f++) - key;
}
@@ -255,12 +257,11 @@
} // anonymous namespace
-extern "C" void FB_PLUGIN_ENTRY_POINT(Firebird::IMaster* m)
+extern "C" void FB_PLUGIN_ENTRY_POINT(IMaster* m)
{
master = m;
pluginManager = master->getPluginManager();
module.registerMe();
- pluginManager->registerPluginFactory(PluginType::DbCrypt, "DbCrypt_example",
- &factory);
+ pluginManager->registerPluginFactory(PluginType::DbCrypt, "DbCrypt_example", &factory);
}
Modified: firebird/trunk/src/dsql/DdlNodes.epp
===================================================================
--- firebird/trunk/src/dsql/DdlNodes.epp 2012-06-02 03:21:48 UTC (rev 54579)
+++ firebird/trunk/src/dsql/DdlNodes.epp 2012-06-03 03:00:24 UTC (rev 54580)
@@ -9947,14 +9947,10 @@
status_exception::raise(Arg::Gds(isc_adm_task_denied));
if (cryptPlugin.hasData())
- {
DFW_post_work(transaction, dfw_db_crypt, cryptPlugin.c_str(), 0);
- }
if (clauses & CLAUSE_DECRYPT)
- {
DFW_post_work(transaction, dfw_db_crypt, "", 0);
- }
if (!(clauses & RDB_DATABASE_MASK))
{
Modified: firebird/trunk/src/dsql/DdlNodes.h
===================================================================
--- firebird/trunk/src/dsql/DdlNodes.h 2012-06-02 03:21:48 UTC (rev 54579)
+++ firebird/trunk/src/dsql/DdlNodes.h 2012-06-03 03:00:24 UTC (rev 54580)
@@ -1950,12 +1950,13 @@
class AlterDatabaseNode : public DdlNode
{
public:
- static const unsigned CLAUSE_BEGIN_BACKUP = 0x01;
- static const unsigned CLAUSE_END_BACKUP = 0x02;
- static const unsigned CLAUSE_DROP_DIFFERENCE = 0x04;
- static const unsigned CLAUSE_DECRYPT = 0x08;
+ static const unsigned CLAUSE_BEGIN_BACKUP = 0x01;
+ static const unsigned CLAUSE_END_BACKUP = 0x02;
+ static const unsigned CLAUSE_DROP_DIFFERENCE = 0x04;
+ static const unsigned CLAUSE_DECRYPT = 0x08;
- static const unsigned RDB_DATABASE_MASK = CLAUSE_BEGIN_BACKUP | CLAUSE_END_BACKUP | CLAUSE_DROP_DIFFERENCE;
+ static const unsigned RDB_DATABASE_MASK =
+ CLAUSE_BEGIN_BACKUP | CLAUSE_END_BACKUP | CLAUSE_DROP_DIFFERENCE;
public:
AlterDatabaseNode(MemoryPool& p)
Modified: firebird/trunk/src/include/firebird/Crypt.h
===================================================================
--- firebird/trunk/src/include/firebird/Crypt.h 2012-06-02 03:21:48 UTC (rev 54579)
+++ firebird/trunk/src/include/firebird/Crypt.h 2012-06-03 03:00:24 UTC (rev 54580)
@@ -30,9 +30,9 @@
// Part 1. Network crypt.
// Plugins of this type are used to crypt data, sent over the wire
-// Plugin must support encrypt and decrypt operations
+// Plugin must support encrypt and decrypt operations.
// Interface of plugin is the same for both client and server,
-// and it may have differerent or same implementations for client and server
+// and it may have different or same implementations for client and server.
class IWireCryptPlugin : public IPluginBase
{
public:
@@ -49,7 +49,7 @@
// Part 2. Database crypt.
// This interface is used to transfer some data (related with crypt keys)
-// between different components of firebird
+// between different components of firebird.
class ICryptKeyCallback : public IVersioned
{
public:
@@ -61,16 +61,16 @@
// Key holder accepts key(s) from attachment at database attach time
// (or gets them it some other arbitrary way)
-// and sends it to database crypt plugin on request
+// and sends it to database crypt plugin on request.
class IKeyHolderPlugin : public IPluginBase
{
public:
// keyCallback() is called when new attachment is probably ready to provide keys
- // to key holder plugin, ICryptKeyCallback interface is provided by attachment
+ // to key holder plugin, ICryptKeyCallback interface is provided by attachment.
virtual int FB_CARG keyCallback(IStatus* status, ICryptKeyCallback* callback) = 0;
- // Crypt plugin calls keyHandle() whne it needs a key, stored in key holder
- // Key is not returned directly - instead of it callback interface is returned
- // Missing key with given name is not an error condition for keyHandle()
+ // Crypt plugin calls keyHandle() when it needs a key, stored in key holder.
+ // Key is not returned directly - instead of it callback interface is returned.
+ // Missing key with given name is not an error condition for keyHandle().
// It should just return NULL in this case
virtual ICryptKeyCallback* FB_CARG keyHandle(IStatus* status, const char* keyName) = 0;
};
@@ -81,10 +81,10 @@
{
public:
// When database crypt plugin is loaded, setKey() is called to provide information
- // about key holders, available for givaen database
+ // about key holders, available for a given database.
// It's supposed that crypt plugin will invoke keyHandle() function from them
- // to access callback interface for getting actual crypt key
- // If crypt plugin fails to find appropriate key in sources, it should raise error
+ // to access callback interface for getting actual crypt key.
+ // If crypt plugin fails to find appropriate key in sources, it should raise error.
virtual void FB_CARG setKey(IStatus* status, unsigned int length, IKeyHolderPlugin** sources) = 0;
virtual void FB_CARG encrypt(IStatus* status, unsigned int length, const void* from, void* to) = 0;
virtual void FB_CARG decrypt(IStatus* status, unsigned int length, const void* from, void* to) = 0;
Modified: firebird/trunk/src/isql/isql.epp
===================================================================
--- firebird/trunk/src/isql/isql.epp 2012-06-02 03:21:48 UTC (rev 54579)
+++ firebird/trunk/src/isql/isql.epp 2012-06-03 03:00:24 UTC (rev 54580)
@@ -221,7 +221,8 @@
if (len > width)
len = width;
- if (right) {
+ if (right)
+ {
memcpy(buffer + width - len, str, len);
if (width > len)
memset(buffer, ' ', width - len);
Modified: firebird/trunk/src/jrd/CryptoManager.cpp
===================================================================
--- firebird/trunk/src/jrd/CryptoManager.cpp 2012-06-02 03:21:48 UTC (rev 54579)
+++ firebird/trunk/src/jrd/CryptoManager.cpp 2012-06-03 03:00:24 UTC (rev 54580)
@@ -17,7 +17,7 @@
* The Original Code was created by Alex Peshkov
* for the Firebird Open Source RDBMS project.
*
- * Copyright (c) 2008 Alex Peshkov <peshkoff at mail.ru>
+ * Copyright (c) 2012 Alex Peshkov <peshkoff at mail.ru>
* and all contributors signed below.
*
* All Rights Reserved.
@@ -65,7 +65,7 @@
THREAD_ENTRY_DECLARE cryptThreadStatic(THREAD_ENTRY_PARAM p)
{
- Jrd::CryptoManager* cryptoManager = (Jrd::CryptoManager*)p;
+ Jrd::CryptoManager* cryptoManager = (Jrd::CryptoManager*) p;
cryptoManager->cryptThread();
return 0;
@@ -93,7 +93,7 @@
void depends(Stack<ULONG>& pages)
{
- while(pages.hasData())
+ while (pages.hasData())
{
CCH_precedence(tdbb, &window, pages.pop());
}
@@ -235,6 +235,7 @@
}
bool newCryptState = plugName.hasData();
+
{ // window scope
Header hdr(tdbb, LCK_write);
@@ -442,7 +443,7 @@
// Release exclusive lock on StartCryptThread
LCK_release(tdbb, threadLock);
}
- catch(const Exception&)
+ catch (const Exception&)
{
try
{
@@ -452,13 +453,13 @@
// Release exclusive lock on StartCryptThread
LCK_release(tdbb, threadLock);
}
- catch(const Exception&)
+ catch (const Exception&)
{ }
throw;
}
}
- catch(const Exception& ex)
+ catch (const Exception& ex)
{
// Error during context creation - we can't even release lock
iscLogException("Crypt thread:", ex);
@@ -485,7 +486,7 @@
{
return bdb->bdb_bcb->bcb_database->dbb_crypto_manager->read(file, bdb, page, sv);
}
- catch(const Exception& ex)
+ catch (const Exception& ex)
{
ex.stuff_exception(sv);
}
@@ -498,7 +499,7 @@
{
return bdb->bdb_bcb->bcb_database->dbb_crypto_manager->write(file, bdb, page, sv);
}
- catch(const Exception& ex)
+ catch (const Exception& ex)
{
ex.stuff_exception(sv);
}
@@ -516,7 +517,7 @@
{
if (!cryptPlugin)
{
- // We are invoked from shared cache manager, i.e. no valid attachment in tdbb
+ // We are invoked from shared cache manager, i.e. no valid attachment in tdbb
// Therefore create system temporary attachment like in crypt thread to be able to work with locks
UserId user;
user.usr_user_name = "(Crypt plugin loader)";
@@ -593,7 +594,7 @@
int CryptoManager::blockingAstChangeCryptState(void* object)
{
- ((CryptoManager*)object)->blockingAstChangeCryptState();
+ ((CryptoManager*) object)->blockingAstChangeCryptState();
return 0;
}
Modified: firebird/trunk/src/jrd/CryptoManager.h
===================================================================
--- firebird/trunk/src/jrd/CryptoManager.h 2012-06-02 03:21:48 UTC (rev 54579)
+++ firebird/trunk/src/jrd/CryptoManager.h 2012-06-03 03:00:24 UTC (rev 54580)
@@ -64,9 +64,10 @@
{
public:
CryptoManager(thread_db* tdbb);
- void shutdown(thread_db* tdbb);
~CryptoManager();
+ void shutdown(thread_db* tdbb);
+
void changeCryptState(thread_db* tdbb, const Firebird::string& plugName);
void attach(thread_db* tdbb, Attachment* att);
void detach(thread_db* tdbb, Attachment* att);
Modified: firebird/trunk/src/jrd/Database.cpp
===================================================================
--- firebird/trunk/src/jrd/Database.cpp 2012-06-02 03:21:48 UTC (rev 54579)
+++ firebird/trunk/src/jrd/Database.cpp 2012-06-03 03:00:24 UTC (rev 54580)
@@ -146,7 +146,8 @@
if (!counter->lock)
{
- Lock* const lock = FB_NEW_RPT(*dbb->dbb_permanent, sizeof(SLONG)) Lock(tdbb, LCK_shared_counter, counter, blockingAst);
+ Lock* const lock = FB_NEW_RPT(*dbb->dbb_permanent, sizeof(SLONG))
+ Lock(tdbb, LCK_shared_counter, counter, blockingAst);
counter->lock = lock;
lock->lck_length = sizeof(SLONG);
lock->lck_key.lck_long = space;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|