winix can drop privileges now (if started as the root)

added parameters to the config:
 user (string)
 group (string)
 additional_groups (bool)



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@668 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2010-10-24 17:49:38 +00:00
parent 149fd1629f
commit 9c34cb5862
7 changed files with 268 additions and 18 deletions

View File

@@ -19,6 +19,7 @@ Log::Log()
item = 0;
item_save = 1;
lines = 0;
log_file_open = false;
}
@@ -29,14 +30,18 @@ void Log::Init(int log_l, const std::string & log_f, bool log_std, int log_reque
log_stdout = log_std;
item_save = log_request;
OpenFile();
// don't open the file here
// because it would be created with the root as an owner
}
void Log::OpenFile()
{
if( !log_file.empty() )
{
file.open( log_file.c_str(), std::ios_base::out | std::ios_base::app );
log_file_open = true;
}
}
@@ -216,7 +221,7 @@ void Log::SaveLog()
if( log_file.empty() )
return;
if( !file )
if( !log_file_open || !file )
{
file.close();
file.clear();
@@ -227,7 +232,8 @@ void Log::SaveLog()
return;
}
file << source << std::endl;
file << source;
file.flush();
}