Fix for securing wlan.ini (#1509)

* Fix for securing wlan.ini

* Fixing error with ' instead of "

* Changing to errorcode 403

* maybe strcmp instead of regular ==

Co-authored-by: Pär Hedberg <par.hedberg@nordicmedtest.se>
This commit is contained in:
parhedberg
2022-12-07 18:24:51 +01:00
committed by GitHub
parent f4d086508d
commit 39019e9c92

View File

@@ -831,6 +831,12 @@ static esp_err_t delete_post_handler(httpd_req_t *req)
return ESP_FAIL; return ESP_FAIL;
} }
if (strcmp(filename, "wlan.ini") == 0) {
ESP_LOGE(TAG, "Trying to delete protected file : %s", filename);
httpd_resp_send_err(req, HTTPD_403_FORBIDDEN, "Not allowed to delete wlan.ini");
return ESP_FAIL;
}
if (stat(filepath, &file_stat) == -1) { if (stat(filepath, &file_stat) == -1) {
ESP_LOGE(TAG, "File does not exist: %s", filename); ESP_LOGE(TAG, "File does not exist: %s", filename);
/* Respond with 400 Bad Request */ /* Respond with 400 Bad Request */