8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 19:23:03 +01:00

Fix clash with winbase.h on IGNORE.

This commit is contained in:
robocop 2005-11-18 04:39:47 +00:00
parent 314569bc60
commit d1373b1555
5 changed files with 54 additions and 60 deletions

View File

@ -281,7 +281,7 @@
# define TRAILING 530 # define TRAILING 530
# define TRIM 531 # define TRIM 531
# define RETURNING 532 # define RETURNING 532
# define IGNORE 533 # define KW_IGNORE 533
# define LIMBO 534 # define LIMBO 534
# define UNDO 535 # define UNDO 535
# define REQUESTS 536 # define REQUESTS 536

View File

@ -161,7 +161,7 @@ static const TOK tokens[] =
{HAVING, "HAVING", 1, false}, {HAVING, "HAVING", 1, false},
{HOUR, "HOUR", 2, false}, {HOUR, "HOUR", 2, false},
{IF, "IF", 1, false}, {IF, "IF", 1, false},
{IGNORE, "IGNORE", 2, true}, {KW_IGNORE, "IGNORE", 2, true},
{IIF, "IIF", 2, true}, {IIF, "IIF", 2, true},
{KW_IN, "IN", 1, false}, {KW_IN, "IN", 1, false},
{INACTIVE, "INACTIVE", 1, false}, {INACTIVE, "INACTIVE", 1, false},

View File

@ -279,7 +279,7 @@
# define TRAILING 530 # define TRAILING 530
# define TRIM 531 # define TRIM 531
# define RETURNING 532 # define RETURNING 532
# define IGNORE 533 # define KW_IGNORE 533
# define LIMBO 534 # define LIMBO 534
# define UNDO 535 # define UNDO 535
# define REQUESTS 536 # define REQUESTS 536
@ -1217,7 +1217,7 @@ static const char *const yytname[] =
"OPEN", "CLOSE", "FETCH", "ROWS", "BLOCK", "IIF", "SCALAR_ARRAY", "OPEN", "CLOSE", "FETCH", "ROWS", "BLOCK", "IIF", "SCALAR_ARRAY",
"CROSS", "NEXT", "SEQUENCE", "RESTART", "BOTH", "COLLATION", "COMMENT", "CROSS", "NEXT", "SEQUENCE", "RESTART", "BOTH", "COLLATION", "COMMENT",
"BIT_LENGTH", "CHAR_LENGTH", "CHARACTER_LENGTH", "LEADING", "KW_LOWER", "BIT_LENGTH", "CHAR_LENGTH", "CHARACTER_LENGTH", "LEADING", "KW_LOWER",
"OCTET_LENGTH", "TRAILING", "TRIM", "RETURNING", "IGNORE", "LIMBO", "OCTET_LENGTH", "TRAILING", "TRIM", "RETURNING", "KW_IGNORE", "LIMBO",
"UNDO", "REQUESTS", "TIMEOUT", "'='", "'<'", "'>'", "'+'", "'-'", "'*'", "UNDO", "REQUESTS", "TIMEOUT", "'='", "'<'", "'>'", "'+'", "'-'", "'*'",
"'/'", "';'", "','", "'('", "')'", "':'", "'['", "']'", "'.'", "'?'", "'/'", "';'", "','", "'('", "')'", "':'", "'['", "']'", "'.'", "'?'",
"top", "statement", "grant", "table_noise", "privileges", "top", "statement", "grant", "table_noise", "privileges",

View File

@ -519,7 +519,7 @@ static LexerState lex;
%token TRAILING %token TRAILING
%token TRIM %token TRIM
%token RETURNING %token RETURNING
%token IGNORE %token KW_IGNORE
%token LIMBO %token LIMBO
%token UNDO %token UNDO
%token REQUESTS %token REQUESTS
@ -2819,7 +2819,7 @@ version_mode : VERSION
tra_misc_options: NO AUTO UNDO tra_misc_options: NO AUTO UNDO
{ $$ = make_flag_node(nod_tra_misc, NOD_NO_AUTO_UNDO, 0, NULL); } { $$ = make_flag_node(nod_tra_misc, NOD_NO_AUTO_UNDO, 0, NULL); }
| IGNORE LIMBO | KW_IGNORE LIMBO
{ $$ = make_flag_node(nod_tra_misc, NOD_IGNORE_LIMBO, 0, NULL); } { $$ = make_flag_node(nod_tra_misc, NOD_IGNORE_LIMBO, 0, NULL); }
| RESTART REQUESTS | RESTART REQUESTS
{ $$ = make_flag_node(nod_tra_misc, NOD_RESTART_REQUESTS, 0, NULL); } { $$ = make_flag_node(nod_tra_misc, NOD_RESTART_REQUESTS, 0, NULL); }
@ -4337,7 +4337,7 @@ non_reserved_word :
| RESTART | RESTART
| COLLATION | COLLATION
| RETURNING | RETURNING
| IGNORE | KW_IGNORE
| LIMBO | LIMBO
| UNDO | UNDO
| REQUESTS | REQUESTS

