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:47.518
2024-05-12 19:15:47.523 act = <firebird.qa.plugin.Action object at [hex]>
2024-05-12 19:15:47.528 user_mike = <firebird.qa.plugin.User object at [hex]>
2024-05-12 19:15:47.532 user_adam = <firebird.qa.plugin.User object at [hex]>
2024-05-12 19:15:47.537 boss = <firebird.qa.plugin.Role object at [hex]>
2024-05-12 19:15:47.542 acnt = <firebird.qa.plugin.Role object at [hex]>
2024-05-12 19:15:47.547 capsys = <_pytest.capture.CaptureFixture object at [hex]>
2024-05-12 19:15:47.551
2024-05-12 19:15:47.556 @pytest.mark.version('>=3')
2024-05-12 19:15:47.561 def test_1(act: Action, user_mike: User, user_adam: User, boss: Role, acnt: Role, capsys):
2024-05-12 19:15:47.566 act.expected_stdout = expected_stdout
2024-05-12 19:15:47.570 with act.db.connect() as con:
2024-05-12 19:15:47.575 c = con.cursor()
2024-05-12 19:15:47.580 c.execute('grant tmp$r2233_boss to tmp$c2233_adam')
2024-05-12 19:15:47.586 c.execute('grant tmp$r2233_acnt to tmp$c2233_adam')
2024-05-12 19:15:47.592 con.commit()
2024-05-12 19:15:47.598 #
2024-05-12 19:15:47.604 with act.db.connect(user=user_mike.name, password=user_mike.password) as con0, \
2024-05-12 19:15:47.609 act.db.connect(user=user_adam.name, password=user_adam.password) as con1, \
2024-05-12 19:15:47.614 act.db.connect(user=user_adam.name, password=user_adam.password) as con2, \
2024-05-12 19:15:47.620 act.db.connect(user=user_adam.name, password=user_adam.password, role=boss.name) as con3, \
2024-05-12 19:15:47.625 > act.db.connect(user=user_adam.name, password=user_adam.password, role=acnt.name) as con4:
2024-05-12 19:15:47.629
2024-05-12 19:15:47.634 tests/bugs/core_2233_test.py:62:
2024-05-12 19:15:47.639 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2024-05-12 19:15:47.644
2024-05-12 19:15:47.649 database = '/var/tmp/qa_2024/test_1376/test.fdb'
2024-05-12 19:15:47.653
2024-05-12 19:15:47.659 def connect(database: str, *, user: str=None, password: str=None, role: str=None,
2024-05-12 19:15:47.664 no_gc: bool=None, no_db_triggers: bool=None, dbkey_scope: DBKeyScope=None,
2024-05-12 19:15:47.669 crypt_callback: iCryptKeyCallbackImpl=None, charset: str=None,
2024-05-12 19:15:47.677 auth_plugin_list: str=None, session_time_zone: str=None) -> Connection:
2024-05-12 19:15:47.684 """Establishes a connection to the database.
2024-05-12 19:15:47.690
2024-05-12 19:15:47.695 Arguments:
2024-05-12 19:15:47.700 database: DSN or Database configuration name.
2024-05-12 19:15:47.704 user: User name.
2024-05-12 19:15:47.709 password: User password.
2024-05-12 19:15:47.714 role: User role.
2024-05-12 19:15:47.719 no_gc: Do not perform garbage collection for this connection.
2024-05-12 19:15:47.724 no_db_triggers: Do not execute database triggers for this connection.
2024-05-12 19:15:47.730 dbkey_scope: DBKEY scope override for connection.
2024-05-12 19:15:47.735 crypt_callback: Callback that provides encryption key for the database.
2024-05-12 19:15:47.741 charset: Character set for connection.
2024-05-12 19:15:47.747 auth_plugin_list: List of authentication plugins override
2024-05-12 19:15:47.753 session_time_zone: Session time zone [Firebird 4]
2024-05-12 19:15:47.760
2024-05-12 19:15:47.765 Hooks:
2024-05-12 19:15:47.770 Event `.ConnectionHook.ATTACH_REQUEST`: Executed after all parameters
2024-05-12 19:15:47.776 are preprocessed and before `Connection` is created. Hook
2024-05-12 19:15:47.781 must have signature::
2024-05-12 19:15:47.786
2024-05-12 19:15:47.792 hook_func(dsn: str, dpb: bytes) -> Optional[Connection]
2024-05-12 19:15:47.798
2024-05-12 19:15:47.806 Hook may return `Connection` instance or None.
2024-05-12 19:15:47.812 First instance returned by any hook will become the return value
2024-05-12 19:15:47.817 of this function and other hooks are not called.
2024-05-12 19:15:47.822
2024-05-12 19:15:47.827 Event `.ConnectionHook.ATTACHED`: Executed before `Connection` instance is
2024-05-12 19:15:47.832 returned. Hook must have signature::
2024-05-12 19:15:47.837
2024-05-12 19:15:47.842 hook_func(connection: Connection) -> None
2024-05-12 19:15:47.847
2024-05-12 19:15:47.852 Any value returned by hook is ignored.
2024-05-12 19:15:47.857 """
2024-05-12 19:15:47.864 db_config = driver_config.get_database(database)
2024-05-12 19:15:47.869 if db_config is None:
2024-05-12 19:15:47.874 db_config = driver_config.db_defaults
2024-05-12 19:15:47.879 else:
2024-05-12 19:15:47.884 database = db_config.database.value
2024-05-12 19:15:47.889 if db_config.server.value is None:
2024-05-12 19:15:47.895 srv_config = driver_config.server_defaults
2024-05-12 19:15:47.900 else:
2024-05-12 19:15:47.905 srv_config = driver_config.get_server(db_config.server.value)
2024-05-12 19:15:47.910 if srv_config is None:
2024-05-12 19:15:47.915 raise ValueError(f"Configuration for server '{db_config.server.value}' not found")
2024-05-12 19:15:47.920 if user is None:
2024-05-12 19:15:47.925 user = db_config.user.value
2024-05-12 19:15:47.931 if user is None:
2024-05-12 19:15:47.936 user = srv_config.user.value
2024-05-12 19:15:47.941 if password is None:
2024-05-12 19:15:47.945 password = db_config.password.value
2024-05-12 19:15:47.950 if password is None:
2024-05-12 19:15:47.959 password = srv_config.password.value
2024-05-12 19:15:47.964 if role is None:
2024-05-12 19:15:47.969 role = db_config.role.value
2024-05-12 19:15:47.974 if charset is None:
2024-05-12 19:15:47.979 charset = db_config.charset.value
2024-05-12 19:15:47.984 if charset:
2024-05-12 19:15:47.989 charset = charset.upper()
2024-05-12 19:15:47.993 if auth_plugin_list is None:
2024-05-12 19:15:47.998 auth_plugin_list = db_config.auth_plugin_list.value
2024-05-12 19:15:48.003 if session_time_zone is None:
2024-05-12 19:15:48.008 session_time_zone = db_config.session_time_zone.value
2024-05-12 19:15:48.014 dsn = _connect_helper(db_config.dsn.value, srv_config.host.value, srv_config.port.value,
2024-05-12 19:15:48.021 database, db_config.protocol.value)
2024-05-12 19:15:48.029 dpb = DPB(user=user, password=password, role=role, trusted_auth=db_config.trusted_auth.value,
2024-05-12 19:15:48.036 sql_dialect=db_config.sql_dialect.value, timeout=db_config.timeout.value,
2024-05-12 19:15:48.043 charset=charset, cache_size=db_config.cache_size.value,
2024-05-12 19:15:48.050 no_linger=db_config.no_linger.value, utf8filename=db_config.utf8filename.value,
2024-05-12 19:15:48.057 no_gc=no_gc, no_db_triggers=no_db_triggers, dbkey_scope=dbkey_scope,
2024-05-12 19:15:48.063 dummy_packet_interval=db_config.dummy_packet_interval.value,
2024-05-12 19:15:48.069 config=db_config.config.value, auth_plugin_list=auth_plugin_list,
2024-05-12 19:15:48.074 session_time_zone=session_time_zone, set_bind=db_config.set_bind.value,
2024-05-12 19:15:48.080 decfloat_round=db_config.decfloat_round.value,
2024-05-12 19:15:48.086 decfloat_traps=db_config.decfloat_traps.value,
2024-05-12 19:15:48.093 parallel_workers=db_config.parallel_workers.value)
2024-05-12 19:15:48.098 > return __make_connection(False, dsn, db_config.utf8filename.value, dpb.get_buffer(),
2024-05-12 19:15:48.104 db_config.sql_dialect.value, charset, crypt_callback)
2024-05-12 19:15:48.109
2024-05-12 19:15:48.114 ../lib/python3.11/site-packages/firebird/driver/core.py:2149:
2024-05-12 19:15:48.119 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2024-05-12 19:15:48.124
2024-05-12 19:15:48.130 create = False, dsn = 'localhost/3702:/var/tmp/qa_2024/test_1376/test.fdb'
2024-05-12 19:15:48.135 utf8filename = False
2024-05-12 19:15:48.141 dpb = b'\x01\x1c\x0eTMP$C2233_ADAM\x1d\x03123<\x0eTMP$R2233_ACNT?\x04\x03\x00\x00\x00'
2024-05-12 19:15:48.146 sql_dialect = 3, charset = None, crypt_callback = None
2024-05-12 19:15:48.150
2024-05-12 19:15:48.156 def __make_connection(create: bool, dsn: str, utf8filename: bool, dpb: bytes,
2024-05-12 19:15:48.160 sql_dialect: int, charset: str,
2024-05-12 19:15:48.166 crypt_callback: iCryptKeyCallbackImpl) -> Connection:
2024-05-12 19:15:48.172 with a.get_api().master.get_dispatcher() as provider:
2024-05-12 19:15:48.176 if crypt_callback is not None:
2024-05-12 19:15:48.181 provider.set_dbcrypt_callback(crypt_callback)
2024-05-12 19:15:48.186 if create:
2024-05-12 19:15:48.191 att = provider.create_database(dsn, dpb, 'utf-8' if utf8filename else FS_ENCODING)
2024-05-12 19:15:48.197 con = Connection(att, dsn, dpb, sql_dialect, charset)
2024-05-12 19:15:48.202 else:
2024-05-12 19:15:48.207 con = None
2024-05-12 19:15:48.212 for hook in get_callbacks(ConnectionHook.ATTACH_REQUEST, Connection):
2024-05-12 19:15:48.217 try:
2024-05-12 19:15:48.222 con = hook(dsn, dpb)
2024-05-12 19:15:48.227 except Exception as e:
2024-05-12 19:15:48.232 raise InterfaceError("Error in DATABASE_ATTACH_REQUEST hook.", *e.args) from e
2024-05-12 19:15:48.237 if con is not None:
2024-05-12 19:15:48.241 break
2024-05-12 19:15:48.246 if con is None:
2024-05-12 19:15:48.252 > att = provider.attach_database(dsn, dpb, 'utf-8' if utf8filename else FS_ENCODING)
2024-05-12 19:15:48.257
2024-05-12 19:15:48.264 ../lib/python3.11/site-packages/firebird/driver/core.py:2064:
2024-05-12 19:15:48.269 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2024-05-12 19:15:48.275
2024-05-12 19:15:48.281 self = <firebird.driver.interfaces.iProvider object at [hex]>
2024-05-12 19:15:48.289 filename = 'localhost/3702:/var/tmp/qa_2024/test_1376/test.fdb'
2024-05-12 19:15:48.295 dpb = b'\x01\x1c\x0eTMP$C2233_ADAM\x1d\x03123<\x0eTMP$R2233_ACNT?\x04\x03\x00\x00\x00'
2024-05-12 19:15:48.300 encoding = 'utf-8'
2024-05-12 19:15:48.306
2024-05-12 19:15:48.311 def attach_database(self, filename: str, dpb: Optional[bytes] = None, encoding: str = 'ascii') -> iAttachment:
2024-05-12 19:15:48.317 "Replaces `isc_attach_database()`"
2024-05-12 19:15:48.322 result = self.vtable.attachDatabase(self, self.status, filename.encode(encoding),
2024-05-12 19:15:48.331 0 if dpb is None else len(dpb), dpb)
2024-05-12 19:15:48.337 > self._check()
2024-05-12 19:15:48.343
2024-05-12 19:15:48.348 ../lib/python3.11/site-packages/firebird/driver/interfaces.py:1295:
2024-05-12 19:15:48.353 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2024-05-12 19:15:48.357
2024-05-12 19:15:48.362 self = <firebird.driver.interfaces.iProvider object at [hex]>
2024-05-12 19:15:48.367
2024-05-12 19:15:48.372 def _check(self) -> None:
2024-05-12 19:15:48.377 state = self.status.get_state()
2024-05-12 19:15:48.383 if StateFlag.ERRORS in state:
2024-05-12 19:15:48.388 > raise self.__report(DatabaseError, self.status.get_errors())
2024-05-12 19:15:48.393 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:48.399
2024-05-12 19:15:48.404 ../lib/python3.11/site-packages/firebird/driver/interfaces.py:113: DatabaseError
2024-05-12 19:15:48.409 ---------------------------- Captured stdout setup -----------------------------
2024-05-12 19:15:48.414 Cached db: db-12.0-None-None-NONE.fdb [page_size=None, sql_dialect=None, charset='NONE'
2024-05-12 19:15:48.420 DROP user: TMP$C2233_MIKE PLUGIN: Srp
2024-05-12 19:15:48.425 CREATE user: TMP$C2233_MIKE PLUGIN: Srp
2024-05-12 19:15:48.430 DROP user: TMP$C2233_ADAM PLUGIN: Srp
2024-05-12 19:15:48.436 CREATE user: TMP$C2233_ADAM PLUGIN: Srp
2024-05-12 19:15:48.442 CREATE role: TMP$R2233_BOSS
2024-05-12 19:15:48.448 CREATE role: TMP$R2233_ACNT
2024-05-12 19:15:48.453 --------------------------- Captured stdout teardown ---------------------------
2024-05-12 19:15:48.459 DROP role: TMP$R2233_ACNT
2024-05-12 19:15:48.465 DROP role: TMP$R2233_BOSS
|
3 #text |
act = <firebird.qa.plugin.Action pytest object at [hex]>
user_mike = <firebird.qa.plugin.User pytest object at [hex]>
user_adam = <firebird.qa.plugin.User pytest object at [hex]>
boss = <firebird.qa.plugin.Role pytest object at [hex]>
acnt = <firebird.qa.plugin.Role pytest object at [hex]>
capsys = <_pytest.capture.CaptureFixture pytest object at [hex]>
@pytest.mark.version('>=3')
def test_1(act: Action, user_mike: User, user_adam: User, boss: Role, acnt: Role, capsys):
act.expected_stdout = expected_stdout
with act.db.connect() as con:
c = con.cursor()
c.execute('grant tmp$r2233_boss to tmp$c2233_adam')
c.execute('grant tmp$r2233_acnt to tmp$c2233_adam')
con.commit()
#
with act.db.connect(user=user_mike.name, password=user_mike.password) as con0, \
act.db.connect(user=user_adam.name, password=user_adam.password) as con1, \
act.db.connect(user=user_adam.name, password=user_adam.password) as con2, \
act.db.connect(user=user_adam.name, password=user_adam.password, role=boss.name) as con3, \
> act.db.connect(user=user_adam.name, password=user_adam.password, role=acnt.name) as con4:
tests/bugs/core_2233_test.py:62:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
database = '/var/tmp/qa_2024/test_1376/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_1376/test.fdb'
utf8filename = False
dpb = b'\x01\x1c\x0eTMP$C2233_ADAM\x1d\x03123<\x0eTMP$R2233_ACNT?\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_1376/test.fdb'
dpb = b'\x01\x1c\x0eTMP$C2233_ADAM\x1d\x03123<\x0eTMP$R2233_ACNT?\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
|