mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 22:03:03 +01:00
Style.
This commit is contained in:
parent
c0adc2575c
commit
72293a7f69
@ -173,7 +173,8 @@ int alice(Firebird::UtilSvc* uSvc)
|
||||
for (table = alice_in_sw_table; true; ++table)
|
||||
{
|
||||
const TEXT* p = (TEXT*) table->in_sw_name;
|
||||
if (!p) {
|
||||
if (!p)
|
||||
{
|
||||
ALICE_print(2, SafeArg() << (*--argv)); // msg 2: invalid switch %s
|
||||
error = true;
|
||||
break;
|
||||
@ -193,7 +194,8 @@ int alice(Firebird::UtilSvc* uSvc)
|
||||
if (*table->in_sw_name == 'x') {
|
||||
tdgbl->ALICE_data.ua_debug++;
|
||||
}
|
||||
if (table->in_sw_value & sw_trusted_svc) {
|
||||
if (table->in_sw_value & sw_trusted_svc)
|
||||
{
|
||||
uSvc->checkService();
|
||||
if (--argc <= 0) {
|
||||
ALICE_error(13); // msg 13: user name required
|
||||
@ -201,13 +203,15 @@ int alice(Firebird::UtilSvc* uSvc)
|
||||
tdgbl->ALICE_data.ua_tr_user = *argv++;
|
||||
continue;
|
||||
}
|
||||
if (table->in_sw_value & sw_trusted_role) {
|
||||
if (table->in_sw_value & sw_trusted_role)
|
||||
{
|
||||
uSvc->checkService();
|
||||
tdgbl->ALICE_data.ua_tr_role = true;
|
||||
continue;
|
||||
}
|
||||
#ifdef TRUSTED_AUTH
|
||||
if (table->in_sw_value & sw_trusted_auth) {
|
||||
if (table->in_sw_value & sw_trusted_auth)
|
||||
{
|
||||
tdgbl->ALICE_data.ua_trusted = true;
|
||||
continue;
|
||||
}
|
||||
@ -240,7 +244,8 @@ int alice(Firebird::UtilSvc* uSvc)
|
||||
found = false;
|
||||
// Consume argument only if we identified mode
|
||||
// Let's hope that database with names of modes above are unusual
|
||||
if (found) {
|
||||
if (found)
|
||||
{
|
||||
argv++;
|
||||
argc--;
|
||||
}
|
||||
@ -248,7 +253,8 @@ int alice(Firebird::UtilSvc* uSvc)
|
||||
|
||||
#ifdef DEV_BUILD
|
||||
/*
|
||||
if (table->in_sw_value & sw_begin_log) {
|
||||
if (table->in_sw_value & sw_begin_log)
|
||||
{
|
||||
if (--argc <= 0) {
|
||||
ALICE_error(5); // msg 5: replay log pathname required
|
||||
}
|
||||
@ -257,7 +263,8 @@ int alice(Firebird::UtilSvc* uSvc)
|
||||
*/
|
||||
#endif
|
||||
|
||||
if (table->in_sw_value & sw_buffers) {
|
||||
if (table->in_sw_value & sw_buffers)
|
||||
{
|
||||
if (--argc <= 0) {
|
||||
ALICE_error(6); // msg 6: number of page buffers for cache required
|
||||
}
|
||||
@ -271,7 +278,8 @@ int alice(Firebird::UtilSvc* uSvc)
|
||||
}
|
||||
}
|
||||
|
||||
if (table->in_sw_value & sw_housekeeping) {
|
||||
if (table->in_sw_value & sw_housekeeping)
|
||||
{
|
||||
if (--argc <= 0) {
|
||||
ALICE_error(9); // msg 9: number of transactions per sweep required
|
||||
}
|
||||
@ -285,15 +293,15 @@ int alice(Firebird::UtilSvc* uSvc)
|
||||
}
|
||||
}
|
||||
|
||||
if (table->in_sw_value & sw_set_db_dialect) {
|
||||
if (table->in_sw_value & sw_set_db_dialect)
|
||||
{
|
||||
if (--argc <= 0) {
|
||||
ALICE_error(113); // msg 113: dialect number required
|
||||
}
|
||||
|
||||
ALICE_down_case(*argv++, string, sizeof(string));
|
||||
|
||||
if ((!(tdgbl->ALICE_data.ua_db_SQL_dialect = atoi(string))) &&
|
||||
(strcmp(string, "0")))
|
||||
if ((!(tdgbl->ALICE_data.ua_db_SQL_dialect = atoi(string))) && (strcmp(string, "0")))
|
||||
{
|
||||
ALICE_error(7); // msg 7: numeric value required
|
||||
}
|
||||
@ -306,12 +314,14 @@ int alice(Firebird::UtilSvc* uSvc)
|
||||
// }
|
||||
}
|
||||
|
||||
if (table->in_sw_value & (sw_commit | sw_rollback | sw_two_phase)) {
|
||||
if (table->in_sw_value & (sw_commit | sw_rollback | sw_two_phase))
|
||||
{
|
||||
if (--argc <= 0) {
|
||||
ALICE_error(10); // msg 10: transaction number or "all" required
|
||||
}
|
||||
ALICE_down_case(*argv++, string, sizeof(string));
|
||||
if (!(tdgbl->ALICE_data.ua_transaction = atoi(string))) {
|
||||
if (!(tdgbl->ALICE_data.ua_transaction = atoi(string)))
|
||||
{
|
||||
if (strcmp(string, "all")) {
|
||||
ALICE_error(10); // msg 10: transaction number or "all" required
|
||||
}
|
||||
@ -321,7 +331,8 @@ int alice(Firebird::UtilSvc* uSvc)
|
||||
}
|
||||
}
|
||||
|
||||
if (table->in_sw_value & sw_write) {
|
||||
if (table->in_sw_value & sw_write)
|
||||
{
|
||||
if (--argc <= 0) {
|
||||
ALICE_error(11); // msg 11: "sync" or "async" required
|
||||
}
|
||||
@ -337,7 +348,8 @@ int alice(Firebird::UtilSvc* uSvc)
|
||||
}
|
||||
}
|
||||
|
||||
if (table->in_sw_value & sw_no_reserve) {
|
||||
if (table->in_sw_value & sw_no_reserve)
|
||||
{
|
||||
if (--argc <= 0) {
|
||||
ALICE_error(12); // msg 12: "full" or "reserve" required
|
||||
}
|
||||
@ -353,14 +365,16 @@ int alice(Firebird::UtilSvc* uSvc)
|
||||
}
|
||||
}
|
||||
|
||||
if (table->in_sw_value & sw_user) {
|
||||
if (table->in_sw_value & sw_user)
|
||||
{
|
||||
if (--argc <= 0) {
|
||||
ALICE_error(13); // msg 13: user name required
|
||||
}
|
||||
tdgbl->ALICE_data.ua_user = *argv++;
|
||||
}
|
||||
|
||||
if (table->in_sw_value & sw_password) {
|
||||
if (table->in_sw_value & sw_password)
|
||||
{
|
||||
if (--argc <= 0) {
|
||||
ALICE_error(14); // msg 14: password required
|
||||
}
|
||||
@ -393,7 +407,8 @@ int alice(Firebird::UtilSvc* uSvc)
|
||||
++argv;
|
||||
}
|
||||
|
||||
if (table->in_sw_value & sw_disable) {
|
||||
if (table->in_sw_value & sw_disable)
|
||||
{
|
||||
if (--argc <= 0) {
|
||||
ALICE_error(15); // msg 15: subsystem name
|
||||
}
|
||||
@ -403,7 +418,8 @@ int alice(Firebird::UtilSvc* uSvc)
|
||||
}
|
||||
}
|
||||
|
||||
if (table->in_sw_value & (sw_attach | sw_force | sw_tran | sw_cache)) {
|
||||
if (table->in_sw_value & (sw_attach | sw_force | sw_tran | sw_cache))
|
||||
{
|
||||
if (--argc <= 0) {
|
||||
ALICE_error(17); // msg 17: number of seconds required
|
||||
}
|
||||
@ -419,7 +435,8 @@ int alice(Firebird::UtilSvc* uSvc)
|
||||
}
|
||||
}
|
||||
|
||||
if (table->in_sw_value & sw_mode) {
|
||||
if (table->in_sw_value & sw_mode)
|
||||
{
|
||||
if (--argc <= 0) {
|
||||
ALICE_error(110); // msg 110: "read_only" or "read_write" required
|
||||
}
|
||||
@ -503,17 +520,21 @@ int alice(Firebird::UtilSvc* uSvc)
|
||||
{
|
||||
bool any_error = false;
|
||||
|
||||
for (int i = 0; i < MAX_VAL_ERRORS; ++i) {
|
||||
if (ua_val_errors[i]) {
|
||||
for (int i = 0; i < MAX_VAL_ERRORS; ++i)
|
||||
{
|
||||
if (ua_val_errors[i])
|
||||
{
|
||||
any_error = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (any_error) {
|
||||
if (any_error)
|
||||
{
|
||||
ALICE_print(24); // msg 24: Summary of validation errors\n
|
||||
|
||||
for (int i = 0; i < MAX_VAL_ERRORS; ++i) {
|
||||
for (int i = 0; i < MAX_VAL_ERRORS; ++i)
|
||||
{
|
||||
if (ua_val_errors[i]) {
|
||||
ALICE_print(val_err_table[i], SafeArg() << ua_val_errors[i]);
|
||||
}
|
||||
@ -522,7 +543,8 @@ int alice(Firebird::UtilSvc* uSvc)
|
||||
}
|
||||
}
|
||||
|
||||
if (ret == FINI_ERROR) {
|
||||
if (ret == FINI_ERROR)
|
||||
{
|
||||
ALICE_print_status(tdgbl->status);
|
||||
ALICE_exit(FINI_ERROR, tdgbl);
|
||||
}
|
||||
|
@ -177,7 +177,8 @@ tdr* MET_get_transaction(ISC_STATUS* user_status, isc_db_handle handle, SLONG id
|
||||
|
||||
const USHORT capabilities = get_capabilities(user_status);
|
||||
|
||||
if (capabilities & CAP_transactions) {
|
||||
if (capabilities & CAP_transactions)
|
||||
{
|
||||
FOR(REQUEST_HANDLE request)
|
||||
TRA IN RDB$TRANSACTIONS WITH
|
||||
TRA.RDB$TRANSACTION_ID = id AND
|
||||
@ -305,9 +306,11 @@ static tdr* get_description(ISC_QUAD* blob_id)
|
||||
|
||||
const TEXT* p = buffer;
|
||||
const USHORT length = snarf_blob(blob_id, (USHORT) sizeof(buffer), buffer);
|
||||
if (length) {
|
||||
if (length)
|
||||
{
|
||||
p = bigger_buffer = (TEXT *) gds__alloc((SLONG) length);
|
||||
if (!p) {
|
||||
if (!p)
|
||||
{
|
||||
tdgbl->status[0] = isc_arg_gds;
|
||||
tdgbl->status[1] = isc_virmemexh;
|
||||
tdgbl->status[2] = isc_arg_end;
|
||||
@ -347,7 +350,8 @@ static tdr* get_description(ISC_QUAD* blob_id)
|
||||
if (!trans) {
|
||||
trans = ptr = FB_NEW(*tdgbl->getDefaultPool()) tdr;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
ptr->tdr_next = FB_NEW(*tdgbl->getDefaultPool()) tdr;
|
||||
ptr = ptr->tdr_next;
|
||||
}
|
||||
@ -409,7 +413,8 @@ static void parse_fullpath(tdr* trans)
|
||||
|
||||
while (*q && *q != '/' && *q != '\\')
|
||||
q++;
|
||||
if (*q) {
|
||||
if (*q)
|
||||
{
|
||||
trans->tdr_filename = q + 1;
|
||||
|
||||
trans->tdr_remote_site = FB_NEW_RPT(*tdgbl->getDefaultPool(), q - p + 1) alice_str;
|
||||
@ -443,7 +448,8 @@ static void parse_fullpath(tdr* trans)
|
||||
--p;
|
||||
++p;
|
||||
|
||||
if (length) {
|
||||
if (length)
|
||||
{
|
||||
trans->tdr_remote_site = FB_NEW_RPT(*tdgbl->getDefaultPool(), length + 1) alice_str;
|
||||
TEXT* q = (TEXT *) trans->tdr_remote_site->str_data;
|
||||
while (length--)
|
||||
@ -481,7 +487,8 @@ static USHORT snarf_blob(ISC_QUAD* blob_id, USHORT buffer_length, TEXT* buffer)
|
||||
|
||||
TEXT* ptr = buffer;
|
||||
const TEXT* const end = buffer + buffer_length;
|
||||
for (;;) {
|
||||
for (;;)
|
||||
{
|
||||
if (ptr >= end)
|
||||
break;
|
||||
if (!(buffer_length = end - ptr))
|
||||
@ -497,7 +504,8 @@ static USHORT snarf_blob(ISC_QUAD* blob_id, USHORT buffer_length, TEXT* buffer)
|
||||
|
||||
if (!buffer_length)
|
||||
{
|
||||
for (;;) {
|
||||
for (;;)
|
||||
{
|
||||
USHORT returned_length;
|
||||
ISC_STATUS status =
|
||||
isc_get_segment(gds_status, &blob, &returned_length, buffer_length, buffer);
|
||||
|
@ -207,7 +207,8 @@ static void buildDpb(Firebird::ClumpletWriter& dpb, const ULONG switches)
|
||||
else if (switches & sw_activate) {
|
||||
dpb.insertTag(isc_dpb_activate_shadow);
|
||||
}
|
||||
else if (switches & sw_validate) {
|
||||
else if (switches & sw_validate)
|
||||
{
|
||||
UCHAR b = isc_dpb_pages;
|
||||
if (switches & sw_full)
|
||||
b |= isc_dpb_records;
|
||||
@ -223,7 +224,8 @@ static void buildDpb(Firebird::ClumpletWriter& dpb, const ULONG switches)
|
||||
dpb.insertInt(isc_dpb_sweep_interval, tdgbl->ALICE_data.ua_sweep_interval);
|
||||
}
|
||||
/*
|
||||
else if (switches & sw_begin_log) {
|
||||
else if (switches & sw_begin_log)
|
||||
{
|
||||
dpb.insertString(isc_dpb_begin_log,
|
||||
tdgbl->ALICE_data.ua_log_file,
|
||||
strlen(tdgbl->ALICE_data.ua_log_file));
|
||||
@ -318,25 +320,30 @@ static void buildDpb(Firebird::ClumpletWriter& dpb, const ULONG switches)
|
||||
dpb.insertInt(isc_dpb_set_db_sql_dialect, tdgbl->ALICE_data.ua_db_SQL_dialect);
|
||||
}
|
||||
|
||||
if (tdgbl->ALICE_data.ua_user) {
|
||||
if (tdgbl->ALICE_data.ua_user)
|
||||
{
|
||||
dpb.insertString(isc_dpb_user_name,
|
||||
tdgbl->ALICE_data.ua_user, strlen(tdgbl->ALICE_data.ua_user));
|
||||
}
|
||||
if (tdgbl->ALICE_data.ua_password) {
|
||||
if (tdgbl->ALICE_data.ua_password)
|
||||
{
|
||||
dpb.insertString(tdgbl->uSvc->isService() ? isc_dpb_password_enc : isc_dpb_password,
|
||||
tdgbl->ALICE_data.ua_password, strlen(tdgbl->ALICE_data.ua_password));
|
||||
}
|
||||
if (tdgbl->ALICE_data.ua_tr_user) {
|
||||
if (tdgbl->ALICE_data.ua_tr_user)
|
||||
{
|
||||
tdgbl->uSvc->checkService();
|
||||
dpb.insertString(isc_dpb_trusted_auth,
|
||||
tdgbl->ALICE_data.ua_tr_user, strlen(tdgbl->ALICE_data.ua_tr_user));
|
||||
}
|
||||
if (tdgbl->ALICE_data.ua_tr_role) {
|
||||
if (tdgbl->ALICE_data.ua_tr_role)
|
||||
{
|
||||
tdgbl->uSvc->checkService();
|
||||
dpb.insertString(isc_dpb_trusted_role, ADMIN_ROLE, strlen(ADMIN_ROLE));
|
||||
}
|
||||
#ifdef TRUSTED_AUTH
|
||||
if (tdgbl->ALICE_data.ua_trusted) {
|
||||
if (tdgbl->ALICE_data.ua_trusted)
|
||||
{
|
||||
if (!dpb.find(isc_dpb_trusted_auth)) {
|
||||
dpb.insertTag(isc_dpb_trusted_auth);
|
||||
}
|
||||
|
@ -102,7 +102,8 @@ USHORT TDR_analyze(const tdr* trans)
|
||||
// perverse case of a rollback, otherwise a commit if at all possible
|
||||
|
||||
case TRA_commit:
|
||||
if (state == TRA_rollback) {
|
||||
if (state == TRA_rollback)
|
||||
{
|
||||
ALICE_print(105);
|
||||
// msg 105: Warning: Multidatabase transaction is in inconsistent state for recovery.
|
||||
ALICE_print(106, SafeArg() << trans->tdr_id);
|
||||
@ -134,7 +135,8 @@ USHORT TDR_analyze(const tdr* trans)
|
||||
// transaction has committed or is assumed committed
|
||||
|
||||
case TRA_rollback:
|
||||
if ((state == TRA_commit) || (state == TRA_none)) {
|
||||
if ((state == TRA_commit) || (state == TRA_none))
|
||||
{
|
||||
ALICE_print(105);
|
||||
// msg 105: Warning: Multidatabase transaction is in inconsistent state for recovery.
|
||||
ALICE_print(107, SafeArg() << trans->tdr_id);
|
||||
@ -196,17 +198,20 @@ bool TDR_attach_database(ISC_STATUS* status_vector, tdr* trans, const TEXT* path
|
||||
if (tdgbl->ALICE_data.ua_user) {
|
||||
dpb.insertString(isc_dpb_user_name, tdgbl->ALICE_data.ua_user, strlen(tdgbl->ALICE_data.ua_user));
|
||||
}
|
||||
if (tdgbl->ALICE_data.ua_password) {
|
||||
if (tdgbl->ALICE_data.ua_password)
|
||||
{
|
||||
dpb.insertString(tdgbl->uSvc->isService() ? isc_dpb_password_enc : isc_dpb_password,
|
||||
tdgbl->ALICE_data.ua_password, strlen(tdgbl->ALICE_data.ua_password));
|
||||
}
|
||||
if (tdgbl->ALICE_data.ua_tr_user) {
|
||||
if (tdgbl->ALICE_data.ua_tr_user)
|
||||
{
|
||||
tdgbl->uSvc->checkService();
|
||||
dpb.insertString(isc_dpb_trusted_auth,
|
||||
tdgbl->ALICE_data.ua_tr_user,
|
||||
strlen(reinterpret_cast<const char*>(tdgbl->ALICE_data.ua_tr_user)));
|
||||
}
|
||||
if (tdgbl->ALICE_data.ua_tr_role) {
|
||||
if (tdgbl->ALICE_data.ua_tr_role)
|
||||
{
|
||||
tdgbl->uSvc->checkService();
|
||||
dpb.insertString(isc_dpb_trusted_role, ADMIN_ROLE, strlen(ADMIN_ROLE));
|
||||
}
|
||||
@ -217,8 +222,10 @@ bool TDR_attach_database(ISC_STATUS* status_vector, tdr* trans, const TEXT* path
|
||||
&trans->tdr_db_handle, dpb.getBufferLength(),
|
||||
reinterpret_cast<const char*>(dpb.getBuffer()));
|
||||
|
||||
if (status_vector[1]) {
|
||||
if (tdgbl->ALICE_data.ua_debug) {
|
||||
if (status_vector[1])
|
||||
{
|
||||
if (tdgbl->ALICE_data.ua_debug)
|
||||
{
|
||||
ALICE_print(69); // msg 69: failed
|
||||
ALICE_print_status(status_vector);
|
||||
}
|
||||
@ -389,7 +396,8 @@ bool TDR_reconnect_multiple(FB_API_HANDLE handle, SLONG id, const TEXT* name, UL
|
||||
|
||||
const USHORT advice = TDR_analyze(trans);
|
||||
|
||||
if (!advice) {
|
||||
if (!advice)
|
||||
{
|
||||
print_description(trans);
|
||||
switches = ask();
|
||||
}
|
||||
@ -398,7 +406,8 @@ bool TDR_reconnect_multiple(FB_API_HANDLE handle, SLONG id, const TEXT* name, UL
|
||||
switch (advice)
|
||||
{
|
||||
case TRA_rollback:
|
||||
if (switches & sw_commit) {
|
||||
if (switches & sw_commit)
|
||||
{
|
||||
ALICE_print(74, SafeArg() << trans->tdr_id);
|
||||
// msg 74: A commit of transaction %ld will violate two-phase commit.
|
||||
print_description(trans);
|
||||
@ -408,7 +417,8 @@ bool TDR_reconnect_multiple(FB_API_HANDLE handle, SLONG id, const TEXT* name, UL
|
||||
switches |= sw_rollback;
|
||||
else if (switches & sw_two_phase)
|
||||
switches |= sw_rollback;
|
||||
else if (switches & sw_prompt) {
|
||||
else if (switches & sw_prompt)
|
||||
{
|
||||
ALICE_print(75, SafeArg() << trans->tdr_id);
|
||||
// msg 75: A rollback of transaction %ld is needed to preserve two-phase commit.
|
||||
print_description(trans);
|
||||
@ -417,7 +427,8 @@ bool TDR_reconnect_multiple(FB_API_HANDLE handle, SLONG id, const TEXT* name, UL
|
||||
break;
|
||||
|
||||
case TRA_commit:
|
||||
if (switches & sw_rollback) {
|
||||
if (switches & sw_rollback)
|
||||
{
|
||||
ALICE_print(76, SafeArg() << trans->tdr_id);
|
||||
// msg 76: Transaction %ld has already been partially committed.
|
||||
ALICE_print(77);
|
||||
@ -732,7 +743,8 @@ static void reattach_database(tdr* trans)
|
||||
// attaching using the old method didn't work;
|
||||
// try attaching to the remote node directly
|
||||
|
||||
if (trans->tdr_remote_site) {
|
||||
if (trans->tdr_remote_site)
|
||||
{
|
||||
char* p = buffer;
|
||||
const UCHAR* q = trans->tdr_remote_site->str_data;
|
||||
while (*q && p < end)
|
||||
@ -823,11 +835,13 @@ static bool reconnect(FB_API_HANDLE handle, SLONG number, const TEXT* name, ULON
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!(switches & (sw_commit | sw_rollback))) {
|
||||
if (!(switches & (sw_commit | sw_rollback)))
|
||||
{
|
||||
ALICE_print(91, SafeArg() << number);
|
||||
// msg 91: Transaction %ld:
|
||||
switches = ask();
|
||||
if (switches == ULONG(~0)) {
|
||||
if (switches == ULONG(~0))
|
||||
{
|
||||
ALICE_print(84);
|
||||
// msg 84: unexpected end of input
|
||||
return true;
|
||||
@ -841,7 +855,8 @@ static bool reconnect(FB_API_HANDLE handle, SLONG number, const TEXT* name, ULON
|
||||
else
|
||||
return false;
|
||||
|
||||
if (status_vector[1]) {
|
||||
if (status_vector[1])
|
||||
{
|
||||
ALICE_print_status(status_vector);
|
||||
return true;
|
||||
}
|
||||
|
@ -261,11 +261,13 @@ isc_svc_handle attachRemoteServiceManager(ISC_STATUS* status,
|
||||
static void userInfoToSpb(char*& spb, const internal_user_data& userInfo)
|
||||
{
|
||||
stuffSpb2(spb, isc_spb_sec_username, userInfo.user_name);
|
||||
if (userInfo.uid_entered) {
|
||||
if (userInfo.uid_entered)
|
||||
{
|
||||
stuffSpbByte(spb, isc_spb_sec_userid);
|
||||
stuffSpbLong(spb, userInfo.uid);
|
||||
}
|
||||
if (userInfo.gid_entered) {
|
||||
if (userInfo.gid_entered)
|
||||
{
|
||||
stuffSpbByte(spb, isc_spb_sec_groupid);
|
||||
stuffSpbLong(spb, userInfo.gid);
|
||||
}
|
||||
@ -418,7 +420,8 @@ void callRemoteServiceManager(ISC_STATUS* status,
|
||||
outputFunction(functionArg, &uData, !uData.user_name_entered);
|
||||
}
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
const char request = isc_info_svc_line;
|
||||
for (;;)
|
||||
{
|
||||
|
@ -141,7 +141,7 @@ int gsec(Firebird::UtilSvc* uSvc)
|
||||
tdsec->tsec_interactive = !uSvc->isService();
|
||||
internal_user_data* user_data = tdsec->tsec_user_data;
|
||||
|
||||
ISC_STATUS_ARRAY status;
|
||||
|
||||
SSHORT ret = parse_cmd_line(argv, tdsec);
|
||||
Firebird::PathName databaseName;
|
||||
bool databaseNameEntered = user_data->database_name_entered;
|
||||
@ -176,6 +176,7 @@ int gsec(Firebird::UtilSvc* uSvc)
|
||||
databaseName.copyTo(user_data->database_name, sizeof(user_data->database_name));
|
||||
|
||||
FB_API_HANDLE db_handle = 0;
|
||||
ISC_STATUS_ARRAY status;
|
||||
|
||||
if (! useServices)
|
||||
{
|
||||
@ -214,7 +215,8 @@ int gsec(Firebird::UtilSvc* uSvc)
|
||||
}
|
||||
}
|
||||
|
||||
if (user_data->sql_role_name_entered) {
|
||||
if (user_data->sql_role_name_entered)
|
||||
{
|
||||
dpb.insertString(isc_dpb_sql_role_name,
|
||||
user_data->sql_role_name, strlen(user_data->sql_role_name));
|
||||
}
|
||||
@ -336,7 +338,8 @@ int gsec(Firebird::UtilSvc* uSvc)
|
||||
uSvc->setServiceStatus(status);
|
||||
}
|
||||
|
||||
if (db_handle) {
|
||||
if (db_handle)
|
||||
{
|
||||
if (isc_detach_database(status, &db_handle)) {
|
||||
GSEC_error_redirect(status, GsecMsg93);
|
||||
}
|
||||
@ -547,7 +550,8 @@ static bool get_switches(Firebird::UtilSvc::ArgvType& argv,
|
||||
user_data->user_name[l] = UPPER(string[l]);
|
||||
++l;
|
||||
}
|
||||
if (l == MAX_SQL_IDENTIFIER_SIZE) {
|
||||
if (l == MAX_SQL_IDENTIFIER_SIZE)
|
||||
{
|
||||
GSEC_diag(GsecMsg76);
|
||||
// invalid user name (maximum 31 bytes allowed)
|
||||
return false;
|
||||
@ -643,7 +647,8 @@ static bool get_switches(Firebird::UtilSvc::ArgvType& argv,
|
||||
else if (val == "DROP") {
|
||||
user_data->operation = MAP_DROP_OPER;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
GSEC_diag(GsecMsg99);
|
||||
// gsec - invalid parameter value for -MAPPING, only SET or DROP is accepted
|
||||
return false;
|
||||
@ -677,7 +682,8 @@ static bool get_switches(Firebird::UtilSvc::ArgvType& argv,
|
||||
|
||||
for (int l = 0; *p; ++l)
|
||||
{
|
||||
if (!*++p) {
|
||||
if (!*++p)
|
||||
{
|
||||
if (l >= in_sw_tab->in_sw_min_length)
|
||||
in_sw = in_sw_tab->in_sw;
|
||||
else
|
||||
@ -762,7 +768,8 @@ static bool get_switches(Firebird::UtilSvc::ArgvType& argv,
|
||||
switch (in_sw)
|
||||
{
|
||||
case IN_SW_GSEC_PASSWORD:
|
||||
if (user_data->password_specified) {
|
||||
if (user_data->password_specified)
|
||||
{
|
||||
err_msg_no = GsecMsg31;
|
||||
break;
|
||||
}
|
||||
@ -770,7 +777,8 @@ static bool get_switches(Firebird::UtilSvc::ArgvType& argv,
|
||||
user_data->password[0] = '\0';
|
||||
break;
|
||||
case IN_SW_GSEC_UID:
|
||||
if (user_data->uid_specified) {
|
||||
if (user_data->uid_specified)
|
||||
{
|
||||
err_msg_no = GsecMsg32;
|
||||
break;
|
||||
}
|
||||
@ -778,7 +786,8 @@ static bool get_switches(Firebird::UtilSvc::ArgvType& argv,
|
||||
user_data->uid = 0;
|
||||
break;
|
||||
case IN_SW_GSEC_GID:
|
||||
if (user_data->gid_specified) {
|
||||
if (user_data->gid_specified)
|
||||
{
|
||||
err_msg_no = GsecMsg33;
|
||||
break;
|
||||
}
|
||||
@ -786,7 +795,8 @@ static bool get_switches(Firebird::UtilSvc::ArgvType& argv,
|
||||
user_data->gid = 0;
|
||||
break;
|
||||
case IN_SW_GSEC_SYSU:
|
||||
if (user_data->sys_user_specified) {
|
||||
if (user_data->sys_user_specified)
|
||||
{
|
||||
err_msg_no = GsecMsg34;
|
||||
break;
|
||||
}
|
||||
@ -794,7 +804,8 @@ static bool get_switches(Firebird::UtilSvc::ArgvType& argv,
|
||||
user_data->sys_user_name[0] = '\0';
|
||||
break;
|
||||
case IN_SW_GSEC_GROUP:
|
||||
if (user_data->group_name_specified) {
|
||||
if (user_data->group_name_specified)
|
||||
{
|
||||
err_msg_no = GsecMsg35;
|
||||
break;
|
||||
}
|
||||
@ -802,7 +813,8 @@ static bool get_switches(Firebird::UtilSvc::ArgvType& argv,
|
||||
user_data->group_name[0] = '\0';
|
||||
break;
|
||||
case IN_SW_GSEC_FNAME:
|
||||
if (user_data->first_name_specified) {
|
||||
if (user_data->first_name_specified)
|
||||
{
|
||||
err_msg_no = GsecMsg36;
|
||||
break;
|
||||
}
|
||||
@ -810,7 +822,8 @@ static bool get_switches(Firebird::UtilSvc::ArgvType& argv,
|
||||
user_data->first_name[0] = '\0';
|
||||
break;
|
||||
case IN_SW_GSEC_MNAME:
|
||||
if (user_data->middle_name_specified) {
|
||||
if (user_data->middle_name_specified)
|
||||
{
|
||||
err_msg_no = GsecMsg37;
|
||||
break;
|
||||
}
|
||||
@ -818,7 +831,8 @@ static bool get_switches(Firebird::UtilSvc::ArgvType& argv,
|
||||
user_data->middle_name[0] = '\0';
|
||||
break;
|
||||
case IN_SW_GSEC_LNAME:
|
||||
if (user_data->last_name_specified) {
|
||||
if (user_data->last_name_specified)
|
||||
{
|
||||
err_msg_no = GsecMsg38;
|
||||
break;
|
||||
}
|
||||
@ -826,7 +840,8 @@ static bool get_switches(Firebird::UtilSvc::ArgvType& argv,
|
||||
user_data->last_name[0] = '\0';
|
||||
break;
|
||||
case IN_SW_GSEC_DATABASE:
|
||||
if (user_data->database_name_specified) {
|
||||
if (user_data->database_name_specified)
|
||||
{
|
||||
err_msg_no = GsecMsg78;
|
||||
break;
|
||||
}
|
||||
@ -834,7 +849,8 @@ static bool get_switches(Firebird::UtilSvc::ArgvType& argv,
|
||||
user_data->database_name[0] = '\0';
|
||||
break;
|
||||
case IN_SW_GSEC_DBA_USER_NAME:
|
||||
if (user_data->dba_user_name_specified) {
|
||||
if (user_data->dba_user_name_specified)
|
||||
{
|
||||
err_msg_no = GsecMsg79;
|
||||
break;
|
||||
}
|
||||
@ -843,7 +859,8 @@ static bool get_switches(Firebird::UtilSvc::ArgvType& argv,
|
||||
break;
|
||||
case IN_SW_GSEC_DBA_TRUST_USER:
|
||||
tdsec->utilSvc->checkService();
|
||||
if (user_data->dba_trust_user_name_specified) {
|
||||
if (user_data->dba_trust_user_name_specified)
|
||||
{
|
||||
err_msg_no = GsecMsg79;
|
||||
break;
|
||||
}
|
||||
@ -856,7 +873,8 @@ static bool get_switches(Firebird::UtilSvc::ArgvType& argv,
|
||||
break;
|
||||
case IN_SW_GSEC_DBA_PASSWORD:
|
||||
case IN_SW_GSEC_FETCH_PASSWORD:
|
||||
if (user_data->dba_password_specified) {
|
||||
if (user_data->dba_password_specified)
|
||||
{
|
||||
err_msg_no = GsecMsg80;
|
||||
break;
|
||||
}
|
||||
@ -864,7 +882,8 @@ static bool get_switches(Firebird::UtilSvc::ArgvType& argv,
|
||||
user_data->dba_password[0] = '\0';
|
||||
break;
|
||||
case IN_SW_GSEC_SQL_ROLE_NAME:
|
||||
if (user_data->sql_role_name_specified) {
|
||||
if (user_data->sql_role_name_specified)
|
||||
{
|
||||
err_msg_no = GsecMsg81;
|
||||
break;
|
||||
}
|
||||
@ -872,7 +891,8 @@ static bool get_switches(Firebird::UtilSvc::ArgvType& argv,
|
||||
user_data->sql_role_name[0] = '\0';
|
||||
break;
|
||||
}
|
||||
if (err_msg_no) {
|
||||
if (err_msg_no)
|
||||
{
|
||||
GSEC_error(err_msg_no);
|
||||
return false;
|
||||
}
|
||||
@ -1151,7 +1171,8 @@ static SSHORT parse_cmd_line(Firebird::UtilSvc::ArgvType& argv, tsec* tdsec)
|
||||
}
|
||||
else if (user_data->operation)
|
||||
{
|
||||
if (user_data->operation == HELP_OPER) {
|
||||
if (user_data->operation == HELP_OPER)
|
||||
{
|
||||
printhelp();
|
||||
ret = -1;
|
||||
}
|
||||
|
@ -117,7 +117,8 @@ SSHORT SECURITY_exec_line(ISC_STATUS* isc_status,
|
||||
SSHORT ret = 0;
|
||||
|
||||
// check for non-printable characters in user name
|
||||
for (const TEXT *p = io_user_data->user_name; *p; p++) {
|
||||
for (const TEXT *p = io_user_data->user_name; *p; p++)
|
||||
{
|
||||
if (! isprint(*p)) {
|
||||
return GsecMsg75; // Add special error message for this case ?
|
||||
}
|
||||
@ -146,19 +147,22 @@ SSHORT SECURITY_exec_line(ISC_STATUS* isc_status,
|
||||
|
||||
STORE (TRANSACTION_HANDLE trans REQUEST_HANDLE request) U IN USERS USING
|
||||
strcpy(U.USER_NAME, io_user_data->user_name);
|
||||
if (io_user_data->uid_entered) {
|
||||
if (io_user_data->uid_entered)
|
||||
{
|
||||
U.UID = io_user_data->uid;
|
||||
U.UID.NULL = ISC_FALSE;
|
||||
}
|
||||
else
|
||||
U.UID.NULL = ISC_TRUE;
|
||||
if (io_user_data->gid_entered) {
|
||||
if (io_user_data->gid_entered)
|
||||
{
|
||||
U.GID = io_user_data->gid;
|
||||
U.GID.NULL = ISC_FALSE;
|
||||
}
|
||||
else
|
||||
U.GID.NULL = ISC_TRUE;
|
||||
if (io_user_data->group_name_entered) {
|
||||
if (io_user_data->group_name_entered)
|
||||
{
|
||||
strcpy(U.GROUP_NAME, io_user_data->group_name);
|
||||
U.GROUP_NAME.NULL = ISC_FALSE;
|
||||
}
|
||||
@ -173,19 +177,22 @@ SSHORT SECURITY_exec_line(ISC_STATUS* isc_status,
|
||||
}
|
||||
else
|
||||
U.PASSWD.NULL = ISC_TRUE;
|
||||
if (io_user_data->first_name_entered) {
|
||||
if (io_user_data->first_name_entered)
|
||||
{
|
||||
strcpy(U.FIRST_NAME, io_user_data->first_name);
|
||||
U.FIRST_NAME.NULL = ISC_FALSE;
|
||||
}
|
||||
else
|
||||
U.FIRST_NAME.NULL = ISC_TRUE;
|
||||
if (io_user_data->middle_name_entered) {
|
||||
if (io_user_data->middle_name_entered)
|
||||
{
|
||||
strcpy(U.MIDDLE_NAME, io_user_data->middle_name);
|
||||
U.MIDDLE_NAME.NULL = ISC_FALSE;
|
||||
}
|
||||
else
|
||||
U.MIDDLE_NAME.NULL = ISC_TRUE;
|
||||
if (io_user_data->last_name_entered) {
|
||||
if (io_user_data->last_name_entered)
|
||||
{
|
||||
strcpy(U.LAST_NAME, io_user_data->last_name);
|
||||
U.LAST_NAME.NULL = ISC_FALSE;
|
||||
}
|
||||
@ -207,19 +214,22 @@ SSHORT SECURITY_exec_line(ISC_STATUS* isc_status,
|
||||
WITH U.USER_NAME EQ io_user_data->user_name
|
||||
found = true;
|
||||
MODIFY U USING
|
||||
if (io_user_data->uid_entered) {
|
||||
if (io_user_data->uid_entered)
|
||||
{
|
||||
U.UID = io_user_data->uid;
|
||||
U.UID.NULL = ISC_FALSE;
|
||||
}
|
||||
else if (io_user_data->uid_specified)
|
||||
U.UID.NULL = ISC_TRUE;
|
||||
if (io_user_data->gid_entered) {
|
||||
if (io_user_data->gid_entered)
|
||||
{
|
||||
U.GID = io_user_data->gid;
|
||||
U.GID.NULL = ISC_FALSE;
|
||||
}
|
||||
else if (io_user_data->gid_specified)
|
||||
U.GID.NULL = ISC_TRUE;
|
||||
if (io_user_data->group_name_entered) {
|
||||
if (io_user_data->group_name_entered)
|
||||
{
|
||||
strcpy(U.GROUP_NAME, io_user_data->group_name);
|
||||
U.GROUP_NAME.NULL = ISC_FALSE;
|
||||
}
|
||||
@ -234,19 +244,22 @@ SSHORT SECURITY_exec_line(ISC_STATUS* isc_status,
|
||||
}
|
||||
else if (io_user_data->password_specified)
|
||||
U.PASSWD.NULL = ISC_TRUE;
|
||||
if (io_user_data->first_name_entered) {
|
||||
if (io_user_data->first_name_entered)
|
||||
{
|
||||
strcpy(U.FIRST_NAME, io_user_data->first_name);
|
||||
U.FIRST_NAME.NULL = ISC_FALSE;
|
||||
}
|
||||
else if (io_user_data->first_name_specified)
|
||||
U.FIRST_NAME.NULL = ISC_TRUE;
|
||||
if (io_user_data->middle_name_entered) {
|
||||
if (io_user_data->middle_name_entered)
|
||||
{
|
||||
strcpy(U.MIDDLE_NAME, io_user_data->middle_name);
|
||||
U.MIDDLE_NAME.NULL = ISC_FALSE;
|
||||
}
|
||||
else if (io_user_data->middle_name_specified)
|
||||
U.MIDDLE_NAME.NULL = ISC_TRUE;
|
||||
if (io_user_data->last_name_entered) {
|
||||
if (io_user_data->last_name_entered)
|
||||
{
|
||||
strcpy(U.LAST_NAME, io_user_data->last_name);
|
||||
U.LAST_NAME.NULL = ISC_FALSE;
|
||||
}
|
||||
@ -375,11 +388,13 @@ SSHORT SECURITY_exec_line(ISC_STATUS* isc_status,
|
||||
// rollback if we have an error using tmp_status to avoid
|
||||
// overwriting the error status which the caller wants to see
|
||||
|
||||
if (ret) {
|
||||
if (ret)
|
||||
{
|
||||
ISC_STATUS_ARRAY tmp_status;
|
||||
isc_rollback_transaction(tmp_status, &gds_trans);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
COMMIT
|
||||
ON_ERROR
|
||||
return GsecMsg75; // gsec error
|
||||
|
Loading…
Reference in New Issue
Block a user