Fixed errors during storage server build. For some reason detection of a request from localhost was no longer detected by the webserver.

This commit is contained in:
paul.baranowski 2010-09-10 10:48:08 -04:00
parent 9bf149b5c6
commit 768797a60c
3 changed files with 22 additions and 11 deletions

View File

@ -27,7 +27,7 @@
WWW_ROOT=`cd var/install; php -q getWwwRoot.php` || exit $? WWW_ROOT=`cd var/install; php -q getWwwRoot.php` || exit $?
echo " *** StorageServer bin/setupDirs.sh BEGIN" echo " *** StorageServer bin/setupDirs.sh BEGIN"
echo " *** Root URL: $WWW_ROOT" echo " * Root URL: $WWW_ROOT"
PHP_PWD_COMMAND=`bin/getUrl.sh $WWW_ROOT/install/getPwd.php` || \ PHP_PWD_COMMAND=`bin/getUrl.sh $WWW_ROOT/install/getPwd.php` || \
{ {
errno=$? errno=$?
@ -37,6 +37,7 @@ PHP_PWD_COMMAND=`bin/getUrl.sh $WWW_ROOT/install/getPwd.php` || \
fi fi
exit $errno exit $errno
} }
PHP_PWD=$PHP_PWD_COMMAND PHP_PWD=$PHP_PWD_COMMAND
# MOD_PHP may not be working, this command will tell us # MOD_PHP may not be working, this command will tell us
if [ ${PHP_PWD_COMMAND:0:5} == '<?php' ]; then if [ ${PHP_PWD_COMMAND:0:5} == '<?php' ]; then
@ -44,14 +45,19 @@ if [ ${PHP_PWD_COMMAND:0:5} == '<?php' ]; then
exit 1 exit 1
fi fi
echo " *** Webspace mapping test:" if [ $PHP_PWD == "" ]; then
echo " *** mod_php : $PHP_PWD" echo " * ERROR: Could not get PHP working directory."
exit 1
fi
echo " ** Webspace mapping test:"
echo " * mod_php : $PHP_PWD"
INSTALL_DIR="$PWD/var/install" INSTALL_DIR="$PWD/var/install"
echo " *** install : $INSTALL_DIR" echo " * install : $INSTALL_DIR"
if [ $PHP_PWD == $INSTALL_DIR ]; then if [ $PHP_PWD == $INSTALL_DIR ]; then
echo " *** Mapping OK" echo " * Mapping OK"
else else
echo " *** WARNING: there was a problem with webspace mapping!!!" echo " * WARNING: there was a problem with webspace mapping!!!"
fi fi
HTTP_GROUP=`bin/getUrl.sh $WWW_ROOT/install/getGname.php` || \ HTTP_GROUP=`bin/getUrl.sh $WWW_ROOT/install/getGname.php` || \
@ -61,11 +67,11 @@ HTTP_GROUP=`bin/getUrl.sh $WWW_ROOT/install/getGname.php` || \
echo " -> Probably wrong setting in var/conf.php: URL configuration"; echo " -> Probably wrong setting in var/conf.php: URL configuration";
exit $ERN; exit $ERN;
} }
echo " *** The system group that is running the http daemon: '$HTTP_GROUP'" echo " ** The system group that is running the http daemon: '$HTTP_GROUP'"
for i in $* for i in $*
do do
echo " *** chown :$HTTP_GROUP $i" echo " * chown :$HTTP_GROUP $i"
if [ -G $i ]; then if [ -G $i ]; then
chown :$HTTP_GROUP $i || \ chown :$HTTP_GROUP $i || \
{ {
@ -73,7 +79,7 @@ do
echo "ERROR: chown :$HTTP_GROUP $i -> You should have permissions to set group owner to group '$HTTP_GROUP'"; echo "ERROR: chown :$HTTP_GROUP $i -> You should have permissions to set group owner to group '$HTTP_GROUP'";
exit $ERN; exit $ERN;
} }
echo " *** chmod g+sw $i" echo " * chmod g+sw $i"
chmod g+sw $i || exit $? chmod g+sw $i || exit $?
fi fi
done done

View File

@ -6,7 +6,9 @@
header("Content-type: text/plain"); header("Content-type: text/plain");
$egid = posix_getegid(); $egid = posix_getegid();
$info = posix_getgrgid($egid); $info = posix_getgrgid($egid);
if ($_SERVER["REMOTE_ADDR"] == "127.0.0.1") { if ( (isset($_SERVER["REMOTE_ADDR"]) && ($_SERVER["REMOTE_ADDR"] == "127.0.0.1"))
|| (isset($_SERVER["HTTP_HOST"]) && ($_SERVER["HTTP_HOST"] == "localhost"))
|| (isset($_SERVER["SHELL"])) ) {
echo $info['name']; echo $info['name'];
} }
?> ?>

View File

@ -4,7 +4,10 @@
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
header("Content-type: text/plain"); header("Content-type: text/plain");
if ($_SERVER["REMOTE_ADDR"] == "127.0.0.1") { //var_dump($_SERVER);
if ( (isset($_SERVER["REMOTE_ADDR"]) && ($_SERVER["REMOTE_ADDR"] == "127.0.0.1"))
|| (isset($_SERVER["HTTP_HOST"]) && ($_SERVER["HTTP_HOST"] == "localhost"))
|| (isset($_SERVER["SHELL"])) ) {
echo `pwd`; echo `pwd`;
} }
?> ?>