##
## Copyright (c) 1999 Sascha Schumann \n";
exit;
}
function ac_gc($gc_time, $name) {
$timeout =time();
$ldapdate =date("YmdHis", $timeout - ($gc_time * 60));
$sr =ldap_search($this->ds, $this->basedn, "(&(cn=*_$name)(modifytimestamp<=$ldapdate))");
$inf =ldap_get_entries($this->ds, $sr);
for ($i=0; $i<$inf["count"];$i++) {
ldap_delete($this->ds, $inf[$i]["dn"]);
}
ldap_free_result($sr);
}
function ac_store($id, $name, $str) {
$ret = true;
$ldapdate =date("YmdHis", time());
$dn = "cn=${id}_$name, ".$this->basedn;
$entry = array(
"cn" => "${id}_$name",
"str" => $str,
"objectclass" => $this->objclass,
"modifytimestamp" => $ldapdate
);
if(! <email protected>($this->ds, $dn, $entry)) {
if(!ldap_add($this->ds, $dn, $entry)) {
$ret =false;
}
}
return $ret;
}
function ac_delete($id, $name) {
ldap_delete($this->ds, "cn=${id}_$name, ".$this->basedn);
}
function ac_get_value($id, $name) {
$str ="";
$sr =ldap_search($this->ds, $this->basedn, "cn=${id}_$name");
$inf =ldap_get_entries($this->ds, $sr);
if ($inf["count"] > 0 && $inf[0]["str"]["count"] > 0) {
$str =$inf[0]["str"][0];
}
ldap_free_result($sr);
return $str;
}
function ac_release_lock() {
}
function ac_get_lock() {
}
function ac_newid($str, $name) {
return $str;
}
function ac_auth($username, $password) {
## we need a username and a md5() encrypted password
$sr = ldap_search($this->ds, $this->basedn, "username=$username");
if(ldap_count_entries($this->ds, $sr) > 0) {
$inf = ldap_get_entries($this->ds, $sr);
$passmd5 = $inf[0]["password"][0];
if(md5($password) == $passmd5) {
return array($inf[0]["uid"][0],
$inf[0]["perms"][0]);
}
}
return array();
}
};
?>

