Rewrite migrate_ldap.

Make it more flexible by not making as many assumptions.

Change-Id: I9fea969ef798a9c2d9512a6f744f34fbe9107d43