]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/LdapCommon/extlib/Net/LDAP2/LDIF.php
Updated LDAP2 extlib to latest version.
[quix0rs-gnu-social.git] / plugins / LdapCommon / extlib / Net / LDAP2 / LDIF.php
index 34f3e75dd54c6358f4e6221d654304a79d41beaf..384b8e2b797fab542d8a54b4e2abe68839ab297a 100644 (file)
@@ -10,7 +10,7 @@
 * @author    Benedikt Hallinger <beni@php.net>
 * @copyright 2009 Benedikt Hallinger
 * @license   http://www.gnu.org/licenses/lgpl-3.0.txt LGPLv3
-* @version   SVN: $Id: LDIF.php 286718 2009-08-03 07:30:49Z beni $
+* @version   SVN: $Id: LDIF.php 324918 2012-04-06 12:31:04Z clockwerx $
 * @link      http://pear.php.net/package/Net_LDAP2/
 */
 
@@ -340,6 +340,7 @@ class Net_LDAP2_LDIF extends PEAR
                                            + count($entry_attrs_changes['replace'])
                                            + count($entry_attrs_changes['delete']);
 
+
                     $is_changed = ($num_of_changes > 0 || $entry->willBeDeleted() || $entry->willBeMoved());
 
                     // write version if not done yet
@@ -556,10 +557,10 @@ class Net_LDAP2_LDIF extends PEAR
         $attributes = array();
         $dn = false;
         foreach ($lines as $line) {
-            if (preg_match('/^(\w+)(:|::|:<)\s(.+)$/', $line, $matches)) {
-                $attr  =& $matches[1];
-                $delim =& $matches[2];
-                $data  =& $matches[3];
+            if (preg_match('/^(\w+(;binary)?)(:|::|:<)\s(.+)$/', $line, $matches)) {
+                $attr  =& $matches[1] . $matches[2];
+                $delim =& $matches[3];
+                $data  =& $matches[4];
 
                 if ($delim == ':') {
                     // normal data
@@ -682,20 +683,22 @@ class Net_LDAP2_LDIF extends PEAR
                         if (preg_match('/^version:\s(.+)$/', $data, $match)) {
                             // version statement, set version
                             $this->version($match[1]);
-                        } elseif (preg_match('/^\w+::?\s.+$/', $data)) {
+                        } elseif (preg_match('/^\w+(;binary)?::?\s.+$/', $data)) {
                             // normal attribute: add line
                             $commentmode         = false;
                             $this->_lines_next[] = trim($data);
                             $datalines_read++;
                         } elseif (preg_match('/^\s(.+)$/', $data, $matches)) {
                             // wrapped data: unwrap if not in comment mode
+                            // note that the \s above is some more liberal than
+                            // the RFC requests as it also matches tabs etc.
                             if (!$commentmode) {
                                 if ($datalines_read == 0) {
                                     // first line of entry: wrapped data is illegal
                                     $this->dropError('Net_LDAP2_LDIF error: illegal wrapping at input line '.$this->_input_line, $this->_input_line);
                                 } else {
                                     $last                = array_pop($this->_lines_next);
-                                    $last                = $last.trim($matches[1]);
+                                    $last                = $last.$matches[1];
                                     $this->_lines_next[] = $last;
                                     $datalines_read++;
                                 }