2 suPHP - (c)2002-2005 Sebastian Marsching <sebastian@marsching.com>
4 This file is part of suPHP.
6 suPHP is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 suPHP is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with suPHP; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #ifndef SUPHP_CONFIGURATION_H
27 #define SUPHP_CONFIGURATION_H
32 #include "ParsingException.hpp"
33 #include "IOException.hpp"
35 #include "KeyNotFoundException.hpp"
40 * Class encapsulating run-time configuration.
45 std::string webserver_user;
47 bool allow_file_group_writeable;
48 bool allow_directory_group_writeable;
49 bool allow_file_others_writeable;
50 bool allow_directory_others_writeable;
51 bool check_vhost_docroot;
52 bool errors_to_browser;
54 std::map<std::string, std::string> handlers;
61 * Converts string to bool
63 bool strToBool(const std::string& str) const throw (ParsingException);
66 * Converts string to LogLevel
68 LogLevel strToLogLevel(const std::string& str) const
69 throw (ParsingException);
73 * Constructor, initializes configuration with default values.
78 * Reads values from INI file
80 void readFromFile(File& file) throw (IOException, ParsingException);
83 * Return path to logfile;
85 std::string getLogfile() const;
90 LogLevel getLogLevel() const;
93 * Return username of user the webserver is running as
95 std::string getWebserverUser() const;
98 * Return document root (directory, all script have to be in)
100 std::string getDocroot() const;
103 * Returns wheter suPHP should check if scripts in within the
104 * document root of the VHost
106 bool getCheckVHostDocroot() const;
109 * Returns wheter suPHP should ignore the group write bit of
112 bool getAllowFileGroupWriteable() const;
115 * Returns wheter suPHP should ignore the group write bit of
116 * the directory the is script in
118 bool getAllowDirectoryGroupWriteable() const;
121 * Returns wheter suPHP should ignore the others write bit of the
124 bool getAllowFileOthersWriteable() const;
127 * Returns wheter suPHP should ignore the others write bit of
128 * the directory the is script in
130 bool getAllowDirectoryOthersWriteable() const;
133 * Returns whether (minor) error message should be sent to browser
135 bool getErrorsToBrowser() const;
138 * Returns the content for the PATH environment variable
140 std::string getEnvPath() const;
143 * Returns interpreter string for specified handler
145 std::string getInterpreter(std::string handler) const
146 throw (KeyNotFoundException);
149 * Returns minimum UID allowed for scripts
151 int getMinUid() const;
154 * Returns minimum GID allowed for scripts
156 int getMinGid() const;
159 * Returns umask to set
161 int getUmask() const;
165 #endif // SUPHP_CONFIGURATION_H