From 755673e1bca7edb6bee7a958f40d9ae54d85d44c Mon Sep 17 00:00:00 2001 From: msg Date: Mon, 1 Apr 2019 19:34:11 -0400 Subject: [PATCH] Fixed #30307 -- Fixed incorrect quoting of database user password when using dbshell on Oracle. Regression in acfc650f2a6e4a79e80237eabfa923ea3a05d709. --- django/db/backends/oracle/base.py | 2 +- docs/releases/2.2.1.txt | 4 +++- tests/backends/oracle/tests.py | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/django/db/backends/oracle/base.py b/django/db/backends/oracle/base.py index f80c6f3024..b19361b157 100644 --- a/django/db/backends/oracle/base.py +++ b/django/db/backends/oracle/base.py @@ -213,7 +213,7 @@ class DatabaseWrapper(BaseDatabaseWrapper): return settings_dict['NAME'] def _connect_string(self): - return '%s/\\"%s\\"@%s' % (self.settings_dict['USER'], self.settings_dict['PASSWORD'], self._dsn()) + return '%s/"%s"@%s' % (self.settings_dict['USER'], self.settings_dict['PASSWORD'], self._dsn()) def get_connection_params(self): conn_params = self.settings_dict['OPTIONS'].copy() diff --git a/docs/releases/2.2.1.txt b/docs/releases/2.2.1.txt index 6710ad63cf..fb26e39a25 100644 --- a/docs/releases/2.2.1.txt +++ b/docs/releases/2.2.1.txt @@ -9,4 +9,6 @@ Django 2.2.1 fixes several bugs in 2.2. Bugfixes ======== -* ... +* Fixed a regression in Django 2.1 that caused the incorrect quoting of + database user password when using :djadmin:`dbshell` on Oracle + (:ticket:`30307`). diff --git a/tests/backends/oracle/tests.py b/tests/backends/oracle/tests.py index baf2b083ff..a0d49854d9 100644 --- a/tests/backends/oracle/tests.py +++ b/tests/backends/oracle/tests.py @@ -87,7 +87,7 @@ class TransactionalTests(TransactionTestCase): old_password = connection.settings_dict['PASSWORD'] connection.settings_dict['PASSWORD'] = 'p@ssword' try: - self.assertIn('/\\"p@ssword\\"@', connection._connect_string()) + self.assertIn('/"p@ssword"@', connection._connect_string()) with self.assertRaises(DatabaseError) as context: connection.cursor() # Database exception: "ORA-01017: invalid username/password" is