From 7787cf19624f7cc8ce353f7295371862bd6f7500 Mon Sep 17 00:00:00 2001
From: Wichert Akkerman <wichert@wiggy.net>
Date: Mon, 28 Apr 2008 12:06:40 +0200
Subject: [PATCH] Protect the status page with authentication
The LibHTTPD API is a bit silly here.
---
src/http.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/src/http.c b/src/http.c
index b2b8ff9..90e4890 100644
|
a
|
b
|
|
| 137 | 137 | void |
| 138 | 138 | http_callback_status(httpd *webserver, request *r) |
| 139 | 139 | { |
| | 140 | const s_config *config = config_get_config(); |
| 140 | 141 | char * status = NULL; |
| 141 | 142 | 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 | |
| 142 | 152 | status = get_status_text(); |
| 143 | 153 | safe_asprintf(&buf, "<pre>%s</pre>", status); |
| 144 | 154 | send_http_page(r, "WiFiDog Status", buf); |