Privilege checks must run before bootloader init
This commit is contained in:
@@ -548,11 +548,6 @@ void initServer()
|
|||||||
}
|
}
|
||||||
},[](AsyncWebServerRequest *request, String filename, size_t index, uint8_t *data, size_t len, bool isFinal){
|
},[](AsyncWebServerRequest *request, String filename, size_t index, uint8_t *data, size_t len, bool isFinal){
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
// Allocate the context structure
|
|
||||||
if (!initBootloaderOTA(request)) {
|
|
||||||
return; // Error will be dealt with after upload in response handler, above
|
|
||||||
}
|
|
||||||
|
|
||||||
// Privilege checks
|
// Privilege checks
|
||||||
IPAddress client = request->client()->remoteIP();
|
IPAddress client = request->client()->remoteIP();
|
||||||
if (((otaSameSubnet && !inSameSubnet(client)) && !strlen(settingsPIN)) || (!otaSameSubnet && !inLocalSubnet(client))) {
|
if (((otaSameSubnet && !inSameSubnet(client)) && !strlen(settingsPIN)) || (!otaSameSubnet && !inLocalSubnet(client))) {
|
||||||
@@ -571,6 +566,11 @@ void initServer()
|
|||||||
setBootloaderOTAReplied(request);
|
setBootloaderOTAReplied(request);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Allocate the context structure
|
||||||
|
if (!initBootloaderOTA(request)) {
|
||||||
|
return; // Error will be dealt with after upload in response handler, above
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
handleBootloaderOTAData(request, index, data, len, isFinal);
|
handleBootloaderOTAData(request, index, data, len, isFinal);
|
||||||
|
|||||||
Reference in New Issue
Block a user