|
Greenbone Security Assistant
7.0.3~git
|
Main module of Greenbone Security Assistant daemon. More...
#include <arpa/inet.h>#include <assert.h>#include <errno.h>#include <gcrypt.h>#include <glib.h>#include <gnutls/gnutls.h>#include <langinfo.h>#include <locale.h>#include <netinet/in.h>#include <openvas/misc/openvas_logging.h>#include <openvas/base/openvas_file.h>#include <openvas/base/openvas_networking.h>#include <openvas/base/pidfile.h>#include <openvas/omp/xml.h>#include <openvas/misc/openvas_uuid.h>#include <pthread.h>#include <pwd.h>#include <grp.h>#include <signal.h>#include <stdint.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <sys/socket.h>#include <sys/un.h>#include <sys/stat.h>#include <sys/types.h>#include <unistd.h>#include <microhttpd.h>#include "gsad_base.h"#include "gsad_omp.h"#include "validator.h"#include "xslt_i18n.h"
Go to the source code of this file.
Data Structures | |
| struct | user |
| User information structure, for sessions. More... | |
| struct | gsad_connection_info |
| Connection information. More... | |
| struct | connection_watcher_data_t |
Macros | |
| #define | _GNU_SOURCE /* for strcasecmp */ |
| The Glib fatal mask, redefined to leave out G_LOG_FLAG_RECURSION. More... | |
| #define | G_LOG_DOMAIN "gsad main" |
| GLib log domain. More... | |
| #define | G_LOG_FATAL_MASK G_LOG_LEVEL_ERROR |
| #define | MHD_HTTP_NOT_ACCEPTABLE MHD_HTTP_METHOD_NOT_ACCEPTABLE |
| The symbol is deprecated, but older versions (0.9.37 - Debian jessie) don't define it yet. More... | |
| #define | SID_COOKIE_NAME "GSAD_SID" |
| Name of the cookie used to store the SID. More... | |
| #define | DEFAULT_GSAD_HTTPS_PORT 443 |
| Fallback GSAD port for HTTPS. More... | |
| #define | DEFAULT_GSAD_HTTP_PORT 80 |
| Fallback GSAD port for HTTP. More... | |
| #define | DEFAULT_GSAD_PORT 9392 |
| Fallback unprivileged GSAD port. More... | |
| #define | DEFAULT_GSAD_REDIRECT_PORT 80 |
| Fallback GSAD port. More... | |
| #define | DEFAULT_OPENVAS_MANAGER_PORT 9390 |
| Fallback Manager port. More... | |
| #define | POST_BUFFER_SIZE 500000 |
| Buffer size for POST processor. More... | |
| #define | MAX_FILE_NAME_SIZE 128 |
| Maximum length of "file name" for /help/ URLs. More... | |
| #define | SESSION_TIMEOUT 15 |
| Max number of minutes between activity in a session. More... | |
| #define | DEFAULT_CLIENT_WATCH_INTERVAL 1 |
| Default value for client_watch_interval. More... | |
| #define | DEFAULT_GSAD_FACE "classic" |
| Default face name. More... | |
| #define | DEFAULT_GSAD_X_FRAME_OPTIONS "SAMEORIGIN" |
| Default value for HTTP header "X-Frame-Options". More... | |
| #define | DEFAULT_GSAD_CONTENT_SECURITY_POLICY |
| Default value for HTTP header "Content-Security-Policy". More... | |
| #define | DEFAULT_GSAD_GUEST_CHART_X_FRAME_OPTIONS "SAMEORIGIN" |
| Default value for HTTP header "X-Frame-Options" for guest charts. More... | |
| #define | DEFAULT_GSAD_GUEST_CHART_CONTENT_SECURITY_POLICY |
| Default guest charts value for HTTP header "Content-Security-Policy". More... | |
| #define | DEFAULT_GSAD_HSTS_MAX_AGE 31536000 |
| Default "max-age" for HTTP header "Strict-Transport-Security". More... | |
| #define | UTF8_ERROR_PAGE(location) |
| #define | HOST_HEADER_ERROR_PAGE |
| #define | USER_OK 0 |
| #define | USER_BAD_TOKEN 1 |
| #define | USER_EXPIRED_TOKEN 2 |
| #define | USER_BAD_MISSING_COOKIE 3 |
| #define | USER_BAD_MISSING_TOKEN 4 |
| #define | USER_GUEST_LOGIN_FAILED 5 |
| #define | USER_OMP_DOWN 6 |
| #define | USER_IP_ADDRESS_MISSMATCH 7 |
| #define | USER_GUEST_LOGIN_ERROR -1 |
| #define | ELSE(name) |
| Add else branch for an OMP operation. More... | |
| #define | ELSE(name) |
| Add else branch for an OMP operation. More... | |
| #define | EXPIRES_LENGTH 100 |
| Max length of cookie expires param. More... | |
| #define | MAX_HOST_LEN 1000 |
| Maximum length of the host portion of the redirect address. More... | |
| #define | DATE_2822_LEN 100 |
| At least maximum length of rfc2822 format date. More... | |
Typedefs | |
| typedef struct user | user_t |
| User information type, for sessions. More... | |
Functions | |
| void | add_security_headers (struct MHD_Response *response) |
| Add security headers to a MHD response. More... | |
| void | add_guest_chart_content_security_headers (struct MHD_Response *response) |
| Add guest chart content security headers to a MHD response. More... | |
| user_t * | user_add (const gchar *username, const gchar *password, const gchar *timezone, const gchar *severity, const gchar *role, const gchar *capabilities, const gchar *language, const gchar *pw_warning, GTree *chart_prefs, const gchar *autorefresh, const char *address) |
| Add a user. More... | |
| int | user_find (const gchar *cookie, const gchar *token, const char *address, user_t **user_return) |
| Find a user, given a token and cookie. More... | |
| int | user_set_timezone (const gchar *token, const gchar *timezone) |
| Set timezone of user. More... | |
| int | user_set_password (const gchar *token, const gchar *password) |
| Set password of user. More... | |
| int | user_set_severity (const gchar *token, const gchar *severity) |
| Set severity class of user. More... | |
| int | user_set_language (const gchar *token, const gchar *language) |
| Set language of user. More... | |
| int | user_set_charts (const gchar *token, const int charts) |
| Set charts setting of user. More... | |
| int | user_set_chart_pref (const gchar *token, gchar *pref_id, gchar *pref_value) |
| Set a chart preference of a user. More... | |
| int | user_set_autorefresh (const gchar *token, const gchar *autorefresh) |
| Set default autorefresh interval of user. More... | |
| int | user_logout_all_sessions (const gchar *username, credentials_t *credentials) |
| Logs out all sessions of a given user, except the current one. More... | |
| void | user_release (user_t *user) |
| Release a user_t returned by user_add or user_find. More... | |
| void | user_remove (user_t *user) |
| Remove a user from the session "database", releasing the user_t too. More... | |
| int | token_user (const gchar *token, user_t **user_return) |
| Find a user, given a token. More... | |
| int | token_user_remove (const char *token) |
| Remove a user from the session "database", releasing the user_t too. More... | |
| void | init_validator () |
| Initialise the parameter validator. More... | |
| void | free_resources (void *cls, struct MHD_Connection *connection, void **con_cls, enum MHD_RequestTerminationCode toe) |
| Free resources. More... | |
| int | serve_post (void *coninfo_cls, enum MHD_ValueKind kind, const char *key, const char *filename, const char *content_type, const char *transfer_encoding, const char *data, uint64_t off, size_t size) |
| Serves part of a POST request. More... | |
| void | params_mhd_validate_values (const char *parent_name, void *params) |
| Validate param values. More... | |
| int | exec_omp_post (struct gsad_connection_info *con_info, user_t **user_return, gchar **new_sid, const char *client_address) |
| Handle a complete POST request. More... | |
| char * | exec_omp_get (struct MHD_Connection *con, credentials_t *credentials, enum content_type *content_type, gchar **content_type_string, char **content_disposition, gsize *response_size, cmd_response_data_t *response_data) |
| Handle a complete GET request. More... | |
| void | add_local_addresses (GHashTable *hashtable, int include_ipv6, int localhost_only) |
| Add all local IP addresses to a GHashTable. More... | |
| int | send_response (struct MHD_Connection *connection, const char *content, int status_code, const gchar *sid, enum content_type content_type, const char *content_disposition, size_t content_length) |
| Sends a HTTP response. More... | |
| int | send_redirect_to_uri (struct MHD_Connection *connection, const char *uri, user_t *user) |
| Sends a HTTP redirection to an uri. More... | |
| int | send_redirect_to_urn (struct MHD_Connection *connection, const char *urn, user_t *user) |
| Sends an HTTP redirection response to an urn. More... | |
| int | redirect_handler (void *cls, struct MHD_Connection *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... | |
| int | handle_request (void *cls, struct MHD_Connection *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... | |
| int | gsad_init () |
| Initialization routine for GSAD. More... | |
| void | gsad_cleanup () |
| Cleanup routine for GSAD. More... | |
| void | handle_signal_exit (int signal) |
| Handle a SIGINT signal. More... | |
| int | main (int argc, char **argv) |
| Main routine of Greenbone Security Assistant daemon. More... | |
Variables | |
| volatile int | termination_signal = 0 |
| Flag for signal handler. More... | |
| GCRY_THREAD_OPTION_PTHREAD_IMPL | |
| Libgcrypt thread callback definition for libgcrypt < 1.6.0. More... | |
| const char * | NOT_FOUND_TITLE = "Invalid request" |
| Title for "Page not found" messages. More... | |
| const char * | NOT_FOUND_MESSAGE = "The requested page or file does not exist." |
| Main message for "Page not found" messages. More... | |
| const char * | ERROR_PAGE = "<html><body>HTTP Method not supported</body></html>" |
| Error page HTML. More... | |
| char * | BAD_REQUEST_PAGE |
| Bad request error HTML. More... | |
| char * | SERVER_ERROR |
| Server error HTML. More... | |
| struct MHD_Daemon * | gsad_daemon |
| The handle on the embedded HTTP daemon. More... | |
| GSList * | address_list = NULL |
| The IP addresses of this program, "the GSAD". More... | |
| GHashTable * | gsad_header_hosts = NULL |
| Host names and IP accepted in the "Host" HTTP header. More... | |
| gchar * | redirect_location = NULL |
| Location for redirection server. More... | |
| pid_t | redirect_pid = 0 |
| PID of redirect child in parent, 0 in child. More... | |
| pid_t | unix_pid = 0 |
| PID of unix socket child in parent, 0 in child. More... | |
| int | unix_socket = 0 |
| Unix socket to listen on. More... | |
| GSList * | log_config = NULL |
| Logging parameters, as passed to setup_log_handlers. More... | |
| int | use_secure_cookie = 1 |
| Whether to use a secure cookie. More... | |
| int | session_timeout |
| Maximum number of minutes of user idle time. More... | |
| gchar * | guest_username = NULL |
| Guest username. More... | |
| gchar * | guest_password = NULL |
| Guest password. More... | |
| GPtrArray * | users = NULL |
| User session data. More... | |
| gchar * | http_x_frame_options |
| Current value for HTTP header "X-Frame-Options". More... | |
| gchar * | http_content_security_policy |
| Current value for HTTP header "Content-Security-Policy". More... | |
| gchar * | http_guest_chart_x_frame_options |
| Current guest chart specific value for HTTP header "X-Frame-Options". More... | |
| gchar * | http_guest_chart_content_security_policy |
| Current guest chart value for HTTP header "Content-Security-Policy". More... | |
| gchar * | http_strict_transport_security |
| Current value of for HTTP header "Strict-Transport-Security". More... | |
| gboolean | ignore_http_x_real_ip |
| Current preference for using X_Real_IP from HTTP header. More... | |
| int | chroot_state = 0 |
| Whether chroot is used. More... | |
| int | client_watch_interval = DEFAULT_CLIENT_WATCH_INTERVAL |
| Interval in seconds to check whether client connection was closed. More... | |
| validator_t | validator |
| Parameter validator. More... | |
Main module of Greenbone Security Assistant daemon.
This file contains the core of the GSA server process that handles HTTPS requests and communicates with OpenVAS-Manager via the OMP protocol.
Definition in file gsad.c.
| #define _GNU_SOURCE /* for strcasecmp */ |
| #define DATE_2822_LEN 100 |
| #define DEFAULT_CLIENT_WATCH_INTERVAL 1 |
| #define DEFAULT_GSAD_CONTENT_SECURITY_POLICY |
| #define DEFAULT_GSAD_GUEST_CHART_CONTENT_SECURITY_POLICY |
| #define DEFAULT_GSAD_GUEST_CHART_X_FRAME_OPTIONS "SAMEORIGIN" |
| #define DEFAULT_GSAD_HSTS_MAX_AGE 31536000 |
| #define DEFAULT_GSAD_HTTP_PORT 80 |
| #define DEFAULT_GSAD_HTTPS_PORT 443 |
| #define DEFAULT_GSAD_PORT 9392 |
| #define DEFAULT_GSAD_REDIRECT_PORT 80 |
| #define DEFAULT_GSAD_X_FRAME_OPTIONS "SAMEORIGIN" |
| #define DEFAULT_OPENVAS_MANAGER_PORT 9390 |
| #define ELSE | ( | name | ) |
| #define ELSE | ( | name | ) |
| #define EXPIRES_LENGTH 100 |
| #define HOST_HEADER_ERROR_PAGE |
| #define MAX_FILE_NAME_SIZE 128 |
| #define MAX_HOST_LEN 1000 |
Maximum length of the host portion of the redirect address.
Definition at line 4116 of file gsad.c.
Referenced by redirect_handler(), and send_redirect_to_urn().
| #define MHD_HTTP_NOT_ACCEPTABLE MHD_HTTP_METHOD_NOT_ACCEPTABLE |
The symbol is deprecated, but older versions (0.9.37 - Debian jessie) don't define it yet.
Definition at line 122 of file gsad.c.
Referenced by handle_request(), and redirect_handler().
| #define POST_BUFFER_SIZE 500000 |
| #define SESSION_TIMEOUT 15 |
| #define SID_COOKIE_NAME "GSAD_SID" |
| #define USER_BAD_MISSING_TOKEN 4 |
Definition at line 517 of file gsad.c.
Referenced by user_find().
| #define UTF8_ERROR_PAGE | ( | location | ) |
Definition at line 255 of file gsad.c.
Referenced by handle_request().
| void add_guest_chart_content_security_headers | ( | struct MHD_Response * | response | ) |
Add guest chart content security headers to a MHD response.
Definition at line 403 of file gsad.c.
References http_content_security_policy, http_guest_chart_content_security_policy, http_guest_chart_x_frame_options, and http_x_frame_options.
| void add_local_addresses | ( | GHashTable * | hashtable, |
| int | include_ipv6, | ||
| int | localhost_only | ||
| ) |
Add all local IP addresses to a GHashTable.
| [in] | hashtable | The hashtable to add the addresses to. |
| [in] | include_ipv6 | Whether to include IPv6 addresses. |
| [in] | localhost_only | Whether to add only localhost, 127.0.0.1 and ::1. |
Definition at line 3856 of file gsad.c.
References gsad_header_hosts.
| void add_security_headers | ( | struct MHD_Response * | response | ) |
Add security headers to a MHD response.
Definition at line 386 of file gsad.c.
References http_content_security_policy, http_strict_transport_security, and http_x_frame_options.
| char* exec_omp_get | ( | struct MHD_Connection * | con, |
| credentials_t * | credentials, | ||
| enum content_type * | content_type, | ||
| gchar ** | content_type_string, | ||
| char ** | content_disposition, | ||
| gsize * | response_size, | ||
| cmd_response_data_t * | response_data | ||
| ) |
Handle a complete GET request.
After some input checking, depending on the cmd parameter of the connection, issue an omp command (via *_omp functions).
| [in] | con | Connection. |
| [in] | credentials | User credentials. |
| [out] | content_type | Return location for the content type of the response. |
| [out] | content_type_string | Return location for dynamic content type. |
| [out] | content_disposition | Return location for the content_disposition, if any. |
| [out] | response_size | Return location for response size, if any. |
| [in] | response_data | Response data. Return info is written into here. |
Definition at line 3040 of file gsad.c.
References openvas_validate(), params_new(), params_t, and validator.

| int exec_omp_post | ( | struct gsad_connection_info * | con_info, |
| user_t ** | user_return, | ||
| gchar ** | new_sid, | ||
| const char * | client_address | ||
| ) |
Handle a complete POST request.
Ensures there is a command, then depending on the command validates parameters and calls the appropriate OMP function (like create_task_omp).
| [in] | con_info | Connection info. |
| [out] | user_return | User after successful login. |
| [out] | new_sid | SID when appropriate to attach. |
| [out] | client_address | Client address. |
Definition at line 2205 of file gsad.c.
References cmd_response_data_init(), user::language, gsad_connection_info::params, and params_value().

| void free_resources | ( | void * | cls, |
| struct MHD_Connection * | connection, | ||
| void ** | con_cls, | ||
| enum MHD_RequestTerminationCode | toe | ||
| ) |
Free resources.
Used as free callback for HTTP daemon.
| [in] | cls | Dummy parameter. |
| [in] | connection | Connection. |
| [in] | con_cls | Connection information. |
| [in] | toe | Dummy parameter. |
Definition at line 1772 of file gsad.c.
References gsad_connection_info::connectiontype, gsad_connection_info::content_disposition, gsad_connection_info::cookie, gsad_connection_info::language, gsad_connection_info::params, params_free(), and gsad_connection_info::postprocessor.

| void gsad_cleanup | ( | ) |
Cleanup routine for GSAD.
This routine will stop the http server, free log resources and remove the pidfile.
Definition at line 5856 of file gsad.c.
References gsad_base_cleanup(), gsad_daemon, log_config, redirect_pid, and unix_pid.

| int gsad_init | ( | ) |
| int handle_request | ( | void * | cls, |
| struct MHD_Connection * | 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 | Not used for this callback. |
| [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). |
Definition at line 4598 of file gsad.c.
References BAD_REQUEST_PAGE, gsad_connection_info::connectiontype, ERROR_PAGE, GSAD_CONTENT_TYPE_TEXT_HTML, gsad_message(), MHD_HTTP_NOT_ACCEPTABLE, NOT_FOUND_MESSAGE, NOT_FOUND_TITLE, gsad_connection_info::params, params_new(), send_response(), and UTF8_ERROR_PAGE.

| void handle_signal_exit | ( | int | signal | ) |
Handle a SIGINT signal.
| [in] | signal | The signal that caused this function to run. |
Definition at line 5876 of file gsad.c.
References termination_signal.
| void init_validator | ( | ) |
Initialise the parameter validator.
Definition at line 999 of file gsad.c.
References openvas_validator_add(), openvas_validator_alias(), openvas_validator_new(), and validator.

| int main | ( | int | argc, |
| char ** | argv | ||
| ) |
Main routine of Greenbone Security Assistant daemon.
| [in] | argc | Argument counter |
| [in] | argv | Argument vector |
Definition at line 6092 of file gsad.c.
References DEFAULT_GSAD_REDIRECT_PORT, DEFAULT_OPENVAS_MANAGER_PORT, and gsad_init().

| void params_mhd_validate_values | ( | const char * | parent_name, |
| void * | params | ||
| ) |
Validate param values.
| [in] | parent_name | Name of the parent param. |
| [in] | params | Values. |
Definition at line 1995 of file gsad.c.
References openvas_validate(), openvas_validator_alias_for(), param::original_value, params_iterator_init, params_iterator_next(), params_iterator_t, param::valid, param::valid_utf8, validator, param::value, and param::value_size.

| int redirect_handler | ( | void * | cls, |
| struct MHD_Connection * | 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 | Not used for this callback. |
| [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). |
Definition at line 4201 of file gsad.c.
References gsad_connection_info::connectiontype, ERROR_PAGE, GSAD_CONTENT_TYPE_TEXT_HTML, MAX_HOST_LEN, MHD_HTTP_NOT_ACCEPTABLE, gsad_connection_info::params, params_new(), and send_response().

| int send_redirect_to_uri | ( | struct MHD_Connection * | connection, |
| const char * | uri, | ||
| user_t * | user | ||
| ) |
Sends a HTTP redirection to an uri.
| [in] | connection | The connection handle. |
| [in] | uri | The full URI to redirect to. |
| [in] | user | User to add cookie for, or NULL. |
Definition at line 4059 of file gsad.c.
| int send_redirect_to_urn | ( | struct MHD_Connection * | connection, |
| const char * | urn, | ||
| user_t * | user | ||
| ) |
Sends an HTTP redirection response to an urn.
| [in] | connection | The connection handle. |
| [in] | urn | The full urn to redirect to. |
| [in] | user | User to add cookie for, or NULL. |
Definition at line 4128 of file gsad.c.
References MAX_HOST_LEN.
| int send_response | ( | struct MHD_Connection * | connection, |
| const char * | content, | ||
| int | status_code, | ||
| const gchar * | sid, | ||
| enum content_type | content_type, | ||
| const char * | content_disposition, | ||
| size_t | content_length | ||
| ) |
Sends a HTTP response.
| [in] | connection | The connection handle. |
| [in] | content | The content. |
| [in] | status_code | The HTTP status code. |
| [in] | sid | Session ID, or NULL. |
| [in] | content_type | The content type. |
| [in] | content_disposition | The content disposition or NULL. |
| [in] | content_length | Content length, 0 for strlen (content). |
Definition at line 4006 of file gsad.c.
Referenced by handle_request(), and redirect_handler().

| int serve_post | ( | void * | coninfo_cls, |
| enum MHD_ValueKind | kind, | ||
| const char * | key, | ||
| const char * | filename, | ||
| const char * | content_type, | ||
| const char * | transfer_encoding, | ||
| const char * | data, | ||
| uint64_t | off, | ||
| size_t | size | ||
| ) |
Serves part of a POST request.
Implements an MHD_PostDataIterator.
Called one or more times to collect the multiple parts (key/value pairs) of a POST request. Fills the params of a gsad_connection_info.
After serve_post, the connection info is free'd.
| [in,out] | coninfo_cls | Connection info (a gsad_connection_info). |
| [in] | kind | Type of request data (header, cookie, etc.). |
| [in] | key | Name of data (name of request variable). |
| [in] | filename | Name of uploaded file if any, else NULL. |
| [in] | content_type | MIME type of data if known, else NULL. |
| [in] | transfer_encoding | Transfer encoding if known, else NULL. |
| [in] | data | Data. |
| [in] | off | Offset into entire data. |
| [in] | size | Size of data, in bytes. |
Definition at line 1968 of file gsad.c.
References gsad_connection_info::answercode, gsad_connection_info::response, and SERVER_ERROR.
| int token_user | ( | const gchar * | token, |
| user_t ** | user_return | ||
| ) |
Find a user, given a token.
If a user is returned, it's up to the caller to release the user.
| [in] | token | Token request parameter. |
| [out] | user_return | User. |
Definition at line 938 of file gsad.c.
Referenced by token_user_remove().

| int token_user_remove | ( | const char * | token | ) |
Remove a user from the session "database", releasing the user_t too.
| [in] | token | User's token. |
Definition at line 980 of file gsad.c.
References token_user(), and users.
Referenced by logout().


| user_t* user_add | ( | const gchar * | username, |
| const gchar * | password, | ||
| const gchar * | timezone, | ||
| const gchar * | severity, | ||
| const gchar * | role, | ||
| const gchar * | capabilities, | ||
| const gchar * | language, | ||
| const gchar * | pw_warning, | ||
| GTree * | chart_prefs, | ||
| const gchar * | autorefresh, | ||
| const char * | address | ||
| ) |
Add a user.
Creates and initializes a user object with given parameters
It's up to the caller to release the returned user.
| [in] | username | Name of user. |
| [in] | password | Password for user. |
| [in] | timezone | Timezone of user. |
| [in] | severity | Severity class setting of user. |
| [in] | role | Role of user. |
| [in] | capabilities | Capabilities of manager. |
| [in] | language | User Interface Language (language name or code) |
| [in] | pw_warning | Password policy warning. |
| [in] | chart_prefs | The chart preferences. |
| [in] | autorefresh | The autorefresh preference. |
| [in] | address | Client's IP address. |
Definition at line 469 of file gsad.c.
| int user_find | ( | const gchar * | cookie, |
| const gchar * | token, | ||
| const char * | address, | ||
| user_t ** | user_return | ||
| ) |
Find a user, given a token and cookie.
If a user is returned, it's up to the caller to release the user.
| [in] | cookie | Token in cookie. |
| [in] | token | Token request parameter. |
| [in] | address | Client's IP address. |
| [out] | user_return | User. |
Definition at line 539 of file gsad.c.
References user::autorefresh, user::capabilities, user::chart_prefs, guest_username, user::language, user::pw_warning, user::role, user::severity, user::timezone, and USER_BAD_MISSING_TOKEN.
| int user_logout_all_sessions | ( | const gchar * | username, |
| credentials_t * | credentials | ||
| ) |
| void user_release | ( | user_t * | user | ) |
| void user_remove | ( | user_t * | user | ) |
| int user_set_autorefresh | ( | const gchar * | token, |
| const gchar * | autorefresh | ||
| ) |
| int user_set_chart_pref | ( | const gchar * | token, |
| gchar * | pref_id, | ||
| gchar * | pref_value | ||
| ) |
| int user_set_charts | ( | const gchar * | token, |
| const int | charts | ||
| ) |
| int user_set_language | ( | const gchar * | token, |
| const gchar * | language | ||
| ) |
Set language of user.
| [in] | token | User token. |
| [in] | language | Language. |
Definition at line 762 of file gsad.c.
| int user_set_password | ( | const gchar * | token, |
| const gchar * | password | ||
| ) |
| int user_set_severity | ( | const gchar * | token, |
| const gchar * | severity | ||
| ) |
| int user_set_timezone | ( | const gchar * | token, |
| const gchar * | timezone | ||
| ) |
| GSList* address_list = NULL |
| char* BAD_REQUEST_PAGE |
Bad request error HTML.
Definition at line 243 of file gsad.c.
Referenced by handle_request().
| int chroot_state = 0 |
Whether chroot is used.
Definition at line 375 of file gsad.c.
Referenced by get_chroot_state(), and set_chroot_state().
| int client_watch_interval = DEFAULT_CLIENT_WATCH_INTERVAL |
| const char* ERROR_PAGE = "<html><body>HTTP Method not supported</body></html>" |
Error page HTML.
Definition at line 238 of file gsad.c.
Referenced by handle_request(), and redirect_handler().
| GCRY_THREAD_OPTION_PTHREAD_IMPL |
| struct MHD_Daemon* gsad_daemon |
The handle on the embedded HTTP daemon.
Definition at line 276 of file gsad.c.
Referenced by gsad_cleanup().
| GHashTable* gsad_header_hosts = NULL |
Host names and IP accepted in the "Host" HTTP header.
Definition at line 286 of file gsad.c.
Referenced by add_local_addresses().
| gchar* guest_username = NULL |
| gchar* http_content_security_policy |
Current value for HTTP header "Content-Security-Policy".
Definition at line 350 of file gsad.c.
Referenced by add_guest_chart_content_security_headers(), and add_security_headers().
| gchar* http_guest_chart_content_security_policy |
Current guest chart value for HTTP header "Content-Security-Policy".
Definition at line 360 of file gsad.c.
Referenced by add_guest_chart_content_security_headers().
| gchar* http_guest_chart_x_frame_options |
Current guest chart specific value for HTTP header "X-Frame-Options".
Definition at line 355 of file gsad.c.
Referenced by add_guest_chart_content_security_headers().
| gchar* http_strict_transport_security |
Current value of for HTTP header "Strict-Transport-Security".
Definition at line 365 of file gsad.c.
Referenced by add_security_headers().
| gchar* http_x_frame_options |
Current value for HTTP header "X-Frame-Options".
Definition at line 345 of file gsad.c.
Referenced by add_guest_chart_content_security_headers(), and add_security_headers().
| gboolean ignore_http_x_real_ip |
| GSList* log_config = NULL |
Logging parameters, as passed to setup_log_handlers.
Definition at line 313 of file gsad.c.
Referenced by gsad_cleanup().
| const char* NOT_FOUND_MESSAGE = "The requested page or file does not exist." |
Main message for "Page not found" messages.
Definition at line 233 of file gsad.c.
Referenced by handle_request().
| const char* NOT_FOUND_TITLE = "Invalid request" |
Title for "Page not found" messages.
Definition at line 227 of file gsad.c.
Referenced by handle_request().
| gchar* redirect_location = NULL |
| pid_t redirect_pid = 0 |
PID of redirect child in parent, 0 in child.
Definition at line 296 of file gsad.c.
Referenced by gsad_cleanup().
| char* SERVER_ERROR |
Server error HTML.
Definition at line 249 of file gsad.c.
Referenced by serve_post().
| int session_timeout |
| volatile int termination_signal = 0 |
| pid_t unix_pid = 0 |
PID of unix socket child in parent, 0 in child.
Definition at line 301 of file gsad.c.
Referenced by gsad_cleanup().
| int use_secure_cookie = 1 |
| GPtrArray* users = NULL |
User session data.
Definition at line 340 of file gsad.c.
Referenced by create_group_omp(), create_role_omp(), save_group_omp(), save_role_omp(), token_user_remove(), and user_remove().
| validator_t validator |
Parameter validator.
Definition at line 993 of file gsad.c.
Referenced by exec_omp_get(), init_validator(), and params_mhd_validate_values().