Compare commits

..

5 Commits

Author SHA1 Message Date
Pterodactyl CI
09a598ddc8 bump version for release 2022-05-31 18:38:57 +00:00
DaneEveritt
cec51f11f0 Update CHANGELOG.md 2022-05-31 14:36:24 -04:00
DaneEveritt
b1be2081eb Better archive detection logic; try to use reflection as last ditch effort if unmatched
closes pterodactyl/panel#4101
2022-05-30 18:42:31 -04:00
DaneEveritt
203a2091a0 Use the correct CPU period when throttling servers; closes pterodactyl/panel#4102 2022-05-30 17:45:41 -04:00
DaneEveritt
7fa7cc313f Fix permissions not being checked correctly for admins 2022-05-29 21:48:49 -04:00
5 changed files with 31 additions and 10 deletions

View File

@@ -1,5 +1,14 @@
# Changelog # Changelog
## v1.6.4
### Fixed
* Fixes a bug causing CPU limiting to not be properly applied to servers.
* Fixes a bug causing zip archives to decompress without taking into account nested folder structures.
## v1.6.3
### Fixed
* Fixes SFTP authentication failing for administrative users due to a permissions adjustment on the Panel.
## v1.6.2 ## v1.6.2
### Fixed ### Fixed
* Fixes file upload size not being properly enforced. * Fixes file upload size not being properly enforced.

View File

@@ -118,7 +118,7 @@ func (l Limits) AsContainerResources() container.Resources {
// @see https://github.com/pterodactyl/panel/issues/3988 // @see https://github.com/pterodactyl/panel/issues/3988
if l.CpuLimit > 0 { if l.CpuLimit > 0 {
resources.CPUQuota = l.CpuLimit * 1_000 resources.CPUQuota = l.CpuLimit * 1_000
resources.CPUPeriod = 100_00 resources.CPUPeriod = 100_000
resources.CPUShares = 1024 resources.CPUShares = 1024
} }

View File

@@ -5,9 +5,12 @@ import (
"archive/zip" "archive/zip"
"compress/gzip" "compress/gzip"
"fmt" "fmt"
gzip2 "github.com/klauspost/compress/gzip"
zip2 "github.com/klauspost/compress/zip"
"os" "os"
"path" "path"
"path/filepath" "path/filepath"
"reflect"
"strings" "strings"
"sync/atomic" "sync/atomic"
"time" "time"
@@ -172,13 +175,26 @@ func ExtractNameFromArchive(f archiver.File) string {
return f.Name() return f.Name()
} }
switch s := sys.(type) { switch s := sys.(type) {
case *zip.FileHeader:
return s.Name
case *zip2.FileHeader:
return s.Name
case *tar.Header: case *tar.Header:
return s.Name return s.Name
case *gzip.Header: case *gzip.Header:
return s.Name return s.Name
case *zip.FileHeader: case *gzip2.Header:
return s.Name return s.Name
default: default:
// At this point we cannot figure out what type of archive this might be so
// just try to find the name field in the struct. If it is found return it.
field := reflect.Indirect(reflect.ValueOf(sys)).FieldByName("Name")
if field.IsValid() {
return field.String()
}
// Fallback to the basename of the file at this point. There is nothing we can really
// do to try and figure out what the underlying directory of the file is supposed to
// be since it didn't implement a name field.
return f.Name() return f.Name()
} }
} }

View File

@@ -288,14 +288,10 @@ func (h *Handler) can(permission string) bool {
return false 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 { 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 return true
} }
} }

View File

@@ -1,3 +1,3 @@
package system package system
var Version = "develop" var Version = "1.6.4"