0045c6757fbf6a1a749a56b9706caceb9dba88bc
1 <?php
2 /*
3 This code is part of GOsa (https://gosa.gonicus.de)
4 Copyright (C) 2003 Cajus Pollmeier
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
21 function dump_ldap ($mode= 0)
22 {
23 global $config;
24 $ldap= $config->get_ldap_link();
26 $display = "";
28 if($mode == 2){ // Single Entry Export !
29 $dn = base64_decode($_GET['dn']);
30 $display = $ldap->gen_one_entry($dn);
31 echo $display;
32 }
33 elseif($mode == 3){ // Full LDIF Export !
34 $dn = base64_decode($_GET['dn']);
35 $display = $ldap->gen_ldif($dn);
36 echo $display;
37 }
38 elseif($mode == 4){ // IVBB LDIF Export
39 $dn = base64_decode($_GET['dn']);
40 $display= $ldap->gen_ldif($dn,"(objectClass=ivbbentry)",array(
41 "GouvernmentOrganizationalUnit","houseIdentifier","vocation",
42 "ivbbLastDeliveryCollective","gouvernmentOrganizationalPersonLocality",
43 "gouvernmentOrganizationalUnitDescription","gouvernmentOrganizationalUnitSubjectArea",
44 "functionalTitle","role","certificateSerialNumber","userCertificate","publicVisible",
45 "telephoneNumber","seeAlso","description","title","x121Address","registeredAddress",
46 "destinationIndicator","preferredDeliveryMethod","telexNumber","teletexTerminalIdentifier",
47 "telephoneNumber","internationaliSDNNumber","facsimileTelephoneNumber","street",
48 "postOfficeBox","postalCode","postalAddress","physicalDeliveryOfficeName","ou",
49 "st","l","audio","businessCategory","carLicense","departmentNumber","displayName",
50 "employeeNumber","employeeType","givenName","homePhone","homePostalAddress",
51 "initials","jpegPhoto","labeledURI","mail","manager","mobile","o","pager","photo",
52 "roomNumber","secretary","userCertificate","x500uniqueIdentifier","preferredLanguage",
53 "userSMIMECertificate","userPKCS12"));
55 echo $display;
56 }
57 }
60 /* Basic setup, remove eventually registered sessions */
61 @require_once ("../include/php_setup.inc");
62 @require_once ("functions.inc");
63 error_reporting (E_ALL);
64 session_start ();
66 /* Logged in? Simple security check */
67 if (!isset($_SESSION['ui'])){
68 gosa_log ("Error: getldif.php called without session");
69 header ("Location: index.php");
70 exit;
71 }
72 $ui= $_SESSION["ui"];
73 $config= $_SESSION['config'];
75 /* Check ACL's */
76 $dn = base64_decode($_GET['dn']);
77 $acl = $ui->get_permissions($dn,"ldapmanager/ldifexport");
78 if(!preg_match("/r/",$acl)){
79 echo "insufficient permissions";
80 exit();
81 }
84 header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
85 header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
86 header("Cache-Control: no-cache");
87 header("Pragma: no-cache");
88 header("Cache-Control: post-check=0, pre-check=0");
90 header("Content-type: text/plain");
93 switch ($_GET['ivbb']){
94 case 2: dump_ldap (2);
95 break;
97 case 3: dump_ldap (3);
98 break;
100 case 4: dump_ldap (4);
101 break;
103 default:
104 echo "Error in ivbb parameter. Request aborted.";
105 }
106 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
107 ?>