Changeset 1370

Show
Ignore:
Timestamp:
09/30/08 05:16:09 (2 months ago)
Author:
wichert
Message:

Protect the status page with authentication (The LibHTTPD API is a bit silly here)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wifidog/src/http.c

    r1346 r1370  
    138138http_callback_status(httpd *webserver, request *r) 
    139139{ 
     140        const s_config *config = config_get_config(); 
    140141        char * status = NULL; 
    141142        char *buf; 
     143 
     144        if (config->httpdusername &&  
     145                        (strcmp(config->httpdusername, r->request.authUser) || 
     146                         strcmp(config->httpdpassword, r->request.authPassword))) { 
     147                debug(LOG_INFO, "Status page requested, forcing authentication"); 
     148                httpdForceAuthenticate(r, config->httpdrealm); 
     149                return; 
     150        } 
     151 
    142152        status = get_status_text(); 
    143153        safe_asprintf(&buf, "<pre>%s</pre>", status);