summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e78194e)
raw | patch | inline | side by side (parent: e78194e)
author | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 19 Mar 2007 16:49:08 +0000 (16:49 +0000) | ||
committer | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 19 Mar 2007 16:49:08 +0000 (16:49 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@5827 594d385d-05f5-0310-b6e9-bd551577e9d8
diff --git a/Changelog b/Changelog
index a8807ab19f2642ebbcfd322d6fcbbd4bcfa737f3..aeb1253278d70e483178e8ec2547cd2960b40974 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
- Updated italian translation
diff --git a/include/functions.inc b/include/functions.inc
index 3f6025ecb38506fdbeada6d1c3914bb1b93d5c45..e78c2f8742c209d972f4f3a163d3f5c09f5bbb0d 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 63e2579f64b20ea10a0abbbf4c9f582adcb93e14..26bf2169f5019979227694c817412cb10e7a9575 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);
}
/* check if id reached maximum of 32 bit*/
if ($id >= pow(2,32)){
- echo _("Too many users, can't allocate a free ID!");
+ echo _("Too many groups, can't allocate a free ID!");
exit;
}
}
diff --git a/plugins/personal/posix/class_posixAccount.inc b/plugins/personal/posix/class_posixAccount.inc
index cd34a0036046c818e5fac89db7aed1d541b1ff94..fa1a3821eda756e20b99a2a2897e76a1a5d947bd 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 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;
/* 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);
}
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);
}
function convertToSeconds($val)