Changeset 1369

Show
Ignore:
Timestamp:
09/30/08 05:15:44 (4 years ago)
Author:
wichert
Message:

Add authentication related settings to the configuration

Location:
trunk/wifidog
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/wifidog/src/conf.c

    r1346 r1369  
    8585        oHTTPDMaxConn, 
    8686        oHTTPDName, 
     87        oHTTPDRealm, 
     88        oHTTPDUsername, 
     89        oHTTPDPassword, 
    8790        oClientTimeout, 
    8891        oCheckInterval, 
     
    112115        { "httpdmaxconn",       oHTTPDMaxConn }, 
    113116        { "httpdname",          oHTTPDName }, 
     117        { "httpdrealm",         oHTTPDRealm }, 
     118        { "httpdusername",      oHTTPDUsername }, 
     119        { "httpdpassword",      oHTTPDPassword }, 
    114120        { "clienttimeout",      oClientTimeout }, 
    115121        { "checkinterval",      oCheckInterval }, 
     
    166172        config.auth_servers = NULL; 
    167173        config.httpdname = NULL; 
     174        config.httpdrealm = DEFAULT_HTTPDNAME; 
     175        config.httpdusername = NULL; 
     176        config.httpdpassword = NULL; 
    168177        config.clienttimeout = DEFAULT_CLIENTTIMEOUT; 
    169178        config.checkinterval = DEFAULT_CHECKINTERVAL; 
     
    706715                                        sscanf(p1, "%d", &config.httpdmaxconn); 
    707716                                        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; 
    708726                                case oBadOption: 
    709727                                        debug(LOG_ERR, "Bad option on line %d " 
     
    733751                        } 
    734752                } 
     753        } 
     754 
     755        if (config.httpdusername && !config.httpdpassword) { 
     756                debug(LOG_ERR, "HTTPDUserName requires a HTTPDPassword to be set."); 
     757                exit(-1); 
    735758        } 
    736759 
  • trunk/wifidog/src/conf.h

    r1346 r1369  
    142142    int httpdmaxconn;           /**< @brief Used by libhttpd, not sure what it 
    143143                                     does */ 
     144    char *httpdrealm;           /**< @brief HTTP Authentication realm */ 
     145    char *httpdusername;        /**< @brief Username for HTTP authentication */ 
     146    char *httpdpassword;        /**< @brief Password for HTTP authentication */ 
    144147    int clienttimeout;          /**< @brief How many CheckIntervals before a client 
    145148                                     must be re-authenticated */ 
  • trunk/wifidog/wifidog.conf

    r1346 r1369  
    110110# How many sockets to listen to 
    111111# HTTPDMaxConn 10 
     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 
    112130 
    113131# Parameter: CheckInterval