Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions lib/Resque/Redis.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,8 @@ public static function parseDsn($dsn)
$database = intval(preg_replace('/[^0-9]/', '', $parts['path']));
}

// Extract any 'user' and 'pass' values
// Extract any 'user' values
$user = isset($parts['user']) ? $parts['user'] : false;
$pass = isset($parts['pass']) ? $parts['pass'] : false;

// Convert the query string into an associative array
$options = array();
Expand All @@ -218,6 +217,20 @@ public static function parseDsn($dsn)
parse_str($parts['query'], $options);
}

//check 'password-hashing' parameter and extracting password based on encoding
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be called password-encoding, since we're not actually hashing anything at this point...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made the changes as suggested

if($options && isset($options['password-hashing']) && $options['password-hashing'] === 'u'){
//extracting urlencoded password
$pass = isset($parts['pass']) ? urldecode($parts['pass']) : false;
}
else if($options && isset($options['password-hashing']) && $options['password-hashing'] === 'b'){
//extracting base64 encoded password
$pass = isset($parts['pass']) ? base64_decode($parts['pass']) : false;
}
else{
//extracting pass directly since 'password-hashing' parameter is not present
$pass = isset($parts['pass']) ? $parts['pass'] : false;
}

return array(
$parts['host'],
$port,
Expand Down