Hi guys,

I noticed that HTTP authentication was not working in auth.php. Since php4 the variables changed for this to work.
I created a little patch that will make it work again.

Kind regards,
- Ramon.

--
.--------------------------------------------.
| ing. Ramon Bastiaans                       |
| HPC - Systems Programmer                   |
|--------------------------------------------|
| SARA - Computing and Networking Services   |
| Kruislaan 415           PO Box 194613      |
| 1098 SJ Amsterdam       1090 GP Amsterdam  |
|--------------------------------------------|
| Mail:  bastiaans ( a t ) sara ( d o t ) nl |
| Web:   http://www.sara.nl/                 |
| Phone: +31 (0)20 592 80 19                 |
| Fax:   +31 (0)20 668 31 67                 |
`--------------------------------------------'

--- ganglia-3.0.1/web/auth.php  2005-02-02 19:24:14.000000000 +0100
+++ ./auth.php  2005-08-30 10:07:47.182962576 +0200
@@ -43,19 +43,20 @@
 
#-------------------------------------------------------------------------------
 function checkprivate()
 {
-   global $clustername, $context, $PHP_AUTH_PW;
+   global $clustername, $context;
+
    # Allow the Meta context page.
    if ($context=="meta") { return; }
 
    $private=embarrassed();
    if ($private[$clustername]) {
       #echo "The password for $clustername is $private[$clustername]<br>";
-      if (empty($PHP_AUTH_PW)) {
+      if (empty($_SERVER['PHP_AUTH_PW'])) {
         authenticate();
       }
       else {
         # Check password (in md5 format). Username does not matter.
-        if (md5($PHP_AUTH_PW) != $private[$clustername]) {
+        if (md5($_SERVER['PHP_AUTH_PW']) != $private[$clustername]) {
            authenticate();
         }
       }
@@ -68,17 +69,17 @@
 # The control room is always embarrassed.
 function checkcontrol()
 {
-   global $context, $PHP_AUTH_PW;
+   global $context;
 
    if ($context != "control") { return; }
 
-   if (empty($PHP_AUTH_PW)) {
+   if (empty($_SERVER['PHP_AUTH_PW'])) {
       authenticate();
    }
    else {
       #echo "You entered password ". md5($PHP_AUTH_PW) ." ($PHP_AUTH_PW)<br>";
       $private=embarrassed();
-      if (md5($PHP_AUTH_PW) != $private["controlroom"]) {
+      if (md5($_SERVER['PHP_AUTH_PW']) != $private["controlroom"]) {
         authenticate();
       }
    }

Reply via email to