diff --git a/framework/Smtp/lib/Horde/Smtp/Filter/Data.php b/framework/Smtp/lib/Horde/Smtp/Filter/Data.php
index 2ea78c12460..b65ab68085c 100644
--- a/framework/Smtp/lib/Horde/Smtp/Filter/Data.php
+++ b/framework/Smtp/lib/Horde/Smtp/Filter/Data.php
@@ -48,7 +48,7 @@ public function filter($in, $out, &$consumed, $closing)
// EOLs need to be CRLF; double leading periods.
$bucket->data = preg_replace(
array("/(?:\r\n|\n|\r(?!\n))/", "/\n\./"),
- array("\r\n", '..'),
+ array("\r\n", "\n.."),
$bucket->data
);
diff --git a/framework/Smtp/package.xml b/framework/Smtp/package.xml
index 3243b389ce9..c727c5d5f9f 100644
--- a/framework/Smtp/package.xml
+++ b/framework/Smtp/package.xml
@@ -10,7 +10,7 @@
slusarz@horde.org
yes
- 2013-10-15
+ 2013-10-19
1.2.5
1.2.0
@@ -21,7 +21,7 @@
LGPL-2.1
-*
+* [mms] Fix escaping periods that begin a line of DATA input.
@@ -59,6 +59,7 @@
+
@@ -142,6 +143,7 @@
+
@@ -253,10 +255,10 @@
stable
stable
- 2013-10-15
+ 2013-10-19
LGPL-2.1
-*
+* [mms] Fix escaping periods that begin a line of DATA input.
diff --git a/framework/Smtp/test/Horde/Smtp/FilterDataTest.php b/framework/Smtp/test/Horde/Smtp/FilterDataTest.php
new file mode 100644
index 00000000000..e74cb63ca12
--- /dev/null
+++ b/framework/Smtp/test/Horde/Smtp/FilterDataTest.php
@@ -0,0 +1,53 @@
+
+ * @category Horde
+ * @copyright 2013 Horde LLC
+ * @ignore
+ * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
+ * @package Smtp
+ * @subpackage UnitTests
+ */
+class Horde_Smtp_FilterDataTest extends Horde_Test_Case
+{
+ private $stream;
+
+ public function setUp()
+ {
+ $this->stream = fopen('php://temp', 'r+');
+ stream_filter_register('horde_smtp_data', 'Horde_Smtp_Filter_Data');
+ stream_filter_append($this->stream, 'horde_smtp_data', STREAM_FILTER_READ);
+ }
+
+ public function tearDown()
+ {
+ fclose($this->stream);
+ }
+
+ public function testLeadingPeriodsEscape()
+ {
+ fwrite($this->stream, "Foo\r\n.\r\nFoo\r\n");
+ rewind($this->stream);
+
+ $this->assertEquals(
+ "Foo\r\n..\r\nFoo\r\n",
+ stream_get_contents($this->stream)
+ );
+ }
+
+}