From e4ce1a9ad30f56e2e55dc6e407137985b899cd5a Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Fri, 30 Jul 2021 11:33:09 -0700 Subject: [PATCH] Fix crash --- src/ldap.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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`,