From 82cf42aafc6e0bc50c2c91b1f1cbfe348c1857f4 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Tue, 7 Aug 2007 17:47:47 +0000 Subject: [PATCH] no more PHP4 --- lam/INSTALL | 12 ++------ lam/README | 4 +-- lam/lib/lamdaemon.inc | 67 +++++++++++++++++-------------------------- 3 files changed, 30 insertions(+), 53 deletions(-) diff --git a/lam/INSTALL b/lam/INSTALL index 83a2cf30..e3763b58 100644 --- a/lam/INSTALL +++ b/lam/INSTALL @@ -13,17 +13,9 @@ Installation Instructions for LAM - OpenLDAP (>2.0) - A web browser :-) - MHash is only needed if you use PHP < 4.3 and if you want to use SHA or SSHA - for password hashes. + MHash is only needed for Samba password hashes. MCrypt will be used to store your LDAP password encrypted in the session file. - Getting mcrypt and mhash for Suse/RedHat: - - Either you compile PHP4 yourself or you use some unofficial packages: - - - Suse: ftp://ftp.suse.com/pub/people/poeml/mod_php4 - - RedHat: http://ftp.horde.org/pub/RPMS - See docs/README.schema.txt for information about used LDAP schema files. @@ -60,7 +52,7 @@ Installation Instructions for LAM 3. Setting up PHP - LAM runs with PHP4 or PHP5. + LAM runs with PHP5. Needed changes in your php.ini: diff --git a/lam/README b/lam/README index 69abeef9..d28959ef 100644 --- a/lam/README +++ b/lam/README @@ -3,7 +3,7 @@ LAM - Readme ============ LDAP Account Manager (LAM) manages user, group and host accounts in an LDAP - directory. LAM runs on any webserver with PHP4/5 support and connects to your + directory. LAM runs on any webserver with PHP5 support and connects to your LDAP server unencrypted or via SSL/TLS. Currently LAM supports these account types: Samba 2 and 3, Unix, Kolab 2, address book entries, NIS mail aliases and MAC addresses. There is a tree @@ -20,7 +20,7 @@ LAM - Readme Tilo Lutz Requirements: - PHP4/5 + PHP5 Openldap (2.0 or greater) A web-browser that supports CSS diff --git a/lam/lib/lamdaemon.inc b/lam/lib/lamdaemon.inc index 6bfa5e4d..bd70e564 100644 --- a/lam/lib/lamdaemon.inc +++ b/lam/lib/lamdaemon.inc @@ -50,49 +50,34 @@ function lamdaemon($commands, $server) { $userstring = implode ("\n", $commands); $output_array = array(); - if (function_exists('proc_open')) { - // New Code, requires PHP 4.3 - $towrite = escapeshellarg($server)." ".escapeshellarg($_SESSION['config']->scriptPath)." - -"; - $descriptorspec = array( - 0 => array("pipe", "r"), // stdin - 1 => array("pipe", "w"), // stout - 2 => array("file", "/dev/null", "a") // sterr - ); - $process = proc_open(escapeshellarg($_SESSION['lampath']."lib/lamdaemonOld.pl")." ".$towrite, - $descriptorspec, - $pipes); - if (is_resource($process)) { - /* perl-script is running - * $pipes[0] is writeable handle to child stdin - * $pipes[1] is readable handle to child stdout - * any error is send to /dev/null - */ - // user+passwd - fwrite($pipes[0], $ldap_q[0] . "\n"); - fwrite($pipes[0], $ldap_q[1] . "\n"); - // Write to stdin - fwrite($pipes[0], $userstring); - } - fclose($pipes[0]); - while (!feof($pipes[1])) { - $output = fgets($pipes[1], 1024); - if ($output!='') $output_array[] = $output; - } - fclose($pipes[1]); - proc_close($process); + $towrite = escapeshellarg($server)." ".escapeshellarg($_SESSION['config']->scriptPath)." - -"; + $descriptorspec = array( + 0 => array("pipe", "r"), // stdin + 1 => array("pipe", "w"), // stout + 2 => array("file", "/dev/null", "a") // sterr + ); + $process = proc_open(escapeshellarg($_SESSION['lampath']."lib/lamdaemonOld.pl")." ".$towrite, + $descriptorspec, + $pipes); + if (is_resource($process)) { + /* perl-script is running + * $pipes[0] is writeable handle to child stdin + * $pipes[1] is readable handle to child stdout + * any error is send to /dev/null + */ + // user+passwd + fwrite($pipes[0], $ldap_q[0] . "\n"); + fwrite($pipes[0], $ldap_q[1] . "\n"); + // Write to stdin + fwrite($pipes[0], $userstring); } - else { // PHP 4.3> - $towrite = escapeshellarg($server)." ".escapeshellarg($_SESSION['config']->scriptPath)." ". - escapeshellarg($ldap_q[0]).' '.escapeshellarg($ldap_q[1]); - $command = escapeshellarg($_SESSION['lampath']."lib/lamdaemonOld.pl")." ".$towrite; - $pipe = popen("echo \"$userstring\"|$command" , 'r'); - while(!feof($pipe)) { - //$output .= fread($pipe, 1024); - $output = fgets($pipe, 1024); - if ($output!='') $output_array[] = $output; - } - pclose($pipe); + fclose($pipes[0]); + while (!feof($pipes[1])) { + $output = fgets($pipes[1], 1024); + if ($output!='') $output_array[] = $output; } + fclose($pipes[1]); + proc_close($process); if (sizeof($output_array) > 0) { return $output_array; }