Exactly how the line is terminated is not really relevant, so strip all
authorkink <kink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Tue, 1 Feb 2005 16:42:47 +0000 (16:42 +0000)
committerkink <kink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Tue, 1 Feb 2005 16:42:47 +0000 (16:42 +0000)
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
plugins/administrator/auth.php

index 5da30c5d6fd8ebd7ef0e32c11fd13accc278d87c..21eda18d4682e46be727b2359d0e05989256d0fd 100644 (file)
@@ -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
 
 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. 
 
 Use this plugin at your own risk, and always remember to make a
 backup of your config.php file before use. 
index d356fec3f38ada7eddaa68cdb3dbd6406929ccc3..0f394471b75620e0fe1391ecffe254a02d134b37 100644 (file)
@@ -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 = 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');
     } 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 );
     } 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);
 }
 
     return ($auth);
 }
 
-?>
\ No newline at end of file
+?>