From: opensides Date: Tue, 1 Nov 2005 18:29:34 +0000 (+0000) Subject: cleanup of code X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=3c21d3bffe4e0724c05a9aa9ca3bccc22735b9be;p=gosa.git cleanup of code cleanup of contrib in opensides removal of getxls.php5 until a solution is found git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1779 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/contrib/opensides/README b/contrib/opensides/README deleted file mode 100644 index 9079839bc..000000000 --- a/contrib/opensides/README +++ /dev/null @@ -1,17 +0,0 @@ -goSamba.pl - This script will help you populate your ldap tree with - the correct attribute when using the smbldap-tools - from idealx. - -goNagios.pl - This script will help you to manage the authentification - users inside of the cgi.cfg, contacts.cfg, contactgroups.cfg -ldap : - -slapd.conf - The slapd.conf confg for openldap 2.2 - -nagios.README - how to add the right entry to make the nagios plugin work - -xls-export.README - how to add the right entry to make the xls export xork - -Benoit Mortier -Guillaume Delecourt -Vincent Seynhaeve \ No newline at end of file diff --git a/contrib/opensides/README.OpenSides b/contrib/opensides/README.OpenSides index d8fd3d2d0..339cfe04b 100644 --- a/contrib/opensides/README.OpenSides +++ b/contrib/opensides/README.OpenSides @@ -4,7 +4,6 @@ goSamba.pl - This script will help you populate your ldap tree with goNagios.pl - This script will help you to manage the authentification users inside of the cgi.cfg, contacts.cfg, contactgroups.cfg -ldap : slapd.conf - The slapd.conf confg for openldap 2.2 @@ -23,8 +22,7 @@ LICENSE : GNU LESSER GENERAL PUBLIC LICENSE Bug: -to make it work under php5 you have to copy the file getxls.php5 on getxls.php -by default it only work with php4 +It doesn't work on php5 we are working on it. Benoit Mortier Guillaume Delecourt diff --git a/contrib/opensides/ldap/slapd.conf b/contrib/opensides/ldap/slapd.conf index 558a2eed4..689bceae1 100644 --- a/contrib/opensides/ldap/slapd.conf +++ b/contrib/opensides/ldap/slapd.conf @@ -37,6 +37,9 @@ include /etc/ldap/schema/gofirewall.schema #include /etc/ldap/schema/phpgwaccount.schema #include /etc/ldap/schema/phpgwcontact.schema +# These should be present for nagios plugin to work +#include /etc/ldap/schema/nagios.schema + # Schema check allows for forcing entries to # match schemas for their objectClasses's schemacheck on @@ -64,7 +67,7 @@ allow bind_v2 password-hash {CRYPT} # Search base -defaultsearchbase dc=ccib,dc=be +defaultsearchbase dc=opensides,dc=be # Where clients are refered to if no @@ -80,7 +83,7 @@ defaultsearchbase dc=ccib,dc=be #sasl-authz-policy #sasl-host gosa.sweatshop.local #sasl-realm sweatshop.LOCAL -#sasl-regexp cn=(.*),ou=(.*) cn=$1,ou=$2,ou=people,dc=ccib,dc=be +#sasl-regexp cn=(.*),ou=(.*) cn=$1,ou=$2,ou=people,dc=opensides,dc=be #sasl-secprops noanonymous ## Kerberos setup @@ -128,11 +131,11 @@ checkpoint 512 720 mode 0600 # The base of your directory -suffix "dc=ccib,dc=be" +suffix "dc=opensides,dc=be" # Sample password is "tester", generate a new one using the mkpasswd # utility and put the string after {crypt} -rootdn "cn=ldapadmin,dc=ccib,dc=be" +rootdn "cn=ldapadmin,dc=opensides,dc=be" rootpw {crypt}2wTonoD6DWM/A # Indexing @@ -161,7 +164,7 @@ lastmod off # Others should not be able to see it, except the admin # entry below access to attrs=userPassword,sambaPwdLastSet,sambaPwdMustChange,sambaPwdCanChange,shadowMax,shadowExpire - by dn="cn=ldapadmin,dc=ccib,dc=be" write + by dn="cn=ldapadmin,dc=opensides,dc=be" write by anonymous auth by self write by self read @@ -170,13 +173,13 @@ access to attrs=userPassword,sambaPwdLastSet,sambaPwdMustChange,sambaPwdCanChang # Deny access to imap/fax/kerberos admin passwords stored # in ldap tree access to attrs=goImapPassword - by dn="cn=ldapadmin,dc=ccib,dc=be" write + by dn="cn=ldapadmin,dc=opensides,dc=be" write by * none access to attrs=goKrbPassword - by dn="cn=ldapadmin,dc=ccib,dc=be" write + by dn="cn=ldapadmin,dc=opensides,dc=be" write by * none access to attrs=goFaxPassword - by dn="cn=ldapadmin,dc=ccib,dc=be" write + by dn="cn=ldapadmin,dc=opensides,dc=be" write by * none # Let servers write last user attribute @@ -188,20 +191,16 @@ access to attrs=gotoLastUser # Others should not be able to see it, except the # admin entry below access to attrs=sambaLmPassword,sambaNtPassword - by dn="cn=ldapadmin,dc=ccib,dc=be" write + by dn="cn=ldapadmin,dc=opensides,dc=be" write by anonymous auth by self write by self read by * none # Enable write create access for the terminal admin -access to dn="ou=incoming,dc=ccib,dc=be" - by dn="cn=terminal-admin,dc=ccib,dc=be" write - by dn="cn=ldapadmin,dc=ccib,dc=be" write - -#access to dn=".*,ou=incoming,dc=ccib,dc=be" -# by dn="cn=terminal-admin,dc=ccib,dc=be" write -# by dn="cn=ldapadmin,dc=ccib,dc=be" write +access to dn="ou=incoming,dc=opensides,dc=be" + by dn="cn=terminal-admin,dc=opensides,dc=be" write + by dn="cn=ldapadmin,dc=opensides,dc=be" write # What trees should be readable, depends on your policy. Either # use this entry and specify what should be readable, or leave @@ -211,7 +210,7 @@ access to dn="ou=incoming,dc=ccib,dc=be" # The admin dn has full write access access to * - by dn="cn=ldapadmin,dc=ccib,dc=be" =wrscx + by dn="cn=ldapadmin,dc=opensides,dc=be" =wrscx by * read # Example replication using admin account. This will require taking the @@ -221,11 +220,11 @@ access to * # Replication setup #replogfile /var/log/ldap-replicalog #replica host=ldap-2.sweatshop.local -# binddn="cn=replicator,dc=ccib,dc=be bindmethod=simple credentials=secret +# binddn="cn=replicator,dc=opensides,dc=be bindmethod=simple credentials=secret # Dummy database for config replication #database shell -#suffix "dc=ccib,dc=shell" +#suffix "dc=opensides,dc=shell" #search /etc/ldap/shell/process.pl #add /etc/ldap/shell/process.pl diff --git a/html/getxls.php5 b/html/getxls.php5 deleted file mode 100644 index d50480fce..000000000 --- a/html/getxls.php5 +++ /dev/null @@ -1,389 +0,0 @@ -get_ldap_link(); - error_reporting (E_ALL & ~E_NOTICE); - - $display = ""; - if($mode == 2){ // Single Entry Export ! - $d = base64_decode($_GET['d']); - $n = base64_decode($_GET['n']); - // print_r($_GET); - $dn=$d.$n; - // echo $dn ; - $fname = tempnam("/tmp", "demo.xls"); - $workbook= new writeexcel_workbook($fname); - - $title_bold= $workbook->addformat(array( - bold => 1, - color => 'black', - size => 10, - font => 'Helvetica' - )); - - - switch ($d){ - case "ou=people," : - $user= $ldap->gen_xls($dn,"(objectClass=*)",array("uid","dateOfBirth","gender","givenName","preferredLanguage")); - $intitul=array("Date de naissance:","Sexe:","Nom/prénom","Langue"); - - $worksheet= $workbook->addworksheet('Users'); - $worksheet->set_column('A:B', 32); - - - $user_nbr=count($user); - $r=1; - for($i=1;$i<$user_nbr;$i++) - { - if($i>1) - $worksheet->write('A'.$r++,""); - $worksheet->write('A'.$r++,"uid : ".$user[$i][0],$title_bold); - for($j=1;$j<5;$j++) - { - $r++; - $worksheet->write('A'.$r,$intitul[$j-1]); - $worksheet->write('B'.$r,$user[$i][$j]); - } - $worksheet->write('A'.$r++,""); - } - break; - - case "ou=groups,": $groups= $ldap->gen_xls($dn,"(objectClass=*)",array("cn","memberUid"),TRUE,1); - $intitul=array("Membres:"); - $worksheet =& $workbook->addworksheet('Groups'); - $worksheet->set_column('A:B', 32); - - //count number of groups - $groups_nbr=count($groups); - $r=1; - for($i=1;$i<$groups_nbr;$i++) - { - $worksheet->write('A'.$r++,"uid : ".$groups[$i][0][0],$title_bold); - for($j=1;$j<=2;$j++) - { - $r++; - $worksheet->write('A'.$r,$intitul[$j-1]); - for($k=0;$k<= $groups[$i][$j]['count'];$k++) - { - $worksheet->write('B'.$r,$groups[$i][$j][$k]); - $r++; - } - } - } - break; - - case "ou=computers,": $computers= $ldap->gen_xls($dn,"(objectClass=*)",array("cn","description","uid")); - $intitul=array("Description:","Uid:"); - $worksheet =& $workbook->addworksheet('Computers'); - $worksheet->set_column('A:B', 32); - - //count number of computers - $computers_nbr=count($computers); - $r=1; - for($i=1;$i<$computers_nbr;$i++) - { - if($i>1) - $worksheet->write('A'.$r++,""); - $worksheet->write('A'.$r++,"cn : ".$computers[$i][0],$title_bold); - for($j=1;$j<3;$j++) - { - $r++; - $worksheet->write('A'.$r,$intitul[$j-1]); - $worksheet->write('B'.$r,$computers[$i][$j]); - } - $worksheet->write('A'.$r++,""); - } - break; - - case "ou=servers,ou=systems,": $servers= $ldap->gen_xls($dn,"(objectClass=*)",array("cn")); - $intitul=array("cn:"); - - $worksheet =& $workbook->addworksheet('Servers'); - $worksheet->set_column('A:B', 32); - - //count number of servers - $servers_nbr=count($servers); - $r=1; - $worksheet->write('A'.$r++,"Servers : ",$title_bold); - for($i=1;$i<$servers_nbr;$i++) - { - for($j=0;$j<1;$j++) - { - $r++; - $worksheet->write('A'.$r,$intitul[$j]); - $worksheet->write('B'.$r,$servers[$i][$j]); - } - } - break; - - case "dc=addressbook,": //data about addressbook - $address= $ldap->gen_xls($dn,"(objectClass=*)",array("cn","displayName","facsimileTelephoneNumber","givenName","homePhone","homePostalAddress","initials","l","mail","mobile","o","ou","pager","telephoneNumber","postalAddress","postalCode","sn","st","title")); - - $intitul=array("cn","DisplayName:","Fax:","Nom/prénom:","Numero de telelphone:","Adresse du domicile:","Initiales:","Ville:","Adresse email:","GSM:","Societe:","Poste:","Pager:","Numero de telelphone:","Adresse:","Code postal:","Sn:","Pays:","Fonction:"); - - $worksheet =& $workbook->addworksheet('Servers'); - $worksheet->set_column('A:B', 32); - - //count number of entries - $address_nbr=count($address); - $r=1; - for($i=1;$i<$address_nbr;$i++) - { - if($i>1) - $worksheet->write('A'.$r++,""); - $worksheet->write('A'.$r++,"cn : ".$address[$i][0],$title_bold); - for($j=1;$j<19;$j++) - { - $r++; - $worksheet->write('A'.$r,$intitul[$j]); - $worksheet->write('B'.$r,$address[$i][$j]); - } - $worksheet->write('A'.$r++,""); - } - - break; - - default: echo "error!!"; - } - - $workbook->close(); - - - // We'll be outputting a xls - header('Content-type: application/x-msexcel'); - - // It will be called demo.xls - header('Content-Disposition: attachment; filename="demo.xls"'); - - // The PDF source is in original.xl - readfile($fname); - - } - elseif($mode == 3){ // Full LDIF Export ! - $dn = base64_decode($_GET['dn']); - - //data about users - $user= $ldap->gen_xls("ou=people,".$dn,"(objectClass=*)",array("uid","dateOfBirth","gender","givenName","preferredLanguage")); - $user_intitul=array("Date de naissance:","Sexe:","Nom/prénom","Langue"); - //data about groups - $groups= $ldap->gen_xls("ou=groups,".$dn,"(objectClass=*)",array("cn","memberUid"),TRUE,1); - $groups_intitul=array("Membres:"); - //data about computers - $computers= $ldap->gen_xls("ou=computers,".$dn,"(objectClass=*)",array("cn","description","uid")); - $computers_intitul=array("Description:","Uid:"); - //data about servers - $servers= $ldap->gen_xls("ou=servers,ou=systems,".$dn,"(objectClass=*)",array("cn")); - $servers_intitul=array("cn:"); - //data about addressbook - $address= $ldap->gen_xls("dc=addressbook,".$dn,"(objectClass=*)",array("cn","displayName","facsimileTelephoneNumber","givenName","homePhone","homePostalAddress","initials","l","mail","mobile","o","ou","pager","telephoneNumber","postalAddress","postalCode","sn","st","title")); - $address_intitul=array("cn","DisplayName:","Fax:","Nom/prénom:","Numero de telelphone:","Adresse du domicile:","Initiales:","Ville:","Adresse email:","GSM:","Societe:","Poste:","Pager:","Numero de telelphone:","Adresse:","Code postal:","Sn:","Pays:","Fonction:"); - - - $fname = tempnam("/tmp", "demo.xls"); - $workbook = new writeexcel_workbook($fname); - $worksheet = $workbook->addworksheet('Users'); - $worksheet2 = $workbook->addworksheet('Groups'); - $worksheet3 = $workbook->addworksheet('Servers'); - $worksheet4 = $workbook->addworksheet('Computers'); - $worksheet5 = $workbook->addworksheet('Adressbook'); - - $worksheet->set_column('A:B', 32); - $worksheet2->set_column('A:B', 32); - $worksheet3->set_column('A:B', 32); - $worksheet4->set_column('A:B', 32); - $worksheet5->set_column('A:B', 32); - - $title_bold =& $workbook->addformat(array( - bold => 1, - color => 'black', - size => 10, - font => 'Helvetica' - )); - - - //count number of users - $user_nbr=count($user); - $r=1; - for($i=1;$i<$user_nbr;$i++) - { - if($i>1) - $worksheet->write('A'.$r++,""); - $worksheet->write('A'.$r++,"uid : ".$user[$i][0],$title_bold); - for($j=1;$j<5;$j++) - { - $r++; - $worksheet->write('A'.$r,$user_intitul[$j-1]); - $worksheet->write('B'.$r,$user[$i][$j]); - } - $worksheet->write('A'.$r++,""); - } - - //count number of groups - $groups_nbr=count($groups); - $r=1; - for($i=1;$i<$groups_nbr;$i++) - { - $worksheet2->write('A'.$r++,"uid : ".$groups[$i][0][0],$title_bold); - for($j=1;$j<=2;$j++) - { - $r++; - $worksheet2->write('A'.$r,$group_intitul[$j-1]); - for($k=0;$k<= $groups[$i][$j]['count'];$k++) - { - $worksheet2->write('B'.$r,$groups[$i][$j][$k]); - $r++; - } - } - } - - //count number of servers - $servers_nbr=count($servers); - $r=1; - $worksheet3->write('A'.$r++,"Servers : ",$title_bold); - for($i=1;$i<$servers_nbr;$i++) - { - for($j=0;$j<1;$j++) - { - $r++; - $worksheet3->write('A'.$r,$servers_intitul[$j]); - $worksheet3->write('B'.$r,$servers[$i][$j]); - } - } - - //count number of computers - $computers_nbr=count($computers); - $r=1; - for($i=1;$i<$computers_nbr;$i++) - { - if($i>1) - $worksheet->write('A'.$r++,""); - $worksheet4->write('A'.$r++,"cn : ".$computers[$i][0],$title_bold); - for($j=1;$j<3;$j++) - { - $r++; - $worksheet4->write('A'.$r,$computers_intitul[$j-1]); - $worksheet4->write('B'.$r,$computers[$i][$j]); - } - $worksheet4->write('A'.$r++,""); - } - - //count number of entries - $address_nbr=count($address); - $r=1; - for($i=1;$i<$address_nbr;$i++) - { - if($i>1) - $worksheet5->write('A'.$r++,""); - $worksheet5->write('A'.$r++,"cn : ".$address[$i][0],$title_bold); - for($j=1;$j<19;$j++) - { - $r++; - $worksheet5->write('A'.$r,$address_intitul[$j]); - $worksheet5->write('B'.$r,$address[$i][$j]); - } - $worksheet5->write('A'.$r++,""); - } - $workbook->close(); - - - // We'll be outputting a xls - header('Content-type: application/x-msexcel'); - - // It will be called demo.xls - header('Content-Disposition: attachment; filename="demo.xls"'); - - // The PDF source is in original.xl - readfile($fname); - - } - elseif($mode == 4){ // IVBB LDIF Export - $dn = base64_decode($_GET['dn']); - /*$display= $ldap->gen_ldif($dn,"(objectClass=ivbbEntry)",array( - "GouvernmentOrganizationalUnit","houseIdentifier","vocation", - "ivbbLastDeliveryCollective","gouvernmentOrganizationalPersonLocality", - "gouvernmentOrganizationalUnitDescription","gouvernmentOrganizationalUnitSubjectArea", - "functionalTitle","role","certificateSerialNumber","userCertificate","publicVisible", - "telephoneNumber","seeAlso","description","title","x121Address","registeredAddress", - "destinationIndicator","preferredDeliveryMethod","telexNumber","teletexTerminalIdentifier", - "telephoneNumber","internationaliSDNNumber","facsimileTelephoneNumber","street", - "postOfficeBox","postalCode","postalAddress","physicalDeliveryOfficeName","ou", - "st","l","audio","businessCategory","carLicense","departmentNumber","displayName", - "employeeNumber","employeeType","givenName","homePhone","homePostalAddress", - "initials","jpegPhoto","labeledURI","mail","manager","mobile","o","pager","photo", - "roomNumber","secretary","userCertificate","x500uniqueIdentifier","preferredLanguage", - "userSMIMECertificate","userPKCS12"));*/ - - echo $display; - } -} - - -/* Basic setup, remove eventually registered sessions */ -@require_once ("../include/php_setup.inc"); -@require_once ("functions.inc"); -error_reporting (E_ALL); -session_start (); - -/* Logged in? Simple security check */ -if (!isset($_SESSION['ui'])){ - gosa_log ("Error: getldif.php called without session"); - header ("Location: ../index.php"); - exit; -} -$ui= $_SESSION["ui"]; -$config= $_SESSION['config']; - -header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); -header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); -header("Cache-Control: no-cache"); -header("Pragma: no-cache"); -header("Cache-Control: post-check=0, pre-check=0"); - -header("Content-type: text/plain"); - -/* Check ACL's */ -$acl= get_permissions ($config->current['BASE'], $ui->subtreeACL); -$acl= get_module_permission($acl, "all", $config->current['BASE']); -if (chkacl($acl, "all") != ""){ - header ("Location: ../index.php"); - exit; -} - -switch ($_GET['ivbb']){ - case 2: dump_ldap (2); - break; - - case 3: dump_ldap (3); - break; - - case 4: dump_ldap (4); - break; - - default: - echo "Error in ivbb parameter. Request aborted."; -} -// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -?> diff --git a/include/class_ldap.inc b/include/class_ldap.inc index c48b64e31..11d42152b 100644 --- a/include/class_ldap.inc +++ b/include/class_ldap.inc @@ -556,7 +556,6 @@ function gen_xls ($dn, $filter= "(objectClass=*)", $attributes= array('*'), $rec $j=0; foreach ($attributes as $at) { -// echo $at; $display[$i][$j]= $this->get_attribute($attrs['dn'], $at,$r_array); $j++;}