Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
92f143163b | ||
|
|
3c1a1f1b81 | ||
|
|
4bc7c70e2e | ||
|
|
cc6ddf50b1 |
5
CHANGES
5
CHANGES
@@ -1848,4 +1848,9 @@
|
||||
[5.0.5]
|
||||
* Fix bug where incoming mail from dynamic hostnames was rejected
|
||||
* Increase token expiry
|
||||
* Fix bug in tag UI where tag removal did not work
|
||||
|
||||
[5.0.6]
|
||||
* Make mail eventlog only visible to owners
|
||||
* Make app password work with sftp
|
||||
|
||||
|
||||
11
src/ldap.js
11
src/ldap.js
@@ -534,13 +534,16 @@ function authenticateSftp(req, res, next) {
|
||||
var parts = email.split('@');
|
||||
if (parts.length !== 2) return next(new ldap.NoSuchObjectError(req.dn.toString()));
|
||||
|
||||
// actual user bind
|
||||
users.verifyWithUsername(parts[0], req.credentials, users.AP_SFTP, function (error) {
|
||||
apps.getByFqdn(parts[1], function (error, app) {
|
||||
if (error) return next(new ldap.InvalidCredentialsError(req.dn.toString()));
|
||||
|
||||
debug('sftp auth: success');
|
||||
users.verifyWithUsername(parts[0], req.credentials, app.id, function (error) {
|
||||
if (error) return next(new ldap.InvalidCredentialsError(req.dn.toString()));
|
||||
|
||||
res.end();
|
||||
debug('sftp auth: success');
|
||||
|
||||
res.end();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -244,7 +244,13 @@ function initializeExpressSync() {
|
||||
}, routes.settings.set);
|
||||
|
||||
// email routes
|
||||
router.get('/api/v1/mailserver/:pathname', token, authorizeAdmin, routes.mailserver.proxy);
|
||||
router.get('/api/v1/mailserver/:pathname', token, (req, res, next) => {
|
||||
// some routes are more special than others
|
||||
if (req.params.pathname === 'eventlog' || req.params.pathname === 'clear_eventlog') {
|
||||
return authorizeOwner(req, res, next);
|
||||
}
|
||||
authorizeAdmin(req, res, next);
|
||||
}, routes.mailserver.proxy);
|
||||
|
||||
router.get ('/api/v1/mail/:domain', token, authorizeAdmin, routes.mail.getDomain);
|
||||
router.post('/api/v1/mail', token, authorizeAdmin, routes.mail.addDomain);
|
||||
|
||||
@@ -31,7 +31,6 @@ exports = module.exports = {
|
||||
count: count,
|
||||
|
||||
AP_MAIL: 'mail',
|
||||
AP_SFTP: 'sftp',
|
||||
AP_WEBADMIN: 'webadmin',
|
||||
|
||||
ROLE_ADMIN: 'admin',
|
||||
|
||||
Reference in New Issue
Block a user