X-Git-Url: http://git.home-dn.net/?p=manu%2Fsuphp.git;a=blobdiff_plain;f=src%2Fcheck.c;fp=src%2Fcheck.c;h=0000000000000000000000000000000000000000;hp=488641525a26504b4fc8cc7f1fbf767b5969d591;hb=873afb00229b8e205345b6895eaad6602d5e10f4;hpb=728a5b3f000f892e52ecea98fcc8f0c5d7275b7b diff --git a/src/check.c b/src/check.c deleted file mode 100644 index 4886415..0000000 --- a/src/check.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - suPHP - (c)2002-2004 Sebastian Marsching - - This file is part of suPHP. - - suPHP is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - suPHP is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with suPHP; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include -#include -#include -#include -#include -#include "suphp.h" - -int check_path(char *script_path) -{ - char *document_root = getenv("DOCUMENT_ROOT"); - if(!document_root) - { - suphp_log_error("Could not get DOCUMENT_ROOT from the environment processing %s", script_path); - error_msg_exit(ERRCODE_WRONG_ENVIRONMENT, "DOCUMENT_ROOT not set", __FILE__, __LINE__); - } - if (strncmp(document_root, script_path, strlen(document_root))!=0) - return 0; - else - return 1; -} - -int check_permissions(char *script_path) -{ - struct stat file_info; - - if (stat(script_path, &file_info)) - { - suphp_log_error("Could not stat() script %s", script_path); - error_sysmsg_exit(ERRCODE_UNKNOWN, "stat() failed", __FILE__, __LINE__); - } - - if (!(file_info.st_mode & S_IRUSR)) - { - suphp_log_error("Owner doesn't have read permission on %s", script_path); - return 0; - } - - if (file_info.st_mode & (S_IWGRP | S_IWOTH)) - { - suphp_log_error("Script (%s) is writeable by others", script_path); - return 0; - } - - return 1; -}