diff --git a/cron/SendReminder.service b/cron/SendReminder.service index 0f8562d7b4f3bcb767e1c26f0219267b3f15de54..f9334720399c686d84c7c5fce71c05ff08abd713 100644 --- a/cron/SendReminder.service +++ b/cron/SendReminder.service @@ -253,7 +253,7 @@ function send_email($to,$from,$subject,$contents,$mail_server,$mail_server_usern else $mail->SMTPAuth = false; $mail->Username = $mail_server_username ; // SMTP username - $mail->Password = $mail_server_password ; // SMTP password + $mail->Password = Vtiger_Functions::fromProtectedText($mail_server_password) ; // SMTP password $mail->From = $from; $mail->FromName = $initialfrom; $log->info("Mail sending process : From Name & email id => '".$initialfrom."','".$from."'"); diff --git a/cron/intimateTaskStatus.php b/cron/intimateTaskStatus.php index cc6122efbeb86c3f25e767b6b7d76d0ed13621f3..0e7252d9db687b6f0f661ce39ceb3a7bbdf993d0 100755 --- a/cron/intimateTaskStatus.php +++ b/cron/intimateTaskStatus.php @@ -22,7 +22,7 @@ $mailserveresult = $adb->pquery("SELECT server,server_username,server_password,s $mailrow = $adb->fetch_array($mailserveresult); $mailserver = $mailrow[0]; $mailuname = $mailrow[1]; -$mailpwd = $mailrow[2]; +$mailpwd = Vtiger_Functions::fromProtectedText($mailrow[2]); $smtp_auth = $mailrow[3]; // End Email Setup diff --git a/cron/send_mail.php b/cron/send_mail.php index 918f3632b3bf63332dd5671240203a625eb05cce..695f79c2109af0b196ee0c3d0025f6f9ac0c3804 100755 --- a/cron/send_mail.php +++ b/cron/send_mail.php @@ -42,7 +42,7 @@ function sendmail($to,$from,$subject,$contents,$mail_server,$mail_server_usernam else $mail->SMTPAuth = false; $mail->Username = $mail_server_username ;//$smtp_username; // SMTP username - $mail->Password = $mail_server_password ;//$smtp_password; // SMTP password + $mail->Password = Vtiger_Functions::fromProtectedText($mail_server_password);//$smtp_password; // SMTP password $mail->From = $from; $mail->FromName = $initialfrom; $mail->AddAddress($to); // name is optional diff --git a/modules/Emails/mail.php b/modules/Emails/mail.php index cb5359cee4ecbf181dd9fab70caf084096caea0c..911bc30d1b423a159c96311bfbd93e5386e418b9 100755 --- a/modules/Emails/mail.php +++ b/modules/Emails/mail.php @@ -326,7 +326,7 @@ function setMailServerProperties($mail) } $mail->Host = $server; // specify main and backup server $mail->Username = $username ; // SMTP username - $mail->Password = $password ; // SMTP password + $mail->Password = Vtiger_Functions::fromProtectedText($password); // SMTP password // To Support TLS $serverinfo = explode("://", $server); diff --git a/modules/Migration/schema/710_to_711.php b/modules/Migration/schema/710_to_711.php index 118c9656b703ef65da2846164ffed30cbeb41830..bea8a87d59f9d9fba64cc35ed6863b23b0062802 100644 --- a/modules/Migration/schema/710_to_711.php +++ b/modules/Migration/schema/710_to_711.php @@ -17,4 +17,7 @@ if (defined('VTIGER_UPGRADE')) { if (in_array('user_hash', $columns)) { $db->pquery('ALTER TABLE vtiger_users DROP COLUMN user_hash', array()); } + + // Resizing column to hold wider string value. + $db->pquery('ALTER TABLE vtiger_systems MODIFY server_password VARCHAR(255)', array()); } diff --git a/modules/Settings/Vtiger/models/Systems.php b/modules/Settings/Vtiger/models/Systems.php index 57c67dc752b8653b2e96c4cd4e7820054e92427a..d4beccb1ed9999e0e06de9793209f7f262c4cf2b 100644 --- a/modules/Settings/Vtiger/models/Systems.php +++ b/modules/Settings/Vtiger/models/Systems.php @@ -26,7 +26,13 @@ class Settings_Vtiger_Systems_Model extends Vtiger_Base_Model{ $id = $this->getId(); $params = array(); - array_push($params, $this->get('server'),$this->get('server_port'),$this->get('server_username'),$this->get('server_password'),$this->get('server_type'), + + $server_password = $this->get('server_password'); + if ($id && !Vtiger_Functions::isProtectedText($server_password)) { + $server_password = Vtiger_Functions::toProtectedText($server_password); + } + + array_push($params, $this->get('server'),$this->get('server_port'),$this->get('server_username'),$server_password,$this->get('server_type'), $this->isSmtpAuthEnabled(),$this->get('server_path'),$this->get('from_email_field')); if(empty($id)) { diff --git a/schema/DatabaseSchema.xml b/schema/DatabaseSchema.xml index efbe43015572397abad1af132e80d07674413a35..68d7d560e0594184c49676ffdc546d81fb4693d8 100644 --- a/schema/DatabaseSchema.xml +++ b/schema/DatabaseSchema.xml @@ -1822,7 +1822,7 @@ <field name="server" type="C" size="100" /> <field name="server_port" type="I" size="19" /> <field name="server_username" type="C" size="100" /> - <field name="server_password" type="C" size="100" /> + <field name="server_password" type="C" size="255" /> <field name="server_type" type="C" size="20" /> <field name="smtp_auth" type="C" size="5" /> <field name="server_path" type="C" size="256" /> diff --git a/vtlib/Vtiger/Mailer.php b/vtlib/Vtiger/Mailer.php index 3c69bc8723e7b24383b44d508140027502f58bdc..8eb3871ecb128c01b0cc7dba08fa014d09a4fe39 100644 --- a/vtlib/Vtiger/Mailer.php +++ b/vtlib/Vtiger/Mailer.php @@ -52,7 +52,7 @@ class Vtiger_Mailer extends PHPMailer { if($adb->num_rows($result)) { $this->Host = $adb->query_result($result, 0, 'server'); $this->Username = decode_html($adb->query_result($result, 0, 'server_username')); - $this->Password = decode_html($adb->query_result($result, 0, 'server_password')); + $this->Password = Vtiger_Functions::fromProtectedText(decode_html($adb->query_result($result, 0, 'server_password'))); $this->SMTPAuth = $adb->query_result($result, 0, 'smtp_auth'); // To support TLS