From 0856b8d4af8e339ada2f75f6ec4790b3bc41ea0d Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 28 Feb 2022 16:24:39 -0500 Subject: [PATCH] fix: correct the prefix check --- plugins/common/io.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/common/io.go b/plugins/common/io.go index 75d878ac2..98641f168 100644 --- a/plugins/common/io.go +++ b/plugins/common/io.go @@ -183,7 +183,7 @@ func SetPermissions(path string, fileMode os.FileMode) error { systemGroup := GetenvWithDefault("DOKKU_SYSTEM_GROUP", "dokku") systemUser := GetenvWithDefault("DOKKU_SYSTEM_USER", "dokku") - if strings.HasPrefix("/etc/sudoers.d/", path) { + if strings.HasPrefix(path, "/etc/sudoers.d/") { systemGroup = "root" systemUser = "root" } @@ -212,7 +212,7 @@ func SetPermissions(path string, fileMode os.FileMode) error { // WriteSliceToFile writes a slice of strings to a file func WriteSliceToFile(filename string, lines []string) error { mode := os.FileMode(0600) - if strings.HasPrefix("/etc/sudoers.d/", filename) { + if strings.HasPrefix(filename, "/etc/sudoers.d/") { // sudoers files should be either 0600 (rhel) or 0440 (debian) defaultMode := map[string]bool{ "centos": true,