added: plugin message: WINIX_CHECK_PLUGIN_ACCESS

this message is sent before calling MakePost() or MakeGet()
       if you return false (which is default) you can prevent the access
       to the resource
       



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@901 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
Tomasz Sowa 2012-10-17 19:52:55 +00:00
parent 8aa6f08e08
commit 53b4175d00
3 changed files with 26 additions and 1 deletions

View File

@ -275,6 +275,23 @@ size_t locale_id;
}
bool App::CheckAccessFromPlugins()
{
PluginRes res = plugin.Call(WINIX_CHECK_PLUGIN_ACCESS);
if( res.res_false > 0 )
{
cur.request->status = WINIX_ERR_PERMISSION_DENIED;
log << log2 << "App: access prevented by a plugin" << logend;
return false;
}
return true;
}
void App::ProcessRequestThrow()
{
ReadRequest();
@ -459,6 +476,8 @@ void App::Make()
if( cur.request->status == WINIX_ERR_OK )
functions.CheckFunctionAndSymlink();
CheckAccessFromPlugins();
// !! CHECK ME CheckFunctionAndSymlink can set redirect_to
// may it should be tested before calling CheckIfNeedSSLredirect?
CheckIfNeedSSLredirect();

View File

@ -123,6 +123,7 @@ private:
std::string sendfilea, sendfile2a;
std::string send_data_buf;
bool CheckAccessFromPlugins();
void ProcessRequestThrow();
void ProcessRequest();
void BaseUrlRedirect(int code, bool add_subdomain);

View File

@ -246,11 +246,16 @@
//
#define WINIX_POST_PARAMS 31040
// this is the raw string sent in POST method
// in p1 there is a pointer to std::string object
#define WINIX_RAW_POST_STRING 31050
// this message is sent before calling MakePost() or MakeGet()
// if you return false (which is default) you can prevent the access
// to the resource
#define WINIX_CHECK_PLUGIN_ACCESS 31060
/*
messages sent from other threads