2008-12-11 03:48:25 +01:00
|
|
|
/*
|
2010-02-28 01:08:10 +01:00
|
|
|
* This file is a part of Winix
|
2008-12-11 03:48:25 +01:00
|
|
|
* and is not publicly distributed
|
|
|
|
*
|
2012-01-12 03:24:08 +01:00
|
|
|
* Copyright (c) 2008-2012, Tomasz Sowa
|
2008-12-11 03:48:25 +01:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2011-01-23 15:15:30 +01:00
|
|
|
#ifndef headerfile_winix_core_config
|
|
|
|
#define headerfile_winix_core_config
|
2008-12-11 03:48:25 +01:00
|
|
|
|
2009-04-21 22:50:55 +02:00
|
|
|
#include <string>
|
2012-05-01 00:53:54 +02:00
|
|
|
#include "space/spaceparser.h"
|
2010-08-12 21:10:12 +02:00
|
|
|
#include "htmlfilter.h"
|
2012-06-27 01:19:19 +02:00
|
|
|
|
2008-12-11 03:48:25 +01:00
|
|
|
|
2008-12-30 02:05:03 +01:00
|
|
|
|
2008-12-11 03:48:25 +01:00
|
|
|
|
2010-07-27 22:41:56 +02:00
|
|
|
|
2008-12-11 03:48:25 +01:00
|
|
|
class Config
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2010-10-24 21:26:54 +02:00
|
|
|
// name of the config file
|
|
|
|
// this is the parameter passed to winix programm
|
2010-08-10 18:12:50 +02:00
|
|
|
std::string config_file;
|
|
|
|
|
2010-10-24 21:26:54 +02:00
|
|
|
// start as a demon (in the background)
|
|
|
|
// default: true
|
|
|
|
bool demonize;
|
|
|
|
|
2010-10-24 19:49:38 +02:00
|
|
|
// system user name (to which drop privileges)
|
|
|
|
// used only if winix is started as the root
|
|
|
|
std::string user;
|
|
|
|
|
|
|
|
// system group name (to which drop privileges)
|
|
|
|
// used only if winix is started as the root
|
|
|
|
std::string group;
|
|
|
|
|
|
|
|
// setting additional effective groups from /etc/group
|
|
|
|
// by using initgroups()
|
|
|
|
// used only if winix is started as the root
|
|
|
|
// default: true
|
|
|
|
bool additional_groups;
|
|
|
|
|
2010-08-10 18:12:50 +02:00
|
|
|
// log file name, log file name for notifications (sending emails, etc)
|
|
|
|
std::string log_file, log_notify_file;
|
|
|
|
|
|
|
|
// 1 - minimum
|
|
|
|
// 2 - (default)
|
|
|
|
// 3 - maximum - all logs
|
|
|
|
int log_level;
|
|
|
|
|
|
|
|
// logging to stdout too
|
2010-10-24 21:26:54 +02:00
|
|
|
// only if demonize is 'false'
|
|
|
|
// default: false
|
2010-08-10 18:12:50 +02:00
|
|
|
bool log_stdout;
|
|
|
|
|
2011-01-05 22:24:11 +01:00
|
|
|
// how many requests should be saved in the same time
|
2010-08-10 18:12:50 +02:00
|
|
|
// default: 1
|
|
|
|
int log_request;
|
|
|
|
|
2011-01-05 22:24:11 +01:00
|
|
|
// whether to save each line of the config (use it for debug purposes)
|
|
|
|
// default: false
|
|
|
|
bool log_save_each_line;
|
|
|
|
|
2010-09-18 02:51:12 +02:00
|
|
|
// logging db queries
|
|
|
|
// default: false
|
|
|
|
bool log_db_query;
|
|
|
|
|
2010-11-23 22:52:25 +01:00
|
|
|
// logging when a plugin function is called
|
|
|
|
// default: false
|
|
|
|
bool log_plugin_call;
|
|
|
|
|
2011-06-07 00:47:34 +02:00
|
|
|
// how many characters in values should be logged from POST parameters
|
|
|
|
// default: 80
|
|
|
|
// set to 0 to turn off
|
|
|
|
size_t log_post_value_size;
|
|
|
|
|
2010-08-12 21:10:12 +02:00
|
|
|
// request delimiter in the log file, default "---------"
|
2010-11-21 01:19:17 +01:00
|
|
|
std::wstring log_delimiter;
|
2010-08-12 21:10:12 +02:00
|
|
|
|
2010-08-10 18:12:50 +02:00
|
|
|
// fast cgi: socket (unix domain)
|
|
|
|
std::string fcgi_socket;
|
|
|
|
|
|
|
|
// fast cgi: socket permissions
|
|
|
|
int fcgi_socket_chmod;
|
|
|
|
|
|
|
|
// fast cgi: owner of the socket
|
|
|
|
std::string fcgi_socket_user;
|
|
|
|
|
|
|
|
// fast cgi: group of the socket
|
|
|
|
std::string fcgi_socket_group;
|
|
|
|
|
2010-11-21 01:19:17 +01:00
|
|
|
std::wstring templates_dir;
|
2010-12-02 02:02:02 +01:00
|
|
|
std::wstring templates_dir_default; // html templates from winix
|
|
|
|
|
|
|
|
std::wstring txt_templates_dir;
|
|
|
|
std::wstring txt_templates_dir_default; // txt (notifications) templates from winix
|
2010-08-10 18:12:50 +02:00
|
|
|
|
2010-08-13 22:04:57 +02:00
|
|
|
// prefix and postfix for functions templates
|
|
|
|
// default:
|
|
|
|
// prefix: "fun_"
|
|
|
|
// postfix: ".html"
|
2010-11-21 01:19:17 +01:00
|
|
|
std::wstring templates_fun_prefix;
|
|
|
|
std::wstring templates_fun_postfix;
|
2010-08-13 22:04:57 +02:00
|
|
|
|
|
|
|
// main html template
|
|
|
|
// default: index.html
|
2010-11-21 01:19:17 +01:00
|
|
|
std::wstring templates_index;
|
2010-08-13 22:04:57 +02:00
|
|
|
|
|
|
|
// if true then only root can use 'template' function
|
|
|
|
// default: false
|
|
|
|
bool template_only_root_use_template_fun;
|
|
|
|
|
2010-08-10 18:12:50 +02:00
|
|
|
std::string db_database;
|
|
|
|
std::string db_user;
|
|
|
|
std::string db_pass;
|
|
|
|
|
|
|
|
std::string http_session_id_name;
|
|
|
|
|
|
|
|
// string used in a place where is a user (or group) selected
|
2010-11-21 01:19:17 +01:00
|
|
|
std::wstring priv_no_user;
|
|
|
|
std::wstring priv_no_group;
|
2010-08-10 18:12:50 +02:00
|
|
|
|
|
|
|
// time in seconds when the user will be automatically logged out (iddle time)
|
|
|
|
int session_max_idle;
|
|
|
|
|
|
|
|
// time in seconds when the user will be automatically logged out (when he selected 'remember me' option)
|
|
|
|
// this time is usually greater than session_max_idle
|
|
|
|
int session_remember_max_idle;
|
|
|
|
|
|
|
|
// this file is used when the program is starting and ending
|
|
|
|
std::string session_file;
|
|
|
|
|
2010-12-07 18:41:28 +01:00
|
|
|
// how many sessions can be (zero turn off this checking)
|
|
|
|
// default: 1000000 (one milion)
|
|
|
|
size_t session_max;
|
|
|
|
|
2011-04-02 02:10:16 +02:00
|
|
|
// allow the html output to be compressed
|
|
|
|
// default: true
|
2010-08-10 18:12:50 +02:00
|
|
|
bool compression;
|
2010-08-12 21:10:12 +02:00
|
|
|
|
|
|
|
// if the output is shorter than this value then it will not be compressed
|
2011-04-02 02:10:16 +02:00
|
|
|
// default: 512 bytes
|
|
|
|
size_t compression_page_min_size;
|
|
|
|
|
|
|
|
// 1 - use deflate if available (or raw deflate for Internet Explorer) or don't compress
|
|
|
|
// 2 - use gzip if available or don't compress
|
|
|
|
// 10 - prefer deflate -- use deflate (or raw deflate for IE) if both deflate and gzip are available
|
|
|
|
// 20 - prefer gzip -- use gzip if both deflate and gzip are available
|
|
|
|
// default: 20
|
|
|
|
int compression_encoding;
|
2010-08-10 18:12:50 +02:00
|
|
|
|
2010-08-18 00:32:47 +02:00
|
|
|
// plugins directory
|
|
|
|
// default: /usr/local/winix/plugins
|
2010-11-21 01:19:17 +01:00
|
|
|
std::wstring plugins_dir;
|
2010-08-18 00:32:47 +02:00
|
|
|
|
2010-08-10 18:12:50 +02:00
|
|
|
// plugins
|
2010-08-18 00:32:47 +02:00
|
|
|
// you can provide either a relative path (plugins_dir will be used)
|
|
|
|
// or a full path to a plugin
|
2010-11-21 01:19:17 +01:00
|
|
|
std::vector<std::wstring> plugin_file;
|
2010-08-10 18:12:50 +02:00
|
|
|
|
2010-08-12 21:10:12 +02:00
|
|
|
// should the html code be cleaned by the html filter
|
2010-08-10 18:12:50 +02:00
|
|
|
bool html_filter;
|
|
|
|
|
2010-08-12 21:10:12 +02:00
|
|
|
// should white characters be trimmed
|
|
|
|
bool html_filter_trim_white;
|
|
|
|
|
2011-04-16 10:42:22 +02:00
|
|
|
// when long words should be broken (a space will be inserted)
|
2010-08-12 21:10:12 +02:00
|
|
|
// default: after 60 non white characters will be put a space
|
|
|
|
// set zero to turn off
|
2011-04-16 10:42:22 +02:00
|
|
|
size_t html_filter_break_word;
|
|
|
|
|
|
|
|
// when long lines should be broken (a new line character will be inserted)
|
|
|
|
// default: 80
|
|
|
|
// set zero to turn off
|
|
|
|
size_t html_filter_wrap_line;
|
2010-08-12 21:10:12 +02:00
|
|
|
|
|
|
|
// how many spaces will be put at one tree level
|
|
|
|
// default: 2
|
|
|
|
size_t html_filter_tabs;
|
|
|
|
|
|
|
|
// use checking for 'orphans' for a specicic language
|
2011-04-16 10:42:22 +02:00
|
|
|
// default: true
|
2010-08-12 21:10:12 +02:00
|
|
|
bool html_filter_orphans;
|
|
|
|
|
|
|
|
// orphans mode
|
|
|
|
// either: "nbsp" or "160"
|
|
|
|
// default: "nbsp"
|
2011-09-26 07:40:26 +02:00
|
|
|
std::wstring html_filter_orphans_mode_str;
|
2010-08-12 21:10:12 +02:00
|
|
|
HTMLFilter::OrphanMode html_filter_orphans_mode;
|
|
|
|
|
2010-08-10 18:12:50 +02:00
|
|
|
// the url of a new empty item (if there is not the subject too)
|
2010-11-21 01:19:17 +01:00
|
|
|
std::wstring item_url_empty;
|
2010-08-10 18:12:50 +02:00
|
|
|
|
|
|
|
// maximum length of a file send by post multipart form
|
|
|
|
// 0 - not used
|
2010-11-21 01:19:17 +01:00
|
|
|
size_t post_file_max;
|
2010-08-10 18:12:50 +02:00
|
|
|
|
2010-12-10 22:07:01 +01:00
|
|
|
// directory for static files
|
|
|
|
std::wstring upload_dir;
|
2010-08-10 18:12:50 +02:00
|
|
|
|
2011-06-15 01:45:42 +02:00
|
|
|
// additional static directories *not* managed by winix
|
|
|
|
// you can refer to this directories by using 'static' mount point
|
|
|
|
// e.g.
|
|
|
|
// let we say in the config you have:
|
|
|
|
// static_dirs = ("/home/a", "/home/b", "/home/c")
|
|
|
|
// and in /etc/fstab (in winix) you have such a line:
|
|
|
|
// "static /my/dir simplefs static(2)"
|
|
|
|
// above line in /etc/fstab means that when a user enters http://domain.com/my/dir/file.txt
|
|
|
|
// then "file.txt" will be taken from "/home/c/file.txt"
|
|
|
|
// this is useful for some javascript files which are protected from running from other domains
|
|
|
|
std::vector<std::wstring> static_dirs;
|
|
|
|
|
|
|
|
// sometimes you can have trouble when you have set an incorrect static path in /etc/fstab
|
|
|
|
// in such a case set dont_use_static_dirs to true
|
|
|
|
// and winix will behave as there are not any static directories
|
|
|
|
// so you can correct your mistake and then set this value to false
|
|
|
|
bool dont_use_static_dirs;
|
|
|
|
|
2011-06-24 22:53:21 +02:00
|
|
|
// static common directory
|
|
|
|
// this is a place where there are some common javascripts, images, css files
|
|
|
|
// winix is allowed to read some files from there
|
|
|
|
// for example ckeditor config, vim config and so on
|
|
|
|
// winix read it as a ezc template and put it into database
|
|
|
|
// default: empty
|
|
|
|
std::wstring common_dir;
|
|
|
|
|
2010-12-10 22:07:01 +01:00
|
|
|
// chmod of newly created directories (under upload_dir)
|
|
|
|
// default: 0750
|
|
|
|
int upload_dirs_chmod;
|
|
|
|
|
|
|
|
// chmod of newly created files (under upload_dir)
|
|
|
|
// default: 0640
|
|
|
|
int upload_files_chmod;
|
|
|
|
|
|
|
|
// create a thumbnail from an image
|
2010-12-11 23:55:48 +01:00
|
|
|
// default: true
|
2010-12-10 22:07:01 +01:00
|
|
|
bool create_thumb;
|
|
|
|
|
2010-12-11 23:55:48 +01:00
|
|
|
// the mode of creating a thumbnail
|
|
|
|
// width means thumb_cx, height means thumb_cy
|
|
|
|
// 1: Width given, height automagically selected to preserve aspect ratio.
|
|
|
|
// 2: Height given, width automagically selected to preserve aspect ratio.
|
|
|
|
// 3: Maximum values of height and width given, aspect ratio preserved.
|
|
|
|
// 4: Minimum values of width and height given, aspect ratio preserved.
|
|
|
|
// 5: Width and height emphatically given, original aspect ratio ignored.
|
|
|
|
// 6: Change as per widthxheight (3) but only if an image dimension exceeds a specified dimension.
|
|
|
|
// 7: Change dimensions only if both image dimensions are less than specified dimensions.
|
|
|
|
// default: 2
|
|
|
|
int thumb_mode;
|
|
|
|
|
2010-12-10 22:07:01 +01:00
|
|
|
// width of thumbnails
|
|
|
|
// default: 150
|
|
|
|
size_t thumb_cx;
|
|
|
|
|
|
|
|
// height of thumbnails
|
|
|
|
// default: 150
|
|
|
|
size_t thumb_cy;
|
2010-08-10 18:12:50 +02:00
|
|
|
|
2011-09-13 08:08:34 +02:00
|
|
|
// quality of thumbnails
|
|
|
|
// from 0 (the worst) to 100 (the best)
|
|
|
|
// more info: http://www.imagemagick.org/script/command-line-options.php?ImageMagick=p4jtel7557hovd34ui3tgb54h6#quality
|
|
|
|
// default: 92
|
|
|
|
int thumb_quality;
|
|
|
|
|
|
|
|
// resizing images
|
|
|
|
// this not affects thumbnails
|
|
|
|
// default: true
|
|
|
|
bool image_resize;
|
|
|
|
|
|
|
|
// the mode of resizing an image
|
|
|
|
// the same as 'thumb_mode' above
|
|
|
|
// default: 6
|
|
|
|
int image_mode;
|
|
|
|
|
|
|
|
// width of images
|
|
|
|
// default: 1000
|
|
|
|
size_t image_cx;
|
|
|
|
|
|
|
|
// height of images
|
|
|
|
// default: 800
|
|
|
|
size_t image_cy;
|
|
|
|
|
|
|
|
// quality of an image (the same as in thumbnails)
|
|
|
|
// from 0 (the worst) to 100 (the best)
|
|
|
|
// default: 92
|
|
|
|
int image_quality;
|
|
|
|
|
2012-06-27 01:19:19 +02:00
|
|
|
// the convert program (ImageMagic) (for images and thumbnails)
|
2010-12-11 23:55:48 +01:00
|
|
|
// default: /usr/local/bin/convert
|
|
|
|
std::wstring convert_cmd;
|
|
|
|
|
2010-08-10 18:12:50 +02:00
|
|
|
// directory with locale files
|
2010-11-21 01:19:17 +01:00
|
|
|
std::wstring locale_dir;
|
2010-08-10 18:12:50 +02:00
|
|
|
|
|
|
|
// directory with default locale files (those from winix)
|
2010-11-21 01:19:17 +01:00
|
|
|
std::wstring locale_dir_default;
|
2010-08-10 18:12:50 +02:00
|
|
|
|
2011-02-24 18:06:12 +01:00
|
|
|
// locale files (e.g. "en", "pl")
|
|
|
|
// default: only one item: en
|
|
|
|
std::vector<std::wstring> locale_files;
|
|
|
|
|
2012-06-27 01:19:19 +02:00
|
|
|
// a maximum value of a locale identifier
|
|
|
|
// default: 100 (maximum: 1000)
|
|
|
|
// each locale files should have its own identifier (in "winix_locale_id" field)
|
|
|
|
// from zero to this value
|
|
|
|
size_t locale_max_id;
|
2011-02-24 18:06:12 +01:00
|
|
|
|
2012-06-27 01:19:19 +02:00
|
|
|
// locale for not logged users
|
|
|
|
// or for newly created accounts
|
|
|
|
// default: 0
|
|
|
|
size_t locale_default_id;
|
2010-08-10 18:12:50 +02:00
|
|
|
|
2011-08-18 01:09:47 +02:00
|
|
|
// url protocol
|
|
|
|
// default: http://
|
|
|
|
std::wstring url_proto;
|
|
|
|
|
|
|
|
// url protocol when using SSL
|
|
|
|
// default: https://
|
|
|
|
std::wstring url_ssl_proto;
|
|
|
|
|
|
|
|
// enables SSL
|
2012-06-07 02:26:37 +02:00
|
|
|
// it means this site should be accessed through SSL encrypted connection
|
2011-08-18 01:09:47 +02:00
|
|
|
// default: false
|
|
|
|
bool use_ssl;
|
|
|
|
|
2012-06-07 02:26:37 +02:00
|
|
|
// enables SSL for static content
|
|
|
|
// used mainly in templates, look at doc_base_url_static ezc function
|
2011-08-18 01:09:47 +02:00
|
|
|
// default: false
|
|
|
|
bool use_ssl_static;
|
|
|
|
|
2012-06-07 02:26:37 +02:00
|
|
|
// enables SSL for common content
|
|
|
|
// used mainly in templates, look at doc_base_url_common ezc function
|
2011-08-18 01:09:47 +02:00
|
|
|
// default: false
|
|
|
|
bool use_ssl_common;
|
|
|
|
|
|
|
|
// if SSL is enabled then if this is true the SSL will be used
|
|
|
|
// only for logged users
|
|
|
|
// default: true
|
|
|
|
bool use_ssl_only_for_logged_users;
|
|
|
|
|
2012-06-07 02:26:37 +02:00
|
|
|
// if current connection is without SSL and should be made through SSL
|
|
|
|
// or if is via SSL and should be done in plain text
|
|
|
|
// then we make a redirect
|
|
|
|
// default: 303
|
|
|
|
int use_ssl_redirect_code;
|
|
|
|
|
|
|
|
// when the HOST_HTTP environment variable is not equal to 'base_url'
|
|
|
|
// (the part 'http://' and the last slash is removed)
|
|
|
|
// the server will redirect into base_url + 'REQUEST_URI'
|
2011-08-18 01:09:47 +02:00
|
|
|
// it's useful when you want to redirect from 'mydomain.tld' into 'www.mydomain.tld' etc.
|
2012-06-07 02:26:37 +02:00
|
|
|
// set this option to false if you have multiple subdomains
|
|
|
|
// default: false
|
2011-08-18 01:09:47 +02:00
|
|
|
bool base_url_redirect;
|
|
|
|
|
2012-06-07 02:26:37 +02:00
|
|
|
// the HTTP code used during the base redirect
|
|
|
|
// default: 301
|
|
|
|
int base_url_redirect_code;
|
|
|
|
|
2011-08-18 01:09:47 +02:00
|
|
|
// the main address of the site (e.g. www.someserver.com)
|
|
|
|
// (without http:// prefix)
|
2010-11-21 01:19:17 +01:00
|
|
|
std::wstring base_url;
|
2010-08-10 18:12:50 +02:00
|
|
|
|
|
|
|
// static content not authorized by winix
|
2011-08-18 01:09:47 +02:00
|
|
|
// (e.g. static.someserver.com)
|
2010-11-21 01:19:17 +01:00
|
|
|
std::wstring base_url_static;
|
2010-08-10 18:12:50 +02:00
|
|
|
|
|
|
|
// additional static server for common content (not authorized)
|
2011-08-18 01:09:47 +02:00
|
|
|
// (e.g. common.someserver.com)
|
2010-11-21 01:19:17 +01:00
|
|
|
std::wstring base_url_common;
|
2010-08-10 18:12:50 +02:00
|
|
|
|
|
|
|
// separator used in <title> html tag
|
2010-11-21 01:19:17 +01:00
|
|
|
std::wstring title_separator;
|
2010-08-10 18:12:50 +02:00
|
|
|
|
2010-08-12 21:10:12 +02:00
|
|
|
// http header recognized by www server as a file to send back
|
|
|
|
// default: X-LIGHTTPD-send-file
|
2010-11-21 01:19:17 +01:00
|
|
|
std::wstring http_header_send_file;
|
2010-08-12 21:10:12 +02:00
|
|
|
|
|
|
|
// prints additional information (in the end of the html page as a commentary)
|
|
|
|
bool debug_info;
|
|
|
|
|
2010-08-14 19:56:07 +02:00
|
|
|
// in editors (emacs, ckeditor,...) the html will be filtered and unsafe tags
|
|
|
|
// will be dropped (script, frame, etc.)
|
|
|
|
// default: true;
|
|
|
|
bool editors_html_safe_mode;
|
|
|
|
|
|
|
|
// don't filter the html code for root
|
|
|
|
// default: true
|
|
|
|
// (if true the html code for root is not filtered)
|
|
|
|
bool editors_html_safe_mode_skip_root;
|
|
|
|
|
2010-11-21 01:19:17 +01:00
|
|
|
// charset used in templates, locales, logs etc.
|
|
|
|
// default: true (UTF-8)
|
|
|
|
// if false it means 8-bit ASCII
|
|
|
|
bool utf8;
|
|
|
|
|
2011-01-05 22:24:11 +01:00
|
|
|
// how many maximum symlinks can be followed
|
|
|
|
// (symlinks on directories as well)
|
|
|
|
// default: 20
|
|
|
|
size_t symlinks_follow_max;
|
|
|
|
|
|
|
|
// the prefix of a name of html form controls used in the ticket plugin
|
|
|
|
// default: ticketparam
|
|
|
|
std::wstring ticket_form_prefix;
|
2010-08-12 21:10:12 +02:00
|
|
|
|
changed: when winix demonizes it creates a three new descriptors (0, 1 and 3)
pointing to /dev/null
added: DbBase::AssertValueBin(PGresult * r, int row, int col, std::string & result)
it reads binary (bytea) data
added: DbTextStream can handle 'bool' types now
(is puts 'true' of 'false' to the stream)
changed: now passwords can be stored either as plain text, a hash or can be encrypted
with RSA
currently we have following hashes:
md4, md5, sha1, sha224, sha256, sha384, sha512
we are using openssl to manage them
(look at config options for more info)
changed: winix version to 0.4.7
added: class Run - you can run any program from os and send a buffer to its standard input
and read what the program put on its standard output
added: class Crypt (in System) - calculating hashes, and crypting/decrypting
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@734 e52654a7-88a9-db11-a3e9-0013d4bc506e
2011-06-09 23:22:08 +02:00
|
|
|
// the minimal size of a user's password
|
|
|
|
// default: 5
|
|
|
|
size_t pass_min_size;
|
|
|
|
|
|
|
|
// how passwords should be stored
|
|
|
|
// 0 - plain text
|
|
|
|
// 1 - md4 hash
|
|
|
|
// 2 - md5 hash
|
|
|
|
// 10 - sha1 hash
|
|
|
|
// 11 - sha224 hash
|
|
|
|
// 12 - sha256 hash (default)
|
|
|
|
// 13 - sha384 hash
|
|
|
|
// 14 - sha512 hash
|
|
|
|
int pass_type;
|
|
|
|
|
|
|
|
// whether the passwords' hashes should be salted or not
|
|
|
|
// this affects newly created accounts
|
|
|
|
// default: false
|
|
|
|
bool pass_hash_use_salt;
|
|
|
|
|
|
|
|
// salt to a password's hash
|
|
|
|
// default empty
|
|
|
|
// !! once you set this salt don't change it any more (people wouldn't be allowed to login)
|
|
|
|
std::wstring pass_hash_salt;
|
|
|
|
|
|
|
|
// whether the passwords' hashes should be encrypted
|
|
|
|
// this affects newly created accounts
|
|
|
|
// default: false
|
|
|
|
bool pass_use_rsa;
|
|
|
|
|
|
|
|
// path to a RSA private key
|
|
|
|
// this is actually private + public key in one file
|
|
|
|
// generated by "openssl genrsa"
|
|
|
|
// default empty which means encryption will not be used
|
|
|
|
// !! once you set these keys don't change it any more (people wouldn't be allowed to login)
|
|
|
|
std::wstring pass_rsa_private_key;
|
|
|
|
|
|
|
|
// path to 'openssl'
|
|
|
|
// default: /usr/bin/openssl
|
|
|
|
std::wstring opensll_path;
|
|
|
|
|
2011-07-15 04:09:02 +02:00
|
|
|
// setting when we should delete patterns (EZC patterns)
|
|
|
|
// we are deleting when we have more (or equal) patterns than 'when_delete'
|
|
|
|
// and then we are deleting 'how_many_del' patterns
|
|
|
|
// those patterns comes from items (pages) with executable bit set
|
|
|
|
size_t pattern_cacher_when_delete;
|
|
|
|
size_t pattern_cacher_how_many_delete;
|
|
|
|
|
2011-12-17 22:59:22 +01:00
|
|
|
// header "Content-Type" send to the client
|
|
|
|
// 0 - text/html - for HTML
|
|
|
|
// 1 - application/xhtml+xml - for XHTML 1.0
|
|
|
|
// 2 - application/xml - for XHTML 1.0 or for XHTML 1.1
|
|
|
|
// default: 0
|
|
|
|
// if utf8 is true then "; charset=UTF-8" will also be appended
|
|
|
|
int content_type_header;
|
2011-08-18 01:09:47 +02:00
|
|
|
|
2012-01-25 00:03:36 +01:00
|
|
|
// global umask
|
|
|
|
// it is used when an user doesn't have your own umask or for guests (not logged users)
|
|
|
|
// default: 0222
|
|
|
|
int umask;
|
2011-08-18 01:09:47 +02:00
|
|
|
|
2012-02-17 06:19:24 +01:00
|
|
|
// maximum number for elements through the whole template
|
|
|
|
// default: 50000
|
|
|
|
size_t ezc_max_elements;
|
|
|
|
|
|
|
|
// maximum number of each [for] loop
|
|
|
|
// default: 5000 (from ezc generator)
|
|
|
|
size_t ezc_max_loop_elements;
|
|
|
|
|
2012-02-28 22:09:44 +01:00
|
|
|
// when true then when a user want to create a new account
|
|
|
|
// he has to provide his email and a message will be sent back to him
|
|
|
|
// with a link to activate the account
|
|
|
|
// default: true
|
|
|
|
bool account_need_email_verification;
|
2012-02-17 06:19:24 +01:00
|
|
|
|
2012-03-09 23:56:54 +01:00
|
|
|
// when a user forgot his password we are able to send an email to him
|
|
|
|
// with a link to the page where there is a html form for setting a new password
|
|
|
|
// this option tells how long (in seconds) the link is valid
|
|
|
|
// default: 86400 (24 hours)
|
|
|
|
long reset_password_code_expiration_time;
|
2012-02-17 06:19:24 +01:00
|
|
|
|
2012-06-27 01:19:19 +02:00
|
|
|
// time zone identifier for not logged users
|
|
|
|
// or for newly created accounts
|
|
|
|
// those identifiers you can see in etc/time_zones.conf file
|
|
|
|
// or by using timezone winix function with 'a' parameter (timezone/a) (!!IMPROVE ME NOT IMPLEMENTED YET)
|
|
|
|
// default: 34 (Coordinated Universal Time UTC+00:00)
|
|
|
|
size_t time_zone_default_id;
|
|
|
|
|
|
|
|
// a maximum value of a time zone identifier
|
|
|
|
// time zones with an id greater than this will be skipped
|
|
|
|
// default: 130 (maximum: 1000)
|
|
|
|
size_t time_zone_max_id;
|
2012-05-30 21:04:18 +02:00
|
|
|
|
2012-06-23 01:34:33 +02:00
|
|
|
// a directory in which there are some config files
|
|
|
|
// used mainly when winix starts
|
|
|
|
// default: empty (means not for using)
|
|
|
|
std::wstring etc_dir;
|
|
|
|
|
|
|
|
// a file in etc_dir with time zones info
|
|
|
|
// default: time_zones.conf
|
|
|
|
// this is a Space structure with all time zones
|
|
|
|
// with following format:
|
|
|
|
// "tz_-12:00" ( # the name of a space is also a key to the locale files
|
|
|
|
// tz_offset_str = "-12:00" # a string representing the offset from UTC in a format: [+|-]HH:MM
|
|
|
|
// tz_has_dst = "false" # whether the time zone has daylight saving time (bool)
|
|
|
|
// tz_dst_offset = "" # offset of the daylight saving time
|
|
|
|
// tz_dst_start = "" # when the daylight saving time starts, format: MM:DD HH:MM:SS
|
|
|
|
// tz_dst_end = "") # when the daylight saving time ends, format: MM:DD HH:MM:SS
|
|
|
|
// each time zone is in a seperate space
|
|
|
|
std::wstring time_zones_file;
|
|
|
|
|
2012-05-30 21:04:18 +02:00
|
|
|
|
2010-08-10 18:12:50 +02:00
|
|
|
|
|
|
|
Config();
|
|
|
|
bool ReadConfig(bool errors_to_stdout_, bool stdout_is_closed = true);
|
2008-12-11 03:48:25 +01:00
|
|
|
|
2011-09-17 00:46:42 +02:00
|
|
|
std::wstring & Text(const wchar_t * name);
|
|
|
|
std::wstring & Text(const wchar_t * name, const wchar_t * def);
|
|
|
|
std::wstring & Text(const std::wstring & name, const wchar_t * def);
|
|
|
|
std::string & AText(const wchar_t * name);
|
2011-09-26 07:40:26 +02:00
|
|
|
std::string & AText(const wchar_t * name, const char * def);
|
|
|
|
std::string & AText(const std::wstring & name, const char * def);
|
2010-11-21 01:19:17 +01:00
|
|
|
|
2012-03-09 23:56:54 +01:00
|
|
|
int Int(const wchar_t *);
|
|
|
|
int Int(const wchar_t * name, int def);
|
|
|
|
int Int(const std::wstring & name, int def);
|
|
|
|
long Long(const wchar_t *);
|
|
|
|
long Long(const wchar_t * name, long def);
|
|
|
|
long Long(const std::wstring & name, long def);
|
2010-11-21 01:19:17 +01:00
|
|
|
size_t Size(const wchar_t *);
|
|
|
|
size_t Size(const wchar_t * name, size_t def);
|
|
|
|
size_t Size(const std::wstring & name, size_t def);
|
|
|
|
bool Bool(const wchar_t *);
|
|
|
|
bool Bool(const wchar_t * name, bool def);
|
|
|
|
bool Bool(const std::wstring & name, bool def);
|
2011-09-26 07:40:26 +02:00
|
|
|
bool ListText(const wchar_t * name, std::vector<std::wstring> & list);
|
|
|
|
bool ListText(const std::wstring & name, std::vector<std::wstring> & list);
|
2010-11-21 01:19:17 +01:00
|
|
|
|
|
|
|
// for debug
|
2011-09-26 07:40:26 +02:00
|
|
|
void Print(std::wostream & out);
|
2010-07-27 22:41:56 +02:00
|
|
|
|
2012-07-01 01:20:18 +02:00
|
|
|
// raw access to the config
|
|
|
|
PT::Space space;
|
|
|
|
|
2010-07-27 22:41:56 +02:00
|
|
|
private:
|
|
|
|
void ShowError();
|
2010-08-10 18:12:50 +02:00
|
|
|
void AssignValues(bool stdout_is_closed);
|
|
|
|
void SetAdditionalVariables();
|
changed: when winix demonizes it creates a three new descriptors (0, 1 and 3)
pointing to /dev/null
added: DbBase::AssertValueBin(PGresult * r, int row, int col, std::string & result)
it reads binary (bytea) data
added: DbTextStream can handle 'bool' types now
(is puts 'true' of 'false' to the stream)
changed: now passwords can be stored either as plain text, a hash or can be encrypted
with RSA
currently we have following hashes:
md4, md5, sha1, sha224, sha256, sha384, sha512
we are using openssl to manage them
(look at config options for more info)
changed: winix version to 0.4.7
added: class Run - you can run any program from os and send a buffer to its standard input
and read what the program put on its standard output
added: class Crypt (in System) - calculating hashes, and crypting/decrypting
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@734 e52654a7-88a9-db11-a3e9-0013d4bc506e
2011-06-09 23:22:08 +02:00
|
|
|
void CheckPasswd();
|
2010-08-10 18:12:50 +02:00
|
|
|
|
2012-05-01 00:53:54 +02:00
|
|
|
PT::SpaceParser parser;
|
2010-07-27 22:41:56 +02:00
|
|
|
|
2008-12-11 03:48:25 +01:00
|
|
|
std::string default_str;
|
2010-01-07 15:45:00 +01:00
|
|
|
int default_int;
|
2008-12-11 03:48:25 +01:00
|
|
|
bool default_bool;
|
|
|
|
|
|
|
|
bool errors_to_stdout;
|
2009-12-30 21:46:12 +01:00
|
|
|
|
2008-12-11 03:48:25 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-08-10 18:12:50 +02:00
|
|
|
|
2010-07-27 22:41:56 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2008-12-11 03:48:25 +01:00
|
|
|
#endif
|