From 5e58a97c930fe95b13b1d38607b4443dfdd805d1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Oct 2011 00:06:38 +0200 Subject: [PATCH 1/2] Fix: Enhance dump success detection --- htdocs/admin/tools/export.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/tools/export.php b/htdocs/admin/tools/export.php index 8a5b9fc7765..38f73663082 100644 --- a/htdocs/admin/tools/export.php +++ b/htdocs/admin/tools/export.php @@ -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); From 118bcbfcc243c98ae00a5fdf28bba2e589448297 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 23 Oct 2011 20:02:15 +0200 Subject: [PATCH 2/2] Fix: Error when creating a group using posix class --- .../interface_modLdap_Ldapsynchro.class.php | 6 ++++- htdocs/lib/ldap.class.php | 27 +++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/htdocs/includes/triggers/interface_modLdap_Ldapsynchro.class.php b/htdocs/includes/triggers/interface_modLdap_Ldapsynchro.class.php index db210aa2e33..32e0b85f5fb 100644 --- a/htdocs/includes/triggers/interface_modLdap_Ldapsynchro.class.php +++ b/htdocs/includes/triggers/interface_modLdap_Ldapsynchro.class.php @@ -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) { diff --git a/htdocs/lib/ldap.class.php b/htdocs/lib/ldap.class.php index 42ba2e68a86..59e77dc2b26 100644 --- a/htdocs/lib/ldap.class.php +++ b/htdocs/lib/ldap.class.php @@ -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; + + } }