Ticket #463: 0002-Add-authentication-related-settings-to-the-configura.patch

File 0002-Add-authentication-related-settings-to-the-configura.patch, 3.6 KB (added by wichert@…, 4 years ago)
  • src/conf.c

    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  
    8484        oAuthServAuthScriptPathFragment, 
    8585        oHTTPDMaxConn, 
    8686        oHTTPDName, 
     87        oHTTPDRealm, 
     88        oHTTPDUsername, 
     89        oHTTPDPassword, 
    8790        oClientTimeout, 
    8891        oCheckInterval, 
    8992        oWdctlSocket, 
     
    111114        { "authserver",         oAuthServer }, 
    112115        { "httpdmaxconn",       oHTTPDMaxConn }, 
    113116        { "httpdname",          oHTTPDName }, 
     117        { "httpdrealm",         oHTTPDRealm }, 
     118        { "httpdusername",      oHTTPDUsername }, 
     119        { "httpdpassword",      oHTTPDPassword }, 
    114120        { "clienttimeout",      oClientTimeout }, 
    115121        { "checkinterval",      oCheckInterval }, 
    116122        { "syslogfacility",     oSyslogFacility }, 
     
    165171        config.gw_port = DEFAULT_GATEWAYPORT; 
    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; 
    170179        config.syslog_facility = DEFAULT_SYSLOG_FACILITY; 
     
    705714                                case oHTTPDMaxConn: 
    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 " 
    710728                                                        "in %s.", linenum, 
     
    734752                } 
    735753        } 
    736754 
     755        if (config.httpdusername && !config.httpdpassword) { 
     756                debug(LOG_ERR, "HTTPDUserName requires a HTTPDPassword to be set."); 
     757                exit(-1); 
     758        } 
     759 
    737760        fclose(fd); 
    738761} 
    739762 
  • src/conf.h

    diff --git a/src/conf.h b/src/conf.h
    index 1dbaf56..53a8b79 100644
    a b  
    141141                                     replying to a request */ 
    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 */ 
    146149    int checkinterval;          /**< @brief Frequency the the client timeout check 
  • wifidog.conf

    diff --git a/wifidog.conf b/wifidog.conf
    index 89a97bc..8c7d74d 100644
    a b  
    110110# How many sockets to listen to 
    111111# HTTPDMaxConn 10 
    112112 
     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 
    113131# Parameter: CheckInterval 
    114132# Default: 60 
    115133# Optional