Ticket #463: 0003-Protect-the-status-page-with-authentication.patch

File 0003-Protect-the-status-page-with-authentication.patch, 1.1 kB (added by wichert@wiggy.net, 8 months ago)
  • a/src/http.c

    old new  
    137137void  
    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); 
    144154        send_http_page(r, "WiFiDog Status", buf);