r84593 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r84592‎ | r84593 | r84594 >
Date:12:14, 23 March 2011
Author:greg
Status:ok
Tags:
Comment:
Properly quote the username for UPDATE USER calls. Per bug 27348.
Does not affect 1.17 or forward.
Modified paths:
  • /branches/REL1_16/phase3/maintenance/updaters.inc (modified) (history)

Diff [purge]

Index: branches/REL1_16/phase3/maintenance/updaters.inc
@@ -1520,6 +1520,8 @@
15211521 else {
15221522 $search_path = $conf['search_path'];
15231523 }
 1524+
 1525+ $safeuser = $wgDatabase->quote_ident($wgDBuser);
15241526 if( strpos( $search_path, $wgDBmwschema ) === false ) {
15251527 wfOut( "Adding in schema \"$wgDBmwschema\" to search_path for user \"$wgDBuser\"\n" );
15261528 $search_path = "$wgDBmwschema, $search_path";
@@ -1530,7 +1532,7 @@
15311533 }
15321534 $search_path = str_replace( ', ,', ',', $search_path);
15331535 if( array_key_exists( 'search_path', $conf ) === false || $search_path != $conf['search_path'] ) {
1534 - $wgDatabase->doQuery( "ALTER USER $wgDBuser SET search_path = $search_path" );
 1536+ $wgDatabase->doQuery( "ALTER USER $safeuser SET search_path = $search_path" );
15351537 $wgDatabase->doQuery( "SET search_path = $search_path" );
15361538 }
15371539 else {
@@ -1546,7 +1548,7 @@
15471549 $value = $goodconf[$key];
15481550 if( !array_key_exists( $key, $conf ) or $conf[$key] !== $value ) {
15491551 wfOut( "Setting $key to '$value' for user \"$wgDBuser\"\n" );
1550 - $wgDatabase->doQuery( "ALTER USER $wgDBuser SET $key = '$value'" );
 1552+ $wgDatabase->doQuery( "ALTER USER $safeuser SET $key = '$value'" );
15511553 $wgDatabase->doQuery( "SET $key = '$value'" );
15521554 }
15531555 else {

Status & tagging log