Edgewall Software
Modify

Opened 9 years ago

Closed 8 years ago

#12409 closed defect (worksforme)

The $ character must be URL encoded if used as a database password

Reported by: Ryan J Ollos Owned by:
Priority: normal Milestone:
Component: database backend Version:
Severity: normal Keywords: mysql
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

TracEnvironment#DatabaseConnectionStrings lists 3 characters that must be URL encoded when used as a database password. I've found that $ must also be URL encoded (Trac 1.0.10).

I found this by trial and error. It's not clear to me why $ needs to be encoded.

>>> from trac.db.api import _parse_db_str
>>> p = _parse_db_str('mysql://tracuser:the$_$password@localhost:3306/trac')
>>> print(p[1]['password'])
the$_$password

Attachments (1)

Screen Shot 2016-08-30 at 12.09.25.png (123.9 KB ) - added by Ryan J Ollos 8 years ago.

Download all attachments as: .zip

Change History (4)

comment:1 by Jun Omae, 9 years ago

Works for me….

$ ~/venv/trac/1.0.10/bin/trac-admin /dev/shm/trac initenv Project 'mysql://tractestuser:the$_$password@127.0.0.1/tractest'
Creating and Initializing Project
 Installing default wiki pages
  TracNavigation imported from /home/jun66j5/venv/trac/1.0.10/lib/python2.5/site-packages/trac/wiki/default-pages/TracNavigation
...
Congratulations!

$ grep database /dev/shm/trac/conf/trac.ini
database = mysql://tractestuser:the$_$password@127.0.0.1/tractest
$ ~/venv/trac/1.0.10/bin/trac-admin /dev/shm/trac                                                              Welcome to trac-admin 1.0.10
Interactive Trac administration console.
Copyright (C) 2003-2013 Edgewall Software

Type:  '?' or 'help' for help on commands.

Trac [/dev/shm/trac]> ticket_type list

Possible Values
---------------
defect
enhancement
task

Trac [/dev/shm/trac]>

comment:2 by Ryan J Ollos, 9 years ago

Yeah, it's very strange behavior to see on this server. The server on which I did the SQLite to MySQL migration currently has an encoded value for $ in the database connection string password: %24. It's the only way I could get Trac to connect to the database. When connecting with the MySQL client I use $ in the password.

I will try to reproduce locally.

This is CentOS 6:

$ mysql --version
mysql  Ver 14.14 Distrib 5.1.73, for redhat-linux-gnu (x86_64) using readline 5.1

by Ryan J Ollos, 8 years ago

comment:3 by Ryan J Ollos, 8 years ago

Resolution: worksforme
Status: newclosed

Here is some more information about this server, in case this comes up again:

  • MySQL: server: "5.1.73-log", client: "5.1.73", thread-safe: 1
  • MySQLdb: 1.2.3c1
  • Python: 2.6.6

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The ticket will remain with no owner.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from (none) 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.