Do not check if email is enabled when an app tries to do sendmail auth through ldap

This commit is contained in:
Johannes Zellner
2018-01-29 19:29:04 +01:00
parent edb02c859b
commit 6470803604
2 changed files with 3 additions and 3 deletions

View File

@@ -432,8 +432,6 @@ function authenticateMailbox(req, res, next) {
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()));
if (mailbox.ownerType === mailboxdb.TYPE_APP) {
var addonId = req.dn.rdns[1].attrs.ou.value.toLowerCase(); // 'sendmail' or 'recvmail'
var name;
@@ -449,6 +447,8 @@ function authenticateMailbox(req, res, next) {
return res.end();
});
} else if (mailbox.ownerType === mailboxdb.TYPE_USER) {
if (!domain.enabled) return next(new ldap.NoSuchObjectError(req.dn.toString()));
user.verifyWithUsername(parts[0], req.credentials || '', function (error, user) {
if (error && error.reason === UserError.NOT_FOUND) return next(new ldap.NoSuchObjectError(req.dn.toString()));
if (error && error.reason === UserError.WRONG_PASSWORD) return next(new ldap.InvalidCredentialsError(req.dn.toString()));