Go to the source code of this file.
Defines | |
#define | _GNU_SOURCE |
#define | TO_NEXT_WORD(s, e) |
Enumerations | |
enum | OpCodes { oBadOption, oDaemon, oDebugLevel, oExternalInterface, oGatewayID, oGatewayInterface, oGatewayAddress, oGatewayPort, oAuthServer, oAuthServHostname, oAuthServSSLAvailable, oAuthServSSLPort, oAuthServHTTPPort, oAuthServPath, oAuthServLoginScriptPathFragment, oAuthServPortalScriptPathFragment, oAuthServMsgScriptPathFragment, oAuthServPingScriptPathFragment, oAuthServAuthScriptPathFragment, oHTTPDMaxConn, oHTTPDName, oHTTPDRealm, oHTTPDUsername, oHTTPDPassword, oClientTimeout, oCheckInterval, oWdctlSocket, oSyslogFacility, oFirewallRule, oFirewallRuleSet, oTrustedMACList, oHtmlMessageFile } |
Functions | |
static void | config_notnull (const void *parm, const char *parmname) |
static int | parse_boolean_value (char *) |
static void | parse_auth_server (FILE *, const char *, int *) |
static int | _parse_firewall_rule (const char *ruleset, char *leftover) |
static void | parse_firewall_ruleset (const char *, FILE *, const char *, int *) |
static OpCodes | config_parse_token (const char *cp, const char *filename, int linenum) |
s_config * | config_get_config (void) |
Get the current gateway configuration. | |
void | config_init (void) |
Initialise the conf system. | |
void | config_init_override (void) |
Initialize the variables we override with the command line. | |
t_firewall_rule * | get_ruleset (const char *ruleset) |
Fetch a firewall rule set. | |
void | config_read (const char *filename) |
Reads the configuration file. | |
void | parse_trusted_mac_list (char *ptr) |
void | config_validate (void) |
Check that the configuration is valid. | |
t_auth_serv * | get_auth_server (void) |
Get the active auth server. | |
void | mark_auth_server_bad (t_auth_serv *bad_server) |
Bump server to bottom of the list. | |
Variables | |
static s_config | config |
pthread_mutex_t | config_mutex = PTHREAD_MUTEX_INITIALIZER |
static int | missing_parms |
struct { | |
const char * name | |
OpCodes opcode | |
} | keywords [] |
Definition in file conf.c.
#define TO_NEXT_WORD | ( | s, | |||
e | ) |
Value:
do { \ while (*s != '\0' && !isblank(*s)) { \ s++; \ } \ if (*s != '\0') { \ *s = '\0'; \ s++; \ while (isblank(*s)) \ s++; \ } else { \ e = 1; \ } \ } while (0)
s | string to parse, this is the next_word pointer, the value of s when the macro is called is the current word, after the macro completes, s contains the beginning of the NEXT word, so you need to save s to something else before doing TO_NEXT_WORD | |
e | should be 0 when calling TO_NEXT_WORD(), it'll be changed to 1 if the end of the string is reached. |
Definition at line 384 of file conf.c.
Referenced by _parse_firewall_rule().
static int _parse_firewall_rule | ( | const char * | ruleset, | |
char * | leftover | |||
) | [static] |
< 0 == block, 1 == allow
< If 0, port contained non-numerics
< reached end of line
< First word
< port to open/block
< protocol to block, tcp/udp/icmp
< Netmask
< other key word
Definition at line 479 of file conf.c.
References debug, _firewall_ruleset_t::name, _firewall_rule_t::next, _firewall_ruleset_t::next, _firewall_ruleset_t::rules, s_config::rulesets, safe_malloc(), and TO_NEXT_WORD.
s_config* config_get_config | ( | void | ) |
Get the current gateway configuration.
Accessor for the current gateway configuration
Definition at line 152 of file conf.c.
Referenced by _connect_auth_server(), auth_server_request(), authenticate_client(), fw_sync_with_authserver(), http_callback_404(), http_callback_auth(), http_callback_status(), iptables_fw_init(), iptables_fw_set_authservers(), parse_commandline(), ping(), send_http_page(), thread_client_timeout_check(), and thread_ping().
void config_init | ( | void | ) |
Initialise the conf system.
Sets the default config parameters and initialises the configuration system
Definition at line 159 of file conf.c.
References s_config::auth_servers, s_config::checkinterval, s_config::clienttimeout, s_config::configfile, s_config::daemon, debug, s_config::debuglevel, DEFAULT_CHECKINTERVAL, DEFAULT_CLIENTTIMEOUT, DEFAULT_CONFIGFILE, DEFAULT_DEBUGLEVEL, DEFAULT_GATEWAYID, DEFAULT_GATEWAYPORT, DEFAULT_HTMLMSGFILE, DEFAULT_HTTPDMAXCONN, DEFAULT_HTTPDNAME, DEFAULT_INTERNAL_SOCK, DEFAULT_LOG_SYSLOG, DEFAULT_SYSLOG_FACILITY, DEFAULT_WDCTL_SOCK, s_config::external_interface, s_config::gw_address, s_config::gw_id, s_config::gw_interface, s_config::gw_port, s_config::htmlmsgfile, s_config::httpdmaxconn, s_config::httpdname, s_config::httpdpassword, s_config::httpdrealm, s_config::httpdusername, s_config::internal_sock, s_config::log_syslog, s_config::rulesets, s_config::syslog_facility, s_config::trustedmaclist, and s_config::wdctl_sock.
void config_init_override | ( | void | ) |
Initialize the variables we override with the command line.
If the command-line didn't provide a config, use the default.
Definition at line 191 of file conf.c.
References s_config::daemon, and DEFAULT_DAEMON.
void config_read | ( | const char * | filename | ) |
Reads the configuration file.
filename | Full path of the configuration file to be read |
Definition at line 632 of file conf.c.
References s_config::checkinterval, s_config::clienttimeout, s_config::daemon, debug, s_config::external_interface, s_config::gw_address, s_config::gw_id, s_config::gw_interface, s_config::gw_port, s_config::htmlmsgfile, s_config::httpdmaxconn, s_config::httpdname, s_config::httpdpassword, s_config::httpdrealm, s_config::httpdusername, MAX_BUF, s_config::syslog_facility, and s_config::wdctl_sock.
void config_validate | ( | void | ) |
Check that the configuration is valid.
Verifies if the configuration is complete and valid. Terminates the program if it isn't
Definition at line 828 of file conf.c.
References s_config::auth_servers, debug, and s_config::gw_interface.
t_auth_serv* get_auth_server | ( | void | ) |
Get the active auth server.
This function returns the current (first auth_server)
Definition at line 855 of file conf.c.
References s_config::auth_servers.
Referenced by auth_server_request(), authenticate_client(), http_callback_404(), http_callback_auth(), http_send_redirect_to_auth(), and ping().
t_firewall_rule* get_ruleset | ( | const char * | ruleset | ) |
Fetch a firewall rule set.
Definition at line 615 of file conf.c.
References _firewall_ruleset_t::name, _firewall_ruleset_t::next, _firewall_ruleset_t::rules, and s_config::rulesets.
void mark_auth_server_bad | ( | t_auth_serv * | bad_server | ) |
Bump server to bottom of the list.
This function marks the current auth_server, if it matches the argument, as bad. Basically, the "bad" server becomes the last one on the list.
Definition at line 867 of file conf.c.
References s_config::auth_servers, and _auth_serv_t::next.
Referenced by _connect_auth_server().
pthread_mutex_t config_mutex = PTHREAD_MUTEX_INITIALIZER |