From d0184454aa336f410e787b746f4c071a307203c8 Mon Sep 17 00:00:00 2001
From: tokul
Date: Sun, 20 Mar 2005 10:18:01 +0000
Subject: [PATCH] data_dir is not that important in pear based setups. fixed
ldap tests. function was tested as constant and ldap error messages were not
suppressed. added block that does not allow use of script from remote
addresses. configuration files will be updated in other commit.
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@9085 7612ce4b-ef26-0410-bec9-ea0150e637f0
---
src/configtest.php | 62 +++++++++++++++++++++++++++++++++++-----------
1 file changed, 47 insertions(+), 15 deletions(-)
diff --git a/src/configtest.php b/src/configtest.php
index 4b6698e6..e5d11de3 100644
--- a/src/configtest.php
+++ b/src/configtest.php
@@ -34,6 +34,9 @@ ob_implicit_flush();
/** @ignore */
define('SM_PATH', '../');
+/* set default value in order to block remote access to script */
+$allow_remote_configtest=false;
+
/*
* Load config before output begins. functions/strings.php depends on
* functions/globals.php. functions/global.php needs to be run before
@@ -58,7 +61,6 @@ in the config/ directory first before you run this script.
\n| SquirrelMail version: | " . $version . " |
\n" .
@@ -100,7 +109,7 @@ echo $IND . "PHP extensions OK.
\n";
/**
* mbstring.func_overload allows to replace original string and regexp functions
* with their equivalents from php mbstring extension. It causes problems when
- * scripts analyse 8bit strings byte after byte or use 8bit strings in regexp tests.
+ * scripts analyze 8bit strings byte after byte or use 8bit strings in regexp tests.
* Setting can be controlled in php.ini (php 4.2.0), webserver config (php 4.2.0)
* and .htaccess files (php 4.3.5).
*/
@@ -117,22 +126,45 @@ if (function_exists('mb_internal_encoding') &&
echo "Checking paths...
\n";
if(!file_exists($data_dir)) {
- do_err("Data dir ($data_dir) does not exist!");
+ // data_dir is not that important in db_setups.
+ if (isset($prefs_dsn) && ! empty($prefs_dsn)) {
+ $data_dir_error = "Data dir ($data_dir) does not exist!\n";
+ echo $IND .'ERROR: ' . $data_dir_error;
+ } else {
+ do_err("Data dir ($data_dir) does not exist!");
+ }
}
-if(!is_dir($data_dir)) {
- do_err("Data dir ($data_dir) is not a directory!");
+// don't check if errors
+if(!isset($data_dir_error) && !is_dir($data_dir)) {
+ if (isset($prefs_dsn) && ! empty($prefs_dsn)) {
+ $data_dir_error = "Data dir ($data_dir) is not a directory!\n";
+ echo $IND . 'ERROR: ' . $data_dir_error;
+ } else {
+ do_err("Data dir ($data_dir) is not a directory!");
+ }
}
// datadir should be executable - but no clean way to test on that
-if(!is_writable($data_dir)) {
- do_err("I cannot write to data dir ($data_dir)!");
+if(!isset($data_dir_error) && !is_writable($data_dir)) {
+ if (isset($prefs_dsn) && ! empty($prefs_dsn)) {
+ $data_dir_error = "Data dir ($data_dir) is not writable!\n";
+ echo $IND . 'ERROR: ' . $data_dir_error;
+ } else {
+ do_err("Data dir ($data_dir) is not writable!");
+ }
}
-// todo_ornot: actually write something and read it back.
-echo $IND . "Data dir OK.
\n";
-
+if (isset($data_dir_error)) {
+ echo " Some plugins might need access to data directory.
\n";
+} else {
+ // todo_ornot: actually write something and read it back.
+ echo $IND . "Data dir OK.
\n";
+}
if($data_dir == $attachment_dir) {
echo $IND . "Attachment dir is the same as data dir.
\n";
+ if (isset($data_dir_error)) {
+ do_err($data_dir_error);
+ }
} else {
if(!file_exists($attachment_dir)) {
do_err("Attachment dir ($attachment_dir) does not exist!");
@@ -411,13 +443,13 @@ echo "Checking LDAP functions...
\n";
if( empty($ldap_server) ) {
echo $IND."not using LDAP functionality.
\n";
} else {
- if ( !function_exists(ldap_connect) ) {
+ if ( !function_exists('ldap_connect') ) {
do_err('Required LDAP support is not available.');
} else {
echo "$IND LDAP support present.
\n";
foreach ( $ldap_server as $param ) {
- $linkid = ldap_connect($param['host'], (empty($param['port']) ? 389 : $param['port']) );
+ $linkid = @ldap_connect($param['host'], (empty($param['port']) ? 389 : $param['port']) );
if ( $linkid ) {
echo "$IND LDAP connect to ".$param['host']." successful: ".$linkid."
\n";
@@ -428,9 +460,9 @@ if( empty($ldap_server) ) {
}
if ( empty($param['binddn']) ) {
- $bind = ldap_bind($linkid);
+ $bind = @ldap_bind($linkid);
} else {
- $bind = ldap_bind($param['binddn'], $param['bindpw']);
+ $bind = @ldap_bind($param['binddn'], $param['bindpw']);
}
if ( $bind ) {
@@ -439,7 +471,7 @@ if( empty($ldap_server) ) {
do_err('Unable to Bind to LDAP Server');
}
- ldap_close($linkid);
+ @ldap_close($linkid);
} else {
do_err('Connection to LDAP failed');
}
--
2.25.1