* If it fails it redirects to login.php
*/
function ldap_login(){
+ global $conf;
if(!empty($_SESSION[ldapab][username])){
//existing session! Check if valid
if($_COOKIE[ldapabconid] != $_SESSION[ldapab][conid]){
header('Location: login.php?username=');
exit;
}
+ } elseif ($conf[httpd_auth] && !empty($_SERVER[PHP_AUTH_USER])) {
+ $_SESSION[ldapab][username] = $_SERVER[PHP_AUTH_USER];
+ $_SESSION[ldapab][password] = $_SERVER[PHP_AUTH_PW];
}
if(!do_ldap_bind($_SESSION[ldapab][username],
//create global connection to LDAP if nessessary
if(!$LDAP_CON){
- $LDAP_CON = ldap_connect($conf[ldapserver]);
+ $LDAP_CON = ldap_connect($conf[ldapserver],$conf[ldapport]);
if(!$LDAP_CON){
die("couldn't connect to LDAP server");
}
if(empty($dn)){
//anonymous bind to lookup users
- if(!ldap_bind($LDAP_CON)){
+ //blank binddn or blank bindpw will result in anonymous bind
+ if(!ldap_bind($LDAP_CON,$conf[anonbinddn],$conf[anonbindpw])){
die("can not bind anonymously");
}
if($conf[extended]){
$entries[anniversary] = 'anniversary';
}
+ if($conf[openxchange]){
+ $entries[mailDomain] = 'domain';
+ $entries[userCountry] = 'country';
+ $entries[birthDay] = 'birthday';
+ $entries[IPPhone] = 'ipphone';
+ $entries[OXUserCategories] = 'categories';
+ $entries[OXUserInstantMessenger] = 'instantmessenger';
+ $entries[OXTimeZone] = 'timezone';
+ $entries[OXUserPosition] = 'position';
+ $entries[relClientCert] = 'certificate';
+ }
if($flip){
$entries = array_reverse($entries);
if($conf[extended]){
$out[objectclass][] = 'contactPerson';
}
+ if($conf[openxchange]){
+ $out[objectclass][] = 'OXUserObject';
+ }
utf8_encode_array($out);