gunnar: server/kolab-webadmin/kolab-webadmin/www/admin/distributionlist list.php.in, 1.3, 1.4

cvs at kolab.org cvs at kolab.org
Fri Mar 16 13:17:26 CET 2007


Author: gunnar

Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/distributionlist
In directory doto:/tmp/cvs-serv14316/kolab-webadmin/www/admin/distributionlist

Modified Files:
	list.php.in 
Log Message:
2007-03-16  Gunnar Wrobel  <p at rdus.de>

	* www/admin/user/user.php.in: 
	* www/admin/sharedfolder/sf.php.in: 
	* www/admin/maintainer/maintainer.php.in: 
	* www/admin/domainmaintainer/domainmaintainer.php.in: 
	* www/admin/distributionlist/list.php.in: 
	* www/admin/administrator/admin.php.in: 
	* www/admin/addressbook/addr.php.in: 

	Fixed for the new LDAP overlays introduced in
	http://kolab.org/cgi-bin/viewcvs-kolab.cgi/server/kolabd/kolabd/templates/slapd.conf.template.in.diff?r1=1.9&r2=1.10

	Tries to fix the following issues:

	https://intevation.de/roundup/kolab/issue1614
	https://intevation.de/roundup/kolab/issue1652
	https://intevation.de/roundup/kolab/issue1654


Index: list.php.in
===================================================================
RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/distributionlist/list.php.in,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- list.php.in	9 Mar 2006 21:27:22 -0000	1.3
+++ list.php.in	16 Mar 2007 12:17:24 -0000	1.4
@@ -190,13 +190,28 @@
 			  if (($result=ldap_read($ldap->connection,$dn,"(objectclass=*)")) &&
 				  ($entry=ldap_first_entry($ldap->connection,$result)) &&
 				  ($oldattrs=ldap_get_attributes($ldap->connection,$entry))) {
-				if (!ldap_add($ldap->connection,$newdn, $ldap_object) 
-					|| !ldap_delete($ldap->connection,$dn)) {
-				  array_push($errors, sprintf( _("LDAP Error: Could not rename %1\$s to %2\$s: %3\$s"), $dn, $newdn,
-											   ldap_error($ldap->connection)));
-				} else {
-				  $messages[] = _('Distribution List updated');
+
+				// Try to rename the object
+				if (!ldap_rename($ldap->connection, $dn, "cn=" . $ldap_object['cn'], $dl_root, true)) {
+				  array_push($errors, sprintf(_("LDAP Error: could not rename %s to %s: %s"), $dn,
+											  $newdn, ldap_error($ldap->connection)));
 				}
+				if( !$errors ) {
+				  // Renaming was ok, now try to modify the object accordingly
+				  if (!ldap_modify($ldap->connection, $newdn, $ldap_object)) {
+					// While this should not happen, in case it does, we need to revert the
+					// renaming
+					array_push($errors, sprintf(_("LDAP Error: could not modify %s to %s: %s"), $newdn,
+												ldap_error($ldap->connection)));
+					$old_dn = substr($dn, 0, strlen($dn) - strlen($dl_root) - 1);
+					ldap_rename($ldap->connection, $newdn, $old_dn, $dl_root, true);
+				  } else {
+					// everything is fine and we can move on
+					$messages[] = _('Distribution List updated');
+					$dn = $newdn;
+				  }
+				}
+
 				$dn = $newdn;
 			  } else array_push($errors, sprintf( _("LDAP Error: Could not read %s: %s"), $dn,
 												  ldap_error($ldap->connection)));





More information about the commits mailing list