8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 22:43:03 +01:00
This commit is contained in:
asfernandes 2013-06-28 02:03:10 +00:00
parent 8f71473857
commit 21b23ef28d
11 changed files with 53 additions and 38 deletions

View File

@ -135,7 +135,7 @@ int main()
check(st, "detach");
att = NULL;
}
catch(const char* text)
catch (const char* text)
{
// handle error
rc = 1;

View File

@ -46,8 +46,8 @@ using namespace Firebird;
static IMaster* master = fb_get_master_interface();
int get_input (char* , double*);
static const char *Dept_data[] =
int get_input(char*, double*);
static const char* Dept_data[] =
{"622", "100", "116", "900", 0};
static double Percent_data[] =
{0.05, 1.00, 0.075, 0.10, 0};
@ -82,7 +82,7 @@ int main()
// Interface makes it possible to change format of data or define it yourself
IMetadataBuilder* builder = NULL;
const char *updstr =
const char* updstr =
"UPDATE department SET budget = ? * budget + budget WHERE dept_no = ?";
try
@ -133,14 +133,14 @@ int main()
// locations of parameters in input message
char* dept_no = &buffer[meta->getOffset(st, 1)];
check(st, "getOffset");
double* percent_inc = (double*)&buffer[meta->getOffset(st, 0)];
double* percent_inc = (double*) &buffer[meta->getOffset(st, 0)];
check(st, "getOffset");
// null IDs (set to NOT NULL)
short* flag = (short*)&buffer[meta->getNullOffset(st, 0)];
check(st, "getNullOffset");
*flag = 0;
flag = (short*)&buffer[meta->getNullOffset(st, 1)];
flag = (short*) &buffer[meta->getNullOffset(st, 1)];
check(st, "getNullOffset");
*flag = 0;
@ -192,7 +192,7 @@ int main()
check(st, "detach");
att = NULL;
}
catch(const char* text)
catch (const char* text)
{
// handle error
rc = 1;

View File

@ -190,7 +190,7 @@ int main()
check(st, "detach");
att = NULL;
}
catch(const char* text)
catch (const char* text)
{
// handle error
rc = 1;

View File

@ -60,6 +60,7 @@ struct MyField
int main()
{
int rc = 0;
char s[100];
setenv("ISC_USER", "sysdba", 0);
setenv("ISC_PASSWORD", "masterkey", 0);
@ -112,7 +113,7 @@ int main()
unsigned sub = meta->getSubType(st, j);
check(st, "getSubType");
switch(t)
switch (t)
{
case SQL_BLOB:
if (sub != 1)
@ -127,7 +128,6 @@ int main()
default:
{
char s[100];
sprintf(s, "Unknown type %d for %s", t, meta->getField(st, j));
throw s;
}
@ -183,7 +183,7 @@ int main()
check(st, "detach");
att = NULL;
}
catch(const char* text)
catch (const char* text)
{
rc = 1;
@ -229,7 +229,7 @@ void MyField::print(IStatus* st, IAttachment* att, ITransaction* tra, unsigned c
// IBlob makes it possible to read/write BLOB data
IBlob* blob = NULL;
switch(type)
switch (type)
{
// text fields
case SQL_TEXT:
@ -257,7 +257,7 @@ void MyField::print(IStatus* st, IAttachment* att, ITransaction* tra, unsigned c
try
{
// use attachment's method to access BLOB object
blob = att->openBlob(st, tra, (ISC_QUAD*)(buf + offset));
blob = att->openBlob(st, tra, (ISC_QUAD*) (buf + offset));
check(st, "openBlob");
char segbuf[16];
@ -279,7 +279,7 @@ void MyField::print(IStatus* st, IAttachment* att, ITransaction* tra, unsigned c
blob = NULL;
printf("\n");
}
catch(...)
catch (...)
{
if (blob)
blob->release();

View File

@ -64,7 +64,8 @@ int SrpClient::authenticate(IStatus* status, IClientBlock* cb)
if (!client)
{
HANDSHAKE_DEBUG(fprintf(stderr, "Cli: SRP phase1: login=%s password=%s\n", cb->getLogin(), cb->getPassword()));
HANDSHAKE_DEBUG(fprintf(stderr, "Cli: SRP phase1: login=%s password=%s\n",
cb->getLogin(), cb->getPassword()));
if (!(cb->getLogin() && cb->getPassword()))
{
return AUTH_CONTINUE;

View File

@ -507,7 +507,7 @@ FBUDF_API ISC_TIMESTAMP* addMonth(ISC_TIMESTAMP* v, const ISC_LONG& nmonths)
}
const int ly = times.tm_year + 1900;
const bool leap = (ly % 4 == 0 && ly % 100 != 0) || ly % 400 == 0;
const int md[] = {31, leap ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
const int md[] = {31, (leap ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
if (times.tm_mday > md[times.tm_mon])
times.tm_mday = md[times.tm_mon];
internal::encode_timestamp(&times, v);

View File

@ -3356,7 +3356,7 @@ static processing_state show_functions(const SCHAR* funcname)
}
if (i == 0 && private_flag || i == 1 && !private_flag)
if ((i == 0 && private_flag) || (i == 1 && !private_flag))
continue;
// Strip trailing blanks
@ -3377,7 +3377,7 @@ static processing_state show_functions(const SCHAR* funcname)
}
first_dep = false;
isqlGlob.printf("%s, %s", DEP.RDB$DEPENDED_ON_NAME,
Object_types[DEP.RDB$DEPENDED_ON_TYPE]);
Object_types[DEP.RDB$DEPENDED_ON_TYPE]);
END_FOR
ON_ERROR
ISQL_errmsg (isc_status);
@ -3457,7 +3457,7 @@ static processing_state show_func(const SCHAR* funcname)
fb_utils::exact_name(ARG.RDB$ARGUMENT_NAME);
isqlGlob.printf("%-33s %s ", ARG.RDB$ARGUMENT_NAME,
(ARG.RDB$ARGUMENT_POSITION == FUN.RDB$RETURN_ARGUMENT ? "OUTPUT" : "INPUT"));
(ARG.RDB$ARGUMENT_POSITION == FUN.RDB$RETURN_ARGUMENT ? "OUTPUT" : "INPUT"));
prm_mech_t mechanism = prm_mech_normal;
bool prm_default_source_null = true;

View File

@ -13,7 +13,7 @@ set bulk_insert INSERT INTO FACILITIES (LAST_CHANGE, FACILITY, FAC_CODE, MAX_NUM
('2012-02-18 20:00:00', 'SQLERR', 13, 1033)
('1996-11-07 13:38:42', 'SQLWARN', 14, 613)
('2006-09-10 03:04:31', 'JRD_BUGCHK', 15, 307)
('2009-12-21 04:00:05', 'ISQL', 17, 174)
('2013-06-27 23:00:00', 'ISQL', 17, 174)
('2010-07-10 10:50:30', 'GSEC', 18, 105)
('2012-05-25 19:59:42', 'GSTAT', 21, 56)
('2009-12-18 19:33:34', 'FBSVCMGR', 22, 57)

View File

@ -6180,7 +6180,8 @@ static void authFillParametersBlock(ClntAuthBlock& cBlock, ClumpletWriter& dpb,
{
case Auth::AUTH_SUCCESS:
case Auth::AUTH_MORE_DATA:
HANDSHAKE_DEBUG(fprintf(stderr, "Cli: authFillParametersBlock: plugin %s is OK\n", cBlock.plugins.name()));
HANDSHAKE_DEBUG(fprintf(stderr, "Cli: authFillParametersBlock: plugin %s is OK\n",
cBlock.plugins.name()));
cleanDpb(dpb, tags);
cBlock.extractDataFromPluginTo(dpb, tags, port->port_protocol);
return;
@ -6189,12 +6190,15 @@ static void authFillParametersBlock(ClntAuthBlock& cBlock, ClumpletWriter& dpb,
continue;
case Auth::AUTH_FAILED:
HANDSHAKE_DEBUG(fprintf(stderr, "Cli: authFillParametersBlock: plugin %s FAILED\n", cBlock.plugins.name()));
HANDSHAKE_DEBUG(fprintf(stderr, "Cli: authFillParametersBlock: plugin %s FAILED\n",
cBlock.plugins.name()));
(Arg::Gds(isc_login) << Arg::StatusVector(s.get())).raise();
break; // compiler silencer
}
}
HANDSHAKE_DEBUG(fprintf(stderr, "Cli: authFillParametersBlock: try next plugin, %s skipped\n", cBlock.plugins.name()));
HANDSHAKE_DEBUG(fprintf(stderr, "Cli: authFillParametersBlock: try next plugin, %s skipped\n",
cBlock.plugins.name()));
}
}
@ -6252,8 +6256,9 @@ static void authReceiveResponse(ClntAuthBlock& cBlock, rem_port* port, Rdb* rdb,
d = &packet->p_auth_cont.p_data;
n = &packet->p_auth_cont.p_name;
port->addServerKeys(&packet->p_auth_cont.p_keys);
HANDSHAKE_DEBUG(fprintf(stderr, "Cli: authReceiveResponse: ont_auth d=%d n=%d '%.*s' 0x%x\n", d->cstr_length, n->cstr_length,
n->cstr_length, n->cstr_address, n->cstr_address ? n->cstr_address[0] : 0));
HANDSHAKE_DEBUG(fprintf(stderr, "Cli: authReceiveResponse: ont_auth d=%d n=%d '%.*s' 0x%x\n",
d->cstr_length, n->cstr_length,
n->cstr_length, n->cstr_address, n->cstr_address ? n->cstr_address[0] : 0));
break;
case op_crypt:
@ -7505,13 +7510,15 @@ void ClntAuthBlock::extractDataFromPluginTo(Firebird::ClumpletWriter& dpb,
}
dpb.insertPath(tags->plugin_list, pluginList);
firstTime = false;
HANDSHAKE_DEBUG(fprintf(stderr, "Cli: extractDataFromPluginTo: first time - added plugName & pluginList\n"));
HANDSHAKE_DEBUG(fprintf(stderr,
"Cli: extractDataFromPluginTo: first time - added plugName & pluginList\n"));
}
fb_assert(tags->specific_data);
dpb.insertBytes(tags->specific_data, dataFromPlugin.begin(), dataFromPlugin.getCount());
HANDSHAKE_DEBUG(fprintf(stderr, "Cli: extractDataFromPluginTo: Added %" SIZEFORMAT " bytes of spec data with tag %d\n",
dataFromPlugin.getCount(), tags->specific_data));
HANDSHAKE_DEBUG(fprintf(stderr,
"Cli: extractDataFromPluginTo: Added %" SIZEFORMAT " bytes of spec data with tag %d\n",
dataFromPlugin.getCount(), tags->specific_data));
return;
}
@ -7556,12 +7563,14 @@ void ClntAuthBlock::loadClnt(Firebird::ClumpletWriter& dpb, const ParametersSet*
makeUtfString(uft8Convert, password);
dpb.getString(password);
dpb.deleteClumplet();
HANDSHAKE_DEBUG(fprintf(stderr, "Cli: loadClnt: Loaded from PB password = %s\n", password.c_str()));
HANDSHAKE_DEBUG(fprintf(stderr,
"Cli: loadClnt: Loaded from PB password = %s\n", password.c_str()));
}
else if (t == tags->encrypt_key)
{
hasCryptKey = true;
HANDSHAKE_DEBUG(fprintf(stderr, "Cli: loadClnt: PB contains crypt key - need encrypted line to pass\n"));
HANDSHAKE_DEBUG(fprintf(stderr,
"Cli: loadClnt: PB contains crypt key - need encrypted line to pass\n"));
}
}
}
@ -7591,8 +7600,9 @@ void ClntAuthBlock::extractDataFromPluginTo(P_AUTH_CONT* to)
to->p_list.cstr_length = (ULONG) pluginList.length();
to->p_list.cstr_address = (UCHAR*) pluginList.c_str();
to->p_list.cstr_allocated = 0;
HANDSHAKE_DEBUG(fprintf(stderr, "Cli: extractDataFromPluginTo: added plugin list (%d len) to packet\n",
to->p_list.cstr_length));
HANDSHAKE_DEBUG(fprintf(stderr,
"Cli: extractDataFromPluginTo: added plugin list (%d len) to packet\n",
to->p_list.cstr_length));
firstTime = false;
}
else

View File

@ -376,7 +376,8 @@ public:
// if we asked for more data but received nothing switch to next plugin
bool forceNext = contAuth && (!authPort->port_srv_auth_block->hasDataForPlugin());
HANDSHAKE_DEBUG(fprintf(stderr, "Srv: authenticate: ServerAuth calls plug %s\n", forceNext ? "forced-NEXT" : authItr->name()));
HANDSHAKE_DEBUG(fprintf(stderr, "Srv: authenticate: ServerAuth calls plug %s\n",
forceNext ? "forced-NEXT" : authItr->name()));
int authResult = forceNext ? Auth::AUTH_CONTINUE :
authServer->authenticate(&st, authPort->port_srv_auth_block,
&authPort->port_srv_auth_block->authBlockWriter);
@ -1567,14 +1568,16 @@ static bool accept_connection(rem_port* port, P_CNCT* connect, PACKET* send)
Firebird::ClumpletReader id(Firebird::ClumpletReader::UnTagged,
connect->p_cnct_user_id.cstr_address,
connect->p_cnct_user_id.cstr_length);
HANDSHAKE_DEBUG(fprintf(stderr, "Srv: accept_connection: is going to load data to port_srv_auth_block\n"));
HANDSHAKE_DEBUG(fprintf(stderr,
"Srv: accept_connection: is going to load data to port_srv_auth_block\n"));
port->port_srv_auth_block->load(id);
if (port->port_srv_auth_block->getLogin())
{
port->port_login = port->port_srv_auth_block->getLogin();
}
HANDSHAKE_DEBUG(fprintf(stderr, "Srv: accept_connection: finished with port_srv_auth_block prepare, a=%d\n", accepted));
HANDSHAKE_DEBUG(fprintf(stderr,
"Srv: accept_connection: finished with port_srv_auth_block prepare, a=%d\n", accepted));
if (port->port_srv_auth_block->getPluginName())
{
@ -1585,7 +1588,8 @@ static bool accept_connection(rem_port* port, P_CNCT* connect, PACKET* send)
if (port->port_srv_auth_block->plugins) // We have all required data and iterator was created
{
HANDSHAKE_DEBUG(fprintf(stderr, "Srv: accept_connection: call plugin %s\n", port->port_srv_auth_block->getPluginName()));
HANDSHAKE_DEBUG(fprintf(stderr,
"Srv: accept_connection: call plugin %s\n", port->port_srv_auth_block->getPluginName()));
AuthServerPlugins* const plugins = port->port_srv_auth_block->plugins;
for (; plugins->hasData(); plugins->next())