^TipsAnd...

?TableOfContents

cgi configuration

ns_param  map    "GET  /squirrelmail/src  /usr/share/squirrelmail/src"
ns_param  map    "POST /squirrelmail/src  /usr/share/squirrelmail/src"
foreach plugin {tmdatools mail_fetch abook_group translate calendar} {
    ns_param  map    "GET  /squirrelmail/plugins/$plugin /usr/share/squirrelmail/plugins/$plugin"
    ns_param  map    "POST /squirrelmail/plugins/$plugin /usr/share/squirrelmail/plugins/$plugin"
}

sqm_baseuri

Squirrelmail calculates the location in the directory tree via the PHP_SELF variable, which is not present in CGI-Mode. Patch the strings.php file in the squirrelmail/functions directory with the following:

--- strings.php 2006-08-11 13:15:43.000000000 +0200
+++ /usr/share/squirrelmail/functions/strings.php       2006-09-05 22:50:13.000000000 +0200
@@ -227,6 +227,12 @@
       return $php_self;
     }

+    $php_self = $_SERVER['SCRIPT_NAME'];
+    if ( sqgetGlobalVar('QUERY_STRING', $query_string, SQ_SERVER) && !empty($query_string) ) {
+      $php_self .= '?' . $query_string;
+    }
+    return $php_self;
+
     return '';
 }

@@ -249,6 +255,9 @@
     }
     $dirs = array('|src/.*|', '|plugins/.*|', '|functions/.*|');
     $repl = array('', '', '');
+    if (empty($PHP_SELF)) {
+       $PHP_SELF = $_SERVER['SCRIPT_NAME'];
+    }
     $base_uri = preg_replace($dirs, $repl, $PHP_SELF);
     return $base_uri;
 }

redirection to login

https://www.at.anteris.net/squirrelmail/ will show the directory, or a not-found if directory listings are not allowed. The index.php is not executed (with the above cgi-setup).

put a file: index.adp with the following contents in this directory:

<% ns_returnredirect https://www.at.anteris.net/squirrelmail/src/login.php %>

Then edit src/index.php to show like:

header('Location: ../index.adp');

instead of index.php in the Location.

Prevent Debian updates

% dpkg-divert /usr/share/squirrelmail/src/index.php
% dpkg-divert /usr/share/squirrelmail/functions/strings.php