From 7fa7cc313fbdce5bbe67cf0ccbf5a2f713d89279 Mon Sep 17 00:00:00 2001 From: DaneEveritt Date: Sun, 29 May 2022 21:48:49 -0400 Subject: [PATCH] Fix permissions not being checked correctly for admins --- CHANGELOG.md | 4 ++++ sftp/handler.go | 10 +++------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 37368db..1fc066b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## v1.6.3 +### Fixed +* Fixes SFTP authentication failing for administrative users due to a permissions adjustment on the Panel. + ## v1.6.2 ### Fixed * Fixes file upload size not being properly enforced. diff --git a/sftp/handler.go b/sftp/handler.go index 2bbd729..a2e4a33 100644 --- a/sftp/handler.go +++ b/sftp/handler.go @@ -288,14 +288,10 @@ func (h *Handler) can(permission string) bool { return false } - // SFTPServer owners and super admins have their permissions returned as '[*]' via the Panel - // API, so for the sake of speed do an initial check for that before iterating over the - // entire array of permissions. - if len(h.permissions) == 1 && h.permissions[0] == "*" { - return true - } for _, p := range h.permissions { - if p == permission { + // If we match the permission specifically, or the user has been granted the "*" + // permission because they're an admin, let them through. + if p == permission || p == "*" { return true } }