There's some custom SQL in "exists_local" and probably other parts of C4/Auth_with_ldap.pm which could probably be replaced with Koha::Patrons->find_by_identifier()