[PATCH] vBulletin to send database errors warning using your SMTP server [Sitemap] - HeapOverflow Computer Security Community & Forums : Heap Overflow.com

PDA

View Full Version : [PATCH] vBulletin to send database errors warning using your SMTP server


class101
27-12-07, 01:47
By default in the general options vBulletin allows the use of a SMTP server to send emails, this is really useful in a chroot environment for example if you do not want to import the sendmail binary, but if a database error occurs, vBulletin sends theses notification only with the Sendmail bin so follow these few steps to patch vBulletin for sending theses db errors notification using your local postfix for example:

Open class_core.php and find

@mail($technicalemail, $this->appshortname . ' Database Error!', preg_replace("#(\r\n|\r|\n)#s", (@ini_get('sendmail_path') === '') ? "\r\n" : "\n", $message), "From: $technicalemail");
replace to:

require_once(DIR . '/includes/class_mail2.php');
$mail =& new vB_SmtpMail($vbulletin);
$mail->start($technicalemail, "Database Error!", $message, $technicalemail);
$mail->send();
// @mail($technicalemail, $this->appshortname . ' Database Error!', preg_replace("#(\r\n|\r|\n)#s", (@ini_get('sendmail_path') === '') ? "\r\n" : "\n", $message), "From: $technicalemail");
Now copy the content of class_mail.php to class_mail2.php, open it and find:

define('MAIL_INCLUDED', true)add below:

require_once(DIR . '/includes/functions.php');Now find:

($hook = vBulletinHook::fetch_hook('mail_send')) ? eval($hook) : false;and comment it like that:

//($hook = vBulletinHook::fetch_hook('mail_send')) ? eval($hook) : false;and finally find:

$this->smtpHost = (!empty($this->registry->options['smtp_tls']) ? 'tls://' : '') . $this->registry->options['smtp_host'];replace it to:

$this->smtpHost = (!empty($this->registry->options['smtp_tls']) ? 'tls://' : '0.0.0.0') . $this->registry->options['smtp_host'];Database errors are now sent using your local SMTP server, assuming you have it running on localhost:25 without authentication.
Submitted a support bug for this issue to Jelsoft, they confirmed the glitch however I don't know if this is planned to change soon so a reminder isn't useless.

Have fun!