diff -Nbaur --exclude=config.make --exclude=configure --exclude='SOGoCASSession.*' --exclude='SOGoSystemDefaults.*' --exclude='*.css' SOGo-1.3.4-dist/SoObjects/SOGo/LDAPSource.h SOGo-1.3.4/SoObjects/SOGo/LDAPSource.h
--- SOGo-1.3.4-dist/SoObjects/SOGo/LDAPSource.h	2010-11-17 17:30:03.000000000 +0100
+++ SOGo-1.3.4/SoObjects/SOGo/LDAPSource.h	2010-12-02 13:35:05.000000000 +0100
@@ -52,6 +52,7 @@
   NSString *CNField;
   NSString *UIDField;
   NSArray *mailFields;
+  NSArray *searchFields;
   NSString *IMAPHostField;
   NSArray *bindFields;
 
@@ -76,6 +77,7 @@
 	   CNField: (NSString *) newCNField
 	  UIDField: (NSString *) newUIDField
 	mailFields: (NSArray *) newMailFields
+      searchFields: (NSArray *) newSearchFields
      IMAPHostField: (NSString *) newIMAPHostField
      andBindFields: (id) newBindFields;
 
diff -Nbaur --exclude=config.make --exclude=configure --exclude='SOGoCASSession.*' --exclude='SOGoSystemDefaults.*' --exclude='*.css' SOGo-1.3.4-dist/SoObjects/SOGo/LDAPSource.m SOGo-1.3.4/SoObjects/SOGo/LDAPSource.m
--- SOGo-1.3.4-dist/SoObjects/SOGo/LDAPSource.m	2010-11-17 17:30:03.000000000 +0100
+++ SOGo-1.3.4/SoObjects/SOGo/LDAPSource.m	2010-12-02 17:01:09.000000000 +0100
@@ -155,6 +155,9 @@
       UIDField = @"uid";
       mailFields = [NSArray arrayWithObject: @"mail"];
       [mailFields retain];
+      searchFields = [NSArray arrayWithObjects: 
+		      @"mail", CNField, UIDField, @"sn", @"displayname", @"telephonenumber", nil];
+      [searchFields retain];
       IMAPHostField = nil;
       bindFields = nil;
       _scope = @"sub";
@@ -178,6 +181,7 @@
   [CNField release];
   [UIDField release];
   [mailFields release];
+  [searchFields release];
   [IMAPHostField release];
   [bindFields release];
   [_filter release];
@@ -209,6 +213,7 @@
               CNField: [udSource objectForKey: @"CNFieldName"]
              UIDField: [udSource objectForKey: @"UIDFieldName"]
            mailFields: [udSource objectForKey: @"MailFieldNames"]
+         searchFields: [udSource objectForKey: @"SearchFieldNames"]
 	IMAPHostField: [udSource objectForKey: @"IMAPHostFieldName"]
 	andBindFields: [udSource objectForKey: @"bindFields"]];
 
@@ -273,6 +278,7 @@
 	   CNField: (NSString *) newCNField
 	  UIDField: (NSString *) newUIDField
 	mailFields: (NSArray *) newMailFields
+      searchFields: (NSArray *) newSearchFields
      IMAPHostField: (NSString *) newIMAPHostField
      andBindFields: (id) newBindFields
 {
@@ -287,6 +293,8 @@
     ASSIGN (IMAPHostField, newIMAPHostField);
   if (newMailFields)
     ASSIGN (mailFields, newMailFields);
+  if (newSearchFields)
+    ASSIGN (searchFields, newSearchFields);
   if (newBindFields)
     {
       // Before SOGo v1.2.0, bindFields was a comma-separated list
@@ -545,25 +553,17 @@
 /* contact management */
 - (EOQualifier *) _qualifierForFilter: (NSString *) filter
 {
-  NSString *mailFormat, *fieldFormat, *escapedFilter;
+  NSString *searchFormat, *fieldFormat, *escapedFilter;
   EOQualifier *qualifier;
   NSMutableString *qs;
 
   escapedFilter = SafeLDAPCriteria(filter);
   if ([escapedFilter length] > 0)
     {
-      fieldFormat = [NSString stringWithFormat: @"(%%@='%@*')", escapedFilter];
-      mailFormat = [[mailFields stringsWithFormat: fieldFormat]
+      fieldFormat = [NSString stringWithFormat: @"(%%@='*%@*')", escapedFilter];
+      searchFormat = [[searchFields stringsWithFormat: fieldFormat]
                      componentsJoinedByString: @" OR "];
-
-      qs = [NSMutableString string];
-      if ([escapedFilter isEqualToString: @"."])
-        [qs appendFormat: @"(%@='*')", CNField];
-      else
-        [qs appendFormat: @"(%@='%@*') OR (sn='%@*') OR (displayName='%@*')"
-	    @"OR %@ OR (telephoneNumber='*%@*')",
-	    CNField, escapedFilter, escapedFilter, escapedFilter, mailFormat,
-            escapedFilter];
+      qs = [NSMutableString stringWithString: searchFormat];
 
       if (_filter && [_filter length])
 	[qs appendFormat: @" AND %@", _filter];
diff -Nbaur --exclude=config.make --exclude=configure --exclude='SOGoCASSession.*' --exclude='SOGoSystemDefaults.*' --exclude='*.css' SOGo-1.3.4-dist/SoObjects/SOGo/SOGoUserManager.m SOGo-1.3.4/SoObjects/SOGo/SOGoUserManager.m
--- SOGo-1.3.4-dist/SoObjects/SOGo/SOGoUserManager.m	2010-11-17 17:30:03.000000000 +0100
+++ SOGo-1.3.4/SoObjects/SOGo/SOGoUserManager.m	2010-12-02 14:53:03.000000000 +0100
@@ -132,6 +132,9 @@
       value = [udSource objectForKey: @"MailFieldNames"];
       if (value)
         [metadata setObject: value forKey: @"MailFieldNames"];
+      value = [udSource objectForKey: @"SearchFieldNames"];
+      if (value)
+        [metadata setObject: value forKey: @"SearchFieldNames"];
       [_sourcesMetadata setObject: metadata forKey: sourceID];
     }
   else
