Greenbone Security Assistant
|
HTTP handling of GSA. More...
#include "gsad_http_handler.h"
#include "gsad_base.h"
#include "gsad_credentials.h"
#include "gsad_gmp.h"
#include "gsad_i18n.h"
#include "gsad_settings.h"
#include "gsad_user.h"
#include "utils.h"
#include "validator.h"
#include <assert.h>
#include <glib.h>
#include <gvm/base/networking.h>
#include <gvm/util/xmlutils.h>
#include <stdlib.h>
#include <string.h>
Data Structures | |
struct | url_map |
URL regexp to handler function mapping. More... | |
struct | http_handler |
struct | method_router |
Macros | |
#define | G_LOG_DOMAIN "gsad http handler" |
GLib log domain. More... | |
#define | TOKEN_REGEXP "^[a-z0-9\\-]+$" |
#define | SLAVE_ID_REGEXP "^[a-z0-9\\-]+$" |
Typedefs | |
typedef struct url_map | url_map_t |
typedef struct method_router | method_router_t |
Functions | |
http_handler_t * | http_handler_add (http_handler_t *handlers, http_handler_t *next) |
int | http_handler_start (http_connection_t *connection, const char *method, const char *url, gsad_connection_info_t *con_info, http_handler_t *handler, void *data) |
int | http_handler_next (http_connection_t *connection, const char *method, const char *url, gsad_connection_info_t *con_info, http_handler_t *handler, void *data) |
http_handler_t * | http_handler_new_with_data (http_handler_func_t func, http_handler_free_func_t freefunc, void *data) |
void | http_handler_free_internal (http_handler_t *handler) |
http_handler_t * | http_handler_new (http_handler_func_t func) |
void | http_handler_free (http_handler_t *handler) |
int | handle_get_post (http_connection_t *connection, const char *method, const char *url, gsad_connection_info_t *con_info, http_handler_t *handler, void *data) |
void | method_router_free (http_handler_t *handler) |
http_handler_t * | method_router_new () |
void | method_router_set_get_handler (http_handler_t *router, http_handler_t *handler) |
void | method_router_set_post_handler (http_handler_t *router, http_handler_t *handler) |
int | handle_url (http_connection_t *connection, const char *method, const char *url, gsad_connection_info_t *con_info, http_handler_t *current, void *data) |
url_map_t * | url_map_new (const gchar *regexp, http_handler_t *handler) |
void | url_handler_free (http_handler_t *handler) |
http_handler_t * | url_handler_new (const gchar *regexp, http_handler_t *handler) |
http_handler_t * | url_handler_add_func (http_handler_t *handlers, const gchar *regexp, http_handler_func_t handle) |
int | handle_validate (http_connection_t *connection, const char *method, const char *url, gsad_connection_info_t *con_info, http_handler_t *handler, void *data) |
int | handle_invalid_method (http_connection_t *connection, const char *method, const char *url, gsad_connection_info_t *con_info, http_handler_t *handler, void *data) |
int | get_user_from_connection (http_connection_t *connection, user_t **user) |
int | handle_get_user (http_connection_t *connection, const char *method, const char *url, gsad_connection_info_t *con_info, http_handler_t *handler, void *data) |
int | handle_setup_user (http_connection_t *connection, const char *method, const char *url, gsad_connection_info_t *con_info, http_handler_t *handler, void *data) |
int | handle_setup_credentials (http_connection_t *connection, const char *method, const char *url, gsad_connection_info_t *con_info, http_handler_t *handler, void *data) |
int | handle_logout (http_connection_t *connection, const char *method, const char *url, gsad_connection_info_t *con_info, http_handler_t *handler, void *data) |
int | handle_gmp_get (http_connection_t *connection, const char *method, const char *url, gsad_connection_info_t *con_info, http_handler_t *handler, void *data) |
int | handle_gmp_post (http_connection_t *connection, const char *method, const char *url, gsad_connection_info_t *con_info, http_handler_t *handler, void *data) |
int | handle_system_report (http_connection_t *connection, const char *method, const char *url, gsad_connection_info_t *con_info, http_handler_t *handler, void *data) |
int | handle_index (http_connection_t *connection, const char *method, const char *url, gsad_connection_info_t *con_info, http_handler_t *handler, void *data) |
int | handle_static_file (http_connection_t *connection, const char *method, const char *url, gsad_connection_info_t *con_info, http_handler_t *handler, void *data) |
int | handle_static_config (http_connection_t *connection, const char *method, const char *url, gsad_connection_info_t *con_info, http_handler_t *handler, void *data) |
http_handler_t * | init_http_handlers () |
void | cleanup_http_handlers () |
int | handle_request (void *cls, http_connection_t *connection, const char *url, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, void **con_cls) |
HTTP request handler for GSAD. More... | |
Variables | |
validator_t | http_validator |
Validator instance for http params. More... | |
http_handler_t * | handlers |
HTTP handling of GSA.
HTTP URL handling/routing.
#define G_LOG_DOMAIN "gsad http handler" |
GLib log domain.
#define SLAVE_ID_REGEXP "^[a-z0-9\\-]+$" |
#define TOKEN_REGEXP "^[a-z0-9\\-]+$" |
typedef struct method_router method_router_t |
void cleanup_http_handlers | ( | ) |
int get_user_from_connection | ( | http_connection_t * | connection, |
user_t ** | user | ||
) |
int handle_get_post | ( | http_connection_t * | connection, |
const char * | method, | ||
const char * | url, | ||
gsad_connection_info_t * | con_info, | ||
http_handler_t * | handler, | ||
void * | data | ||
) |
int handle_get_user | ( | http_connection_t * | connection, |
const char * | method, | ||
const char * | url, | ||
gsad_connection_info_t * | con_info, | ||
http_handler_t * | handler, | ||
void * | data | ||
) |
int handle_gmp_get | ( | http_connection_t * | connection, |
const char * | method, | ||
const char * | url, | ||
gsad_connection_info_t * | con_info, | ||
http_handler_t * | handler, | ||
void * | data | ||
) |
int handle_gmp_post | ( | http_connection_t * | connection, |
const char * | method, | ||
const char * | url, | ||
gsad_connection_info_t * | con_info, | ||
http_handler_t * | handler, | ||
void * | data | ||
) |
int handle_index | ( | http_connection_t * | connection, |
const char * | method, | ||
const char * | url, | ||
gsad_connection_info_t * | con_info, | ||
http_handler_t * | handler, | ||
void * | data | ||
) |
int handle_invalid_method | ( | http_connection_t * | connection, |
const char * | method, | ||
const char * | url, | ||
gsad_connection_info_t * | con_info, | ||
http_handler_t * | handler, | ||
void * | data | ||
) |
int handle_logout | ( | http_connection_t * | connection, |
const char * | method, | ||
const char * | url, | ||
gsad_connection_info_t * | con_info, | ||
http_handler_t * | handler, | ||
void * | data | ||
) |
int handle_request | ( | void * | cls, |
http_connection_t * | connection, | ||
const char * | url, | ||
const char * | method, | ||
const char * | version, | ||
const char * | upload_data, | ||
size_t * | upload_data_size, | ||
void ** | con_cls | ||
) |
HTTP request handler for GSAD.
This routine is an MHD_AccessHandlerCallback, the request handler for microhttpd.
[in] | cls | A pointer to http_handler_t |
[in] | connection | Connection handle, e.g. used to send response. |
[in] | url | The URL requested. |
[in] | method | "GET" or "POST", others are disregarded. |
[in] | version | Not used for this callback. |
[in] | upload_data | Data used for POST requests. |
[in] | upload_data_size | Size of upload_data. |
[out] | con_cls | For exchange of connection-related data (here a struct gsad_connection_info). |
int handle_setup_credentials | ( | http_connection_t * | connection, |
const char * | method, | ||
const char * | url, | ||
gsad_connection_info_t * | con_info, | ||
http_handler_t * | handler, | ||
void * | data | ||
) |
int handle_setup_user | ( | http_connection_t * | connection, |
const char * | method, | ||
const char * | url, | ||
gsad_connection_info_t * | con_info, | ||
http_handler_t * | handler, | ||
void * | data | ||
) |
int handle_static_config | ( | http_connection_t * | connection, |
const char * | method, | ||
const char * | url, | ||
gsad_connection_info_t * | con_info, | ||
http_handler_t * | handler, | ||
void * | data | ||
) |
int handle_static_file | ( | http_connection_t * | connection, |
const char * | method, | ||
const char * | url, | ||
gsad_connection_info_t * | con_info, | ||
http_handler_t * | handler, | ||
void * | data | ||
) |
int handle_system_report | ( | http_connection_t * | connection, |
const char * | method, | ||
const char * | url, | ||
gsad_connection_info_t * | con_info, | ||
http_handler_t * | handler, | ||
void * | data | ||
) |
int handle_url | ( | http_connection_t * | connection, |
const char * | method, | ||
const char * | url, | ||
gsad_connection_info_t * | con_info, | ||
http_handler_t * | current, | ||
void * | data | ||
) |
int handle_validate | ( | http_connection_t * | connection, |
const char * | method, | ||
const char * | url, | ||
gsad_connection_info_t * | con_info, | ||
http_handler_t * | handler, | ||
void * | data | ||
) |
http_handler_t* http_handler_add | ( | http_handler_t * | handlers, |
http_handler_t * | next | ||
) |
void http_handler_free | ( | http_handler_t * | handler | ) |
void http_handler_free_internal | ( | http_handler_t * | handler | ) |
http_handler_t* http_handler_new | ( | http_handler_func_t | func | ) |
http_handler_t* http_handler_new_with_data | ( | http_handler_func_t | func, |
http_handler_free_func_t | freefunc, | ||
void * | data | ||
) |
int http_handler_next | ( | http_connection_t * | connection, |
const char * | method, | ||
const char * | url, | ||
gsad_connection_info_t * | con_info, | ||
http_handler_t * | handler, | ||
void * | data | ||
) |
int http_handler_start | ( | http_connection_t * | connection, |
const char * | method, | ||
const char * | url, | ||
gsad_connection_info_t * | con_info, | ||
http_handler_t * | handler, | ||
void * | data | ||
) |
http_handler_t* init_http_handlers | ( | ) |
void method_router_free | ( | http_handler_t * | handler | ) |
http_handler_t* method_router_new | ( | ) |
void method_router_set_get_handler | ( | http_handler_t * | router, |
http_handler_t * | handler | ||
) |
void method_router_set_post_handler | ( | http_handler_t * | router, |
http_handler_t * | handler | ||
) |
http_handler_t* url_handler_add_func | ( | http_handler_t * | handlers, |
const gchar * | regexp, | ||
http_handler_func_t | handle | ||
) |
void url_handler_free | ( | http_handler_t * | handler | ) |
http_handler_t* url_handler_new | ( | const gchar * | regexp, |
http_handler_t * | handler | ||
) |
url_map_t* url_map_new | ( | const gchar * | regexp, |
http_handler_t * | handler | ||
) |
http_handler_t* handlers |
validator_t http_validator |
Validator instance for http params.