Fix ldap_root_pw, and indent the ldapConnect function

This commit is contained in:
Miles Lott 2001-02-12 21:11:08 +00:00
parent 401d02fe7d
commit 8ce2e59b25

View File

@ -129,34 +129,34 @@
// connect to the ldap server and return a handle // connect to the ldap server and return a handle
function ldapConnect($host = '', $dn = '', $passwd = '') function ldapConnect($host = '', $dn = '', $passwd = '')
{ {
global $phpgw_info; global $phpgw_info;
if (! $host) { if (! $host) {
$host = $phpgw_info['server']['ldap_host']; $host = $phpgw_info['server']['ldap_host'];
} }
if (! $dn) { if (! $dn) {
$dn = $phpgw_info['server']['ldap_root_dn']; $dn = $phpgw_info['server']['ldap_root_dn'];
} }
if (! $passwd) { if (! $passwd) {
$passwd = $phpgw_info['server']['ldap_root_passwd']; $passwd = $phpgw_info['server']['ldap_root_pw'];
} }
// connect to ldap server // connect to ldap server
if (! $ds = ldap_connect($host)) { if (! $ds = ldap_connect($host)) {
printf("<b>Error: Can't connect to LDAP server %s!</b><br>",$host); printf("<b>Error: Can't connect to LDAP server %s!</b><br>",$host);
return False; return False;
} }
// bind as admin, we not to able to do everything // bind as admin, we not to able to do everything
if (! ldap_bind($ds,$dn,$passwd)) { if (! ldap_bind($ds,$dn,$passwd)) {
printf("<b>Error: Can't bind to LDAP server: %s!</b><br>",$dn); printf("<b>Error: Can't bind to LDAP server: %s!</b><br>",$dn);
return False; return False;
} }
return $ds; return $ds;
} }
// This function is used if the developer wants to stop a running app in the middle of execution // This function is used if the developer wants to stop a running app in the middle of execution