steffen: server/kolab-resource-handlers/kolab-resource-handlers/resmgr smtp.php, 1.2, 1.3
cvs at intevation.de
cvs at intevation.de
Tue Jan 11 13:43:51 CET 2005
Author: steffen
Update of /kolabrepository/server/kolab-resource-handlers/kolab-resource-handlers/resmgr
In directory doto:/tmp/cvs-serv29701/kolab-resource-handlers/resmgr
Modified Files:
smtp.php
Log Message:
Fix for Issue610 (dotstuffing problem)
Index: smtp.php
===================================================================
RCS file: /kolabrepository/server/kolab-resource-handlers/kolab-resource-handlers/resmgr/smtp.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- smtp.php 5 Nov 2004 11:11:01 -0000 1.2
+++ smtp.php 11 Jan 2005 12:43:49 -0000 1.3
@@ -55,8 +55,26 @@
return true;
}
+ /* Modified implementation from Net_SMTP that supports
+ * dotstuffing even when getting the mail line-by line */
+ function quotedataline(&$data) {
+ /*
+ * Change Unix (\n) and Mac (\r) linefeeds into Internet-standard CRLF
+ * (\r\n) linefeeds.
+ */
+ $data = preg_replace("/([^\r]{1})\n/", "\\1\r\n", $data);
+ $data = preg_replace("/\n\n/", "\n\r\n", $data);
+
+ /*
+ * Because a single leading period (.) signifies an end to the data,
+ * legitimate leading periods need to be "doubled" (e.g. '..').
+ */
+ if( $data[0] == '.' ) $data = '.'.$data;
+ $data = str_replace("\n.", "\n..", $data);
+ }
+
function data( $data) {
- $this->smtp->quotedata($data);
+ $this->quotedataline($data);
if (PEAR::isError($this->smtp->_send($data))) {
return new PEAR_Error('write to socket failed');
}
More information about the commits
mailing list