--- a/src/conf.c +++ b/src/conf.c @@ -116,7 +116,10 @@ typedef enum { oFWMarkTrusted, oFWMarkBlocked, oBinAuth, - oPreAuth + oPreAuth, + oSplashPageTitle, + oLoginSuccessText, + oAcceptancePolicy } OpCodes; /** @internal @@ -178,6 +181,9 @@ static const struct { { "fw_mark_blocked", oFWMarkBlocked }, { "binauth", oBinAuth }, { "preauth", oPreAuth }, + { "acceptance_policy", oAcceptancePolicy }, + { "splash_page_title", oSplashPageTitle }, + { "login_success_text",oLoginSuccessText }, { NULL, oBadOption }, }; @@ -269,6 +275,9 @@ config_init(void) config.ip6 = DEFAULT_IP6; config.binauth = NULL; config.preauth = NULL; + config.acceptance_policy = safe_strdup(DEFAULT_ACCEPTANCE_POLICY); + config.splash_page_title = safe_strdup(DEFAULT_SPLASH_PAGE_TITLE); + config.login_success_text = safe_strdup(DEFAULT_LOGIN_SUCCESS_TEXT); // Set up default FirewallRuleSets, and their empty ruleset policies rs = add_ruleset("trusted-users"); @@ -1026,6 +1035,15 @@ config_read(const char *filename) exit(1); } break; + case oAcceptancePolicy: + config.acceptance_policy = safe_strdup(p1); + break; + case oLoginSuccessText: + config.login_success_text = safe_strdup(p1); + break; + case oSplashPageTitle: + config.splash_page_title = safe_strdup(p1); + break; case oBadOption: debug(LOG_ERR, "Bad option %s on line %d in %s", s, linenum, filename); debug(LOG_ERR, "Exiting..."); --- a/src/conf.h +++ b/src/conf.h @@ -52,7 +52,7 @@ #define DEFAULT_DEBUGLEVEL 1 #define DEFAULT_MAXCLIENTS 20 #define DEFAULT_GATEWAY_IPRANGE "0.0.0.0/0" -#define DEFAULT_GATEWAYNAME "openNDS" +#define DEFAULT_GATEWAYNAME "Telecom Infra Project Gateway" #define DEFAULT_GATEWAYPORT 2050 #define DEFAULT_FASPORT 0 #define DEFAULT_LOGIN_OPTION_ENABLED 0 @@ -98,6 +98,9 @@ #define DEFAULT_EMPTY_AUTHENTICATED_USERS_POLICY "RETURN" #define DEFAULT_EMPTY_PREAUTHENTICATED_USERS_POLICY "REJECT" #define DEFAULT_IP6 0 +#define DEFAULT_SPLASH_PAGE_TITLE "Captive Portal" +#define DEFAULT_ACCEPTANCE_POLICY "Use this network at your own risk. No warranty of any kind " +#define DEFAULT_LOGIN_SUCCESS_TEXT "Welcome to Network" // Firewall targets typedef enum { @@ -195,6 +198,9 @@ typedef struct { int ip6; //@brief enable IPv6 char *binauth; //@brief external authentication program char *preauth; //@brief external preauthentication program + char *acceptance_policy; + char *login_success_text; + char *splash_page_title; } s_config; // @brief Get the current gateway configuration --- a/src/http_microhttpd.c +++ b/src/http_microhttpd.c @@ -696,7 +696,7 @@ static int show_preauthpage(struct MHD_C uh_urlencode(enc_query, sizeof(enc_query), query, strlen(query)); debug(LOG_DEBUG, "PreAuth: query: %s", query); } - + debug(LOG_WARNING, "Preauth script: querystring:%s ,user_agent:%s", enc_query, enc_user_agent); rc = execute_ret(msg, HTMLMAXSIZE - 1, "%s '%s' '%s'", config->preauth, enc_query, enc_user_agent); if (rc != 0) { @@ -962,7 +962,8 @@ static char *construct_querystring(t_cli snprintf(querystr, QUERYMAXLEN, "?clientip=%s&gatewayname=%s&hid=%s&gatewayaddress=%s", client->ip, config->url_encoded_gw_name, hash, config->gw_address); } else { - snprintf(querystr, QUERYMAXLEN, "?clientip=%s&gatewayname=%s", client->ip, config->url_encoded_gw_name); + snprintf(querystr, QUERYMAXLEN,"?clientip=%s&gatewayname=%s&splashpagetitle=%s&acceptancepolicy=%s&loginsuccesstext=%s&redirecturl=%s", + client->ip, config->url_encoded_gw_name, config->splash_page_title, config->acceptance_policy, config->login_success_text, config->redirectURL); } } else if (config->fas_secure_enabled == 2 || config->fas_secure_enabled == 3) { @@ -1320,6 +1321,10 @@ static void replace_variables( {"token", client->token}, {"uptime", uptime}, {"version", VERSION}, + {"acceptancepolicy", config->acceptance_policy}, + {"loginsuccesstext", config->login_success_text}, + {"splashpagetitle", config->splash_page_title}, + {"redirecturl", config->redirectURL}, {NULL, NULL} };