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) - OpenLDAP (>2.0)
- A web browser :-) - A web browser :-)
MHash is only needed if you use PHP < 4.3 and if you want to use SHA or SSHA MHash is only needed for Samba password hashes.
for password hashes.
MCrypt will be used to store your LDAP password encrypted in the session file. 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. See docs/README.schema.txt for information about used LDAP schema files.
@ -60,7 +52,7 @@ Installation Instructions for LAM
3. Setting up PHP 3. Setting up PHP
LAM runs with PHP4 or PHP5. LAM runs with PHP5.
Needed changes in your php.ini: 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 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. LDAP server unencrypted or via SSL/TLS.
Currently LAM supports these account types: Samba 2 and 3, Unix, Kolab 2, 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 address book entries, NIS mail aliases and MAC addresses. There is a tree
@ -20,7 +20,7 @@ LAM - Readme
Tilo Lutz <tilolutz@gmx.de> Tilo Lutz <tilolutz@gmx.de>
Requirements: Requirements:
PHP4/5 PHP5
Openldap (2.0 or greater) Openldap (2.0 or greater)
A web-browser that supports CSS A web-browser that supports CSS

View File

@ -50,49 +50,34 @@ function lamdaemon($commands, $server) {
$userstring = implode ("\n", $commands); $userstring = implode ("\n", $commands);
$output_array = array(); $output_array = array();
if (function_exists('proc_open')) { $towrite = escapeshellarg($server)." ".escapeshellarg($_SESSION['config']->scriptPath)." - -";
// New Code, requires PHP 4.3 $descriptorspec = array(
$towrite = escapeshellarg($server)." ".escapeshellarg($_SESSION['config']->scriptPath)." - -"; 0 => array("pipe", "r"), // stdin
$descriptorspec = array( 1 => array("pipe", "w"), // stout
0 => array("pipe", "r"), // stdin 2 => array("file", "/dev/null", "a") // sterr
1 => array("pipe", "w"), // stout );
2 => array("file", "/dev/null", "a") // sterr $process = proc_open(escapeshellarg($_SESSION['lampath']."lib/lamdaemonOld.pl")." ".$towrite,
); $descriptorspec,
$process = proc_open(escapeshellarg($_SESSION['lampath']."lib/lamdaemonOld.pl")." ".$towrite, $pipes);
$descriptorspec, if (is_resource($process)) {
$pipes); /* perl-script is running
if (is_resource($process)) { * $pipes[0] is writeable handle to child stdin
/* perl-script is running * $pipes[1] is readable handle to child stdout
* $pipes[0] is writeable handle to child stdin * any error is send to /dev/null
* $pipes[1] is readable handle to child stdout */
* any error is send to /dev/null // user+passwd
*/ fwrite($pipes[0], $ldap_q[0] . "\n");
// user+passwd fwrite($pipes[0], $ldap_q[1] . "\n");
fwrite($pipes[0], $ldap_q[0] . "\n"); // Write to stdin
fwrite($pipes[0], $ldap_q[1] . "\n"); fwrite($pipes[0], $userstring);
// 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);
} }
else { // PHP 4.3> fclose($pipes[0]);
$towrite = escapeshellarg($server)." ".escapeshellarg($_SESSION['config']->scriptPath)." ". while (!feof($pipes[1])) {
escapeshellarg($ldap_q[0]).' '.escapeshellarg($ldap_q[1]); $output = fgets($pipes[1], 1024);
$command = escapeshellarg($_SESSION['lampath']."lib/lamdaemonOld.pl")." ".$towrite; if ($output!='') $output_array[] = $output;
$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[1]);
proc_close($process);
if (sizeof($output_array) > 0) { if (sizeof($output_array) > 0) {
return $output_array; return $output_array;
} }