/usr/share/php/Horde/Mail/Rfc822/Identification.php is in php-horde-mail 2.6.3-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | <?php
/**
* Copyright 2012-2016 Horde LLC (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (BSD). If you
* did not receive this file, see http://www.horde.org/licenses/bsd.
*
* @category Horde
* @copyright 2012-2016 Horde LLC
* @license http://www.horde.org/licenses/bsd New BSD License
* @package Mail
*/
/**
* Class to parse identification headers (RFC 5322 [3.6.4]): Message-ID,
* References, and In-Reply-To.
*
* @author Michael Slusarz <slusarz@horde.org>
* @category Horde
* @copyright 2012-2016 Horde LLC
* @license http://www.horde.org/licenses/bsd New BSD License
* @package Mail
* @since 2.2.0
*/
class Horde_Mail_Rfc822_Identification extends Horde_Mail_Rfc822
{
/**
* List of message IDs parsed.
*
* @var array
*/
public $ids = array();
/**
* Constructor.
*
* @param string $value Identification field value to parse.
*/
public function __construct($value = null)
{
$this->parse($value);
}
/**
* Parse an identification header.
*
* @param string $value Identification field value to parse.
*/
public function parse($value)
{
if (!strlen($value)) {
return;
}
$this->_data = $value;
$this->_datalen = strlen($value);
$this->_params['validate'] = true;
$this->_ptr = 0;
$this->_rfc822SkipLwsp();
while ($this->_curr() !== false) {
try {
$this->ids[] = $this->_parseMessageId();
} catch (Horde_Mail_Exception $e) {
break;
}
// Some mailers incorrectly insert commas between reference items
if ($this->_curr() == ',') {
$this->_rfc822SkipLwsp(true);
}
}
}
/**
* Message IDs are defined in RFC 5322 [3.6.4]. In short, they can only
* contain one '@' character. However, Outlook can produce invalid
* Message-IDs containing multiple '@' characters, which will fail the
* strict RFC checks.
*
* Since we don't care about the structure/details of the Message-ID,
* just do a basic parse that considers all characters inside of angled
* brackets to be valid.
*
* @return string A full Message-ID (enclosed in angled brackets).
*
* @throws Horde_Mail_Exception
*/
private function _parseMessageId()
{
$bracket = ($this->_curr(true) === '<');
$str = '<';
while (($chr = $this->_curr(true)) !== false) {
if ($bracket) {
$str .= $chr;
if ($chr == '>') {
$this->_rfc822SkipLwsp();
return $str;
}
} else {
if (!strcspn($chr, " \n\r\t,")) {
$this->_rfc822SkipLwsp();
return $str;
}
$str .= $chr;
}
}
if (!$bracket) {
return $str;
}
throw new Horde_Mail_Exception('Invalid Message-ID.');
}
}
|