|
From: <ale...@us...> - 2014-07-02 12:57:20
|
Revision: 59811
http://sourceforge.net/p/firebird/code/59811
Author: alexpeshkoff
Date: 2014-07-02 12:57:12 +0000 (Wed, 02 Jul 2014)
Log Message:
-----------
Added first parameter IStatus* to a lot of functions in API interfaces
Modified Paths:
--------------
firebird/trunk/examples/dbcrypt/CryptKeyHolder.cpp
firebird/trunk/examples/dbcrypt/DbCrypt.cpp
firebird/trunk/src/auth/AuthDbg.cpp
firebird/trunk/src/auth/SecureRemotePassword/manage/SrpManagement.cpp
firebird/trunk/src/auth/SecureRemotePassword/server/SrpServer.cpp
firebird/trunk/src/auth/SecurityDatabase/LegacyManagement.epp
firebird/trunk/src/auth/SecurityDatabase/LegacyServer.cpp
firebird/trunk/src/common/Auth.cpp
firebird/trunk/src/common/Auth.h
firebird/trunk/src/common/MsgMetadata.cpp
firebird/trunk/src/common/call_service.cpp
firebird/trunk/src/common/classes/GetPlugins.h
firebird/trunk/src/common/classes/ImplementHelper.h
firebird/trunk/src/common/classes/fb_string.cpp
firebird/trunk/src/common/classes/fb_string.h
firebird/trunk/src/common/security.cpp
firebird/trunk/src/common/security.h
firebird/trunk/src/dsql/DdlNodes.epp
firebird/trunk/src/dsql/dsql.cpp
firebird/trunk/src/include/firebird/Auth.h
firebird/trunk/src/include/firebird/Plugin.h
firebird/trunk/src/include/firebird/Provider.h
firebird/trunk/src/include/firebird/Timer.h
firebird/trunk/src/include/firebird/Utl.h
firebird/trunk/src/isql/show.epp
firebird/trunk/src/jrd/Database.cpp
firebird/trunk/src/jrd/UserManagement.cpp
firebird/trunk/src/jrd/jrd.cpp
firebird/trunk/src/jrd/trace/TraceConfigStorage.cpp
firebird/trunk/src/plugins/udr_engine/UdrEngine.cpp
firebird/trunk/src/remote/client/BlrFromMessage.cpp
firebird/trunk/src/utilities/gsec/gsec.cpp
firebird/trunk/src/yvalve/MasterImplementation.cpp
firebird/trunk/src/yvalve/PluginManager.cpp
firebird/trunk/src/yvalve/PluginManager.h
firebird/trunk/src/yvalve/alt.cpp
firebird/trunk/src/yvalve/utl.cpp
firebird/trunk/src/yvalve/why.cpp
Modified: firebird/trunk/examples/dbcrypt/CryptKeyHolder.cpp
===================================================================
--- firebird/trunk/examples/dbcrypt/CryptKeyHolder.cpp 2014-07-02 12:19:10 UTC (rev 59810)
+++ firebird/trunk/examples/dbcrypt/CryptKeyHolder.cpp 2014-07-02 12:57:12 UTC (rev 59811)
@@ -205,19 +205,22 @@
status->init();
if (key != 0)
- {
return 1;
- }
- IConfig* def = config->getDefaultConfig();
- IConfigEntry* confEntry = def->find("Auto");
+ IConfig* def = config->getDefaultConfig(status);
+ if (!status->isSuccess())
+ return 1;
+
+ IConfigEntry* confEntry = def->find(status, "Auto");
def->release();
+ if (!status->isSuccess())
+ return 1;
if (confEntry)
{
- char v = *(confEntry->getValue());
+ FB_BOOLEAN b = confEntry->getBoolValue();
confEntry->release();
- if (v == '1' || v == 'y' || v == 'Y' || v == 't' || v == 'T')
+ if (b)
{
key = 0x5a;
return 1;
@@ -256,11 +259,19 @@
return &module;
}
- IPluginBase* FB_CARG createPlugin(IPluginConfig* factoryParameter)
+ IPluginBase* FB_CARG createPlugin(IStatus* status, IPluginConfig* factoryParameter)
{
- CryptKeyHolder* p = new CryptKeyHolder(factoryParameter);
- p->addRef();
- return p;
+ try
+ {
+ CryptKeyHolder* p = new CryptKeyHolder(factoryParameter);
+ p->addRef();
+ return p;
+ }
+ catch(const Exception& ex)
+ {
+ ex.stuffException(status);
+ }
+ return NULL;
}
};
Modified: firebird/trunk/examples/dbcrypt/DbCrypt.cpp
===================================================================
--- firebird/trunk/examples/dbcrypt/DbCrypt.cpp 2014-07-02 12:19:10 UTC (rev 59810)
+++ firebird/trunk/examples/dbcrypt/DbCrypt.cpp 2014-07-02 12:57:12 UTC (rev 59811)
@@ -200,9 +200,15 @@
if (key != 0)
return;
- IConfig* def = config->getDefaultConfig();
- IConfigEntry* confEntry = def->find("Auto");
+ IConfig* def = config->getDefaultConfig(status);
+ if (!status->isSuccess())
+ return;
+
+ IConfigEntry* confEntry = def->find(status, "Auto");
def->release();
+ if (!status->isSuccess())
+ return;
+
if (confEntry)
{
char v = *(confEntry->getValue());
@@ -218,14 +224,10 @@
{
ICryptKeyCallback* callback = sources[n]->keyHandle(status, "sample");
if (!status->isSuccess())
- {
return;
- }
if (callback && callback->callback(0, NULL, 1, &key) == 1)
- {
return;
- }
}
key = 0;
@@ -245,11 +247,19 @@
return &module;
}
- IPluginBase* FB_CARG createPlugin(IPluginConfig* factoryParameter)
+ IPluginBase* FB_CARG createPlugin(IStatus* status, IPluginConfig* factoryParameter)
{
- DbCrypt* p = new DbCrypt(factoryParameter);
- p->addRef();
- return p;
+ try
+ {
+ DbCrypt* p = new DbCrypt(factoryParameter);
+ p->addRef();
+ return p;
+ }
+ catch(const Exception& ex)
+ {
+ ex.stuffException(status);
+ }
+ return NULL;
}
};
Modified: firebird/trunk/src/auth/AuthDbg.cpp
===================================================================
--- firebird/trunk/src/auth/AuthDbg.cpp 2014-07-02 12:19:10 UTC (rev 59810)
+++ firebird/trunk/src/auth/AuthDbg.cpp 2014-07-02 12:57:12 UTC (rev 59811)
@@ -28,6 +28,7 @@
#include "firebird.h"
#include "../auth/AuthDbg.h"
#include "../jrd/ibase.h"
+#include "../common/StatusHolder.h"
#ifdef AUTH_DEBUG
@@ -55,9 +56,12 @@
namespace Auth {
DebugServer::DebugServer(Firebird::IPluginConfig* pConf)
- : str(getPool()),
- config(Firebird::REF_NO_INCR, pConf->getDefaultConfig())
-{ }
+ : str(getPool())
+{
+ Firebird::LocalStatus s;
+ config.assignRefNoIncr(pConf->getDefaultConfig(&s));
+ check(&s);
+}
int FB_CARG DebugServer::authenticate(Firebird::IStatus* status, IServerBlock* sb,
IWriter* writerInterface)
@@ -94,14 +98,19 @@
#ifdef AUTH_VERBOSE
fprintf(stderr, "DebugServer::authenticate2: %s\n", str.c_str());
#endif
- writerInterface->add(str.c_str());
+ Firebird::LocalStatus s;
+ writerInterface->add(&s, str.c_str());
+ check(&s);
str.erase();
- Firebird::RefPtr<Firebird::IConfigEntry> group(Firebird::REF_NO_INCR, config->find("GROUP"));
+ Firebird::RefPtr<Firebird::IConfigEntry> group(Firebird::REF_NO_INCR, config->find(&s, "GROUP"));
+ check(&s);
if (group)
{
- writerInterface->add(group->getValue());
- writerInterface->setType("GROUP");
+ writerInterface->add(&s, group->getValue());
+ check(&s);
+ writerInterface->setType(&s, "GROUP");
+ check(&s);
}
return AUTH_SUCCESS;
Modified: firebird/trunk/src/auth/SecureRemotePassword/manage/SrpManagement.cpp
===================================================================
--- firebird/trunk/src/auth/SecureRemotePassword/manage/SrpManagement.cpp 2014-07-02 12:19:10 UTC (rev 59810)
+++ firebird/trunk/src/auth/SecureRemotePassword/manage/SrpManagement.cpp 2014-07-02 12:57:12 UTC (rev 59811)
@@ -56,8 +56,12 @@
{
public:
explicit SrpManagement(Firebird::IPluginConfig* par)
- : config(Firebird::REF_NO_INCR, par->getFirebirdConf()), upCount(0), delCount(0)
- { }
+ : upCount(0), delCount(0)
+ {
+ Firebird::LocalStatus s;
+ config.assignRefNoIncr(par->getFirebirdConf(&s));
+ check(&s);
+ }
private:
void prepareDataStructures()
@@ -497,8 +501,10 @@
stmt->free(status);
check(status);
- user->admin()->set(0);
- user->admin()->setEntered(1);
+ user->admin()->set(status, 0);
+ check(status);
+ user->admin()->setEntered(status, 1);
+ check(status);
grantRevokeAdmin(user, true);
}
catch (const Firebird::Exception&)
@@ -556,18 +562,17 @@
while (rs->fetchNext(status, di.getBuffer()))
{
- check(status);
-
listField(user->userName(), login);
listField(user->firstName(), first);
listField(user->middleName(), middle);
listField(user->lastName(), last);
- listField(status, user->comment(), comment);
- listField(status, user->attributes(), attr);
+ listField(user->comment(), comment);
+ listField(user->attributes(), attr);
listField(user->active(), active);
listField(user->admin(), admin);
- callback->list(user);
+ callback->list(status, user);
+ check(status);
}
check(status);
@@ -796,49 +801,58 @@
static void listField(Auth::ICharUserField* to, Varfield& from)
{
- to->setEntered(from.null ? 0 : 1);
+ Firebird::LocalStatus st;
+ to->setEntered(&st, from.null ? 0 : 1);
+ check(&st);
if (!from.null)
{
- to->set(from);
+ to->set(&st, from);
+ check(&st);
}
}
static void listField(Auth::IIntUserField* to, Boolean& from)
{
- to->setEntered(from.null ? 0 : 1);
+ Firebird::LocalStatus st;
+ to->setEntered(&st, from.null ? 0 : 1);
+ check(&st);
if (!from.null)
{
- to->set(from);
+ to->set(&st, from);
+ check(&st);
}
}
- void listField(Firebird::IStatus* st, Auth::ICharUserField* to, Blob& from)
+ void listField(Auth::ICharUserField* to, Blob& from)
{
- to->setEntered(from.null ? 0 : 1);
+ Firebird::LocalStatus st;
+ to->setEntered(&st, from.null ? 0 : 1);
+ check(&st);
if (!from.null)
{
Firebird::string s;
Firebird::IBlob* blob = NULL;
try
{
- blob = att->openBlob(st, tra, &from);
- check(st);
+ blob = att->openBlob(&st, tra, &from);
+ check(&st);
char segbuf[256];
unsigned len;
- while ( (len = blob->getSegment(st, sizeof(segbuf), segbuf)) )
+ while ( (len = blob->getSegment(&st, sizeof(segbuf), segbuf)) )
{
- if (st->get()[1] != isc_segment)
- check(st);
+ if (st.get()[1] != isc_segment)
+ check(&st);
s.append(segbuf, len);
}
- if (st->get()[1] != isc_segstr_eof)
- check(st);
+ if (st.get()[1] != isc_segstr_eof)
+ check(&st);
- blob->close(st);
- check(st);
+ blob->close(&st);
+ check(&st);
- to->set(s.c_str());
+ to->set(&st, s.c_str());
+ check(&st);
}
catch (const Firebird::Exception&)
{
Modified: firebird/trunk/src/auth/SecureRemotePassword/server/SrpServer.cpp
===================================================================
--- firebird/trunk/src/auth/SecureRemotePassword/server/SrpServer.cpp 2014-07-02 12:19:10 UTC (rev 59810)
+++ firebird/trunk/src/auth/SecureRemotePassword/server/SrpServer.cpp 2014-07-02 12:57:12 UTC (rev 59811)
@@ -57,8 +57,12 @@
: server(NULL), data(getPool()), account(getPool()),
clientPubKey(getPool()), serverPubKey(getPool()),
verifier(getPool()), salt(getPool()), sessionKey(getPool()),
- config(REF_NO_INCR, par->getFirebirdConf()), secDbName(NULL)
- { }
+ secDbName(NULL)
+ {
+ Firebird::LocalStatus s;
+ config.assignRefNoIncr(par->getFirebirdConf(&s));
+ check(&s);
+ }
// IServer implementation
int FB_CARG authenticate(IStatus* status, IServerBlock* sBlock, IWriter* writerInterface);
@@ -266,8 +270,16 @@
if (clientProof == serverProof)
{
MasterInterfacePtr()->upgradeInterface(writerInterface, FB_AUTH_WRITER_VERSION, upInfo);
- writerInterface->add(account.c_str());
- writerInterface->setDb(secDbName);
+ writerInterface->add(status, account.c_str());
+ if (!status->isSuccess())
+ {
+ return AUTH_FAILED;
+ }
+ writerInterface->setDb(status, secDbName);
+ if (!status->isSuccess())
+ {
+ return AUTH_FAILED;
+ }
return AUTH_SUCCESS;
}
}
Modified: firebird/trunk/src/auth/SecurityDatabase/LegacyManagement.epp
===================================================================
--- firebird/trunk/src/auth/SecurityDatabase/LegacyManagement.epp 2014-07-02 12:19:10 UTC (rev 59810)
+++ firebird/trunk/src/auth/SecurityDatabase/LegacyManagement.epp 2014-07-02 12:57:12 UTC (rev 59811)
@@ -40,6 +40,7 @@
#include "../auth/SecurityDatabase/LegacyManagement.h"
#include "../common/classes/ImplementHelper.h"
#include "../common/classes/ClumpletWriter.h"
+#include "../common/StatusHolder.h"
#include "firebird/Plugin.h"
static Firebird::MakeUpgradeInfo<> upInfo;
@@ -105,8 +106,12 @@
namespace Auth {
SecurityDatabaseManagement::SecurityDatabaseManagement(Firebird::IPluginConfig* par)
- : config(Firebird::REF_NO_INCR, par->getFirebirdConf()), database(0), transaction(0)
-{ }
+ : database(0), transaction(0)
+{
+ Firebird::LocalStatus s;
+ config.assignRefNoIncr(par->getFirebirdConf(&s));
+ check(&s);
+}
void FB_CARG SecurityDatabaseManagement::start(Firebird::IStatus* st, ILogonInfo* logonInfo)
{
@@ -535,8 +540,10 @@
if (!ret && !found)
ret = GsecMsg22; // gsec - record not found for user:
- user->admin()->set(0);
- user->admin()->setEntered(1);
+ user->admin()->set(st, 0);
+ check(st);
+ user->admin()->setEntered(st, 1);
+ check(st);
if (ret == 0 && !grantRevokeAdmin(isc_status, database, transaction, user))
{
ret = GsecMsg24;
@@ -550,7 +557,11 @@
found = false;
if (!user->userName()->entered())
{
+ Firebird::LocalStatus s2;
+ Firebird::IStatus* s = st;
FOR (TRANSACTION_HANDLE transaction REQUEST_HANDLE request) U IN PLG$VIEW_USERS
+ try
+ {
{
Firebird::string attr, a1, a2, a3;
@@ -564,22 +575,37 @@
a3.printf("GroupName=%s\n", U.PLG$GROUP_NAME);
attr = a1 + a2 + a3;
- user->attributes()->set(attr.c_str());
- user->attributes()->setEntered(attr.hasData() ? 1 : 0);
+ user->attributes()->set(s, attr.c_str());
+ check(s);
+ user->attributes()->setEntered(s, attr.hasData() ? 1 : 0);
+ check(s);
}
- user->userName()->set(U.PLG$USER_NAME);
- user->userName()->setEntered(U.PLG$USER_NAME.NULL ? 0 : 1);
- user->password()->set("");
- user->password()->setEntered(0);
- user->firstName()->set(U.PLG$FIRST_NAME);
- user->firstName()->setEntered(U.PLG$FIRST_NAME.NULL ? 0 : 1);
- user->middleName()->set(U.PLG$MIDDLE_NAME);
- user->middleName()->setEntered(U.PLG$MIDDLE_NAME.NULL ? 0 : 1);
- user->lastName()->set(U.PLG$LAST_NAME);
- user->lastName()->setEntered(U.PLG$LAST_NAME.NULL ? 0 : 1);
+ user->userName()->set(s, U.PLG$USER_NAME);
+ check(s);
+ user->userName()->setEntered(s, U.PLG$USER_NAME.NULL ? 0 : 1);
+ check(s);
+ user->password()->set(s, "");
+ check(s);
+ user->password()->setEntered(s, 0);
+ check(s);
+ user->firstName()->set(s, U.PLG$FIRST_NAME);
+ check(s);
+ user->firstName()->setEntered(s, U.PLG$FIRST_NAME.NULL ? 0 : 1);
+ check(s);
+ user->middleName()->set(s, U.PLG$MIDDLE_NAME);
+ check(s);
+ user->middleName()->setEntered(s, U.PLG$MIDDLE_NAME.NULL ? 0 : 1);
+ check(s);
+ user->lastName()->set(s, U.PLG$LAST_NAME);
+ check(s);
+ user->lastName()->setEntered(s, U.PLG$LAST_NAME.NULL ? 0 : 1);
+ check(s);
- user->admin()->set(0);
+ user->admin()->set(s, 0);
+ check(s);
+ user->admin()->setEntered(s, 1);
+ check(s);
FOR (TRANSACTION_HANDLE transaction REQUEST_HANDLE request2)
P IN RDB$USER_PRIVILEGES
@@ -587,24 +613,39 @@
P.RDB$RELATION_NAME EQ 'RDB$ADMIN' AND
P.RDB$PRIVILEGE EQ 'M'
{
- user->admin()->set(1);
+ user->admin()->set(s, 1);
}
END_FOR
+ check(s);
- callback->list(user);
+ callback->list(s, user);
+ check(s);
found = true;
+ }
+ catch(const Firebird::Exception& ex)
+ {
+ ex.stuffException(s);
+ s = &s2;
+ }
END_FOR
ON_ERROR
ret = GsecMsg28; // gsec - find/display record error
END_ERROR;
+
+ // real error raise - out of gpre's FOR loop
+ check(st);
}
else
{
Firebird::string attr, a1, a2, a3;
+ Firebird::LocalStatus s2;
+ Firebird::IStatus* s = st;
FOR (TRANSACTION_HANDLE transaction REQUEST_HANDLE request) U IN PLG$VIEW_USERS
WITH U.PLG$USER_NAME EQ user->userName()->get()
+ try
+ {
if (!U.PLG$UID.NULL)
a1.printf("Uid=%d\n", U.PLG$UID);
@@ -615,39 +656,66 @@
a3.printf("GroupName=%s\n", U.PLG$GROUP_NAME);
attr = a1 + a2 + a3;
- user->attributes()->set(attr.c_str());
- user->attributes()->setEntered(attr.hasData() ? 1 : 0);
+ user->attributes()->set(s, attr.c_str());
+ check(s);
+ user->attributes()->setEntered(s, attr.hasData() ? 1 : 0);
+ check(s);
- user->userName()->set(U.PLG$USER_NAME);
- user->userName()->setEntered(U.PLG$USER_NAME.NULL ? 0 : 1);
- user->password()->set("");
- user->password()->setEntered(0);
- user->firstName()->set(U.PLG$FIRST_NAME);
- user->firstName()->setEntered(U.PLG$FIRST_NAME.NULL ? 0 : 1);
- user->middleName()->set(U.PLG$MIDDLE_NAME);
- user->middleName()->setEntered(U.PLG$MIDDLE_NAME.NULL ? 0 : 1);
- user->lastName()->set(U.PLG$LAST_NAME);
- user->lastName()->setEntered(U.PLG$LAST_NAME.NULL ? 0 : 1);
+ user->userName()->set(s, U.PLG$USER_NAME);
+ check(s);
+ user->userName()->setEntered(s, U.PLG$USER_NAME.NULL ? 0 : 1);
+ check(s);
+ user->password()->set(s, "");
+ check(s);
+ user->password()->setEntered(s, 0);
+ check(s);
+ user->firstName()->set(s, U.PLG$FIRST_NAME);
+ check(s);
+ user->firstName()->setEntered(s, U.PLG$FIRST_NAME.NULL ? 0 : 1);
+ check(s);
+ user->middleName()->set(s, U.PLG$MIDDLE_NAME);
+ check(s);
+ user->middleName()->setEntered(s, U.PLG$MIDDLE_NAME.NULL ? 0 : 1);
+ check(s);
+ user->lastName()->set(s, U.PLG$LAST_NAME);
+ check(s);
+ user->lastName()->setEntered(s, U.PLG$LAST_NAME.NULL ? 0 : 1);
+ check(s);
- user->admin()->set(0);
+ user->admin()->set(s, 0);
+ check(s);
+ user->admin()->setEntered(s, 1);
+ check(s);
+
FOR (TRANSACTION_HANDLE transaction REQUEST_HANDLE request2)
P IN RDB$USER_PRIVILEGES
WITH P.RDB$USER EQ U.PLG$USER_NAME AND
P.RDB$RELATION_NAME EQ 'RDB$ADMIN' AND
P.RDB$PRIVILEGE EQ 'M'
{
- user->admin()->set(1);
+ user->admin()->set(s, 1);
}
END_FOR
+ check(s);
- callback->list(user);
+ callback->list(s, user);
+ check(s);
found = true;
+ }
+ catch(const Firebird::Exception& ex)
+ {
+ ex.stuffException(s);
+ s = &s2;
+ }
END_FOR
ON_ERROR
ret = GsecMsg28; // gsec - find/display record error
END_ERROR;
+
+ // real error raise - out of gpre's FOR loop
+ check(st);
}
break;
Modified: firebird/trunk/src/auth/SecurityDatabase/LegacyServer.cpp
===================================================================
--- firebird/trunk/src/auth/SecurityDatabase/LegacyServer.cpp 2014-07-02 12:19:10 UTC (rev 59810)
+++ firebird/trunk/src/auth/SecurityDatabase/LegacyServer.cpp 2014-07-02 12:57:12 UTC (rev 59811)
@@ -349,9 +349,12 @@
}
}
+ LocalStatus s;
MasterInterfacePtr()->upgradeInterface(authBlock, FB_AUTH_WRITER_VERSION, upInfo);
- authBlock->add(login.c_str());
- authBlock->setDb(secureDbName);
+ authBlock->add(&s, login.c_str());
+ check(&s);
+ authBlock->setDb(&s, secureDbName);
+ check(&s);
return AUTH_SUCCESS;
}
@@ -426,7 +429,9 @@
{
if (curInstances[i])
{
- TimerInterfacePtr()->stop(curInstances[i]);
+ LocalStatus s;
+ TimerInterfacePtr()->stop(&s, curInstances[i]);
+ check(&s);
curInstances[i]->release();
curInstances[i] = NULL;
}
@@ -460,7 +465,9 @@
{
PathName secDbName;
{ // config scope
- RefPtr<IFirebirdConf> config(REF_NO_INCR, iParameter->getFirebirdConf());
+ LocalStatus s;
+ RefPtr<IFirebirdConf> config(REF_NO_INCR, iParameter->getFirebirdConf(&s));
+ check(&s);
if (secDbKey == INIT_KEY)
{
@@ -501,10 +508,11 @@
int rc = instance->verify(writerInterface, sBlock);
#define USE_ATT_RQ_CACHE
#ifdef USE_ATT_RQ_CACHE
- TimerInterfacePtr()->start(instance, 10 * 1000 * 1000);
-#else
- instance->handler();
+ LocalStatus s;
+ TimerInterfacePtr()->start(&s, instance, 10 * 1000 * 1000);
+ if (!s.isSuccess())
#endif
+ instance->handler();
return rc;
}
catch (const Firebird::Exception& ex)
Modified: firebird/trunk/src/common/Auth.cpp
===================================================================
--- firebird/trunk/src/common/Auth.cpp 2014-07-02 12:19:10 UTC (rev 59810)
+++ firebird/trunk/src/common/Auth.cpp 2014-07-02 12:57:12 UTC (rev 59811)
@@ -60,18 +60,25 @@
sequence = 0;
}
-void WriterImplementation::add(const char* name)
+void WriterImplementation::add(Firebird::IStatus* st, const char* name)
{
- putLevel();
+ try
+ {
+ putLevel();
- current.clear();
- current.insertString(AuthReader::AUTH_NAME, name);
- fb_assert(plugin.hasData());
- if (plugin.hasData())
+ current.clear();
+ current.insertString(AuthReader::AUTH_NAME, name);
+ fb_assert(plugin.hasData());
+ if (plugin.hasData())
+ {
+ current.insertString(AuthReader::AUTH_PLUGIN, plugin);
+ }
+ type = "USER";
+ }
+ catch(const Firebird::Exception& ex)
{
- current.insertString(AuthReader::AUTH_PLUGIN, plugin);
+ ex.stuffException(st);
}
- type = "USER";
}
void WriterImplementation::setPlugin(const char* m)
@@ -91,20 +98,34 @@
result.insertBytes(sequence++, current.getBuffer(), current.getBufferLength());
}
-void WriterImplementation::setType(const char* value)
+void WriterImplementation::setType(Firebird::IStatus* st, const char* value)
{
- if (value)
- type = value;
+ try
+ {
+ if (value)
+ type = value;
+ }
+ catch(const Firebird::Exception& ex)
+ {
+ ex.stuffException(st);
+ }
}
-void WriterImplementation::setDb(const char* value)
+void WriterImplementation::setDb(Firebird::IStatus* st, const char* value)
{
- if (value)
+ try
{
- PathName target;
- expandDatabaseName(value, target, NULL);
- current.insertPath(AuthReader::AUTH_SECURE_DB, target);
+ if (value)
+ {
+ PathName target;
+ expandDatabaseName(value, target, NULL);
+ current.insertPath(AuthReader::AUTH_SECURE_DB, target);
+ }
}
+ catch(const Firebird::Exception& ex)
+ {
+ ex.stuffException(st);
+ }
}
} // namespace Auth
Modified: firebird/trunk/src/common/Auth.h
===================================================================
--- firebird/trunk/src/common/Auth.h 2014-07-02 12:19:10 UTC (rev 59810)
+++ firebird/trunk/src/common/Auth.h 2014-07-02 12:57:12 UTC (rev 59811)
@@ -49,9 +49,9 @@
// IWriter implementation
void FB_CARG reset();
- void FB_CARG add(const char* name);
- void FB_CARG setType(const char* value);
- void FB_CARG setDb(const char* value);
+ void FB_CARG add(Firebird::IStatus* st, const char* name);
+ void FB_CARG setType(Firebird::IStatus* st, const char* value);
+ void FB_CARG setDb(Firebird::IStatus* st, const char* value);
private:
Firebird::ClumpletWriter current, result;
Modified: firebird/trunk/src/common/MsgMetadata.cpp
===================================================================
--- firebird/trunk/src/common/MsgMetadata.cpp 2014-07-02 12:19:10 UTC (rev 59810)
+++ firebird/trunk/src/common/MsgMetadata.cpp 2014-07-02 12:57:12 UTC (rev 59811)
@@ -270,15 +270,7 @@
}
}
-void check(IStatus* status)
-{
- if (!status->isSuccess())
- {
- status_exception::raise(status->get());
- }
-}
-
// Add an item based on a descriptor.
void MsgMetadata::addItem(const MetaName& name, bool nullable, const dsc& desc)
{
Modified: firebird/trunk/src/common/call_service.cpp
===================================================================
--- firebird/trunk/src/common/call_service.cpp 2014-07-02 12:19:10 UTC (rev 59810)
+++ firebird/trunk/src/common/call_service.cpp 2014-07-02 12:57:12 UTC (rev 59811)
@@ -328,13 +328,15 @@
}
-static void setAttr(Auth::UserData* u)
+static void setAttr(IStatus* status, Auth::UserData* u)
{
string attr;
setAttr(attr, "Uid", &u->u);
setAttr(attr, "Gid", &u->g);
- u->attributes()->setEntered(attr.hasData());
- u->attributes()->set(attr.c_str());
+ u->attributes()->set(status, attr.c_str());
+ if (!status->isSuccess())
+ return;
+ u->attributes()->setEntered(status, attr.hasData());
}
@@ -472,8 +474,11 @@
if (uData.user.get()[0] && callback)
{
- setAttr(&uData);
- callback->list(&uData);
+ LocalStatus status;
+ setAttr(&status, &uData);
+ check(&status);
+ callback->list(&status, &uData);
+ check(&status);
}
}
else
@@ -554,14 +559,20 @@
p += sizeof(USHORT);
f.set(p, len);
- f.setEntered(1);
p += len;
+
+ LocalStatus s;
+ f.setEntered(&s, 1);
+ check(&s);
}
static void parseLong(const char*& p, Auth::IntField& f, size_t& loop)
{
- f.set(isc_vax_integer(p, sizeof(ULONG)));
- f.setEntered(1);
+ LocalStatus s;
+ f.set(&s, isc_vax_integer(p, sizeof(ULONG)));
+ check(&s);
+ f.setEntered(&s, 1);
+ check(&s);
const size_t len2 = sizeof(ULONG) + 1;
if (len2 > loop)
@@ -639,12 +650,16 @@
case isc_spb_sec_username:
if (uData.user.get()[0])
{
+ LocalStatus status;
if (callback)
{
- setAttr(&uData);
- callback->list(&uData);
+ setAttr(&status, &uData);
+ check(&status);
+ callback->list(&status, &uData);
+ check(&status);
}
- uData.clear();
+ uData.clear(&status);
+ check(&status);
}
parseString2(p, uData.user, loop);
break;
Modified: firebird/trunk/src/common/classes/GetPlugins.h
===================================================================
--- firebird/trunk/src/common/classes/GetPlugins.h 2014-07-02 12:19:10 UTC (rev 59810)
+++ firebird/trunk/src/common/classes/GetPlugins.h 2014-07-02 12:57:12 UTC (rev 59811)
@@ -49,13 +49,8 @@
pluginSet.assignRefNoIncr(pluginInterface->getPlugins(&status, interfaceType,
(namesList ? namesList : Config::getDefaultConfig()->getPlugins(interfaceType)),
desiredVersion, ui, NULL));
+ check(&status);
- if (!pluginSet)
- {
- fb_assert(!status.isSuccess());
- status_exception::raise(status.get());
- }
-
getPlugin();
}
@@ -68,13 +63,8 @@
pluginSet.assignRefNoIncr(pluginInterface->getPlugins(&status, interfaceType,
(namesList ? namesList : knownConfig->getPlugins(interfaceType)),
desiredVersion, ui, new FirebirdConf(knownConfig)));
+ check(&status);
- if (!pluginSet)
- {
- fb_assert(!status.isSuccess());
- status_exception::raise(status.get());
- }
-
getPlugin();
}
@@ -104,7 +94,10 @@
{
pluginInterface->releasePlugin(currentPlugin);
currentPlugin = NULL;
- pluginSet->next();
+
+ LocalStatus status;
+ pluginSet->next(&status);
+ check(&status);
getPlugin();
}
}
@@ -116,7 +109,10 @@
pluginInterface->releasePlugin(currentPlugin);
currentPlugin = NULL;
}
- pluginSet->set(newName);
+
+ LocalStatus status;
+ pluginSet->set(&status, newName);
+ check(&status);
getPlugin();
}
@@ -137,7 +133,9 @@
void getPlugin()
{
- currentPlugin = (P*) pluginSet->getPlugin();
+ LocalStatus status;
+ currentPlugin = (P*) pluginSet->getPlugin(&status);
+ check(&status);
}
};
Modified: firebird/trunk/src/common/classes/ImplementHelper.h
===================================================================
--- firebird/trunk/src/common/classes/ImplementHelper.h 2014-07-02 12:19:10 UTC (rev 59810)
+++ firebird/trunk/src/common/classes/ImplementHelper.h 2014-07-02 12:57:12 UTC (rev 59811)
@@ -145,11 +145,19 @@
class SimpleFactoryBase : public AutoIface<IPluginFactory, FB_PLUGIN_FACTORY_VERSION>
{
public:
- IPluginBase* FB_CARG createPlugin(IPluginConfig* factoryParameter)
+ IPluginBase* FB_CARG createPlugin(IStatus* status, IPluginConfig* factoryParameter)
{
- P* p = new P(factoryParameter);
- p->addRef();
- return p;
+ try
+ {
+ P* p = new P(factoryParameter);
+ p->addRef();
+ return p;
+ }
+ catch(const Firebird::Exception& ex)
+ {
+ ex.stuffException(status);
+ }
+ return NULL;
}
};
@@ -357,6 +365,16 @@
};
+// Generic status checker
+inline void check(IStatus* status)
+{
+ if (!status->isSuccess())
+ {
+ status_exception::raise(status->get());
+ }
+}
+
+
// debugger for reference counters
#ifdef DEV_BUILD
Modified: firebird/trunk/src/common/classes/fb_string.cpp
===================================================================
--- firebird/trunk/src/common/classes/fb_string.cpp 2014-07-02 12:19:10 UTC (rev 59810)
+++ firebird/trunk/src/common/classes/fb_string.cpp 2014-07-02 12:57:12 UTC (rev 59811)
@@ -129,7 +129,7 @@
memset(stringBuffer, c, sizeL);
}
- void AbstractString::adjustRange(const size_type length, size_type& pos, size_type& n)
+ void AbstractString::adjustRange(const size_type length, size_type& pos, size_type& n) throw()
{
if (pos == npos) {
pos = length > n ? length - n : 0;
@@ -174,7 +174,7 @@
return stringBuffer + p0;
}
- void AbstractString::baseErase(size_type p0, size_type n)
+ void AbstractString::baseErase(size_type p0, size_type n) throw()
{
adjustRange(length(), p0, n);
memmove(stringBuffer + p0, stringBuffer + p0 + n, stringLength - (p0 + n) + 1);
Modified: firebird/trunk/src/common/classes/fb_string.h
===================================================================
--- firebird/trunk/src/common/classes/fb_string.h 2014-07-02 12:19:10 UTC (rev 59810)
+++ firebird/trunk/src/common/classes/fb_string.h 2014-07-02 12:57:12 UTC (rev 59811)
@@ -151,7 +151,7 @@
stringBuffer[stringLength] = 0;
}
- void shrinkBuffer()
+ void shrinkBuffer() throw()
{
// Shrink buffer if we decide it is beneficial
}
@@ -200,7 +200,7 @@
}
// Trim the range making sure that it fits inside specified length
- static void adjustRange(const size_type length, size_type& pos, size_type& n);
+ static void adjustRange(const size_type length, size_type& pos, size_type& n) throw();
pointer baseAssign(const size_type n);
@@ -208,7 +208,7 @@
pointer baseInsert(const size_type p0, const size_type n);
- void baseErase(size_type p0, size_type n);
+ void baseErase(size_type p0, size_type n) throw();
enum TrimType {TrimLeft, TrimRight, TrimBoth};
@@ -511,17 +511,17 @@
insert(it - c_str(), first, last - first);
}
- AbstractString& erase(size_type p0 = 0, size_type n = npos)
+ AbstractString& erase(size_type p0 = 0, size_type n = npos) throw()
{
baseErase(p0, n);
return *this;
}
- iterator erase(iterator it)
+ iterator erase(iterator it) throw()
{
erase(it - c_str(), 1);
return it;
}
- iterator erase(iterator first, iterator last)
+ iterator erase(iterator first, iterator last) throw()
{
erase(first - c_str(), last - first);
return first;
Modified: firebird/trunk/src/common/security.cpp
===================================================================
--- firebird/trunk/src/common/security.cpp 2014-07-02 12:19:10 UTC (rev 59810)
+++ firebird/trunk/src/common/security.cpp 2014-07-02 12:57:12 UTC (rev 59811)
@@ -52,7 +52,7 @@
}
}
-void FB_CARG UserData::clear()
+void FB_CARG UserData::clear(Firebird::IStatus*)
{
op = 0;
Modified: firebird/trunk/src/common/security.h
===================================================================
--- firebird/trunk/src/common/security.h 2014-07-02 12:19:10 UTC (rev 59810)
+++ firebird/trunk/src/common/security.h 2014-07-02 12:57:12 UTC (rev 59811)
@@ -49,7 +49,7 @@
return s;
}
- void FB_CARG setEntered(int newValue)
+ void FB_CARG setEntered(Firebird::IStatus*, int newValue)
{
e = newValue;
}
@@ -68,20 +68,27 @@
return value.c_str();
}
- void FB_CARG set(const char* newValue)
+ void FB_CARG set(Firebird::IStatus* status, const char* newValue)
{
- value = newValue ? newValue : "";
+ try
+ {
+ value = newValue ? newValue : "";
+ }
+ catch(const Firebird::Exception& ex)
+ {
+ ex.stuffException(status);
+ }
}
- void FB_CARG set(const char* newValue, size_t len)
+ void set(const char* newValue, size_t len)
{
value.assign(newValue, len);
}
- void clear()
+ void clear() throw()
{
e = s = 0;
- value = "";
+ value.erase(); // should not call allocation function - no throw
}
private:
@@ -107,7 +114,7 @@
return s;
}
- void FB_CARG setEntered(int newValue)
+ void FB_CARG setEntered(Firebird::IStatus*, int newValue)
{
e = newValue;
}
@@ -126,12 +133,12 @@
return value;
}
- void FB_CARG set(int newValue)
+ void FB_CARG set(Firebird::IStatus*, int newValue)
{
value = newValue;
}
- void clear()
+ void clear() throw()
{
e = s = 0;
value = 0;
@@ -200,7 +207,7 @@
return &act;
}
- void FB_CARG clear();
+ void FB_CARG clear(Firebird::IStatus* status);
typedef Firebird::Array<UCHAR> AuthenticationBlock;
Modified: firebird/trunk/src/dsql/DdlNodes.epp
===================================================================
--- firebird/trunk/src/dsql/DdlNodes.epp 2014-07-02 12:19:10 UTC (rev 59810)
+++ firebird/trunk/src/dsql/DdlNodes.epp 2014-07-02 12:57:12 UTC (rev 59811)
@@ -9736,6 +9736,29 @@
name.c_str());
}
+
+static void setCharField(Auth::CharField& field, const string* value)
+{
+ if (value)
+ {
+ LocalStatus s;
+ if (value->hasData())
+ {
+ field.set(&s, value->c_str());
+ check(&s);
+ field.setEntered(&s, 1);
+ check(&s);
+ }
+ else
+ {
+ field.setEntered(&s, 0);
+ check(&s);
+ field.setSpecified(1);
+ }
+ }
+}
+
+
void CreateAlterUserNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch, jrd_tra* transaction)
{
if (mode != USER_ADD && !password && !firstName && !middleName && !lastName &&
@@ -9764,10 +9787,14 @@
}
text.upper();
+ Firebird::LocalStatus s;
+
userData->op = mode == USER_ADD ? Auth::ADD_OPER : mode == USER_MOD ?
Auth::MOD_OPER : Auth::ADDMOD_OPER;
- userData->user.set(text.c_str());
- userData->user.setEntered(1);
+ userData->user.set(&s, text.c_str());
+ check(&s);
+ userData->user.setEntered(&s, 1);
+ check(&s);
if (password)
{
@@ -9777,76 +9804,28 @@
status_exception::raise(Arg::PrivateDyn(250));
}
- userData->pass.set(password->c_str());
- userData->pass.setEntered(1);
+ setCharField(userData->pass, password);
}
- if (firstName)
- {
- if (firstName->hasData())
- {
- userData->first.set(firstName->c_str());
- userData->first.setEntered(1);
- }
- else
- {
- userData->first.setEntered(0);
- userData->first.setSpecified(1);
- }
- }
+ setCharField(userData->first, firstName);
+ setCharField(userData->middle, middleName);
+ setCharField(userData->last, lastName);
+ setCharField(userData->com, comment);
- if (middleName)
- {
- if (middleName->hasData())
- {
- userData->middle.set(middleName->c_str());
- userData->middle.setEntered(1);
- }
- else
- {
- userData->middle.setEntered(0);
- userData->middle.setSpecified(1);
- }
- }
-
- if (lastName)
- {
- if (lastName->hasData())
- {
- userData->last.set(lastName->c_str());
- userData->last.setEntered(1);
- }
- else
- {
- userData->last.setEntered(0);
- userData->last.setSpecified(1);
- }
- }
-
- if (comment)
- {
- if (comment->hasData())
- {
- userData->com.set(comment->c_str());
- userData->com.setEntered(1);
- }
- else
- {
- userData->com.setEntered(0);
- userData->com.setSpecified(1);
- }
- }
-
if (adminRole.specified)
{
- userData->adm.set(adminRole.value);
- userData->adm.setEntered(1);
+ userData->adm.set(&s, adminRole.value);
+ check(&s);
+ userData->adm.setEntered(&s, 1);
+ check(&s);
}
if (active.specified)
{
- userData->act.set((int) active.value);
- userData->act.setEntered(1);
+ userData->act.set(&s, (int) active.value);
+ check(&s);
+ userData->act.setEntered(&s, 1);
+ check(&s);
}
string attributesBuffer;
@@ -9863,8 +9842,10 @@
if (attributesBuffer.hasData())
{
- userData->attr.set(attributesBuffer.c_str());
- userData->attr.setEntered(1);
+ userData->attr.set(&s, attributesBuffer.c_str());
+ check(&s);
+ userData->attr.setEntered(&s, 1);
+ check(&s);
}
const int ddlAction = mode == USER_ADD ? DDL_TRIGGER_CREATE_USER : DDL_TRIGGER_ALTER_USER;
@@ -9901,9 +9882,11 @@
string text = name.c_str();
text.upper();
+ Firebird::LocalStatus s;
userData->op = Auth::DEL_OPER;
- userData->user.set(text.c_str());
- userData->user.setEntered(1);
+ userData->user.set(&s, text.c_str());
+ userData->user.setEntered(&s, 1);
+ check(&s);
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE, DDL_TRIGGER_DROP_USER,
userData->user.get());
Modified: firebird/trunk/src/dsql/dsql.cpp
===================================================================
--- firebird/trunk/src/dsql/dsql.cpp 2014-07-02 12:19:10 UTC (rev 59810)
+++ firebird/trunk/src/dsql/dsql.cpp 2014-07-02 12:57:12 UTC (rev 59811)
@@ -90,7 +90,7 @@
static void sql_info(thread_db*, dsql_req*, ULONG, const UCHAR*, ULONG, UCHAR*);
static UCHAR* var_info(const dsql_msg*, const UCHAR*, const UCHAR* const, UCHAR*,
const UCHAR* const, USHORT, bool);
-static void check(IStatus*);
+static void checkD(IStatus*);
static inline bool reqTypeWithCursor(DsqlCompiledStatement::Type type)
{
@@ -1286,7 +1286,7 @@
LocalStatus st;
unsigned count = meta->getCount(&st);
- check(&st);
+ checkD(&st);
if (count != parameters.getCount())
{
@@ -1303,9 +1303,9 @@
for (USHORT index = 0; index < count; index++)
{
unsigned sqlType = meta->getType(&st, index);
- check(&st);
+ checkD(&st);
unsigned sqlLength = meta->getLength(&st, index);
- check(&st);
+ checkD(&st);
dsc desc;
desc.dsc_flags = 0;
@@ -1317,11 +1317,11 @@
desc.dsc_length = dlength;
desc.dsc_scale = meta->getScale(&st, index);
- check(&st);
+ checkD(&st);
desc.dsc_sub_type = meta->getSubType(&st, index);
- check(&st);
+ checkD(&st);
unsigned textType = meta->getCharSet(&st, index);
- check(&st);
+ checkD(&st);
desc.setTextType(textType);
desc.dsc_address = (UCHAR*)(IPTR) dataOffset;
@@ -1357,7 +1357,7 @@
// raise error if one present
-static void check(IStatus* st)
+static void checkD(IStatus* st)
{
if (!st->isSuccess())
{
Modified: firebird/trunk/src/include/firebird/Auth.h
===================================================================
--- firebird/trunk/src/include/firebird/Auth.h 2014-07-02 12:19:10 UTC (rev 59810)
+++ firebird/trunk/src/include/firebird/Auth.h 2014-07-02 12:57:12 UTC (rev 59811)
@@ -46,9 +46,9 @@
{
public:
virtual void FB_CARG reset() = 0;
- virtual void FB_CARG add(const char* name) = 0;
- virtual void FB_CARG setType(const char* value) = 0;
- virtual void FB_CARG setDb(const char* value) = 0;
+ virtual void FB_CARG add(Firebird::IStatus* status, const char* name) = 0;
+ virtual void FB_CARG setType(Firebird::IStatus* status, const char* value) = 0;
+ virtual void FB_CARG setDb(Firebird::IStatus* status, const char* value) = 0;
};
#define FB_AUTH_WRITER_VERSION (FB_VERSIONED_VERSION + 4)
@@ -96,7 +96,7 @@
public:
virtual int FB_CARG entered() = 0;
virtual int FB_CARG specified() = 0;
- virtual void FB_CARG setEntered(int newValue) = 0;
+ virtual void FB_CARG setEntered(Firebird::IStatus* status, int newValue) = 0;
};
#define FB_AUTH_FIELD_VERSION (FB_VERSIONED_VERSION + 3)
@@ -104,7 +104,7 @@
{
public:
virtual const char* FB_CARG get() = 0;
- virtual void FB_CARG set(const char* newValue) = 0;
+ virtual void FB_CARG set(Firebird::IStatus* status, const char* newValue) = 0;
};
#define FB_AUTH_CHAR_FIELD_VERSION (FB_AUTH_FIELD_VERSION + 2)
@@ -112,7 +112,7 @@
{
public:
virtual int FB_CARG get() = 0;
- virtual void FB_CARG set(int newValue) = 0;
+ virtual void FB_CARG set(Firebird::IStatus* status, int newValue) = 0;
};
#define FB_AUTH_INT_FIELD_VERSION (FB_AUTH_FIELD_VERSION + 2)
@@ -134,14 +134,14 @@
virtual IIntUserField* FB_CARG admin() = 0;
- virtual void FB_CARG clear() = 0;
+ virtual void FB_CARG clear(Firebird::IStatus* status) = 0;
};
#define FB_AUTH_USER_VERSION (FB_VERSIONED_VERSION + 11)
class IListUsers : public Firebird::IVersioned
{
public:
- virtual void FB_CARG list(IUser* user) = 0;
+ virtual void FB_CARG list(Firebird::IStatus* status, IUser* user) = 0;
};
#define FB_AUTH_LIST_USERS_VERSION (FB_VERSIONED_VERSION + 1)
Modified: firebird/trunk/src/include/firebird/Plugin.h
===================================================================
--- firebird/trunk/src/include/firebird/Plugin.h 2014-07-02 12:19:10 UTC (rev 59810)
+++ firebird/trunk/src/include/firebird/Plugin.h 2014-07-02 12:57:12 UTC (rev 59811)
@@ -90,9 +90,9 @@
public:
virtual const char* FB_CARG getName() const = 0;
virtual const char* FB_CARG getModuleName() const = 0;
- virtual IPluginBase* FB_CARG getPlugin() = 0;
- virtual void FB_CARG next() = 0;
- virtual void FB_CARG set(const char*) = 0;
+ virtual IPluginBase* FB_CARG getPlugin(IStatus* status) = 0;
+ virtual void FB_CARG next(IStatus* status) = 0;
+ virtual void FB_CARG set(IStatus* status, const char*) = 0;
};
#define FB_PLUGIN_SET_VERSION (FB_REFCOUNTED_VERSION + 5)
@@ -105,9 +105,9 @@
public:
virtual const char* FB_CARG getName() = 0;
virtual const char* FB_CARG getValue() = 0;
- virtual IConfig* FB_CARG getSubConfig() = 0;
virtual ISC_INT64 FB_CARG getIntValue() = 0;
virtual FB_BOOLEAN FB_CARG getBoolValue() = 0;
+ virtual IConfig* FB_CARG getSubConfig(IStatus* status) = 0;
};
#define FB_CONFIG_PARAMETER_VERSION (FB_REFCOUNTED_VERSION + 5)
@@ -115,9 +115,9 @@
class IConfig : public IRefCounted
{
public:
- virtual IConfigEntry* FB_CARG find(const char* name) = 0;
- virtual IConfigEntry* FB_CARG findValue(const char* name, const char* value) = 0;
- virtual IConfigEntry* FB_CARG findPos(const char* name, unsigned int pos) = 0;
+ virtual IConfigEntry* FB_CARG find(IStatus* status, const char* name) = 0;
+ virtual IConfigEntry* FB_CARG findValue(IStatus* status, const char* name, const char* value) = 0;
+ virtual IConfigEntry* FB_CARG findPos(IStatus* status, const char* name, unsigned int pos) = 0;
};
#define FB_CONFIG_VERSION (FB_REFCOUNTED_VERSION + 3)
@@ -144,9 +144,9 @@
{
public:
virtual const char* FB_CARG getConfigFileName() = 0;
- virtual IConfig* FB_CARG getDefaultConfig() = 0;
- virtual IFirebirdConf* FB_CARG getFirebirdConf() = 0;
- virtual void FB_CARG setReleaseDelay(ISC_UINT64 microSeconds) = 0;
+ virtual IConfig* FB_CARG getDefaultConfig(IStatus* status) = 0;
+ virtual IFirebirdConf* FB_CARG getFirebirdConf(IStatus* status) = 0;
+ virtual void FB_CARG setReleaseDelay(IStatus* status, ISC_UINT64 microSeconds) = 0;
};
#define FB_PLUGIN_CONFIG_VERSION (FB_REFCOUNTED_VERSION + 4)
@@ -154,7 +154,7 @@
class IPluginFactory : public IVersioned
{
public:
- virtual IPluginBase* FB_CARG createPlugin(IPluginConfig* factoryParameter) = 0;
+ virtual IPluginBase* FB_CARG createPlugin(IStatus* status, IPluginConfig* factoryParameter) = 0;
};
#define FB_PLUGIN_FACTORY_VERSION (FB_VERSIONED_VERSION + 1)
@@ -195,7 +195,7 @@
const char* namesList, int desiredVersion,
UpgradeInfo* ui, IFirebirdConf* firebirdConf) = 0;
// Get generic config interface for given file
- virtual IConfig* FB_CARG getConfig(const char* filename) = 0;
+ virtual IConfig* FB_CARG getConfig(IStatus* status, const char* filename) = 0;
// Plugins must be released using this function - use of plugin's release()
// will cause resources leak
virtual void FB_CARG releasePlugin(IPluginBase* plugin) = 0;
@@ -216,20 +216,18 @@
typedef void PluginEntrypoint(IMaster* masterInterface);
namespace PluginType {
- static const unsigned int YValve = 1;
- static const unsigned int Provider = 2;
- // leave space for may be some more super-std plugins
- static const unsigned int FirstNonLibPlugin = 11;
- static const unsigned int AuthServer = 11;
- static const unsigned int AuthClient = 12;
- static const unsigned int AuthUserManagement = 13;
- static const unsigned int ExternalEngine = 14;
- static const unsigned int Trace = 15;
- static const unsigned int WireCrypt = 16;
- static const unsigned int DbCrypt = 17;
- static const unsigned int KeyHolder = 18;
+ static const unsigned int Provider = 1;
+ static const unsigned int FirstNonLibPlugin = 2;
+ static const unsigned int AuthServer = 3;
+ static const unsigned int AuthClient = 4;
+ static const unsigned int AuthUserManagement = 5;
+ static const unsigned int ExternalEngine = 6;
+ static const unsigned int Trace = 7;
+ static const unsigned int WireCrypt = 8;
+ static const unsigned int DbCrypt = 9;
+ static const unsigned int KeyHolder = 10;
- static const unsigned int MaxType = 19; // keep in sync please
+ static const unsigned int MaxType = 11; // keep in sync please
}
Modified: firebird/trunk/src/include/firebird/Provider.h
===================================================================
--- firebird/trunk/src/include/firebird/Provider.h 2014-07-02 12:19:10 UTC (rev 59810)
+++ firebird/trunk/src/include/firebird/Provider.h 2014-07-02 12:57:12 UTC (rev 59811)
@@ -41,6 +41,8 @@
class IEventCallback : public IRefCounted
{
public:
+ // eventCallbackFunction is missing error status cause it's always called from places
+ // where an ability to report an error to the user is missing
virtual void FB_CARG eventCallbackFunction(unsigned int length, const unsigned char* events) = 0;
};
#define FB_EVENT_CALLBACK_VERSION (FB_REFCOUNTED_VERSION + 1)
Modified: firebird/trunk/src/include/firebird/Timer.h
===================================================================
--- firebird/trunk/src/include/firebird/Timer.h 2014-07-02 12:19:10 UTC (rev 59810)
+++ firebird/trunk/src/include/firebird/Timer.h 2014-07-02 12:57:12 UTC (rev 59811)
@@ -49,9 +49,9 @@
{
public:
// Set timer
- virtual void FB_CARG start(ITimer* timer, TimerDelay microSeconds) = 0;
+ virtual void FB_CARG start(IStatus* status, ITimer* timer, TimerDelay microSeconds) = 0;
// Stop timer
- virtual void FB_CARG stop(ITimer* timer) = 0;
+ virtual void FB_CARG stop(IStatus* status, ITimer* timer) = 0;
};
#define FB_TIMER_CONTROL_VERSION (FB_VERSIONED_VERSION + 2)
Modified: firebird/trunk/src/include/firebird/Utl.h
===================================================================
--- firebird/trunk/src/include/firebird/Utl.h 2014-07-02 12:19:10 UTC (rev 59810)
+++ firebird/trunk/src/include/firebird/Utl.h 2014-07-02 12:57:12 UTC (rev 59811)
@@ -36,7 +36,7 @@
class IVersionCallback : public IVersioned
{
public:
- virtual void FB_CARG callback(const char* text) = 0;
+ virtual void FB_CARG callback(IStatus* status, const char* text) = 0;
};
#define FB_VERSION_CALLBACK_VERSION (FB_VERSIONED_VERSION + 1)
Modified: firebird/trunk/src/isql/show.epp
===================================================================
--- firebird/trunk/src/isql/show.epp 2014-07-02 12:19:10 UTC (rev 59810)
+++ firebird/trunk/src/isql/show.epp 2014-07-02 12:57:12 UTC (rev 59811)
@@ -125,7 +125,7 @@
{
public:
// IVersionCallback implementation
- void FB_CARG callback(const char* text)
+ void FB_CARG callback(Firebird::IStatus*, const char* text)
{
isqlGlob.printf("%s%s", text, NEWLINE);
}
Modified: firebird/trunk/src/jrd/Database.cpp
===================================================================
--- firebird/trunk/src/jrd/Database.cpp 2014-07-02 12:19:10 UTC (rev 59810)
+++ firebird/trunk/src/jrd/Database.cpp 2014-07-02 12:57:12 UTC (rev 59811)
@@ -339,16 +339,20 @@
{
if (active)
{
- TimerInterfacePtr()->stop(this);
- active = false;
+ Firebird::LocalStatus s;
+ TimerInterfacePtr()->stop(&s, this);
+ if (s.isSuccess())
+ active = false;
}
}
void Database::Linger::set(unsigned seconds)
{
- if (dbb)
+ if (dbb && !active)
{
- TimerInterfacePtr()->start(this, seconds * 1000 * 1000);
+ Firebird::LocalStatus s;
+ TimerInterfacePtr()->start(&s, this, seconds * 1000 * 1000);
+ check(&s);
active = true;
}
}
Modified: firebird/trunk/src/jrd/UserManagement.cpp
===================================================================
--- firebird/trunk/src/jrd/UserManagement.cpp 2014-07-02 12:19:10 UTC (rev 59810)
+++ firebird/trunk/src/jrd/UserManagement.cpp 2014-07-02 12:57:12 UTC (rev 59811)
@@ -217,8 +217,10 @@
{
Auth::StackUserData cmd;
cmd.op = Auth::DIS_OPER;
- cmd.user.set(command->userName()->get());
- cmd.user.setEntered(1);
+ cmd.user.set(&status, command->userName()->get());
+ check(&status);
+ cmd.user.setEntered(&status, 1);
+ check(&status);
class OldAttributes : public Firebird::AutoIface<Auth::IListUsers, FB_AUTH_LIST_USERS_VERSION>
{
@@ -228,10 +230,17 @@
{ }
// IListUsers implementation
- void FB_CARG list(Auth::IUser* data)
+ void FB_CARG list(IStatus* status, Auth::IUser* data)
{
- value = data->attributes()->entered() ? data->attributes()->get() : "";
- present = true;
+ try
+ {
+ value = data->attributes()->entered() ? data->attributes()->get() : "";
+ present = true;
+ }
+ catch(const Firebird::Exception& ex)
+ {
+ ex.stuffException(status);
+ }
}
string value;
@@ -305,13 +314,16 @@
if (merged.hasData())
{
- command->attr.set(merged.c_str());
+ command->attr.set(&status, merged.c_str());
+ check(&status);
}
else
{
- command->attr.setEntered(0);
+ command->attr.setEntered(&status, 0);
+ check(&status);
command->attr.setSpecified(1);
- command->attr.set("");
+ command->attr.set(&status, "");
+ check(&status);
}
}
}
@@ -320,8 +332,10 @@
{
if (!command->act.entered())
{
- command->act.set(1);
- command->act.setEntered(1);
+ command->act.set(&status, 1);
+ check(&status);
+ command->act.setEntered(&status, 1);
+ check(&status);
}
}
@@ -447,10 +461,17 @@
{ }
// IListUsers implementation
- void FB_CARG list(Auth::IUser* user)
+ void FB_CARG list(IStatus* status, Auth::IUser* user)
{
- MasterInterfacePtr()->upgradeInterface(user, FB_AUTH_USER_VERSION, upInfo);
- userManagement->list(user);
+ try
+ {
+ MasterInterfacePtr()->upgradeInterface(user, FB_AUTH_USER_VERSION, upInfo);
+ userManagement->list(user);
+ }
+ catch(const Firebird::Exception& ex)
+ {
+ ex.stuffException(status);
+ }
}
private:
Modified: firebird/trunk/src/jrd/jrd.cpp
===================================================================
--- firebird/trunk/src/jrd/jrd.cpp 2014-07-02 12:19:10 UTC (rev 59810)
+++ firebird/trunk/src/jrd/jrd.cpp 2014-07-02 12:57:12 UTC (rev 59811)
@@ -371,16 +371,24 @@
{
public:
// IPluginFactory implementation
- IPluginBase* FB_CARG createPlugin(IPluginConfig* factoryParameter)
+ IPluginBase* FB_CARG createPlugin(IStatus* status, IPluginConfig* factoryParameter)
{
- if (myModule->unloadStarted())
+ try
{
- return NULL;
+ if (myModule->unloadStarted())
+ {
+ Arg::Gds(isc_shutdown).raise();
+ }
+
+ IPluginBase* p = new JProvider(factoryParameter);
+ p->addRef();
+ return p;
}
-
- IPluginBase* p = new JProvider(factoryParameter);
- p->addRef();
- return p;
+ catch(const Firebird::Exception& ex)
+ {
+ ex.stuffException(status);
+ }
+ return NULL;
}
};
@@ -6405,7 +6413,9 @@
++maxLinger; // avoid rounding errors
time_t t = time(NULL);
- dbb->dbb_plugin_config->setReleaseDelay(maxLinger > t ? (maxLinger - t) * 1000 * 1000 : 0);
+ LocalStatus s;
+ dbb->dbb_plugin_config->setReleaseDelay(&s, maxLinger > t ? (maxLinger - t) * 1000 * 1000 : 0);
+ check(&s);
}
Modified: firebird/trunk/src/jrd/trace/TraceConfigStorage.cpp
===================================================================
--- firebird/trunk/src/jrd/trace/TraceConfigStorage.cpp 2014-07-02 12:19:10 UTC (rev 59810)
+++ firebird/trunk/src/jrd/trace/TraceConfigStorage.cpp 2014-07-02 12:57:12 UTC (rev 59811)
@@ -581,18 +581,24 @@
void FB_CARG ConfigStorage::TouchFile::handler()
{
os_utils::touchFile(fileName);
- TimerInterfacePtr()->start(this, TOUCH_INTERVAL * 1000 * 1000);
+ LocalStatus s;
+ TimerInterfacePtr()->start(&s, this, TOUCH_INTERVAL * 1000 * 1000);
+ // ignore error in handler
}
void ConfigStorage::TouchFile::start(const char* fName)
{
fileName = fName;
- TimerInterfacePtr()->start(this, TOUCH_INTERVAL * 1000 * 1000);
+ LocalStatus s;
+ TimerInterfacePtr()->start(&s, this, TOUCH_INTERVAL * 1000 * 1000);
+ check(&s);
}
void ConfigStorage::TouchFile::stop()
{
- TimerInterfacePtr()->stop(this);
+ LocalStatus s;
+ TimerInterfacePtr()->stop(&s, this);
+ // ignore error in stop timer
}
int FB_CARG ConfigStorage::TouchFile::release()
Modified: firebird/trunk/src/plugins/udr_engine/UdrEngine.cpp
===================================================================
--- firebird/trunk/src/plugins/udr_engine/UdrEngine.cpp 2014-07-02 12:19:10 UTC (rev 59810)
+++ firebird/trunk/src/plugins/udr_engine/UdrEngine.cpp 2014-07-02 12:57:12 UTC (rev 59811)
@@ -86,7 +86,9 @@
procedures(getPool()),
triggers(getPool())
{
- RefPtr<IConfig> defaultConfig(REF_NO_INCR, par->getDefaultConfig());
+ LocalStatus s;
+ RefPtr<IConfig> defaultConfig(REF_NO_INCR, par->getDefaultConfig(&s));
+ check(&s);
if (defaultConfig)
{
@@ -95,10 +97,11 @@
RefPtr<IConfigEntry> icp;
- for (int n = 0; icp.assignRefNoIncr(defaultConfig->findPos("path", n)); ++n)
+ for (int n = 0; icp.assignRefNoIncr(defaultConfig->findPos(&s, "path", n)); ++n)
{
+ check(&s);
+
PathName newPath(icp->getValue());
-
bool found = false;
for (ObjectsArray<PathName>::iterator i = paths->begin(); i != paths->end(); ++i)
Modified: firebird/trunk/src/remote/client/BlrFromMessage.cpp
===================================================================
--- firebird/trunk/src/remote/client/BlrFromMessage.cpp 2014-07-02 12:19:10 UTC (rev 59810)
+++ firebird/trunk/src/remote/client/BlrFromMessage.cpp 2014-07-02 12:57:12 UTC (rev 59811)
@@ -33,19 +33,6 @@
using namespace Firebird;
-namespace
-{
-
-void checkStatus(IStatus* st)
-{
- if (!st->isSuccess())
- {
- status_exception::raise(st->get());
- }
-}
-
-}
-
namespace Remote
{
@@ -79,7 +66,7 @@
LocalStatus st;
expectedMessageLength = metadata->getMessageLength(&st);
- checkStatus(&st);
+ check(&st);
getBlrData().clear();
@@ -100,15 +87,15 @@
for (unsigned i = 0; i < count; ++i)
{
unsigned dtype = metadata->getType(&st, i) & ~1;
- checkStatus(&st);
+ check(&st);
unsigned len = metadata->getLength(&st, i);
- checkStatus(&st);
+ check(&st);
int scale = metadata->getScale(&st, i);
- checkStatus(&st);
+ check(&st);
unsigned charSet = metadata->getCharSet(&st, i);
- checkStatus(&st);
+ check(&st);
int subType = metadata->getSubType(&st, i);
- checkStatus(&st);
+ check(&st);
switch (dtype)
{
Modified: firebird/trunk/src/utilities/gsec/gsec.cpp
===================================================================
--- firebird/trunk/src/utilities/gsec/gsec.cpp 2014-07-02 12:19:10 UTC (rev 59810)
+++ firebird/trunk/src/utilities/gsec/gsec.cpp 2014-07-02 12:57:12 UTC (rev 59811)
@@ -139,8 +139,11 @@
return;
if (from->entered())
{
- to->set(from->get());
- to->setEntered(1);
+ Firebird::LocalStatus s;
+ to->set(&s, from->get());
+ check(&s);
+ to->setEntered(&s, 1);
+ check(&s);
}
}
@@ -223,7 +226,9 @@
{
serverName = "";
}
- user_data->database.set(databaseName.c_str());
+ Firebird::LocalStatus s;
+ user_data->database.set(&s, databaseName.c_str());
+ check(&s);
Firebird::RefPtr<IManagement> manager;
ISC_STATUS_ARRAY status;
@@ -398,8 +403,11 @@
const Parameter* p = findParameter(name);
if (p)
{
- field->set(p->asInteger());
- field->setEntered(1);
+ Firebird::LocalStatus s;
+ field->set(&s, p->asInteger());
+ check(&s);
+ field->setEntered(&s, 1);
+ check(&s);
}
}
};
@@ -412,45 +420,52 @@
{ }
// IListUsers implementation
- void FB_CARG list(IUser* data)
+ void FB_CARG list(Firebird::IStatus* status, IUser* data)
{
- Attributes attr(data);
-
- if (data->active()->entered() && data->active()->get() == 0)
+ try
{
- // skip inactive users
- return;
- }
+ Attributes attr(data);
- if (tdsec->utilSvc->isService())
- {
- tdsec->utilSvc->putLine(isc_spb_sec_username, data->userName()->get());
- tdsec->utilSvc->putLine(isc_spb_sec_firstname, data->firstName()->entered() ? data->firstName()->get() : "");
- tdsec->utilSvc->putLine(isc_spb_sec_middlename, data->middleName()->entered() ? data->middleName()->get() : "");
- tdsec->utilSvc->putLine(isc_spb_sec_lastname, data->lastName()->entered() ? data->lastName()->get() : "");
- tdsec->utilSvc->putSLong(isc_spb_sec_userid, attr["uid"]);
- tdsec->utilSvc->putSLong(isc_spb_sec_groupid, attr["gid"]);
- if (data->operation() == DIS_OPER)
+ if (data->active()->entered() && data->active()->get() == 0)
{
- tdsec->utilSvc->putSLong(isc_spb_sec_admin, data->admin()->get());
+ // skip inactive users
+ return;
}
- }
- else
- {
- if (first)
+
+ if (tdsec->utilSvc->isService())
{
- GSEC_message(GsecMsg26);
- GSEC_message(GsecMsg27);
- // msg26: " user name uid gid admin full name"
- // msg27: "-------------------------------------------------------------------------------------------------"
- first = false;
+ tdsec->utilSvc->putLine(isc_spb_sec_username, data->userName()->get());
+ tdsec->utilSvc->putLine(isc_spb_sec_firstname, data->firstName()->entered() ? data->firstName()->get() : "");
+ tdsec->utilSvc->putLine(isc_spb_sec_middlename, data->middleName()->entered() ? data->middleName()->get() : "");
+ tdsec->utilSvc->putLine(isc_spb_sec_lastname, data->lastName()->entered() ? data->lastName()->get() : "");
+ tdsec->utilSvc->putSLong(isc_spb_sec_userid, attr["uid"]);
+ tdsec->utilSvc->putSLong(isc_spb_sec_groupid, attr["gid"]);
+ if (data->operation() == DIS_OPER)
+ {
+ tdsec->utilSvc->putSLong(isc_spb_sec_admin, data->admin()->get());
+ }
}
+ else
+ {
+ if (first)
+ {
+ GSEC_message(GsecMsg26);
+ GSEC_message(GsecMsg27);
+ // msg26: " user name uid gid admin full name"
+ // msg27: "-------------------------------------------------------------------------------------------------"
+ first = false;
+ }
- util_output(false, "%-*.*s %5d %5d %-5.5s %s %s %s\n",
- USERNAME_LENGTH, USERNAME_LENGTH, data->userName()->get(),
- attr["uid"], attr["gid"], data->admin()->get() ? "admin" : "",
- data->firstName()->get(), data->middleName()->get(), data->lastName()->get());
+ util_output(false, "%-*.*s %5d %5d %-5.5s %s %s %s\n",
+ USERNAME_LENGTH, USERNAME_LENGTH, data->userName()->get(),
+ attr["uid"], attr["gid"], data->admin()->get() ? "admin" : "",
+ data->firstName()->get(), data->middleName()->get(), data->lastName()->get());
+ }
}
+ catch(const Firebird::Exception& ex)
+ {
+ ex.stuffException(status);
+ }
}
private:
@@ -467,12 +482,19 @@
{ }
// IListUsers implementation
- void FB_CARG list(IUser* data)
+ void FB_CARG list(Firebird::IStatus* status, IUser* data)
{
- Attributes attr(data);
+ try
+ {
+ Attributes attr(data);
- attr.set(&u->u, "uid");
- attr.set(&u->g, "gid");
+ attr.set(&u->u, "uid");
+ attr.set(&u->g, "gid");
+ }
+ catch(const Firebird::Exception& ex)
+ {
+ ex.stuffException(status);
+ }
}
private:
@@ -498,8 +520,10 @@
if (user_data->operation() == ADD_OPER)
{
- user_data->act.set(1);
- user_data->act.setEntered(1);
+ user_data->act.set(&s, 1);
+ check(&s);
+ user_data->act.setEntered(&s, 1);
+ check(&s);
}
if (user_data->operation() == MOD_OPER && user_data->userName()->entered() &&
@@ -507,8 +531,10 @@
{
StackUserData u;
u.op = OLD_DIS_OPER;
- u.user.set(user_data->userName()->get());
- u.user.setEntered(1);
+ u.user.set(&s, user_data->userName()->get());
+ check(&s);
+ u.user.setEntered(&s, 1);
+ check(&s);
Callback cb(&u);
ret = manager->execute(&st, &u, &cb);
@@ -539,8 +565,8 @@
setAttr(attr, "uid", &user_data->u);
setAttr(attr, "gid", &user_data->g);
setAttr(attr, "groupName", &user_data->group);
- user_data->attributes()->set(attr.c_str());
- user_data->attributes()->setEntered(attr.hasData() ? 1 : 0);
+ user_data->attributes()->set(&s, attr.c_str());
+ user_data->attributes()->setEntered(&s, attr.hasData() ? 1 : 0);
ret = manager->execute(&st, user_data, &disp);
@@ -581,7 +607,8 @@
{
MOVE_CLEAR(status, sizeof(ISC_STATUS_ARRAY));
// Clear out user data each time through this loop.
- user_data->clear();
+ user_data->...
[truncated message content] |