part II of rewriting
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@635 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -207,45 +207,28 @@ void PrivChanger::PrivDir(long parent_id)
|
||||
}
|
||||
|
||||
|
||||
bool PrivChanger::ReadPriv(const char * user_in, const char * group_in, const char * priv_in,
|
||||
void PrivChanger::ReadPriv(const char * user_in, const char * group_in, const char * priv_in,
|
||||
long & user_id, long & group_id, int & priv)
|
||||
{
|
||||
std::string * user_str = request->PostVar(user_in);
|
||||
std::string * group_str = request->PostVar(group_in);
|
||||
std::string * priv_str = request->PostVar(priv_in);
|
||||
|
||||
if( change_owner && (!user_str || !group_str) )
|
||||
{
|
||||
log << log1 << "Content: PostFunPriv: there is no some post variables for changing the owner" << logend;
|
||||
return false;
|
||||
}
|
||||
|
||||
if( change_priv && !priv_str )
|
||||
{
|
||||
log << log1 << "Content: PostFunPriv: there is no some post variables for changing privileges" << logend;
|
||||
return false;
|
||||
}
|
||||
const std::string & user_str = request->PostVar(user_in);
|
||||
const std::string & group_str = request->PostVar(group_in);
|
||||
const std::string & priv_str = request->PostVar(priv_in);
|
||||
|
||||
if( change_owner )
|
||||
{
|
||||
user_id = system->users.GetUserId( *user_str );
|
||||
group_id = system->groups.GetGroupId( *group_str );
|
||||
user_id = system->users.GetUserId( user_str );
|
||||
group_id = system->groups.GetGroupId( group_str );
|
||||
}
|
||||
|
||||
if( change_priv )
|
||||
priv = strtol( priv_str->c_str() , 0, 8);
|
||||
|
||||
return true;
|
||||
priv = strtol(priv_str.c_str(), 0, 8);
|
||||
}
|
||||
|
||||
|
||||
void PrivChanger::PrivDir()
|
||||
{
|
||||
if( !ReadPriv("userfile", "groupfile", "privilegesfile", user_id_file, group_id_file, priv_file) )
|
||||
return;
|
||||
|
||||
if( !ReadPriv("userdir", "groupdir", "privilegesdir", user_id_dir, group_id_dir, priv_dir) )
|
||||
return;
|
||||
ReadPriv("userfile", "groupfile", "privilegesfile", user_id_file, group_id_file, priv_file);
|
||||
ReadPriv("userdir", "groupdir", "privilegesdir", user_id_dir, group_id_dir, priv_dir);
|
||||
|
||||
PrivLogStart("Content: changes for files: ", user_id_file, group_id_file, priv_file);
|
||||
PrivLogStart("Content: changes for dirs: ", user_id_dir, group_id_dir, priv_dir);
|
||||
@@ -272,8 +255,7 @@ void PrivChanger::PrivDir()
|
||||
// changing only one item (either a dir or file)
|
||||
void PrivChanger::PrivOneItem()
|
||||
{
|
||||
if( !ReadPriv("user", "group", "privileges", user_id_file, group_id_file, priv_file) )
|
||||
return;
|
||||
ReadPriv("user", "group", "privileges", user_id_file, group_id_file, priv_file);
|
||||
|
||||
PrivLogStart("Content: changes: ", user_id_file, group_id_file, priv_file);
|
||||
|
||||
|
Reference in New Issue
Block a user