Skip to content

Commit c6f6b20

Browse files
The error "DPY-3015: password verifier type is not supported by
python-oracledb in thin mode" is now raised when the database sends a password challenge with a verifier type that is not recognized, instead of "ORA-01017: invalid username/password" (#26).
1 parent 0e3b150 commit c6f6b20

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed

doc/src/release_notes.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ oracledb 1.0.3 (August 2022)
1313
Thin Mode Changes
1414
+++++++++++++++++
1515

16+
#) The error `DPY-3015: password verifier type is not supported by
17+
python-oracledb in thin mode` is now raised when
18+
the database sends a password challenge with a verifier type that is not
19+
recognized, instead of `ORA-01017: invalid username/password`
20+
(`issue 26 <https://github.com/oracle/python-oracledb/issues/26>`__).
21+
1622
Common Changes
1723
++++++++++++++
1824

src/oracledb/errors.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ def _raise_from_string(exc_type: Exception, message: str) -> None:
170170
ERR_NCHAR_CS_NOT_SUPPORTED = 3012
171171
ERR_UNSUPPORTED_PYTHON_TYPE_FOR_VAR = 3013
172172
ERR_LOB_OF_WRONG_TYPE = 3014
173+
ERR_UNSUPPORTED_VERIFIER_TYPE = 3015
173174

174175
# error numbers that result in DatabaseError
175176
ERR_TNS_ENTRY_NOT_FOUND = 4000
@@ -434,6 +435,9 @@ def _raise_from_string(exc_type: Exception, message: str) -> None:
434435
'{db_type_name}',
435436
ERR_UNSUPPORTED_VAR_SET:
436437
'variable of type {db_type_name} does not support being set',
438+
ERR_UNSUPPORTED_VERIFIER_TYPE:
439+
'password verifier type 0x{verifier_type:x} is not supported by '
440+
'python-oracledb in thin mode',
437441
ERR_WALLET_FILE_MISSING:
438442
'cannot connect to database. Wallet file {name} was not found',
439443
ERR_WRONG_ARRAY_DEFINITION:

src/oracledb/impl/thin/constants.pxi

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -596,8 +596,9 @@ DEF TNS_RCAP_TTC_ZERO_COPY = 0x01
596596
DEF TNS_RCAP_TTC_32K = 0x04
597597

598598
# verifier types
599-
DEF TNS_VERIFIER_TYPE_SHA1 = 45394
600-
DEF TNS_VERIFIER_TYPE_SSHA1 = 6949
599+
DEF TNS_VERIFIER_TYPE_11G_1 = 0xb152
600+
DEF TNS_VERIFIER_TYPE_11G_2 = 0x1b25
601+
DEF TNS_VERIFIER_TYPE_12C = 0x4815
601602

602603
# other constants
603604
DEF TNS_MAX_SHORT_LENGTH = 252

src/oracledb/impl/thin/messages.pyx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1477,9 +1477,13 @@ cdef class AuthMessage(Message):
14771477
if self.purity != 0:
14781478
num_pairs += 1
14791479
self.auth_mode |= TNS_AUTH_MODE_WITH_PASSWORD
1480-
if self.verifier_type == TNS_VERIFIER_TYPE_SHA1 \
1481-
or self.verifier_type == TNS_VERIFIER_TYPE_SSHA1:
1480+
1481+
if self.verifier_type in (TNS_VERIFIER_TYPE_11G_1,
1482+
TNS_VERIFIER_TYPE_11G_2):
14821483
verifier_11g = True
1484+
elif self.verifier_type != TNS_VERIFIER_TYPE_12C:
1485+
errors._raise_err(errors.ERR_UNSUPPORTED_VERIFIER_TYPE,
1486+
verifier_type=self.verifier_type)
14831487
else:
14841488
num_pairs += 1
14851489
self._generate_verifier(verifier_11g)

0 commit comments

Comments
 (0)