getCanonicalName fixes and single domain stability

getCanonicalName will do an LDAP lookup for a username to munge
it to another value, to optimize this the lookup is memcached. The
caching was also improperly caching lookups for IP addresses (anon
users) which caused odd behavior.

Additionally, multiple-domain support causes a number of bugs, even
when only a single domain is used. To make the extension more
stable for single domain users, it now sets the domain
automatically if there is only a single domain set.

Change-Id: I2c6c354c84d4ab644bffc3214de5b3ee6e3fae2b
Merge "getCanonicalName fixes and single domain stability"