Edgewall Software
Modify

Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#4866 closed defect (fixed)

Bug when handling slashes in DB passwords

Reported by: shredder80@… Owned by: Matthew Good
Priority: low Milestone: 0.10.4
Component: admin/console Version: 0.10.3
Severity: normal Keywords: _parse_db_string documentation
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

When trying to initialize a new Trac environment with trac-admin and a password containing slashes ('/'), then trac.db.api._parse_db_str(db_str) parses the password up to the first slash as the DB port, which in turn generates a parse error like in the following example (where the DB password starts with "1X2/").

If this is not recognized as a bug but as poor password selection, then this password constraint should at least be mentioned in the Trac install guide.

Creating and Initializing Project
Failed to create environment. invalid literal for int(): 1X2
Traceback (most recent call last):
  File "/projects/skillmap/usr/trac-0.10.3/lib/python2.4/site-packages/trac/scripts/admin.py", line 613, in do_initenv
    options=options)
  File "/projects/skillmap/usr/trac-0.10.3/lib/python2.4/site-packages/trac/env.py", line 124, in __init__
    self.create(options)
  File "/projects/skillmap/usr/trac-0.10.3/lib/python2.4/site-packages/trac/env.py", line 229, in create
    DatabaseManager(self).init_db()
  File "/projects/skillmap/usr/trac-0.10.3/lib/python2.4/site-packages/trac/db/api.py", line 68, in init_db
    connector, args = self._get_connector()
  File "/projects/skillmap/usr/trac-0.10.3/lib/python2.4/site-packages/trac/db/api.py", line 84, in _get_connector
    scheme, args = _parse_db_str(self.connection_uri)
  File "/projects/skillmap/usr/trac-0.10.3/lib/python2.4/site-packages/trac/db/api.py", line 146, in _parse_db_str
    port = int(port)
ValueError: invalid literal for int(): 1X2
Failed to initialize environment. 1
Traceback (most recent call last):
  File "/projects/skillmap/usr/trac-0.10.3/lib/python2.4/site-packages/trac/scripts/admin.py", line 617, in do_initenv
    sys.exit(1)
SystemExit: 1

Attachments (0)

Change History (6)

comment:1 by Christian Boos, 16 years ago

Keywords: documentation added
Milestone: 0.10.4

Well, yes, given you can have multiple "/" later on, better keep the db: URLs parsing simple and explicitly mention this limitation in the doc.

comment:2 by Christian Boos, 16 years ago

Milestone: 0.10.40.12

As a second look, it seems possible to modify the parsing in order to accept such passwords.

This is not high prio though.

comment:3 by Christian Boos, 16 years ago

(and the current limitation is now documented in TracEnvironment#DatabaseConnectionStrings)

comment:4 by Matthew Good, 16 years ago

Milestone: 0.120.11
Owner: changed from Christopher Lenz to Matthew Good
Status: newassigned

The URL spec requires ':', '@' or '/' in the username or password to be quoted. This is simple enough to fix.

comment:5 by Matthew Good, 16 years ago

Resolution: fixed
Status: assignedclosed

Fixed in r5096.

comment:6 by Christian Boos, 16 years ago

Milestone: 0.110.10.4

Ported to 0.10.4 as part of r5137.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Matthew Good.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Matthew Good to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.