From 53ecdfec514b452c19cd4ef4a7b71387d0f6f4bc Mon Sep 17 00:00:00 2001 From: Daniel Kesselberg Date: Thu, 6 Sep 2018 14:04:06 +0200 Subject: [PATCH 1/2] Remove posix_getpwuid and compare only userid Signed-off-by: Daniel Kesselberg --- settings/Controller/CheckSetupController.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/settings/Controller/CheckSetupController.php b/settings/Controller/CheckSetupController.php index 9169808456fd5..c336880455c29 100644 --- a/settings/Controller/CheckSetupController.php +++ b/settings/Controller/CheckSetupController.php @@ -543,7 +543,7 @@ protected function hasOpcacheLoaded(): bool { * @return array */ protected function getAppDirsWithDifferentOwner(): array { - $currentUser = posix_getpwuid(posix_getuid()); + $currentUser = posix_getuid(); $appDirsWithDifferentOwner = [[]]; foreach (OC::$APPSROOTS as $appRoot) { @@ -561,11 +561,11 @@ protected function getAppDirsWithDifferentOwner(): array { /** * Tests if the directories for one apps directory are writable by the current user. * - * @param array $currentUser The current user + * @param int $currentUser The current user * @param array $appRoot The app root config * @return string[] The none writable directory paths inside the app root */ - private function getAppDirsWithDifferentOwnerForAppRoot(array $currentUser, array $appRoot): array { + private function getAppDirsWithDifferentOwnerForAppRoot($currentUser, array $appRoot): array { $appDirsWithDifferentOwner = []; $appsPath = $appRoot['path']; $appsDir = new DirectoryIterator($appRoot['path']); @@ -573,7 +573,7 @@ private function getAppDirsWithDifferentOwnerForAppRoot(array $currentUser, arra foreach ($appsDir as $fileInfo) { if ($fileInfo->isDir() && !$fileInfo->isDot()) { $absAppPath = $appsPath . DIRECTORY_SEPARATOR . $fileInfo->getFilename(); - $appDirUser = posix_getpwuid(fileowner($absAppPath)); + $appDirUser = fileowner($absAppPath); if ($appDirUser !== $currentUser) { $appDirsWithDifferentOwner[] = $absAppPath; } From 843df1c00923fe84df5c59d8f09169a555bd36f0 Mon Sep 17 00:00:00 2001 From: Daniel Kesselberg Date: Wed, 12 Sep 2018 15:05:17 +0200 Subject: [PATCH 2/2] Add int-typehint Signed-off-by: Daniel Kesselberg --- settings/Controller/CheckSetupController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings/Controller/CheckSetupController.php b/settings/Controller/CheckSetupController.php index c336880455c29..2a1401a8a9dc8 100644 --- a/settings/Controller/CheckSetupController.php +++ b/settings/Controller/CheckSetupController.php @@ -565,7 +565,7 @@ protected function getAppDirsWithDifferentOwner(): array { * @param array $appRoot The app root config * @return string[] The none writable directory paths inside the app root */ - private function getAppDirsWithDifferentOwnerForAppRoot($currentUser, array $appRoot): array { + private function getAppDirsWithDifferentOwnerForAppRoot(int $currentUser, array $appRoot): array { $appDirsWithDifferentOwner = []; $appsPath = $appRoot['path']; $appsDir = new DirectoryIterator($appRoot['path']);