From: psc Date: Thu, 11 Feb 2010 12:34:19 +0000 (+0000) Subject: Apply fix for #4099 X-Git-Url: https://git.tokkee.org/?p=gosa.git;a=commitdiff_plain;h=95b6dd2fc6e67da966bb75084b739f3635364481 Apply fix for #4099 - Add a new function getSambaSID() to groupGeneric which calculates a samba SID with the algorithm which is used for new groups as well. - Remove the SID calculation code from the save function and just use getSambaSID - In PrepareForCopyPaste determine a new SID for the new group object. git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@15611 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/trunk/gosa-core/plugins/admin/groups/class_groupGeneric.inc b/trunk/gosa-core/plugins/admin/groups/class_groupGeneric.inc index ce905299c..3956d560c 100644 --- a/trunk/gosa-core/plugins/admin/groups/class_groupGeneric.inc +++ b/trunk/gosa-core/plugins/admin/groups/class_groupGeneric.inc @@ -881,6 +881,23 @@ class group extends plugin } + /*! \brief Get a new SambaSID for a group */ + function getSambaSID() + { + $ldap = $this->config->get_ldap_link(); + $gidNumber= $this->gidNumber; + while(TRUE){ + $sid= $this->SID."-".($gidNumber*2 + $this->ridBase+1); + $ldap->cd($this->config->current['BASE']); + $ldap->search("(sambaSID=$sid)",array("sambaSID")); + if ($ldap->count() == 0){ + break; + } + $gidNumber++; + } + + return $sid; + } /* Save to LDAP */ function save() @@ -972,16 +989,7 @@ class group extends plugin if ($this->groupType == 0){ if ($this->sambaSID == "" || $this->oldgroupType != $this->groupType){ - $gidNumber= $this->gidNumber; - while(TRUE){ - $sid= $this->SID."-".($gidNumber*2 + $this->ridBase+1); - $ldap->cd($this->config->current['BASE']); - $ldap->search("(sambaSID=$sid)",array("sambaSID")); - if ($ldap->count() == 0){ - break; - } - $gidNumber++; - } + $sid = $this->getSambaSID(); $this->attrs['sambaSID']= $sid; $this->sambaSID= $sid; } @@ -1412,6 +1420,10 @@ class group extends plugin $this->$var = $source_o->$var; } + if ($this->smbgroup) { + $this->sambaSID = $this->getSambaSID(); + } + $this->memberUid = array(); if(isset($source['memberUid'])){ for($i = 0 ; $i < $source['memberUid']['count']; $i ++){