Allow sandboxing plugin instances
All checks were successful
gitea-sync/ant-http/pipeline/head This commit looks good

This commit is contained in:
DanyLE
2023-01-15 18:21:42 +01:00
parent bd0663ddf7
commit a1acea2441
6 changed files with 563 additions and 556 deletions

View File

@ -106,28 +106,6 @@ int compressable(char *ctype)
return 0;
}
void htdocs(antd_request_t *rq, char *dest)
{
//dictionary_t xheader = (dictionary_t)dvalue(rq->request, "REQUEST_HEADER");
char *www = (char *)dvalue(rq->request, "SERVER_WWW_ROOT");
if (www)
{
strcpy(dest, www);
}
}
void dbdir(char **dest)
{
UNUSED(dest);
}
void tmpdir(char **dest)
{
UNUSED(dest);
}
void plugindir(char **dest)
{
UNUSED(dest);
}
const char *get_status_str(int stat)
{
switch (stat)
@ -1033,4 +1011,4 @@ void destroy_request(void *data)
}
antd_close(rq->client);
free(rq);
}
}

View File

@ -30,6 +30,8 @@
#define ANTD_PLUGIN_READY 0x0
#define ANTD_PLUGIN_PANNIC 0x1
#define ANTD_PLUGIN_INIT 0x2
#define MAX_PATH_LEN 256
typedef enum
{
@ -108,26 +110,22 @@ typedef struct
typedef struct
{
char name[128];
char* dbpath;
char* tmpdir;
char* pdir;
char name[MAX_PATH_LEN];
char dbpath[MAX_PATH_LEN];
char tmpdir[MAX_PATH_LEN];
char pdir[MAX_PATH_LEN];
dictionary_t config;
int raw_body;
int status;
} plugin_header_t;
int __attribute__((weak)) require_plugin(const char *);
void __attribute__((weak)) htdocs(antd_request_t *rq, char *dest);
void __attribute__((weak)) dbdir(char **dest);
void __attribute__((weak)) tmpdir(char **dest);
void __attribute__((weak)) plugindir(char **dest);
int __attribute__((weak)) compressable(char *ctype);
void set_nonblock(int socket);
//void set_block(int socket);
int __attribute__((weak)) compressable(char *ctype);
void antd_send_header(void *, antd_response_header_t *);
const char *get_status_str(int stat);
int __t(void *, const char *, ...);

View File

@ -40,13 +40,8 @@ STATIC PART, should be included in any plugin
static plugin_header_t __plugin__;
// private function
void __init_plugin__(const char* pl, dictionary_t* conf){
strcpy(__plugin__.name,pl);
dbdir(&__plugin__.dbpath);
plugindir(&__plugin__.pdir);
tmpdir(&__plugin__.tmpdir);
__plugin__.config = conf;
__plugin__.raw_body = 0;
void __init_plugin__(plugin_header_t* pl, dictionary_t* conf){
(void) memcpy(&__plugin__, pl, sizeof(plugin_header_t));
__plugin__.status = ANTD_PLUGIN_READY;
init();
};