Revert "MDL-31248 - lib - Alteration to the rc4encrypt function to allow for old password use."

This reverts commit 0c9edc985c.
This commit is contained in:
Eloy Lafuente (stronk7)
2012-03-09 09:38:59 +01:00
parent f194dcf46a
commit 0e2a80c97b
2 changed files with 13 additions and 31 deletions
+10 -20
View File
@@ -6804,17 +6804,12 @@ class emoticon_manager {
*
* @todo Finish documenting this function
*
* @param string $data Data to encrypt.
* @param bool $usesecurekey Lets us know if we are using the old or new password.
* @return string The now encrypted data.
* @param string $data Data to encrypt
* @return string The now encrypted data
*/
function rc4encrypt($data, $usesecurekey = false) {
if (!$usesecurekey) {
$passwordkey = 'nfgjeingjk';
} else {
$passwordkey = get_site_identifier();
}
return endecrypt($passwordkey, $data, '');
function rc4encrypt($data) {
$password = get_site_identifier();
return endecrypt($password, $data, '');
}
/**
@@ -6822,17 +6817,12 @@ function rc4encrypt($data, $usesecurekey = false) {
*
* @todo Finish documenting this function
*
* @param string $data Data to decrypt.
* @param bool $usesecurekey Lets us know if we are using the old or new password.
* @return string The now decrypted data.
* @param string $data Data to decrypt
* @return string The now decrypted data
*/
function rc4decrypt($data, $usesecurekey = false) {
if (!$usesecurekey) {
$passwordkey = 'nfgjeingjk';
} else {
$passwordkey = get_site_identifier();
}
return endecrypt($passwordkey, $data, 'de');
function rc4decrypt($data) {
$password = get_site_identifier();
return endecrypt($password, $data, 'de');
}
/**
+3 -11
View File
@@ -828,7 +828,7 @@ function set_moodle_cookie($username) {
if ($username !== '') {
// set username cookie for 60 days
setcookie($cookiename, rc4encrypt($username, true), time()+(DAYSECS*60), $CFG->sessioncookiepath, $CFG->sessioncookiedomain, $CFG->cookiesecure, $CFG->cookiehttponly);
setcookie($cookiename, rc4encrypt($username), time()+(DAYSECS*60), $CFG->sessioncookiepath, $CFG->sessioncookiedomain, $CFG->cookiesecure, $CFG->cookiehttponly);
}
}
@@ -849,18 +849,10 @@ function get_moodle_cookie() {
if (empty($_COOKIE[$cookiename])) {
return '';
} else {
$username = rc4decrypt($_COOKIE[$cookiename], true);
if ($username != clean_param($username, PARAM_USERNAME)) {
$username = rc4decrypt($_COOKIE[$cookiename]);
if ($username == clean_param($username, PARAM_USERNAME)) {
set_moodle_cookie($username);
} else {
$username = '';
}
}
$username = rc4decrypt($_COOKIE[$cookiename]);
if ($username === 'guest' or $username === 'nobody') {
// backwards compatibility - we do not set these cookies any more
$username = '';
return '';
}
return $username;
}