forked from extern/egroupware
Fixed parse error and working on LDAP admin section
This commit is contained in:
parent
78e7194dc0
commit
ac8d54a110
@ -11,6 +11,9 @@
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
// Sections of code where taking from slapda http://www.jeremias.net/projects/sldapa by
|
||||
// Jason Jeremias <jason@jeremias.net>
|
||||
|
||||
function account_read($method,$start,$sort,$order)
|
||||
{
|
||||
|
||||
@ -18,7 +21,70 @@
|
||||
|
||||
function account_add($account_info)
|
||||
{
|
||||
global $phpgw_info;
|
||||
|
||||
$phpgw_info["server"]["ldap_encryption_type"] = "DES";
|
||||
|
||||
if ($phpgw_info["server"]["ldap_encryption_type"] == "MD5") {
|
||||
$salt = randomstring(9);
|
||||
$userpassword = md5cryptpass($account_info["passwd"], $salt);
|
||||
}
|
||||
|
||||
if ($phpgw_info["server"]["ldap_encryption_type"] == "DES") {
|
||||
$salt = randomstring(2);
|
||||
$userpassword = descryptpass($account_info["passwd"], $salt);
|
||||
}
|
||||
|
||||
$ldap = ldap_connect($phpgw_info["server"]["ldap_host"]);
|
||||
|
||||
if (! ldap_bind($ldap, $phpgw_info["server"]["ldap_root_dn"], $phpgw_info["server"]["ldap_root_pw"])) {
|
||||
echo "<p><b>Error binding to LDAP server. Check your config</b>";
|
||||
exit;
|
||||
}
|
||||
|
||||
// Create our entry
|
||||
$entry["uid"] = $uid;
|
||||
$entry["uidNumber"] = $uidnumber;
|
||||
$entry["gidNumber"] = $gidnumber;
|
||||
$entry["userpassword"] = $userpassword;
|
||||
$entry["loginShell"] = $ushell;
|
||||
$entry["homeDirectory"] = $homedir;
|
||||
$entry["cn"] = sprintf("%s %s", $givenname, $sn);
|
||||
$entry["sn"] = $sn;
|
||||
$entry["givenname"] = $givenname;
|
||||
$entry["company"] = $company;
|
||||
$entry["title"] = $title;
|
||||
$entry["mail"] = $mail;
|
||||
$entry["telephonenumber"] = $telephonenumber;
|
||||
$entry["homephone"] = $homephone;
|
||||
$entry["pagerphone"] = $pagerphone;
|
||||
$entry["cellphone"] = $cellphone;
|
||||
$entry["streetaddress"] = $streetaddress;
|
||||
$entry["locality"] = $locality;
|
||||
$entry["st"] = $st;
|
||||
$entry["postalcode"] = $postalcode;
|
||||
$entry["countryname"] = $countryname;
|
||||
$entry["homeurl"] = $homeurl;
|
||||
$entry["description"] = $description;
|
||||
$entry["objectclass"][0] = "account";
|
||||
$entry["objectclass"][1] = "posixAccount";
|
||||
$entry["objectclass"][2] = "shadowAccount";
|
||||
$entry["objectclass"][3] = "inetOrgperson";
|
||||
$entry["objectclass"][4] = "person;
|
||||
$entry["objectclass"][5] = "top";
|
||||
/* $dn=sprintf("cn=%s %s, %s", $givenname, $sn, $BASEDN);*/
|
||||
$dn=sprintf("uid=%s, %s", $uid, $BASEDN);
|
||||
|
||||
// add the entries
|
||||
if (ldap_add($ldap, $dn, $entry)) {
|
||||
$cd = 28;
|
||||
} else {
|
||||
$cd = 99; // Come out with a code for this
|
||||
}
|
||||
|
||||
@ldap_close($ldap);
|
||||
|
||||
return $cd;
|
||||
}
|
||||
|
||||
function account_edit($account_info)
|
||||
|
Loading…
Reference in New Issue
Block a user