allow to read min/maxPwdAge for Samba domains

This commit is contained in:
Roland Gruber 2008-12-09 18:52:39 +00:00
parent 3d109afd4b
commit f3db3ffdcd
1 changed files with 18 additions and 5 deletions

View File

@ -300,14 +300,19 @@ function generateRandomPassword() {
* *
* @return array list of samba3domain objects * @return array list of samba3domain objects
*/ */
function search_domains() { function search_domains($server = null, $suffix = null) {
if ($suffix == null) {
$suffix = $_SESSION['config']->get_Suffix('smbDomain'); $suffix = $_SESSION['config']->get_Suffix('smbDomain');
}
$ret = array(); $ret = array();
$attr = array("DN", "sambaDomainName", "sambaSID", "sambaNextRid", "sambaNextGroupRid", $attr = array("DN", "sambaDomainName", "sambaSID", "sambaNextRid", "sambaNextGroupRid",
"sambaNextUserRid", "sambaAlgorithmicRidBase"); "sambaNextUserRid", "sambaAlgorithmicRidBase", 'sambaMinPwdAge', 'sambaMaxPwdAge');
$sr = @ldap_search($_SESSION['ldap']->server(), escapeDN($suffix), "objectClass=sambaDomain", $attr); if ($server == null) {
$server = $_SESSION['ldap']->server();
}
$sr = @ldap_search($server, escapeDN($suffix), "objectClass=sambaDomain", $attr);
if ($sr) { if ($sr) {
$units = ldap_get_entries($_SESSION['ldap']->server(), $sr); $units = ldap_get_entries($server, $sr);
// delete count entry // delete count entry
unset($units['count']); unset($units['count']);
// extract attributes // extract attributes
@ -320,6 +325,8 @@ function search_domains() {
if (isset($units[$i]['sambanextgrouprid'][0])) $ret[$i]->nextGroupRID = $units[$i]['sambanextgrouprid'][0]; if (isset($units[$i]['sambanextgrouprid'][0])) $ret[$i]->nextGroupRID = $units[$i]['sambanextgrouprid'][0];
if (isset($units[$i]['sambanextuserrid'][0])) $ret[$i]->nextUserRID = $units[$i]['sambanextuserrid'][0]; if (isset($units[$i]['sambanextuserrid'][0])) $ret[$i]->nextUserRID = $units[$i]['sambanextuserrid'][0];
if (isset($units[$i]['sambaalgorithmicridbase'][0])) $ret[$i]->RIDbase = $units[$i]['sambaalgorithmicridbase'][0]; if (isset($units[$i]['sambaalgorithmicridbase'][0])) $ret[$i]->RIDbase = $units[$i]['sambaalgorithmicridbase'][0];
if (isset($units[$i]['sambaminpwdage'][0])) $ret[$i]->minPwdAge = $units[$i]['sambaminpwdage'][0];
if (isset($units[$i]['sambamaxpwdage'][0])) $ret[$i]->maxPwdAge = $units[$i]['sambamaxpwdage'][0];
} }
// sort array by domain name // sort array by domain name
usort($ret, "cmp_domain"); usort($ret, "cmp_domain");
@ -368,6 +375,12 @@ class samba3domain {
/** RID base to calculate RIDs, default 1000 */ /** RID base to calculate RIDs, default 1000 */
public $RIDbase = 1000; public $RIDbase = 1000;
/** seconds after the password can be changed */
public $minPwdAge;
/** seconds after the password must be changed */
public $maxPwdAge;
} }
/** /**