Merge branch '3.1'

This commit is contained in:
Regis Houssin 2011-10-24 13:28:08 +02:00
commit a8fee6d9be
3 changed files with 34 additions and 2 deletions

View File

@ -171,7 +171,8 @@ if ($what == 'mysql')
{
$read = fgets($handlein);
fwrite($handle,$read);
if (preg_match('/-- Dump completed/i',$read)) $ok=1;
if (preg_match('/'.preg_quote('-- Dump completed').'/i',$read)) $ok=1;
elseif (preg_match('/'.preg_quote('SET SQL_NOTES=@OLD_SQL_NOTES').'/i',$read)) $ok=1;
}
pclose($handlein);

View File

@ -218,7 +218,11 @@ class InterfaceLdapsynchro
$info=$object->_load_ldap_info();
$dn=$object->_load_ldap_dn($info);
// Get a gid number for objectclass PosixGroup
if(in_array('posixGroup',$info['objectclass']))
$info['gidNumber'] = $ldap->getNextGroupGid();
$result=$ldap->add($dn,$info,$user);
if ($result < 0)
{

View File

@ -1316,6 +1316,33 @@ class Ldap
if ($pagecodeto == 'UTF-8' && $conf->file->character_set_client == 'ISO-8859-1') $str=utf8_encode($str);
return $str;
}
/**
* \brief Return available value of group GID
* \param
* \return int gid number
*/
function getNextGroupGid() {
global $conf;
$search='('.$conf->global->LDAP_KEY_GROUPS.'=*)';
$result = $this->search($this->groups,$search);
if($result) {
$c = $result['count'];
$gids = array();
for($i=0;$i<$c;$i++)
{
$gids[] = $result[$i]['gidnumber'][0];
}
rsort($gids);
return $gids[0]+1;
}
return 0;
}
}