From 6d197a2d4f2188ff40e738cc85fa8cdfb6f4e2d0 Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 20 Oct 2010 08:55:45 +0000 Subject: [PATCH] Added error handling to ldap export class -Once the generateLdif method failed, we just received an empty file. git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6@20095 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../ldapmanager/addons/ldapmanager/class_export.inc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/gosa-plugins/ldapmanager/addons/ldapmanager/class_export.inc b/gosa-plugins/ldapmanager/addons/ldapmanager/class_export.inc index 466ff2239..8f1262b40 100644 --- a/gosa-plugins/ldapmanager/addons/ldapmanager/class_export.inc +++ b/gosa-plugins/ldapmanager/addons/ldapmanager/class_export.inc @@ -80,14 +80,21 @@ class ldifexport extends plugin } if(!empty($dn)){ + // Check permissions before sending the output if(!preg_match("/r/",$acls)){ msg_dialog::display(_("Permission error"), sprintf(_("You have no permission to export %s!"), bold(LDAP::fix($dn))), ERROR_DIALOG); }else{ - $data = $ldap->generateLdif(LDAP::fix($dn), 'objectClass=*',array(),$scope); - send_binary_content($data,$name); + $data = $ldap->generateLdif(LDAP::fix($dn), 'objectClass=*',array(),$scope, $limit=0); + if($data === NULL){ + msg_dialog::display(_("Error"), + sprintf(_("Failed to generate ldap export, error was '%s'!"), $ldap->get_error()), + ERROR_DIALOG); + }else{ + send_binary_content($data,$name); + } } } -- 2.30.2