diff --git a/src/ldap.js b/src/ldap.js index 6df226e1f..67e6b1cd4 100644 --- a/src/ldap.js +++ b/src/ldap.js @@ -610,7 +610,7 @@ function userSearchSftp(req, res, next) { const uidNumber = app.manifest.addons.localstorage.ftp.uid; - const [userGetError, user] = await users.getByUsername(username); + const [userGetError, user] = await safe(users.getByUsername(username)); if (userGetError) return next(new ldap.OperationsError(userGetError.toString())); if (!user) return next(new ldap.OperationsError('Invalid username')); @@ -620,7 +620,7 @@ function userSearchSftp(req, res, next) { if (error) return next(new ldap.OperationsError(error.toString())); if (!hasAccess) return next(new ldap.InsufficientAccessRightsError('Not authorized')); - var obj = { + const obj = { dn: ldap.parseDN(`cn=${username}@${appFqdn},ou=sftp,dc=cloudron`).toString(), attributes: { homeDirectory: app.dataDir ? `/mnt/${app.id}` : `/mnt/appsdata/${app.id}/data`,