Monotone-Parent: ef48f0aa709b92913c131c539cb55562e8c56ebf

Monotone-Revision: 40141d367c9c6560edf3b306cee2aa7683dad3ec

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2012-03-01T21:57:16
This commit is contained in:
Wolfgang Sourdeau
2012-03-01 21:57:16 +00:00
parent 22181c5996
commit 347bc411ac
2 changed files with 32 additions and 12 deletions
+6
View File
@@ -1,5 +1,11 @@
2012-03-01 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* SoObjects/SOGo/LDAPSource.m (_convertRecordToLDAPAttributes):
make sure no field get listed twice in the list of valid field
names by using "removeDoubles".
(_makeLDAPChanges): don't bother checking whether the removed
attributes are strings.
* SoObjects/SOGo/NSArray+Utilities.m (-[NSMutableArray
removeDoubles]): new method removing doublons.
+26 -12
View File
@@ -1368,6 +1368,7 @@ _convertRecordToLDAPAttributes (LDAPSourceSchema *schema, NSDictionary *ldifReco
[validFields addObjectsFromArray: fields];
}
}
[validFields removeDoubles];
attributes = [NSMutableArray new];
max = [validFields count];
@@ -1455,8 +1456,10 @@ _convertRecordToLDAPAttributes (LDAPSourceSchema *schema, NSDictionary *ldifReco
NS_HANDLER
{
result = localException;
[result retain];
}
NS_ENDHANDLER;
[result autorelease];
}
else
[self errorWithFormat: @"no value for id field '%@'", IDField];
@@ -1470,12 +1473,12 @@ _makeLDAPChanges (NGLdapConnection *ldapConnection,
{
NSMutableArray *changes, *attributeNames, *origAttributeNames;
NGLdapEntry *origEntry;
NSArray *values;
// NSArray *values;
NGLdapAttribute *attribute, *origAttribute;
NSString *name;
NSDictionary *origAttributes;
NSUInteger count, max, valueCount, valueMax;
BOOL allStrings;
NSUInteger count, max/* , valueCount, valueMax */;
// BOOL allStrings;
/* additions and modifications */
origEntry = [ldapConnection entryAtDN: dn
@@ -1512,15 +1515,15 @@ _makeLDAPChanges (NGLdapConnection *ldapConnection,
origAttribute = [origAttributes objectForKey: name];
/* the attribute must only have string values, otherwise it will anyway
be missing from the new record */
allStrings = YES;
values = [origAttribute allValues];
valueMax = [values count];
for (valueCount = 0; allStrings && valueCount < valueMax; valueCount++)
if (![[values objectAtIndex: valueCount] isKindOfClass: NSStringK])
allStrings = NO;
if (allStrings)
[changes
addObject: [NGLdapModification deleteModification: origAttribute]];
// allStrings = YES;
// values = [origAttribute allValues];
// valueMax = [values count];
// for (valueCount = 0; allStrings && valueCount < valueMax; valueCount++)
// if (![[values objectAtIndex: valueCount] isKindOfClass: NSStringK])
// allStrings = NO;
// if (allStrings)
[changes
addObject: [NGLdapModification deleteModification: origAttribute]];
}
return changes;
@@ -1554,8 +1557,10 @@ _makeLDAPChanges (NGLdapConnection *ldapConnection,
NS_HANDLER
{
result = localException;
[result retain];
}
NS_ENDHANDLER;
[result autorelease];
}
else
[self errorWithFormat: @"expected dn for modified record"];
@@ -1580,9 +1585,12 @@ _makeLDAPChanges (NGLdapConnection *ldapConnection,
NS_HANDLER
{
result = localException;
[result retain];
}
NS_ENDHANDLER;
[result autorelease];
return result;
}
@@ -1720,8 +1728,10 @@ _makeLDAPChanges (NGLdapConnection *ldapConnection,
{
[self errorWithFormat: @"failed to create addressbook entry"];
result = localException;
[result retain];
}
NS_ENDHANDLER;
[result autorelease];
}
else
result = [NSException exceptionWithName: @"LDAPSourceIOException"
@@ -1766,8 +1776,10 @@ _makeLDAPChanges (NGLdapConnection *ldapConnection,
{
[self errorWithFormat: @"failed to rename addressbook entry"];
result = localException;
[result retain];
}
NS_ENDHANDLER;
[result autorelease];
}
else
result = [NSException exceptionWithName: @"LDAPSourceIOException"
@@ -1808,8 +1820,10 @@ _makeLDAPChanges (NGLdapConnection *ldapConnection,
{
[self errorWithFormat: @"failed to remove addressbook entry"];
result = localException;
[result retain];
}
NS_ENDHANDLER;
[result autorelease];
}
else
result = [NSException exceptionWithName: @"LDAPSourceIOException"