mail.get() returns a MailError

This commit is contained in:
Johannes Zellner
2018-01-29 13:14:08 +01:00
parent c95de547eb
commit 77961e51ec

View File

@@ -17,6 +17,7 @@ var assert = require('assert'),
UserError = user.UserError,
ldap = require('ldapjs'),
mail = require('./mail.js'),
MailError = mail.MailError,
mailboxdb = require('./mailboxdb.js'),
safe = require('safetydance');
@@ -428,7 +429,7 @@ function authenticateMailbox(req, res, next) {
if (error) return next(new ldap.OperationsError(error.message));
mail.get(parts[1], function (error, domain) {
if (error && error.reason === DatabaseError.NOT_FOUND) return next(new ldap.NoSuchObjectError(req.dn.toString()));
if (error && error.reason === MailError.NOT_FOUND) return next(new ldap.NoSuchObjectError(req.dn.toString()));
if (error) return next(new ldap.OperationsError(error.message));
if (!domain.enabled) return next(new ldap.NoSuchObjectError(req.dn.toString()));