mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	[2.2.x] Fixed #30307 -- Fixed incorrect quoting of database user password when using dbshell on Oracle.
Regression inacfc650f2a. Backport of755673e1bcfrom master
This commit is contained in:
		| @@ -213,7 +213,7 @@ class DatabaseWrapper(BaseDatabaseWrapper): | |||||||
|         return settings_dict['NAME'] |         return settings_dict['NAME'] | ||||||
|  |  | ||||||
|     def _connect_string(self): |     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): |     def get_connection_params(self): | ||||||
|         conn_params = self.settings_dict['OPTIONS'].copy() |         conn_params = self.settings_dict['OPTIONS'].copy() | ||||||
|   | |||||||
| @@ -9,4 +9,6 @@ Django 2.2.1 fixes several bugs in 2.2. | |||||||
| Bugfixes | 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`). | ||||||
|   | |||||||
| @@ -88,7 +88,7 @@ class TransactionalTests(TransactionTestCase): | |||||||
|         old_password = connection.settings_dict['PASSWORD'] |         old_password = connection.settings_dict['PASSWORD'] | ||||||
|         connection.settings_dict['PASSWORD'] = 'p@ssword' |         connection.settings_dict['PASSWORD'] = 'p@ssword' | ||||||
|         try: |         try: | ||||||
|             self.assertIn('/\\"p@ssword\\"@', connection._connect_string()) |             self.assertIn('/"p@ssword"@', connection._connect_string()) | ||||||
|             with self.assertRaises(DatabaseError) as context: |             with self.assertRaises(DatabaseError) as context: | ||||||
|                 connection.cursor() |                 connection.cursor() | ||||||
|             # Database exception: "ORA-01017: invalid username/password" is |             # Database exception: "ORA-01017: invalid username/password" is | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user