added: functions: chmod, chown
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@587 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -20,6 +20,9 @@ dircontainer.o: dircontainer.h item.h log.h
|
||||
dirs.o: dirs.h item.h dircontainer.h error.h log.h db.h user.h group.h
|
||||
dirs.o: thread.h ugcontainer.h ticket.h data.h users.h groups.h functions.h
|
||||
dirs.o: function.h lastcontainer.h mounts.h mount.h rebus.h loadavg.h
|
||||
dirs.o: request.h requesttypes.h session.h done.h compress.h
|
||||
dirs.o: acceptencodingparser.h acceptbaseparser.h htmlfilter.h
|
||||
dirs.o: postmultiparser.h
|
||||
done.o: done.h
|
||||
error.o: error.h log.h
|
||||
function.o: function.h item.h
|
||||
|
@@ -12,6 +12,7 @@
|
||||
#include "log.h"
|
||||
#include "db.h"
|
||||
#include "data.h"
|
||||
#include "request.h"
|
||||
|
||||
|
||||
void Dirs::Clear()
|
||||
@@ -26,7 +27,17 @@ void Dirs::CheckRootDir()
|
||||
DirContainer::Iterator i = dir_table.GetRoot();
|
||||
|
||||
if( i != dir_table.End() )
|
||||
{
|
||||
if( !request.HasReadExecAccessForRoot(*i) )
|
||||
{
|
||||
i->privileges = 0755;
|
||||
log << log1 << "Dirs: there is no access for root (admin) to the root dir, setting 0755 for root dir" << logend;
|
||||
db.EditPrivById(*i, i->id);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
log << log1 << "Dirs: there is no a root dir in the database (creating one)" << logend;
|
||||
|
||||
@@ -272,7 +283,8 @@ void Dirs::SplitPath(const std::string & path, std::string & dir, std::string &
|
||||
|
||||
|
||||
|
||||
|
||||
// !! przeniesc to do rm
|
||||
// mamy juz interfejs do chodzenia po parentach
|
||||
void Dirs::DeleteDir(long id)
|
||||
{
|
||||
DirContainer::ParentIterator pnext, p = dir_table.FindFirstParent(id);
|
||||
|
@@ -38,8 +38,8 @@
|
||||
#define FUN_UPTIME 21
|
||||
//#define FUN_MV 23
|
||||
//#define FUN_UNAME 24
|
||||
//#define FUN_CHMOD 25
|
||||
//#define FUN_CHOWN 26
|
||||
#define FUN_CHMOD 25
|
||||
#define FUN_CHOWN 26
|
||||
#define FUN_CKEDITOR 27
|
||||
|
||||
|
||||
|
@@ -124,6 +124,7 @@ void Functions::ReadFunctions()
|
||||
f.code = FUN_UNAME;
|
||||
f.item.url = "uname";
|
||||
table.insert( std::make_pair(f.item.url, f) );
|
||||
*/
|
||||
|
||||
f.code = FUN_CHMOD;
|
||||
f.item.url = "chmod";
|
||||
@@ -132,7 +133,7 @@ void Functions::ReadFunctions()
|
||||
f.code = FUN_CHOWN;
|
||||
f.item.url = "chown";
|
||||
table.insert( std::make_pair(f.item.url, f) );
|
||||
*/
|
||||
|
||||
|
||||
f.code = FUN_CKEDITOR;
|
||||
f.item.url = "ckeditor";
|
||||
|
@@ -676,6 +676,14 @@ bool Request::HasReadExecAccess(const Item & item)
|
||||
}
|
||||
|
||||
|
||||
bool Request::HasReadExecAccessForRoot(const Item & item)
|
||||
{
|
||||
// there must be at least one 'x' (for the root)
|
||||
|
||||
return (item.privileges & 0111) != 0;
|
||||
}
|
||||
|
||||
|
||||
// returning true if we can create a thread in the current directory
|
||||
bool Request::CanCreateThread(bool check_root)
|
||||
{
|
||||
|
@@ -150,6 +150,7 @@ struct Request
|
||||
bool HasWriteAccess(const Item & item);
|
||||
bool HasReadWriteAccess(const Item & item);
|
||||
bool HasReadExecAccess(const Item & item);
|
||||
bool HasReadExecAccessForRoot(const Item & item);
|
||||
|
||||
bool CanCreateThread(bool check_root = false);
|
||||
bool CanCreateTicket(bool check_root = false);
|
||||
|
Reference in New Issue
Block a user