From daa192a86cab089ca2da5c5660a313e9201f4d00 Mon Sep 17 00:00:00 2001 From: kink Date: Tue, 1 Feb 2005 16:42:47 +0000 Subject: [PATCH] Exactly how the line is terminated is not really relevant, so strip all whitespace around an admin-username. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@8748 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- plugins/administrator/INSTALL | 5 +---- plugins/administrator/auth.php | 8 +++++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/plugins/administrator/INSTALL b/plugins/administrator/INSTALL index 5da30c5d..21eda18d 100644 --- a/plugins/administrator/INSTALL +++ b/plugins/administrator/INSTALL @@ -12,10 +12,7 @@ work, if user's id equals to 0. An alternative method, but less secure, is to add a file called admins into the plugin folder with the names of the users that -you want to allow the use of the plugin. admins file must have -empty line after administrator's username. If administrator name -ends of end-of-file symbol instead of line feed, it will be -ignored. +you want to allow the use of the plugin. Use this plugin at your own risk, and always remember to make a backup of your config.php file before use. diff --git a/plugins/administrator/auth.php b/plugins/administrator/auth.php index d356fec3..0f394471 100644 --- a/plugins/administrator/auth.php +++ b/plugins/administrator/auth.php @@ -32,10 +32,12 @@ function adm_check_user() { $auth = FALSE; } else if (file_exists(SM_PATH . 'plugins/administrator/admins')) { $auths = file(SM_PATH . 'plugins/administrator/admins'); - $auth = in_array("$username\n", $auths); + array_walk($auths, 'trim'); + $auth = in_array($username, $auths); } else if (file_exists(SM_PATH . 'config/admins')) { $auths = file(SM_PATH . 'config/admins'); - $auth = in_array("$username\n", $auths); + array_walk($auths, 'trim'); + $auth = in_array($username, $auths); } else if (($adm_id = fileowner(SM_PATH . 'config/config.php')) && function_exists('posix_getpwuid')) { $adm = posix_getpwuid( $adm_id ); @@ -47,4 +49,4 @@ function adm_check_user() { return ($auth); } -?> \ No newline at end of file +?> -- 2.25.1