From 72c3675679c33fa92aeffffcb56fa80912c3228b Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 26 Jun 2006 06:17:29 +0000 Subject: [PATCH] Fixed ldap import single ldif git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3886 594d385d-05f5-0310-b6e9-bd551577e9d8 --- include/class_ldap.inc | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/include/class_ldap.inc b/include/class_ldap.inc index dbcfc24d6..5295eb284 100644 --- a/include/class_ldap.inc +++ b/include/class_ldap.inc @@ -1058,12 +1058,17 @@ class LDAP{ } /* Split the line into attribute and value */ - $attr = split(":", $row); + $attr = split(":", $row,2); $attr[0]= trim($attr[0]); /* attribute */ - $attr[1]= trim($attr[1]); /* value */ + $attr[1]= $attr[1]; /* value */ - $attr[0] = trim( preg_replace("/:.*$/","",$row)); - $attr[1] = trim( preg_replace("/^".$attr[0]."[ ::]/","",$row)); + /* Check :: was used to indicate base64_encoded strings */ + if($attr[1][0] == ":"){ + $attr[1]=trim(preg_replace("/^:/","",$attr[1])); + $attr[1]=base64_decode($attr[1]); + } + + $attr[1] = trim($attr[1]); /* Check for attributes that are used more than once */ if(!isset($data[$attr[0]])) { @@ -1111,6 +1116,7 @@ class LDAP{ $this->cd ($this->basedn); $this->create_missing_trees($data['dn']); $this->cd($data['dn']); + $dn = $data['dn']; unset($data['dn']); -- 2.30.2