I'm testing a 7.1.2 OSE on Ubuntu 10.04.3 LTS server, with multi-server+multi-domain setup.

I've noticed, when testing the GALsync setup, that one of my domains tests fine (this domain has an existing exchange server), i.e. when I type something into the test field, it does retrieve some results.

However, on another two domains (which have never had exchange installed before), when I type something into the test field, even though it says passed, no results are returned.

According to the output of "zmprov gcf zimbraGalLdapFilterDef | grep ad:", the filter used is:

Code:
(&(|(displayName=*%s*)(cn=*%s*)(sn=*%s*)(givenName=*%s*)(mail=*%s*))(!(msExchHideFromAddressLists=TRUE))(mailnickname=*)(|(&(objectCategory=person)(objectClass=user)(!(homeMDB=*))(!(msExchHomeServerName=*)))(&(objectCategory=person)(objectClass=user)(|(homeMDB=*)(msExchHomeServerName=*)))(&(objectCategory=person)(objectClass=contact))(objectCategory=group)(objectCategory=publicFolder)(objectCategory=msExchDynamicDistributionList)))
So to troubleshoot, I started by building an LDAP query manually, using this:
Code:
(&(|(displayName=*)(cn=*)(sn=*)(givenName=*)(mail=*))(!(msExchHideFromAddressLists=TRUE))(mailnickname=*)(|(&(objectCategory=person)(objectClass=user)(!(homeMDB=*))(!(msExchHomeServerName=*)))(&(objectCategory=person)(objectClass=user)(|(homeMDB=*)(msExchHomeServerName=*)))(&(objectCategory=person)(objectClass=contact))(objectCategory=group)(objectCategory=publicFolder)(objectCategory=msExchDynamicDistributionList)))
As expected, this works fine in the 1st domain, and returns an empty set for the other two.

So by trial and error, I found that if I delete these two clauses (not one, not the other, but both), the query works:
Code:
	(!(msExchHideFromAddressLists=TRUE))
	(mailnickname=*)
i.e. the query is now just:
Code:
(&(|(displayName=*)(cn=*)(sn=*)(givenName=*)(mail=*))(|(&(objectCategory=person)(objectClass=user)(!(homeMDB=*))(!(msExchHomeServerName=*)))(&(objectCategory=person)(objectClass=user)(|(homeMDB=*)(msExchHomeServerName=*)))(&(objectCategory=person)(objectClass=contact))(objectCategory=group)(objectCategory=publicFolder)(objectCategory=msExchDynamicDistributionList)))
The values for attribute mailnickname are not populated in my other two domains, so that would explain why the result set is empty, but anybody know why:
1) mailnickname needs to be populated
2) why does the query still not work, by removing just the mailnickname clause?
3) what's a better solution, to populate the mailnickname, or change the zimbraGalLdapFilterDef filter?
4) from some googling, it seems that mailnickname is strictly an MS Exchange attribute, so for non-exchange environments, this would be a bug to be using as a filter?

For better readability, I reformatted the default query so it looks like this (braces matching; you can't use the query like this, so have to replace \t and \n with null):
Code:
(&
	(|(displayName=*)(cn=*)(sn=*)(givenName=*)(mail=*))
	(!(msExchHideFromAddressLists=TRUE))
	(mailnickname=*)
	(|
		(&(objectCategory=person)(objectClass=user)(!(homeMDB=*))(!(msExchHomeServerName=*)))
		(&(objectCategory=person)(objectClass=user)(|(homeMDB=*)(msExchHomeServerName=*)))
		(&(objectCategory=person)(objectClass=contact))
		(objectCategory=group)
		(objectCategory=publicFolder)
		(objectCategory=msExchDynamicDistributionList)
	)
)