shantanugoel / asus-rt-n66u-merlin

Discontinued. Please go to https://github.com/RMerl/asuswrt-merlin . Custom firmware for Asus RT-N66U based on asus sources. Started by Eric/RMerlin @ www.lostrealm.ca . There are 3 branches. master -> Asus stock, merlin -> RMerlin/Eric's builds, shantz -> Shantanu Goel's builds.
Other
18 stars 8 forks source link

Uploading a cfg/firmware over SSL crashes httpd #7

Closed RMerl closed 12 years ago

RMerl commented 12 years ago

Bus error as soon you click on "Submit" when uploading a config file you want to restore, or a firmware you want to flash. Same operation works fine on non-SSL.

RMerl commented 12 years ago

Crashes in web.c/do_upload_post(), on this code:

if (waitfor (fileno(stream), 10) <= 0) {

Apparently, stream is not a valid stream when using SSL, so fileno() returns -1. I hope it's not a bug in mssl, cause I know nothing about SSL programming...

RMerl commented 12 years ago

I will need additional help to fix this one, as it deals with SSL and socket code, which I am unfamiliar with. For now I at least patched the code so httpd will no longer crash.

The root of the problem is that the file pointer lacks a valid file descriptor when created with ssl_server_fopen(). The whole POST handling code is quite complex when compared with Tomato's own code, which has no need for file descriptors.

Leaving this open for now until someone can give me a hand with this one, or I find some way to work around the issue.

RMerl commented 12 years ago

The RT-N53 release based on Asuswrt 3.0.0.4.130 contains code in the httpd service that seems to address this issue. I need to either backport their fixes to my tree, or rebase my work on that build 130.

RMerl commented 12 years ago

Confirmed fixed by Asus in build 130 (committed to the merlin-130 branch with baa7f3f805be1ef10c57c68ccfa9277bb8797282)