View File

@ -96,8 +96,9 @@ const USHORT OSTYPE_WIN_95 = 2;
const char* ISC_USER = "ISC_USER"; const char* ISC_USER = "ISC_USER";
const char* ISC_PASSWORD = "ISC_PASSWORD"; const char* ISC_PASSWORD = "ISC_PASSWORD";
const int MAX_USER_LENGTH = 33; //const int MAX_USER_LENGTH = 33;
#define MAX_OTHER_PARAMS (1 + 1 + sizeof(port->port_dummy_packet_interval)) const int MAX_OTHER_PARAMS = 1 + 1 + sizeof(((rem_port*)NULL)->port_dummy_packet_interval);
const int MAX_DPB_DIR_SIZE = 2 + MAX_UCHAR; // The length is expressed as a byte.
static RVNT add_event(rem_port*); static RVNT add_event(rem_port*);
static void add_other_params(rem_port*, UCHAR*, USHORT*); static void add_other_params(rem_port*, UCHAR*, USHORT*);
@ -279,15 +280,14 @@ ISC_STATUS GDS_ATTACH_DATABASE(ISC_STATUS* user_status,
NULL_CHECK(handle, isc_bad_db_handle); NULL_CHECK(handle, isc_bad_db_handle);
UCHAR new_dpb[MAXPATHLEN]; UCHAR new_dpb[MAXPATHLEN];
memset(new_dpb, '*', sizeof(new_dpb));
UCHAR* new_dpb_ptr = new_dpb; UCHAR* new_dpb_ptr = new_dpb;
rem_port* port = 0; // MAX_OTHER_PARAMS uses port's port_dummy_packet_interval
if ((dpb_length + MAX_USER_LENGTH + MAX_PASSWORD_ENC_LENGTH + USHORT new_dpb_length = dpb_length + MAX_PASSWORD_LENGTH +
MAX_OTHER_PARAMS) > sizeof(new_dpb)) MAX_OTHER_PARAMS + MAX_DPB_DIR_SIZE;
if (new_dpb_length > sizeof(new_dpb))
{ {
new_dpb_ptr = new_dpb_ptr = (UCHAR*)gds__alloc(new_dpb_length);
(UCHAR*)gds__alloc(dpb_length + MAX_USER_LENGTH +
MAX_PASSWORD_ENC_LENGTH + MAX_OTHER_PARAMS);
/* FREE: by return(s) from this procedure */ /* FREE: by return(s) from this procedure */
@ -296,10 +296,10 @@ ISC_STATUS GDS_ATTACH_DATABASE(ISC_STATUS* user_status,
user_status[1] = isc_virmemexh; user_status[1] = isc_virmemexh;
return error(user_status); return error(user_status);
} }
memset(new_dpb_ptr, '*', new_dpb_length);
} }
TEXT user_string[256]; TEXT user_string[256] = "";
USHORT new_dpb_length;
const bool user_verification = get_new_dpb(reinterpret_cast<const UCHAR*>(dpb), const bool user_verification = get_new_dpb(reinterpret_cast<const UCHAR*>(dpb),
dpb_length, true, new_dpb_ptr, dpb_length, true, new_dpb_ptr,
&new_dpb_length, user_string); &new_dpb_length, user_string);
@ -308,7 +308,7 @@ ISC_STATUS GDS_ATTACH_DATABASE(ISC_STATUS* user_status,
Firebird::PathName expanded_name(expanded_filename); Firebird::PathName expanded_name(expanded_filename);
Firebird::PathName node_name; Firebird::PathName node_name;
port = analyze(expanded_name, user_status, us, rem_port* port = analyze(expanded_name, user_status, us,
user_verification, dpb, dpb_length, node_name); user_verification, dpb, dpb_length, node_name);
if (!port) if (!port)
{ {
@ -865,16 +865,15 @@ ISC_STATUS GDS_CREATE_DATABASE(ISC_STATUS* user_status,
NULL_CHECK(handle, isc_bad_db_handle); NULL_CHECK(handle, isc_bad_db_handle);
rem_port* port;
UCHAR new_dpb[MAXPATHLEN]; UCHAR new_dpb[MAXPATHLEN];
memset(new_dpb, '*', sizeof(new_dpb));
UCHAR* new_dpb_ptr = new_dpb; UCHAR* new_dpb_ptr = new_dpb;
if ((dpb_length + MAX_USER_LENGTH + MAX_PASSWORD_ENC_LENGTH + USHORT new_dpb_length = dpb_length + MAX_PASSWORD_LENGTH +
MAX_OTHER_PARAMS) > sizeof(new_dpb)) MAX_OTHER_PARAMS + MAX_DPB_DIR_SIZE;
if (new_dpb_length > sizeof(new_dpb))
{ {
new_dpb_ptr = new_dpb_ptr = (UCHAR*)gds__alloc(new_dpb_length);
(UCHAR*)gds__alloc(dpb_length + MAX_USER_LENGTH +
MAX_PASSWORD_ENC_LENGTH + MAX_OTHER_PARAMS);
/* FREE: by return(s) in this routine */ /* FREE: by return(s) in this routine */
@ -883,10 +882,10 @@ ISC_STATUS GDS_CREATE_DATABASE(ISC_STATUS* user_status,
user_status[1] = isc_virmemexh; user_status[1] = isc_virmemexh;
return error(user_status); return error(user_status);
} }
memset(new_dpb_ptr, '*', new_dpb_length);
} }
USHORT new_dpb_length; TEXT user_string[256] = "";
TEXT user_string[256];
const bool user_verification = const bool user_verification =
get_new_dpb(reinterpret_cast<const UCHAR*>(dpb), get_new_dpb(reinterpret_cast<const UCHAR*>(dpb),
dpb_length, true, new_dpb_ptr, dpb_length, true, new_dpb_ptr,
@ -896,7 +895,7 @@ ISC_STATUS GDS_CREATE_DATABASE(ISC_STATUS* user_status,
Firebird::PathName expanded_name(expanded_filename); Firebird::PathName expanded_name(expanded_filename);
Firebird::PathName node_name; Firebird::PathName node_name;
port = analyze(expanded_name, user_status, us, rem_port* port = analyze(expanded_name, user_status, us,
user_verification, dpb, dpb_length, node_name); user_verification, dpb, dpb_length, node_name);
if (!port) { if (!port) {
if (new_dpb_ptr != new_dpb) if (new_dpb_ptr != new_dpb)
@ -3857,15 +3856,15 @@ ISC_STATUS GDS_SERVICE_ATTACH(ISC_STATUS* user_status,
*v++ = isc_unavailable; *v++ = isc_unavailable;
*v = isc_arg_end; *v = isc_arg_end;
rem_port* port;
UCHAR new_spb[MAXPATHLEN]; UCHAR new_spb[MAXPATHLEN];
memset(new_spb, '*', sizeof(new_spb));
UCHAR* new_spb_ptr = new_spb; UCHAR* new_spb_ptr = new_spb;
if ((spb_length + MAX_USER_LENGTH + MAX_PASSWORD_ENC_LENGTH +
MAX_OTHER_PARAMS) > sizeof(new_spb)) USHORT new_spb_length = spb_length + MAX_PASSWORD_LENGTH +
MAX_OTHER_PARAMS + MAX_DPB_DIR_SIZE;
if (new_spb_length > sizeof(new_spb))
{ {
new_spb_ptr = new_spb_ptr = (UCHAR*)gds__alloc(new_spb_length);
(UCHAR*)gds__alloc(spb_length + MAX_USER_LENGTH +
MAX_PASSWORD_ENC_LENGTH + MAX_OTHER_PARAMS);
/* FREE: by return(s) in this routine */ /* FREE: by return(s) in this routine */
@ -3874,9 +3873,10 @@ ISC_STATUS GDS_SERVICE_ATTACH(ISC_STATUS* user_status,
user_status[1] = isc_virmemexh; user_status[1] = isc_virmemexh;
return error(user_status); return error(user_status);
} }
memset(new_spb_ptr, '*', new_spb_length);
} }
USHORT new_spb_length;
TEXT user_string[256]; TEXT user_string[256] = "";
const bool user_verification = const bool user_verification =
get_new_dpb(reinterpret_cast<const UCHAR*>(spb), get_new_dpb(reinterpret_cast<const UCHAR*>(spb),
spb_length, false, new_spb_ptr, spb_length, false, new_spb_ptr,
@ -3884,7 +3884,7 @@ ISC_STATUS GDS_SERVICE_ATTACH(ISC_STATUS* user_status,
const TEXT* us = (user_string[0]) ? user_string : 0; const TEXT* us = (user_string[0]) ? user_string : 0;
port = analyze_service(expanded_name, user_status, us, rem_port* port = analyze_service(expanded_name, user_status, us,
user_verification, spb, spb_length); user_verification, spb, spb_length);
if (!port) { if (!port) {
if (new_spb_ptr != new_spb) if (new_spb_ptr != new_spb)
@ -4633,9 +4633,10 @@ static void add_working_directory(UCHAR* dpb_or_spb,
dpb_or_spb[(*length)++] = isc_dpb_version1; dpb_or_spb[(*length)++] = isc_dpb_version1;
} }
dpb_or_spb[(*length)++] = isc_dpb_working_directory; dpb_or_spb[(*length)++] = isc_dpb_working_directory;
dpb_or_spb[(*length)++] = cwd.length(); UCHAR l = cwd.length();
memcpy(&(dpb_or_spb[(*length)]), cwd.c_str(), cwd.length()); dpb_or_spb[(*length)++] = l;
*length += cwd.length(); memcpy(&(dpb_or_spb[(*length)]), cwd.c_str(), l);
*length += l;
} }
@ -5651,8 +5652,7 @@ static bool get_new_dpb(const UCHAR* dpb,
* (Based on JRD get_options()) * (Based on JRD get_options())
* *
**************************************/ **************************************/
UCHAR pw_buffer[MAX_PASSWORD_ENC_LENGTH + 6]; const USHORT backup_dpb_length = *new_dpb_length;
*user_string = 0; *user_string = 0;
*new_dpb_length = 0; *new_dpb_length = 0;
@ -5733,15 +5733,11 @@ static bool get_new_dpb(const UCHAR* dpb,
if (c == pb_sys_user_name) if (c == pb_sys_user_name)
{ {
s--; s--;
UCHAR* q = (UCHAR *) user_string; const SSHORT l = *p++;
SSHORT l = *p++; memcpy(user_string, p, l);
if (l)
{ user_string[l] = 0;
do { p += l;
*q++ = *p++;
} while (--l);
}
*q = 0;
} }
else if (c == pb_password) else if (c == pb_password)
{ {
@ -5757,14 +5753,10 @@ static bool get_new_dpb(const UCHAR* dpb,
result = true; result = true;
} }
moved_some = true; moved_some = true;
SSHORT l = *p++; const SSHORT l = 1 + *p;
if (*s++ = static_cast<UCHAR>(l)) memcpy(s, p, l);
{ s += l;
do { p += l;
*s++ = *p++;
} while (--l);
}
} }
} }
@ -5784,10 +5776,11 @@ static bool get_new_dpb(const UCHAR* dpb,
moved_some = true; moved_some = true;
*s++ = pb_password_enc; *s++ = pb_password_enc;
const SSHORT l = MIN(password_length, MAX_PASSWORD_ENC_LENGTH); const SSHORT l = MIN(password_length, MAX_PASSWORD_ENC_LENGTH);
strncpy((char*) pw_buffer, (const char*) password, l); char pw_buffer[MAX_PASSWORD_ENC_LENGTH + 6];
strncpy(pw_buffer, (const char*) password, l);
pw_buffer[l] = 0; pw_buffer[l] = 0;
TEXT pwt[MAX_PASSWORD_LENGTH + 2]; TEXT pwt[MAX_PASSWORD_LENGTH + 2];
ENC_crypt(pwt, sizeof pwt, reinterpret_cast<char*>(pw_buffer), PASSWORD_SALT); ENC_crypt(pwt, sizeof pwt, pw_buffer, PASSWORD_SALT);
const char* pp = pwt + 2; const char* pp = pwt + 2;
*s++ = strlen(pp); *s++ = strlen(pp);
while (*pp) { while (*pp) {
@ -5798,6 +5791,7 @@ static bool get_new_dpb(const UCHAR* dpb,
if (moved_some || ((s - new_dpb) > 1)) { if (moved_some || ((s - new_dpb) > 1)) {
*new_dpb_length = s - new_dpb; *new_dpb_length = s - new_dpb;
fb_assert(*new_dpb_length <= backup_dpb_length);
} }
else { else {
*new_dpb_length = 0; *new_dpb_length = 0;