mirror of
https://github.com/FirebirdSQL/firebird-qa.git
synced 2025-02-02 02:40:42 +01:00
Added/Updated tests\functional\tabloid\test_crash_when_too_long_username_for_auth.py: Customized for run against dev build after Dimitry Sibiryakov request: filter out second item from dev status vector: 335544882 / Login name too long
This commit is contained in:
parent
0c377bc87f
commit
0ed0e705e6
@ -4,10 +4,19 @@
|
||||
TITLE: crash on assert or memory corruption when too long username is used for authentication
|
||||
NOTES:
|
||||
[19.07.2023] pzotov
|
||||
Confirmed problem on 3.x only (3.0.11.33690).
|
||||
Confirmed problem on 3.x only (3.0.11.33690): server crashed, client got:
|
||||
Statement failed, SQLSTATE = 08004
|
||||
connection rejected by remote interface
|
||||
FB 4.0.3.2956 and 5.0.0.1093 (builds before 29-JUN-2023) issued "SQLSTATE = 28000 / Your user name and password..." but not crashed.
|
||||
After fix, all three FB issue "SQLSTATE = 08006 / Error occurred during login, please check server firebird.log for details"
|
||||
Checked on 3.0.11.33965 -- all OK.
|
||||
|
||||
[14.07.2024] pzotov
|
||||
Customized for run against dev build after Dimitry Sibiryakov request.
|
||||
Dev build issues status vector containing TWO elements:
|
||||
335545106 ==> Error occurred during login, please check server firebird.log for details
|
||||
335544882 ==> Login name too long (@1 characters, maximum allowed @2)
|
||||
We can filter out its second item..
|
||||
"""
|
||||
import locale
|
||||
import re
|
||||
@ -15,26 +24,32 @@ from difflib import unified_diff
|
||||
|
||||
import pytest
|
||||
from firebird.qa import *
|
||||
from firebird.driver import DatabaseError
|
||||
|
||||
db = db_factory() # charset = 'utf8', init = init_sql)
|
||||
db = db_factory()
|
||||
|
||||
act = python_act( 'db', substitutions=[('[ \t]+',' ')] )
|
||||
act = python_act( 'db', substitutions=[('[ \t]+',' '), ('.*Login name too long.*', '')] )
|
||||
|
||||
@pytest.mark.version('>=3.0.11')
|
||||
def test_1(act: Action, capsys):
|
||||
|
||||
MAX_NAME_LEN = 31 if act.is_version('<=3') else 63
|
||||
TOO_LONG_USR = 'u1111111111222222222233333333334444444444555555555566666666667777777777'
|
||||
test_sql = f"""
|
||||
connect '{act.db.dsn}' user '{TOO_LONG_USR}' password 'qqq';
|
||||
quit;
|
||||
"""
|
||||
TOO_LONG_USR = 'u2345678901234567890123456789012345678901234567890123456789012345678901'
|
||||
# 1 2 3 4 5 6 7
|
||||
try:
|
||||
with act.db.connect(user = TOO_LONG_USR, password = 'qwe', charset = 'win1251'):
|
||||
pass
|
||||
except DatabaseError as e:
|
||||
# ACHTUNG: dev-build will raise error with TWO gdscodes: [335545106, 335544882].
|
||||
# 335545106 ==> Error occurred during login, please check server firebird.log for details
|
||||
# 335544882 ==> Login name too long (@1 characters, maximum allowed @2)
|
||||
# We have to check only first of them. DO NOT iterate through gds_codes tuple!
|
||||
print( e.gds_codes[0] )
|
||||
print( e.__str__() )
|
||||
|
||||
expected_stdout = """
|
||||
Statement failed, SQLSTATE = 08006
|
||||
act.stdout = capsys.readouterr().out
|
||||
act.expected_stdout = """
|
||||
335545106
|
||||
Error occurred during login, please check server firebird.log for details
|
||||
"""
|
||||
|
||||
act.expected_stdout = expected_stdout
|
||||
act.isql(switches=['-q'], charset = 'win1251', credentials = False, connect_db = False, input = test_sql, combine_output = True, io_enc = locale.getpreferredencoding())
|
||||
assert act.clean_stdout == act.clean_expected_stdout
|
||||
|
Loading…
Reference in New Issue
Block a user