summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e7c682a)
raw | patch | inline | side by side (parent: e7c682a)
author | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 20 Mar 2007 08:51:21 +0000 (08:51 +0000) | ||
committer | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 20 Mar 2007 08:51:21 +0000 (08:51 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5831 594d385d-05f5-0310-b6e9-bd551577e9d8
diff --git a/Changelog b/Changelog
index cf1ac23a83500055e55e466c8c25d9cb79eb2e8f..bddb0b5602b3f804305b1b996c332822b57b29d9 100644 (file)
--- a/Changelog
+++ b/Changelog
GOsa2 changelog
===============
+
+* gosa 2.5.10
+ - Added hook for dynamic uid-bases
+
* gosa 2.5.9
- Fixed ldap tls connections when schema check was being used
diff --git a/include/functions.inc b/include/functions.inc
index 5b35af77fd159449d3be46b205c1a74021d48411..65c9fa53a16f485c081ec2d128c2b1441f04b0f4 100644 (file)
--- a/include/functions.inc
+++ b/include/functions.inc
}
+function get_base_from_hook($dn, $attrib)
+{
+ global $config;
+
+ if (isset($config->current['BASE_HOOK'])){
+
+ /* Call hook script - if present */
+ $command= $config->current['BASE_HOOK'];
+
+ if ($command != ""){
+ $command.= " '$dn' $attrib";
+ if (check_command($command)){
+ @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $command, "Execute");
+ exec($command, $output);
+ if (preg_match("/^[0-9]+$/", $output)){
+ return ($output[0]);
+ } else {
+ print_red(_("Warning - base_hook is not avialable. Using default base."));
+ return ($config->current['UIDBASE']);
+ }
+ } else {
+ print_red(_("Warning - base_hook is not avialable. Using default base."));
+ return ($config->current['UIDBASE']);
+ }
+
+ } else {
+
+ print_red(_("Warning - no base_hook defined. Using default base."));
+ return ($config->current['UIDBASE']);
+
+ }
+ }
+}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
?>
diff --git a/plugins/admin/groups/class_groupGeneric.inc b/plugins/admin/groups/class_groupGeneric.inc
index 8858285e8947b7618882d8f19a783f514c52f905..644873ed387e956bd66a23510b909652cf5e406a 100644 (file)
}
}
add_lock ("uidnumber", "gosa");
- $this->gidNumber= $this->get_next_id("gidNumber");
+ $this->gidNumber= $this->get_next_id("gidNumber", $this->dn);
}
}
return ($message);
}
- function get_next_id($attrib)
+ function get_next_id($attrib, $dn)
{
$ids= array();
$ldap= $this->config->get_ldap_link();
}
/* Find out next free id near to UID_BASE */
- for ($id= $this->config->current['UIDBASE']; $id++; $id < pow(2,32)){
+ if (!isset($this->config->current['BASE_HOOK'])){
+ $base= $this->config->current['UIDBASE'];
+ } else {
+ /* Call base hook */
+ $base= get_base_from_hook($dn, $attrib);
+ }
+ for ($id= $base; $id++; $id < pow(2,32)){
if (!in_array($id, $ids)){
return ($id);
}
diff --git a/plugins/personal/posix/class_posixAccount.inc b/plugins/personal/posix/class_posixAccount.inc
index 4df29ad4ad0aac584aea4de89f41e1eb3f556fac..340e6f301e4e46f98037a498287b7fb622cb27dc 100644 (file)
}
add_lock ("uidnumber", "gosa");
- $this->uidNumber= $this->get_next_id("uidNumber");
+ $this->uidNumber= $this->get_next_id("uidNumber", $this->dn);
if ($this->savedGidNumber != ""){
$this->gidNumber= $this->savedGidNumber;
} else {
- $this->gidNumber= $this->get_next_id("gidNumber");
+ $this->gidNumber= $this->get_next_id("gidNumber", $this->dn);
}
}
}
}
-
function convertToSeconds($val)
{
if ($val != 0){
}
- function get_next_id($attrib)
+ function get_next_id($attrib, $dn)
{
$ids= array();
$ldap= $this->config->get_ldap_link();
}
/* Add the nobody id */
- $ids[]= 65534;
+ $ids[]= 65534;
/* get the ranges */
$tmp = array('0'=> 1000);
if (preg_match('/posixAccount/', $oc) && isset($this->config->current['UIDBASE'])) {
$tmp= split('-',$this->config->current['UIDBASE']);
- } elseif(isset($this->config->current['UIDBASE'])) {
+ } elseif(isset($this->config->current['GIDBASE'])){
$tmp= split('-',$this->config->current['GIDBASE']);
}
}
/* Find out next free id near to UID_BASE */
- for ($id=$lwm; $id++; $id<$hwm){
+ if (!isset($this->config->current['BASE_HOOK'])){
+ $base= $lwm;
+ } else {
+ /* Call base hook */
+ $base= get_base_from_hook($dn, $attrib);
+ }
+ for ($id= $base; $id++; $id < pow(2,32)){
if (!in_array($id, $ids)){
return ($id);
}
plugin::PrepareForCopyPaste($source);
/* Avoid using the same gid/uid number as source user */
- $this->savedUidNumber = $this->get_next_id("gidNumber");
- $this->savedGidNumber = $this->get_next_id("uidNumber");
+ $this->savedUidNumber = $this->get_next_id("gidNumber", $this->dn);
+ $this->savedGidNumber = $this->get_next_id("uidNumber", $this->dn);
}