fix oql syntax

This commit is contained in:
Peter Hormanns 2019-12-03 18:54:33 +01:00
parent e084e04133
commit da02f37ee4

View File

@ -51,7 +51,7 @@ public class AutoconfigAutodiscoverServlet extends HttpServlet {
final String domain = addrParts[1];
final Transaction transaction = new Transaction("autoconfig");
final EntityManager em = transaction.getEntityManager();
final Query emailQuery = em.createQuery("SELECT addr FROM EMailAddresses WHERE addr.localpart = :localpart AND addr.domain = :domain AND ( addr.subdomain IS NULL OR addr.subdomain = :subdomain)");
final Query emailQuery = em.createQuery("SELECT addr FROM EMailAddresses addr WHERE addr.localpart = :localpart AND addr.domain = :domain AND ( addr.subdomain IS NULL OR addr.subdomain = :subdomain)");
emailQuery.setParameter("subdomain", "");
emailQuery.setParameter("domain", domain);
emailQuery.setParameter("localpart", localpart);
@ -62,7 +62,7 @@ public class AutoconfigAutodiscoverServlet extends HttpServlet {
return;
}
final EMailAddress emailAddress = (EMailAddress) emailResult;
final Query mboxQuery = em.createQuery("SELECT mbox FROM UnixUsers WHERE mbox.name = :target");
final Query mboxQuery = em.createQuery("SELECT mbox FROM UnixUsers mbox WHERE mbox.name = :target");
final String target = emailAddress.getTarget();
if (target == null || target.length() < 5 || (target.length() > 6 && target.charAt(5) != '-')) {
transaction.close();