Raised This Month: $32 Target: $400
 8% 

Bug Report Database password bug.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
lugui
Senior Member
Join Date: Feb 2016
Location: GetClientAbsOrigin();
Old 02-27-2017 , 12:43   Database password bug.
Reply With Quote #1

In the config file "config.php" where you set up your database password, if you use some characters (like "#") you will get a blank page.

It happens in init.php at line 126

$GLOBALS['db'] = ADONewConnection("mysqli://".DB_USER.':'.DB_PASS.'@'.DB_HOST.':'.DB_PORT .'/'.DB_NAME);

PHP Code:

// ---------------------------------------------------
//  Setup our DB
// ---------------------------------------------------
include_once(INCLUDES_PATH "/adodb/adodb.inc.php");
include_once(
INCLUDES_PATH "/adodb/adodb-errorhandler.inc.php");

$GLOBALS['db'] = ADONewConnection("mysqli://".DB_USER.':'.DB_PASS.'@'.DB_HOST.':'.DB_PORT.'/'.DB_NAME);
$GLOBALS['log'] = new CSystemLog();

if( !
is_object($GLOBALS['db']) )
                die(
'');
                
$mysql_server_info $GLOBALS['db']->ServerInfo();
$GLOBALS['db_version'] = $mysql_server_info['version'];

$debug $GLOBALS['db']->Execute("SELECT value FROM `".DB_PREFIX."_settings` WHERE setting = 'config.debug';");
if(
$debug->fields['value']=="1") {
    
define("DEVELOPER_MODE"true);

it will try to connect to the database, if it fails, the page dies whith no error.

PHP Code:

if( !is_object($GLOBALS['db']) )
                die(
''); 
Solution: just urlencode the DB_PASS


PHP Code:
$GLOBALS['db'] = ADONewConnection("mysqli://".DB_USER.':'.urlencode(DB_PASS).'@'.DB_HOST.':'.DB_PORT.'/'.DB_NAME); 
lugui is offline
Distortion
Member
Join Date: Feb 2017
Old 02-28-2017 , 02:28   Re: Database password bug.
Reply With Quote #2

I've posted your solution to github issues section.

https://github.com/sbpp/sourcebans-pp/issues/235

_______Edit_______
https://github.com/sbpp/sourcebans-p...ment-283015324
Quote:
config.php is using single quoted strings they don't interpret special characters like #. I will take a look into this and push a commit with the changes later.
__________________

Last edited by Distortion; 02-28-2017 at 06:43. Reason: Github Response
Distortion is offline
lugui
Senior Member
Join Date: Feb 2016
Location: GetClientAbsOrigin();
Old 02-28-2017 , 10:23   Re: Database password bug.
Reply With Quote #3

Thx
lugui is offline
lugui
Senior Member
Join Date: Feb 2016
Location: GetClientAbsOrigin();
Old 02-28-2017 , 10:34   Re: Database password bug.
Reply With Quote #4

Quote:
Originally Posted by Technoblazed

# cancels out the remainder of the line, why the hell would you use a # in a password

I just use a safe password...

https://lastpass.com/generatepassword.php

Last edited by lugui; 02-28-2017 at 13:39.
lugui is offline
Distortion
Member
Join Date: Feb 2017
Old 03-03-2017 , 03:05   [SOLVED] Database password bug.
Reply With Quote #5

Added encoding for database passwords
https://github.com/sbpp/sourcebans-p...0002ff4e498f3a
__________________
Distortion is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 13:09.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode