2 @message |
Authentification problem
firebird.driver.types.DatabaseError: Your user name and password are not defined. Ask your database administrator to set up a Firebird login.
LOG DETAILS:
2024-05-12 19:15:49.785
2024-05-12 19:15:49.790 act = <firebird.qa.plugin.Action object at [hex]>
2024-05-12 19:15:49.794 user_srp = <firebird.qa.plugin.User object at [hex]>
2024-05-12 19:15:49.799 user_leg = <firebird.qa.plugin.User object at [hex]>
2024-05-12 19:15:49.805 capsys = <_pytest.capture.CaptureFixture object at [hex]>
2024-05-12 19:15:49.810
2024-05-12 19:15:49.816 @pytest.mark.version('>=3.0')
2024-05-12 19:15:49.822 def test_2(act: Action, user_srp: User, user_leg: User, capsys):
2024-05-12 19:15:49.828 act.expected_stdout = expected_stdout_2
2024-05-12 19:15:49.833 check_sql='select mon$user as who_am_i, left(mon$auth_method,3) as auth_method from mon$attachments'
2024-05-12 19:15:49.838 custom_tpb = tpb(isolation=Isolation.READ_COMMITTED_RECORD_VERSION, lock_timeout=0)
2024-05-12 19:15:49.843 #
2024-05-12 19:15:49.848 with act.db.connect() as con1:
2024-05-12 19:15:49.853 trn1 = con1.transaction_manager(custom_tpb)
2024-05-12 19:15:49.858 cur1 = trn1.cursor()
2024-05-12 19:15:49.863 cur1.execute('select sec$user_name from sec$users').fetchall()
2024-05-12 19:15:49.868 with act.db.connect(user=user_leg.name, password=user_leg.password) as con2, \
2024-05-12 19:15:49.874 > act.db.connect(user=user_srp.name, password=user_srp.password) as con3:
2024-05-12 19:15:49.880
2024-05-12 19:15:49.885 tests/bugs/core_4200_test.py:49:
2024-05-12 19:15:49.890 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2024-05-12 19:15:49.894
2024-05-12 19:15:49.900 database = '/var/tmp/qa_2024/test_21/test.fdb'
2024-05-12 19:15:49.904
2024-05-12 19:15:49.909 def connect(database: str, *, user: str=None, password: str=None, role: str=None,
2024-05-12 19:15:49.914 no_gc: bool=None, no_db_triggers: bool=None, dbkey_scope: DBKeyScope=None,
2024-05-12 19:15:49.919 crypt_callback: iCryptKeyCallbackImpl=None, charset: str=None,
2024-05-12 19:15:49.924 auth_plugin_list: str=None, session_time_zone: str=None) -> Connection:
2024-05-12 19:15:49.929 """Establishes a connection to the database.
2024-05-12 19:15:49.934
2024-05-12 19:15:49.939 Arguments:
2024-05-12 19:15:49.945 database: DSN or Database configuration name.
2024-05-12 19:15:49.950 user: User name.
2024-05-12 19:15:49.955 password: User password.
2024-05-12 19:15:49.960 role: User role.
2024-05-12 19:15:49.965 no_gc: Do not perform garbage collection for this connection.
2024-05-12 19:15:49.971 no_db_triggers: Do not execute database triggers for this connection.
2024-05-12 19:15:49.976 dbkey_scope: DBKEY scope override for connection.
2024-05-12 19:15:49.981 crypt_callback: Callback that provides encryption key for the database.
2024-05-12 19:15:49.987 charset: Character set for connection.
2024-05-12 19:15:49.992 auth_plugin_list: List of authentication plugins override
2024-05-12 19:15:49.997 session_time_zone: Session time zone [Firebird 4]
2024-05-12 19:15:50.002
2024-05-12 19:15:50.007 Hooks:
2024-05-12 19:15:50.012 Event `.ConnectionHook.ATTACH_REQUEST`: Executed after all parameters
2024-05-12 19:15:50.018 are preprocessed and before `Connection` is created. Hook
2024-05-12 19:15:50.022 must have signature::
2024-05-12 19:15:50.027
2024-05-12 19:15:50.032 hook_func(dsn: str, dpb: bytes) -> Optional[Connection]
2024-05-12 19:15:50.037
2024-05-12 19:15:50.042 Hook may return `Connection` instance or None.
2024-05-12 19:15:50.047 First instance returned by any hook will become the return value
2024-05-12 19:15:50.052 of this function and other hooks are not called.
2024-05-12 19:15:50.057
2024-05-12 19:15:50.062 Event `.ConnectionHook.ATTACHED`: Executed before `Connection` instance is
2024-05-12 19:15:50.067 returned. Hook must have signature::
2024-05-12 19:15:50.072
2024-05-12 19:15:50.079 hook_func(connection: Connection) -> None
2024-05-12 19:15:50.084
2024-05-12 19:15:50.091 Any value returned by hook is ignored.
2024-05-12 19:15:50.096 """
2024-05-12 19:15:50.101 db_config = driver_config.get_database(database)
2024-05-12 19:15:50.107 if db_config is None:
2024-05-12 19:15:50.112 db_config = driver_config.db_defaults
2024-05-12 19:15:50.117 else:
2024-05-12 19:15:50.122 database = db_config.database.value
2024-05-12 19:15:50.127 if db_config.server.value is None:
2024-05-12 19:15:50.132 srv_config = driver_config.server_defaults
2024-05-12 19:15:50.137 else:
2024-05-12 19:15:50.142 srv_config = driver_config.get_server(db_config.server.value)
2024-05-12 19:15:50.147 if srv_config is None:
2024-05-12 19:15:50.151 raise ValueError(f"Configuration for server '{db_config.server.value}' not found")
2024-05-12 19:15:50.156 if user is None:
2024-05-12 19:15:50.161 user = db_config.user.value
2024-05-12 19:15:50.166 if user is None:
2024-05-12 19:15:50.171 user = srv_config.user.value
2024-05-12 19:15:50.176 if password is None:
2024-05-12 19:15:50.184 password = db_config.password.value
2024-05-12 19:15:50.195 if password is None:
2024-05-12 19:15:50.213 password = srv_config.password.value
2024-05-12 19:15:50.224 if role is None:
2024-05-12 19:15:50.234 role = db_config.role.value
2024-05-12 19:15:50.248 if charset is None:
2024-05-12 19:15:50.260 charset = db_config.charset.value
2024-05-12 19:15:50.273 if charset:
2024-05-12 19:15:50.291 charset = charset.upper()
2024-05-12 19:15:50.299 if auth_plugin_list is None:
2024-05-12 19:15:50.304 auth_plugin_list = db_config.auth_plugin_list.value
2024-05-12 19:15:50.309 if session_time_zone is None:
2024-05-12 19:15:50.315 session_time_zone = db_config.session_time_zone.value
2024-05-12 19:15:50.320 dsn = _connect_helper(db_config.dsn.value, srv_config.host.value, srv_config.port.value,
2024-05-12 19:15:50.325 database, db_config.protocol.value)
2024-05-12 19:15:50.330 dpb = DPB(user=user, password=password, role=role, trusted_auth=db_config.trusted_auth.value,
2024-05-12 19:15:50.335 sql_dialect=db_config.sql_dialect.value, timeout=db_config.timeout.value,
2024-05-12 19:15:50.340 charset=charset, cache_size=db_config.cache_size.value,
2024-05-12 19:15:50.345 no_linger=db_config.no_linger.value, utf8filename=db_config.utf8filename.value,
2024-05-12 19:15:50.350 no_gc=no_gc, no_db_triggers=no_db_triggers, dbkey_scope=dbkey_scope,
2024-05-12 19:15:50.355 dummy_packet_interval=db_config.dummy_packet_interval.value,
2024-05-12 19:15:50.360 config=db_config.config.value, auth_plugin_list=auth_plugin_list,
2024-05-12 19:15:50.365 session_time_zone=session_time_zone, set_bind=db_config.set_bind.value,
2024-05-12 19:15:50.369 decfloat_round=db_config.decfloat_round.value,
2024-05-12 19:15:50.374 decfloat_traps=db_config.decfloat_traps.value,
2024-05-12 19:15:50.379 parallel_workers=db_config.parallel_workers.value)
2024-05-12 19:15:50.384 > return __make_connection(False, dsn, db_config.utf8filename.value, dpb.get_buffer(),
2024-05-12 19:15:50.390 db_config.sql_dialect.value, charset, crypt_callback)
2024-05-12 19:15:50.396
2024-05-12 19:15:50.401 ../lib/python3.11/site-packages/firebird/driver/core.py:2149:
2024-05-12 19:15:50.406 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2024-05-12 19:15:50.411
2024-05-12 19:15:50.417 create = False, dsn = 'localhost/3702:/var/tmp/qa_2024/test_21/test.fdb'
2024-05-12 19:15:50.424 utf8filename = False
2024-05-12 19:15:50.431 dpb = b'\x01\x1c\rTMP$C4200_SRP\x1d\x03123?\x04\x03\x00\x00\x00'
2024-05-12 19:15:50.437 sql_dialect = 3, charset = None, crypt_callback = None
2024-05-12 19:15:50.442
2024-05-12 19:15:50.447 def __make_connection(create: bool, dsn: str, utf8filename: bool, dpb: bytes,
2024-05-12 19:15:50.452 sql_dialect: int, charset: str,
2024-05-12 19:15:50.457 crypt_callback: iCryptKeyCallbackImpl) -> Connection:
2024-05-12 19:15:50.462 with a.get_api().master.get_dispatcher() as provider:
2024-05-12 19:15:50.467 if crypt_callback is not None:
2024-05-12 19:15:50.472 provider.set_dbcrypt_callback(crypt_callback)
2024-05-12 19:15:50.478 if create:
2024-05-12 19:15:50.484 att = provider.create_database(dsn, dpb, 'utf-8' if utf8filename else FS_ENCODING)
2024-05-12 19:15:50.490 con = Connection(att, dsn, dpb, sql_dialect, charset)
2024-05-12 19:15:50.496 else:
2024-05-12 19:15:50.502 con = None
2024-05-12 19:15:50.508 for hook in get_callbacks(ConnectionHook.ATTACH_REQUEST, Connection):
2024-05-12 19:15:50.514 try:
2024-05-12 19:15:50.520 con = hook(dsn, dpb)
2024-05-12 19:15:50.526 except Exception as e:
2024-05-12 19:15:50.532 raise InterfaceError("Error in DATABASE_ATTACH_REQUEST hook.", *e.args) from e
2024-05-12 19:15:50.538 if con is not None:
2024-05-12 19:15:50.544 break
2024-05-12 19:15:50.549 if con is None:
2024-05-12 19:15:50.555 > att = provider.attach_database(dsn, dpb, 'utf-8' if utf8filename else FS_ENCODING)
2024-05-12 19:15:50.560
2024-05-12 19:15:50.565 ../lib/python3.11/site-packages/firebird/driver/core.py:2064:
2024-05-12 19:15:50.572 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2024-05-12 19:15:50.578
2024-05-12 19:15:50.583 self = <firebird.driver.interfaces.iProvider object at [hex]>
2024-05-12 19:15:50.589 filename = 'localhost/3702:/var/tmp/qa_2024/test_21/test.fdb'
2024-05-12 19:15:50.595 dpb = b'\x01\x1c\rTMP$C4200_SRP\x1d\x03123?\x04\x03\x00\x00\x00'
2024-05-12 19:15:50.601 encoding = 'utf-8'
2024-05-12 19:15:50.606
2024-05-12 19:15:50.612 def attach_database(self, filename: str, dpb: Optional[bytes] = None, encoding: str = 'ascii') -> iAttachment:
2024-05-12 19:15:50.617 "Replaces `isc_attach_database()`"
2024-05-12 19:15:50.623 result = self.vtable.attachDatabase(self, self.status, filename.encode(encoding),
2024-05-12 19:15:50.628 0 if dpb is None else len(dpb), dpb)
2024-05-12 19:15:50.633 > self._check()
2024-05-12 19:15:50.637
2024-05-12 19:15:50.642 ../lib/python3.11/site-packages/firebird/driver/interfaces.py:1295:
2024-05-12 19:15:50.647 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2024-05-12 19:15:50.652
2024-05-12 19:15:50.657 self = <firebird.driver.interfaces.iProvider object at [hex]>
2024-05-12 19:15:50.662
2024-05-12 19:15:50.667 def _check(self) -> None:
2024-05-12 19:15:50.672 state = self.status.get_state()
2024-05-12 19:15:50.677 if StateFlag.ERRORS in state:
2024-05-12 19:15:50.682 > raise self.__report(DatabaseError, self.status.get_errors())
2024-05-12 19:15:50.688 E firebird.driver.types.DatabaseError: Your user name and password are not defined. Ask your database administrator to set up a Firebird login.
2024-05-12 19:15:50.694
2024-05-12 19:15:50.700 ../lib/python3.11/site-packages/firebird/driver/interfaces.py:113: DatabaseError
2024-05-12 19:15:50.705 ---------------------------- Captured stdout setup -----------------------------
2024-05-12 19:15:50.710 Cached db: db-12.0-None-None-NONE.fdb [page_size=None, sql_dialect=None, charset='NONE'
2024-05-12 19:15:50.715 DROP user: TMP$C4200_SRP PLUGIN: Srp
2024-05-12 19:15:50.721 CREATE user: TMP$C4200_SRP PLUGIN: Srp
2024-05-12 19:15:50.727 CREATE user: TMP$C4200_LEG PLUGIN: Legacy_UserManager
2024-05-12 19:15:50.732 --------------------------- Captured stdout teardown ---------------------------
2024-05-12 19:15:50.737 DROP user: TMP$C4200_LEG PLUGIN: Legacy_UserManager
|
3 #text |
act = <firebird.qa.plugin.Action pytest object at [hex]>
user_srp = <firebird.qa.plugin.User pytest object at [hex]>
user_leg = <firebird.qa.plugin.User pytest object at [hex]>
capsys = <_pytest.capture.CaptureFixture pytest object at [hex]>
@pytest.mark.version('>=3.0')
def test_2(act: Action, user_srp: User, user_leg: User, capsys):
act.expected_stdout = expected_stdout_2
check_sql='select mon$user as who_am_i, left(mon$auth_method,3) as auth_method from mon$attachments'
custom_tpb = tpb(isolation=Isolation.READ_COMMITTED_RECORD_VERSION, lock_timeout=0)
#
with act.db.connect() as con1:
trn1 = con1.transaction_manager(custom_tpb)
cur1 = trn1.cursor()
cur1.execute('select sec$user_name from sec$users').fetchall()
with act.db.connect(user=user_leg.name, password=user_leg.password) as con2, \
> act.db.connect(user=user_srp.name, password=user_srp.password) as con3:
tests/bugs/core_4200_test.py:49:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
database = '/var/tmp/qa_2024/test_21/test.fdb'
def connect(database: str, *, user: str=None, password: str=None, role: str=None,
no_gc: bool=None, no_db_triggers: bool=None, dbkey_scope: DBKeyScope=None,
crypt_callback: iCryptKeyCallbackImpl=None, charset: str=None,
auth_plugin_list: str=None, session_time_zone: str=None) -> Connection:
"""Establishes a connection to the database.
Arguments:
database: DSN or Database configuration name.
user: User name.
password: User password.
role: User role.
no_gc: Do not perform garbage collection for this connection.
no_db_triggers: Do not execute database triggers for this connection.
dbkey_scope: DBKEY scope override for connection.
crypt_callback: Callback that provides encryption key for the database.
charset: Character set for connection.
auth_plugin_list: List of authentication plugins override
session_time_zone: Session time zone [Firebird 4]
Hooks:
Event `.ConnectionHook.ATTACH_REQUEST`: Executed after all parameters
are preprocessed and before `Connection` is created. Hook
must have signature::
hook_func(dsn: str, dpb: bytes) -> Optional[Connection]
Hook may return `Connection` instance or None.
First instance returned by any hook will become the return value
of this function and other hooks are not called.
Event `.ConnectionHook.ATTACHED`: Executed before `Connection` instance is
returned. Hook must have signature::
hook_func(connection: Connection) -> None
Any value returned by hook is ignored.
"""
db_config = driver_config.get_database(database)
if db_config is None:
db_config = driver_config.db_defaults
else:
database = db_config.database.value
if db_config.server.value is None:
srv_config = driver_config.server_defaults
else:
srv_config = driver_config.get_server(db_config.server.value)
if srv_config is None:
raise ValueError(f"Configuration for server '{db_config.server.value}' not found")
if user is None:
user = db_config.user.value
if user is None:
user = srv_config.user.value
if password is None:
password = db_config.password.value
if password is None:
password = srv_config.password.value
if role is None:
role = db_config.role.value
if charset is None:
charset = db_config.charset.value
if charset:
charset = charset.upper()
if auth_plugin_list is None:
auth_plugin_list = db_config.auth_plugin_list.value
if session_time_zone is None:
session_time_zone = db_config.session_time_zone.value
dsn = _connect_helper(db_config.dsn.value, srv_config.host.value, srv_config.port.value,
database, db_config.protocol.value)
dpb = DPB(user=user, password=password, role=role, trusted_auth=db_config.trusted_auth.value,
sql_dialect=db_config.sql_dialect.value, timeout=db_config.timeout.value,
charset=charset, cache_size=db_config.cache_size.value,
no_linger=db_config.no_linger.value, utf8filename=db_config.utf8filename.value,
no_gc=no_gc, no_db_triggers=no_db_triggers, dbkey_scope=dbkey_scope,
dummy_packet_interval=db_config.dummy_packet_interval.value,
config=db_config.config.value, auth_plugin_list=auth_plugin_list,
session_time_zone=session_time_zone, set_bind=db_config.set_bind.value,
decfloat_round=db_config.decfloat_round.value,
decfloat_traps=db_config.decfloat_traps.value,
parallel_workers=db_config.parallel_workers.value)
> return __make_connection(False, dsn, db_config.utf8filename.value, dpb.get_buffer(),
db_config.sql_dialect.value, charset, crypt_callback)
../lib/python3.11/site-packages/firebird/driver/core.py:2149:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
create = False, dsn = 'localhost/3702:/var/tmp/qa_2024/test_21/test.fdb'
utf8filename = False
dpb = b'\x01\x1c\rTMP$C4200_SRP\x1d\x03123?\x04\x03\x00\x00\x00'
sql_dialect = 3, charset = None, crypt_callback = None
def __make_connection(create: bool, dsn: str, utf8filename: bool, dpb: bytes,
sql_dialect: int, charset: str,
crypt_callback: iCryptKeyCallbackImpl) -> Connection:
with a.get_api().master.get_dispatcher() as provider:
if crypt_callback is not None:
provider.set_dbcrypt_callback(crypt_callback)
if create:
att = provider.create_database(dsn, dpb, 'utf-8' if utf8filename else FS_ENCODING)
con = Connection(att, dsn, dpb, sql_dialect, charset)
else:
con = None
for hook in get_callbacks(ConnectionHook.ATTACH_REQUEST, Connection):
try:
con = hook(dsn, dpb)
except Exception as e:
raise InterfaceError("Error in DATABASE_ATTACH_REQUEST hook.", *e.args) from e
if con is not None:
break
if con is None:
> att = provider.attach_database(dsn, dpb, 'utf-8' if utf8filename else FS_ENCODING)
../lib/python3.11/site-packages/firebird/driver/core.py:2064:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <firebird.driver.interfaces.iProvider pytest object at [hex]>
filename = 'localhost/3702:/var/tmp/qa_2024/test_21/test.fdb'
dpb = b'\x01\x1c\rTMP$C4200_SRP\x1d\x03123?\x04\x03\x00\x00\x00'
encoding = 'utf-8'
def attach_database(self, filename: str, dpb: Optional[bytes] = None, encoding: str = 'ascii') -> iAttachment:
"Replaces `isc_attach_database()`"
result = self.vtable.attachDatabase(self, self.status, filename.encode(encoding),
0 if dpb is None else len(dpb), dpb)
> self._check()
../lib/python3.11/site-packages/firebird/driver/interfaces.py:1295:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <firebird.driver.interfaces.iProvider pytest object at [hex]>
def _check(self) -> None:
state = self.status.get_state()
if StateFlag.ERRORS in state:
> raise self.__report(DatabaseError, self.status.get_errors())
E firebird.driver.types.DatabaseError: Your user name and password are not defined. Ask your database administrator to set up a Firebird login.
../lib/python3.11/site-packages/firebird/driver/interfaces.py:113: DatabaseError
|