summaryrefslogtreecommitdiff
path: root/program/lib/Net/SMTP.php
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2012-07-23 08:52:23 +0200
committerAleksander Machniak <alec@alec.pl>2012-07-23 08:53:05 +0200
commite7d997915dac4e4a08995e6ba40dd50c92cafc4a (patch)
tree4cf0ad25f8f0792fd0945ef7af2d48efd9b706fb /program/lib/Net/SMTP.php
parent0b0bc46a909924aa8770f3f72998bab23440bb90 (diff)
Update Net_SMTP/Auth_SASL packages to fix Digest-MD5/Cram-MD5 authentication (#1488571)
Diffstat (limited to 'program/lib/Net/SMTP.php')
-rw-r--r--program/lib/Net/SMTP.php20
1 files changed, 8 insertions, 12 deletions
diff --git a/program/lib/Net/SMTP.php b/program/lib/Net/SMTP.php
index 4e04f9191..2c1ef5c55 100644
--- a/program/lib/Net/SMTP.php
+++ b/program/lib/Net/SMTP.php
@@ -17,8 +17,6 @@
// | Jon Parise <jon@php.net> |
// | Damian Alejandro Fernandez Sosa <damlists@cnba.uba.ar> |
// +----------------------------------------------------------------------+
-//
-// $Id$
require_once 'PEAR.php';
require_once 'Net/Socket.php';
@@ -189,7 +187,7 @@ class Net_SMTP
/* Include the Auth_SASL package. If the package is available, we
* enable the authentication methods that depend upon it. */
- if ((@include_once 'Auth/SASL.php') === true) {
+ if (@include_once 'Auth/SASL.php') {
$this->setAuthMethod('CRAM-MD5', array($this, '_authCram_MD5'));
$this->setAuthMethod('DIGEST-MD5', array($this, '_authDigest_MD5'));
}
@@ -727,7 +725,7 @@ class Net_SMTP
}
$challenge = base64_decode($this->_arguments[0]);
- $digest = &Auth_SASL::factory('digestmd5');
+ $digest = &Auth_SASL::factory('digest-md5');
$auth_str = base64_encode($digest->getResponse($uid, $pwd, $challenge,
$this->host, "smtp",
$authz));
@@ -779,7 +777,7 @@ class Net_SMTP
}
$challenge = base64_decode($this->_arguments[0]);
- $cram = &Auth_SASL::factory('crammd5');
+ $cram = &Auth_SASL::factory('cram-md5');
$auth_str = base64_encode($cram->getResponse($uid, $pwd, $challenge));
if (PEAR::isError($error = $this->_put($auth_str))) {
@@ -1004,14 +1002,12 @@ class Net_SMTP
*/
function quotedata(&$data)
{
- /* Change Unix (\n) and Mac (\r) linefeeds into
- * Internet-standard CRLF (\r\n) linefeeds. */
- $data = preg_replace(array('/(?<!\r)\n/','/\r(?!\n)/'), "\r\n", $data);
-
/* Because a single leading period (.) signifies an end to the
- * data, legitimate leading periods need to be "doubled"
- * (e.g. '..'). */
- $data = str_replace("\n.", "\n..", $data);
+ * data, legitimate leading periods need to be "doubled" ('..'). */
+ $data = preg_replace('/^\./m', '..', $data);
+
+ /* Change Unix (\n) and Mac (\r) linefeeds into CRLF's (\r\n). */
+ $data = preg_replace('/(?:\r\n|\n|\r(?!\n))/', "\r\n", $data);
}
/**