6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-22 21:43:06 +01:00
firebird-qa/tests/bugs/core_4998_test.py

84 lines
2.8 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-24 20:27:02 +01:00
"""
ID: issue-5286
ISSUE: https://github.com/FirebirdSQL/firebird/issues/5286
2022-01-24 20:27:02 +01:00
TITLE: Both client and server could not close connection after failed authentification
DESCRIPTION:
[FBT only] Reproduced on 3.0.0.32136 RC1 with firebird.conf:
2022-01-24 20:27:02 +01:00
AuthServer = Legacy_Auth,Srp
AuthClient = Srp,Legacy_Auth
2021-04-26 20:07:00 +02:00
2022-01-24 20:27:02 +01:00
JIRA: CORE-4998
FBTEST: bugs.core_4998
NOTES:
[18.08.2022] pzotov
There is a problem with issue reproduction if we use firebird-driver for work with too old FB version!
Connection is established OK but an attempt to start transaction (with 3.0.0.32136 RC1) fails:
INTERNALERROR> firebird.driver.types.DatabaseError: invalid format for transaction parameter block
INTERNALERROR> -wrong version of transaction parameter block
Trace shows following errors in that case:
335544331 : invalid format for transaction parameter block
335544411 : wrong version of transaction parameter block
Test applies the same scenario as was described in the 1st message of this ticket, and checks that
there is no difference in the content of firebird.log before and after failed attempts to connect.
Checked on 5.0.0.591, 4.0.1.2692, 3.0.8.33535
2022-01-24 20:27:02 +01:00
"""
import os
import locale
import re
from difflib import unified_diff
import time
2022-01-24 20:27:02 +01:00
import pytest
from firebird.qa import *
2021-04-26 20:07:00 +02:00
for v in ('ISC_USER','ISC_PASSWORD'):
try:
del os.environ[ v ]
except KeyError as e:
pass
2022-01-24 20:27:02 +01:00
db = db_factory()
substitutions = [('Your user name and password are not defined.*', '')]
act = python_act('db', substitutions = substitutions)
2022-01-24 20:27:02 +01:00
@pytest.mark.version('>=3.0')
def test_1(act: Action, capsys):
fblog_1 = act.get_firebird_log()
sql_chk = f"""
connect 'inet://{act.db.db_path}' user sysdba password 'inv@l1d_1';
connect 'inet://{act.db.db_path}' user sysdba password 'inv@l1d_2';
connect 'inet://{act.db.db_path}' user sysdba password '{act.db.password}';
set heading off;
select sign(current_connection) from rdb$database;
quit;
"""
act.expected_stdout = """
Statement failed, SQLSTATE = 28000
Statement failed, SQLSTATE = 28000
1
"""
act.isql(switches = ['-q'], input = sql_chk, connect_db = False, credentials = False, combine_output = True, io_enc = locale.getpreferredencoding())
assert act.clean_stdout == act.clean_expected_stdout
act.reset()
time.sleep(1) # Allow content of firebird log be fully flushed on disk.
fblog_2 = act.get_firebird_log()
for line in unified_diff(fblog_1, fblog_2):
if line.startswith('+'):
print(line)
2021-04-26 20:07:00 +02:00
expected_stdout_log_diff = ''
act.expected_stdout = expected_stdout_log_diff
act.stdout = capsys.readouterr().out
assert act.clean_stdout == act.clean_expected_stdout
act.reset()