merge maildb.js into mail.js
This commit is contained in:
+8
-3
@@ -19,7 +19,8 @@ const assert = require('assert'),
|
||||
mailboxdb = require('./mailboxdb.js'),
|
||||
safe = require('safetydance'),
|
||||
services = require('./services.js'),
|
||||
users = require('./users.js');
|
||||
users = require('./users.js'),
|
||||
util = require('util');
|
||||
|
||||
var gServer = null;
|
||||
|
||||
@@ -534,7 +535,9 @@ function authenticateUserMailbox(req, res, next) {
|
||||
var parts = email.split('@');
|
||||
if (parts.length !== 2) return next(new ldap.NoSuchObjectError(req.dn.toString()));
|
||||
|
||||
mail.getDomain(parts[1], function (error, domain) {
|
||||
const getDomainFunc = util.callbackify(mail.getDomain);
|
||||
|
||||
getDomainFunc(parts[1], function (error, domain) {
|
||||
if (error && error.reason === BoxError.NOT_FOUND) return next(new ldap.NoSuchObjectError(req.dn.toString()));
|
||||
if (error) return next(new ldap.OperationsError(error.message));
|
||||
|
||||
@@ -671,7 +674,9 @@ function authenticateMailAddon(req, res, next) {
|
||||
const addonId = req.dn.rdns[1].attrs.ou.value.toLowerCase(); // 'sendmail' or 'recvmail'
|
||||
if (addonId !== 'sendmail' && addonId !== 'recvmail') return next(new ldap.OperationsError('Invalid DN'));
|
||||
|
||||
mail.getDomain(parts[1], function (error, domain) {
|
||||
const getDomainFunc = util.callbackify(mail.getDomain);
|
||||
|
||||
getDomainFunc(parts[1], function (error, domain) {
|
||||
if (error && error.reason === BoxError.NOT_FOUND) return next(new ldap.NoSuchObjectError(req.dn.toString()));
|
||||
if (error) return next(new ldap.OperationsError(error.message));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user