BUG 9477 Problem notifying the next user

We've detected 2 problems:

1.- The new algorithm to detect if the password is encrypted don't support passwords with a ":" character

2.- When recover the email configuration the system don't decrypt correctly the password of a previous version (without encryption, backwards compatibility)
This commit is contained in:
Julio Cesar Laura
2012-07-25 18:47:13 -04:00
parent 16ce328397
commit f6d90d7ac6
12 changed files with 309 additions and 186 deletions

View File

@@ -4452,10 +4452,15 @@ class Cases
$aConfiguration = unserialize($aConfiguration["CFG_VALUE"]);
$passwd = $aConfiguration["MESS_PASSWORD"];
$passwdDec = G::decrypt($passwd, "EMAILENCRYPT");
if (strpos($passwdDec, "hash:") !== false) {
list($hash, $pass) = explode(":", $passwdDec);
$passwd = $pass;
}
$auxPass = explode('hash:', $passwdDec);
if (count($auxPass) > 1) {
if (count($auxPass) == 2) {
$passwd = $auxPass[1];
} else {
array_shift($auxPass);
$passwd = implode('', $auxPass);
}
}
$aConfiguration["MESS_PASSWORD"] = $passwd;
} else {
$aConfiguration = array();

View File

@@ -52,7 +52,7 @@ require_once ('classes/model/AppMessage.php');
class spoolRun {
private $config;
public $config;
private $fileData;
private $spool_id;
public $status;
@@ -332,10 +332,16 @@ class spoolRun {
$oPHPMailer->Username = $this->config['MESS_ACCOUNT'];
$passwd = $this->config['MESS_PASSWORD'];
$passwdDec = G::decrypt($passwd,'EMAILENCRYPT');
if (strpos( $passwdDec, 'hash:' ) !== false) {
list($hash, $pass) = explode(":", $passwdDec);
$this->config['MESS_PASSWORD'] = $pass;
}
$auxPass = explode('hash:', $passwdDec);
if (count($auxPass) > 1) {
if (count($auxPass) == 2) {
$passwd = $auxPass[1];
} else {
array_shift($auxPass);
$passwd = implode('', $auxPass);
}
}
$this->config['MESS_PASSWORD'] = $passwd;
$oPHPMailer->Password = $this->config['MESS_PASSWORD'];
$oPHPMailer->From = $this->fileData['from_email'];
$oPHPMailer->FromName = utf8_decode($this->fileData['from_name']);
@@ -386,10 +392,16 @@ class spoolRun {
$oPHPMailer->Username = $this->config['MESS_ACCOUNT'];
$passwd = $this->config['MESS_PASSWORD'];
$passwdDec = G::decrypt($passwd,'EMAILENCRYPT');
if (strpos( $passwdDec, 'hash:' ) !== false) {
list($hash, $pass) = explode(":", $passwdDec);
$this->config['MESS_PASSWORD'] = $pass;
}
$auxPass = explode('hash:', $passwdDec);
if (count($auxPass) > 1) {
if (count($auxPass) == 2) {
$passwd = $auxPass[1];
} else {
array_shift($auxPass);
$passwd = implode('', $auxPass);
}
}
$this->config['MESS_PASSWORD'] = $passwd;
$oPHPMailer->Password = $this->config['MESS_PASSWORD'];
$oPHPMailer->From = $this->fileData['from_email'];
$oPHPMailer->FromName = utf8_decode($this->fileData['from_name']);
@@ -472,10 +484,16 @@ class spoolRun {
$passwd = $this->config['MESS_PASSWORD'];
$passwdDec = G::decrypt($passwd,'EMAILENCRYPT');
if (strpos( $passwdDec, 'hash:' ) !== false) {
list($hash, $pass) = explode(":", $passwdDec);
$this->config['MESS_PASSWORD'] = $pass;
}
$auxPass = explode('hash:', $passwdDec);
if (count($auxPass) > 1) {
if (count($auxPass) == 2) {
$passwd = $auxPass[1];
} else {
array_shift($auxPass);
$passwd = implode('', $auxPass);
}
}
$this->config['MESS_PASSWORD'] = $passwd;
$send->setPassword($this->config['MESS_PASSWORD']);
$send->setReturnPath($this->fileData['from_email']);
$send->setHeaders($header);
@@ -508,11 +526,16 @@ class spoolRun {
$aConfiguration = unserialize($aConfiguration["CFG_VALUE"]);
$passwd = $aConfiguration["MESS_PASSWORD"];
$passwdDec = G::decrypt($passwd,"EMAILENCRYPT");
if (strpos($passwdDec, "hash:") !== false) {
list($hash, $pass) = explode(":", $passwdDec);
$aConfiguration["MESS_PASSWORD"] = $pass;
}
$auxPass = explode('hash:', $passwdDec);
if (count($auxPass) > 1) {
if (count($auxPass) == 2) {
$passwd = $auxPass[1];
} else {
array_shift($auxPass);
$passwd = implode('', $auxPass);
}
}
$aConfiguration["MESS_PASSWORD"] = $passwd;
if ($aConfiguration["MESS_ENABLED"] == "1") {
$this->setConfig(array(

View File

@@ -710,11 +710,16 @@ class wsBase
$passwd =$aSetup['MESS_PASSWORD'];
$passwdDec = G::decrypt($passwd,'EMAILENCRYPT');
if (strpos($passwdDec, 'hash:') !== false) {
list($hash, $pass) = explode(":", $passwdDec);
$arrayFrom['MESS_PASSWORD'] = $pass;
}
$auxPass = explode('hash:', $passwdDec);
if (count($auxPass) > 1) {
if (count($auxPass) == 2) {
$passwd = $auxPass[1];
} else {
array_shift($auxPass);
$passwd = implode('', $auxPass);
}
}
$aSetup['MESS_PASSWORD'] = $passwd;
$oSpool = new spoolRun();
$oSpool->setConfig(array(

View File

@@ -15,7 +15,7 @@ require_once 'classes/model/om/BaseAppNotes.php';
*/
class AppNotes extends BaseAppNotes {
function getNotesList($appUid, $usrUid='', $start='', $limit='')
function getNotesList($appUid, $usrUid='', $start='', $limit='')
{
require_once ("classes/model/Users.php");
@@ -62,8 +62,8 @@ class AppNotes extends BaseAppNotes {
$oDataset = appNotesPeer::doSelectRS($Criteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
while ($aRow = $oDataset->getRow()) {
while ($aRow = $oDataset->getRow()) {
$aRow['NOTE_CONTENT'] = stripslashes($aRow['NOTE_CONTENT']);
$response['notes'][] = $aRow;
$oDataset->next();
@@ -147,12 +147,18 @@ class AppNotes extends BaseAppNotes {
$aConfiguration = $oConfiguration->load('Emails', '', '', '', '');
if ($aConfiguration['CFG_VALUE'] != '') {
$aConfiguration = unserialize($aConfiguration['CFG_VALUE']);
$passwd = $aConfiguration['MESS_PASSWORD'];
$passwd = $aConfiguration['MESS_PASSWORD'];
$passwdDec = G::decrypt($passwd,'EMAILENCRYPT');
if (strpos( $passwdDec, 'hash:' ) !== false) {
list($hash, $pass) = explode(":", $passwdDec);
$aConfiguration['MESS_PASSWORD'] = $pass;
}
$auxPass = explode('hash:', $passwdDec);
if (count($auxPass) > 1) {
if (count($auxPass) == 2) {
$passwd = $auxPass[1];
} else {
array_shift($auxPass);
$passwd = implode('', $auxPass);
}
}
$aConfiguration['MESS_PASSWORD'] = $passwd;
} else {
$aConfiguration = array();
}
@@ -195,7 +201,7 @@ class AppNotes extends BaseAppNotes {
}
$sSubject = G::replaceDataField($configNoteNotification['subject'], $aFields);
//erik: new behaviour for messages
//G::loadClass('configuration');
@@ -220,7 +226,7 @@ class AppNotes extends BaseAppNotes {
G::LoadClass('spool');
$oUser = new Users();
$recipientsArray=explode(",",$noteRecipients);
foreach($recipientsArray as $recipientUid){
@@ -255,7 +261,7 @@ class AppNotes extends BaseAppNotes {
if (($aConfiguration['MESS_BACKGROUND'] == '') || ($aConfiguration['MESS_TRY_SEND_INMEDIATLY'] == '1')) {
$oSpool->sendMail();
}
}
//Send derivation notification - End