// Which LDAP Port Server to use? (389 is standard, 636 for ssl)
$conf['ldapport'] = 389;
+ // Use LDAP protocol version 3? (0|1)
+ $conf['ldapv3'] = 1;
+
// What is the root dn on this Server?
$conf['ldaprootdn'] = 'o=cosmocode, c=de';
// Where to store private contacts (relative to $conf['usertree'])
$conf['privatebook'] = 'ou=contacts';
+ // Should the public address book be viewable by logged in users only? (0|1)
+ $conf['userlogreq'] = 0;
+
// Should the additional schema ldapab.schema be used? (0|1)
// Note: openxchange and extended are currently exclusive, do not use both at the same time!
$conf['extended'] = 1;
-
+
// Should we use some parts of the openxchange.schema? (0|1)
// Note: openxchange and extended are currently exclusive, do not use both at the same time!
$conf['openxchange'] = 0;
-
+
// Should we try to login using the username and password provided by httpd? (0|1)
$conf['httpd_auth'] = 0;
-
+
// Dateformat for birthdays when using extended schema
// see http://www.php.net/manual/en/function.strftime.php
#$conf['dateformat'] = '%Y/%m/%d';
// Force recompilation of smarty templates?
$conf['smartycompile'] = 0;
-?>
+
}
} elseif ($conf['httpd_auth'] && !empty($_SERVER['PHP_AUTH_USER'])) {
// use HTTP auth if wanted and possible
- $_SESSION['ldapab']['username'] = $_SERVER['PHP_AUTH_USER'];
- $_SESSION['ldapab']['password'] = $_SERVER['PHP_AUTH_PW'];
+ $_SESSION['ldapab']['username'] = $_SERVER['PHP_AUTH_USER'];
+ $_SESSION['ldapab']['password'] = $_SERVER['PHP_AUTH_PW'];
} elseif ($_COOKIE['ldapabauth']) {
// check persistent cookie
$cookie = base64_decode($_COOKIE['ldapabauth']);
function do_ldap_bind($user,$pass,$dn=""){
global $conf;
global $LDAP_CON;
-
+
//create global connection to LDAP if necessary
if(!$LDAP_CON){
if (!empty($conf['ldapurl'])){
}
}
+ if($conf['ldapv3']) ldap_set_option($LDAP_CON, LDAP_OPT_PROTOCOL_VERSION, 3);
+
if(empty($dn)){
//anonymous bind to lookup users
//blank binddn or blank bindpw will result in anonymous bind
if(!ldap_bind($LDAP_CON,$conf['anonbinddn'],$conf['anonbindpw'])){
die("can not bind for user lookup");
}
-
+
//when no user was given stay connected anonymous
if(empty($user)){
set_session('','','');
}
}
}
- return $users;
+ return $users;
}
/**
$smarty->assign('search',$_REQUEST['search']);
//display templates
if($_REQUEST['export'] == 'csv'){
- header("Content-Type: text/csv");
- header('Content-Disposition: Attachement; filename="ldapabexport.csv"');
- $smarty->display('export_list_csv.tpl');
+ if ($conf['userlogreq'] == 1 && $user == '')
+ {
+ header("HTTP/1.1 401 ACCESS DENIED");
+ exit();
+ } else {
+ header("Content-Type: text/csv");
+ header('Content-Disposition: Attachement; filename="ldapabexport.csv"');
+ $smarty->display('export_list_csv.tpl');
+ }
}else{
//save location in session
$_SESSION['ldapab']['lastlocation']=$_SERVER["REQUEST_URI"];
{include file="header.tpl"}
<table cellspacing="0" cellpadding="0" width="100%" align="center">
- {if $list == ''}
+ {if $conf.userlogreq == 1 && $user == ''}
<tr>
<td align="center">
- {$lang.err_noentries}
+ {* include un truc *} {$lang.msg_login}
</td>
</tr>
{else}
- {* $list is a concatenation of multiple list_entry.tpl *}
- {$list}
+ {if $list == ''}
+ <tr>
+ <td align="center">
+ {$lang.err_noentries}
+ </td>
+ </tr>
+ {else}
+ {* $list is a concatenation of multiple list_entry.tpl *}
+ {$list}
+ {/if}
{/if}
</table>