no more PHP4

This commit is contained in:
Roland Gruber 2007-08-07 17:47:47 +00:00
parent 7206e7bdc5
commit 82cf42aafc
3 changed files with 30 additions and 53 deletions

View File

@ -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:

View File

@ -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 <tilolutz@gmx.de>
Requirements:
PHP4/5
PHP5
Openldap (2.0 or greater)
A web-browser that supports CSS

View File

@ -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;
}