import doesn't escape characters in db_url

anarcat - June 17, 2009 - 16:58
Project:Provision
Version:6.x-0.2
Component:Code
Category:bug report
Priority:critical
Assigned:anarcat
Status:closed
Issue tags:aegir-0.2-hotfix
Description

So I have just seen a backup fail because of escaped characters in the db_url:

Generating mysql dump for default. [0.063 sec]                          [backup]
mysqldump -hexample.koumbit.net -uaegir                                   [notice]
-p%40...  -rsites/default/database.sql aegir
[0.063 sec]
Executing: mysqldump -hmysql.koumbit.net -uaegir -p%40... -rsites/default/database.sql aegir
  mysqldump: Got error: 1045: Access denied for user 'aegir'@'example.koumbit.net' (using password: YES) when trying to connect
Adding sites directory to /var/aegir/backups/default-2009-06-17_3.tar   [backup]
[0.074 sec]

(Some parameters were changed to protect our security.)

I'll try to track this down, but it's rather annoying since it's in 0.2 and we'll need to hotfix...

#1

anarcat - June 17, 2009 - 17:01
Assigned to:Anonymous» anarcat
Status:active» needs work

Okay, so the problem seems to be related with the import mechanism, because the install functions have the urldecode() calls hooked in properly and they are nowhere to be found in import.

#2

anarcat - June 17, 2009 - 17:07
Status:needs work» needs review

Here's a patch I'm going to test in prod. It fixes the dburl parts on import.

AttachmentSize
494358_import_decode_hotfix.patch 3.61 KB

#3

anarcat - June 17, 2009 - 17:13
Status:needs review» fixed

The patch works and I can now backup the site after importing again. I committed the patch as is. However, I'm worried that the backup said it succeeded when it wasn't actually able to connect to the database backend, is that a feature we want?! I have opened #494376: backup succeeds even if database connexion fails to make sure I look into this.

#4

anarcat - June 17, 2009 - 17:18
Title:backup doesn't interpret properly escape characters in db_url» import doesn't escape characters in db_url
Status:fixed» needs work

So the committed fix works great, except verify writes back the db_url without urlencoding it (ugh!). So this breaks the site altogether.

#5

anarcat - June 17, 2009 - 17:39
Status:needs work» needs review

So this patch works better: I urlencode the various parts before injecting them back, directly in the template.

AttachmentSize
494358_import_decode_hotfix-2.patch 4.55 KB

#6

anarcat - June 24, 2009 - 01:34
Status:needs review» fixed

I committed the fix already.

#7

System Message - July 8, 2009 - 01:40
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.