[api] LDAP configuration clean up
[api] fix several issues for ldap
[dist] sync with 2.4 branch
[api] prepare for rails 4 port