From 24c4a4e1dc39e5dc788e2a489776785b418ae5c7 Mon Sep 17 00:00:00 2001
From: Wichert Akkerman <wichert@wiggy.net>
Date: Mon, 28 Apr 2008 12:04:28 +0200
Subject: [PATCH] Add authentication related settings to the configuration
---
src/conf.c | 23 +++++++++++++++++++++++
src/conf.h | 3 +++
wifidog.conf | 18 ++++++++++++++++++
3 files changed, 44 insertions(+), 0 deletions(-)
diff --git a/src/conf.c b/src/conf.c
index ff2cd1c..617ba42 100644
|
a
|
b
|
|
| 84 | 84 | oAuthServAuthScriptPathFragment, |
| 85 | 85 | oHTTPDMaxConn, |
| 86 | 86 | oHTTPDName, |
| | 87 | oHTTPDRealm, |
| | 88 | oHTTPDUsername, |
| | 89 | oHTTPDPassword, |
| 87 | 90 | oClientTimeout, |
| 88 | 91 | oCheckInterval, |
| 89 | 92 | oWdctlSocket, |
| … |
… |
|
| 111 | 114 | { "authserver", oAuthServer }, |
| 112 | 115 | { "httpdmaxconn", oHTTPDMaxConn }, |
| 113 | 116 | { "httpdname", oHTTPDName }, |
| | 117 | { "httpdrealm", oHTTPDRealm }, |
| | 118 | { "httpdusername", oHTTPDUsername }, |
| | 119 | { "httpdpassword", oHTTPDPassword }, |
| 114 | 120 | { "clienttimeout", oClientTimeout }, |
| 115 | 121 | { "checkinterval", oCheckInterval }, |
| 116 | 122 | { "syslogfacility", oSyslogFacility }, |
| … |
… |
|
| 165 | 171 | config.gw_port = DEFAULT_GATEWAYPORT; |
| 166 | 172 | config.auth_servers = NULL; |
| 167 | 173 | config.httpdname = NULL; |
| | 174 | config.httpdrealm = DEFAULT_HTTPDNAME; |
| | 175 | config.httpdusername = NULL; |
| | 176 | config.httpdpassword = NULL; |
| 168 | 177 | config.clienttimeout = DEFAULT_CLIENTTIMEOUT; |
| 169 | 178 | config.checkinterval = DEFAULT_CHECKINTERVAL; |
| 170 | 179 | config.syslog_facility = DEFAULT_SYSLOG_FACILITY; |
| … |
… |
|
| 705 | 714 | case oHTTPDMaxConn: |
| 706 | 715 | sscanf(p1, "%d", &config.httpdmaxconn); |
| 707 | 716 | break; |
| | 717 | case oHTTPDRealm: |
| | 718 | config.httpdrealm = safe_strdup(p1); |
| | 719 | break; |
| | 720 | case oHTTPDUsername: |
| | 721 | config.httpdusername = safe_strdup(p1); |
| | 722 | break; |
| | 723 | case oHTTPDPassword: |
| | 724 | config.httpdpassword = safe_strdup(p1); |
| | 725 | break; |
| 708 | 726 | case oBadOption: |
| 709 | 727 | debug(LOG_ERR, "Bad option on line %d " |
| 710 | 728 | "in %s.", linenum, |
| … |
… |
|
| 734 | 752 | } |
| 735 | 753 | } |
| 736 | 754 | |
| | 755 | if (config.httpdusername && !config.httpdpassword) { |
| | 756 | debug(LOG_ERR, "HTTPDUserName requires a HTTPDPassword to be set."); |
| | 757 | exit(-1); |
| | 758 | } |
| | 759 | |
| 737 | 760 | fclose(fd); |
| 738 | 761 | } |
| 739 | 762 | |
diff --git a/src/conf.h b/src/conf.h
index 1dbaf56..53a8b79 100644
|
a
|
b
|
|
| 141 | 141 | replying to a request */ |
| 142 | 142 | int httpdmaxconn; /**< @brief Used by libhttpd, not sure what it |
| 143 | 143 | does */ |
| | 144 | char *httpdrealm; /**< @brief HTTP Authentication realm */ |
| | 145 | char *httpdusername; /**< @brief Username for HTTP authentication */ |
| | 146 | char *httpdpassword; /**< @brief Password for HTTP authentication */ |
| 144 | 147 | int clienttimeout; /**< @brief How many CheckIntervals before a client |
| 145 | 148 | must be re-authenticated */ |
| 146 | 149 | int checkinterval; /**< @brief Frequency the the client timeout check |
diff --git a/wifidog.conf b/wifidog.conf
index 89a97bc..8c7d74d 100644
|
a
|
b
|
|
| 110 | 110 | # How many sockets to listen to |
| 111 | 111 | # HTTPDMaxConn 10 |
| 112 | 112 | |
| | 113 | # Parameter: HTTPDRealm |
| | 114 | # Default: WiFiDog |
| | 115 | # Optional |
| | 116 | # |
| | 117 | # The name of the HTTP authentication realm. This only used when a user |
| | 118 | # tries to access a protected WiFiDog internal page. See HTTPUserName. |
| | 119 | # HTTPDRealm WiFiDog |
| | 120 | |
| | 121 | # Parameter: HTTPDUserName / HTTPDPassword |
| | 122 | # Default: unset |
| | 123 | # Optional |
| | 124 | # |
| | 125 | # The gateway exposes some information such as the status page through its web |
| | 126 | # interface. This information can be protected with a username and password, |
| | 127 | # which can be set through the HTTPDUserName and HTTPDPassword parameters. |
| | 128 | # HTTPDUserName admin |
| | 129 | # HTTPDPassword secret |
| | 130 | |
| 113 | 131 | # Parameter: CheckInterval |
| 114 | 132 | # Default: 60 |
| 115 | 133 | # Optional |