summaryrefslogtreecommitdiff
path: root/uhttpd-utils.c
Commit message (Collapse)AuthorAgeFilesLines
* Another round of path handling fixesHEADmasterJo-Philipp Wich2014-09-231-4/+7
| | | | | | | | | | | | | | | * In canonpath(): * Make sure the internal path_copy buffer is zero initialized, this guarantees a trailing \0 when copying the input to the buffer * Handle failing getcwd() * Copy path argument to the correct offset when converting relative to absolute paths * In uh_realpath(): * Fix off-by-one in strncpy() - usually the callers buffer is zero-initialized so the trailing \0 is present nonetheless but this makes the function safer to use Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
* Fix possible buffer overruns in path handlingJo-Philipp Wich2014-09-221-7/+28
| | | | | | | | * Implement safe uh_realpath() wrapper * Fix possible buffer overrun in canonpath() * Fix possible buffer overrun in uh_path_lookup() Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
* support multiple index files in the configuration and the command line argsJo-Philipp Wich2012-10-151-20/+22
|
* define _XOPEN_SOURCE and _BSD_SOURCE globally, increase _XOPEN_SOURCE to ↵Felix Fietkau2012-10-041-3/+0
| | | | include strdup et al on mac os x
* [package] uhttpd: various changesjow2012-07-131-17/+13
| | | | | | | | | - remove unused variables - simply ignore command line args which belong to not enabled features - resolve peer address at accept() time, should solve (#11850) - remove floating point operations where possible git-svn-id: svn://svn.openwrt.org/openwrt/trunk/package/uhttpd/src@32704 3c298f89-4303-0410-b956-a3cf2f4a3e73
* [package] uhttpd: various fixesjow2012-07-091-15/+47
| | | | | | | | | - avoid closing descriptors before removing them from uloop (#11755, #11830) - do not auto-initialize ubus if no prefix is set (#11832) - remove extraneous client context pointer from cgi and lua states - code cleanups and debug message changes git-svn-id: svn://svn.openwrt.org/openwrt/trunk/package/uhttpd/src@32651 3c298f89-4303-0410-b956-a3cf2f4a3e73
* [package] uhttpd: do not subscribe to epoll write eventsjow2012-07-061-0/+3
| | | | | | | | Watch child read pipe end for data instead of relying on socket write notification to process cgi data, should lower cpu consumption during requests on weaker devices. git-svn-id: svn://svn.openwrt.org/openwrt/trunk/package/uhttpd/src@32640 3c298f89-4303-0410-b956-a3cf2f4a3e73
* [package] uhttpd:jow2012-05-281-86/+164
| | | | | | | | | | | - rewrite large parts of the server, use uloop event driven structure - support concurrent requests and make the upper limit configurable - implement initial version of HTTP-to-ubus JSON proxy and session.* namespace - add compile time support for debug information - code style changes - bump package revision git-svn-id: svn://svn.openwrt.org/openwrt/trunk/package/uhttpd/src@31931 3c298f89-4303-0410-b956-a3cf2f4a3e73
* [package] uhttpd: display errors in init script, code formatting changes, ↵jow2012-05-031-120/+124
| | | | | | bump package version git-svn-id: svn://svn.openwrt.org/openwrt/trunk/package/uhttpd/src@31572 3c298f89-4303-0410-b956-a3cf2f4a3e73
* Fixed: [PATCH 2/3] uhttpd URL-codec enhancements.jow2012-05-031-15/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | My apologies, the 2nd of those patches had a syntax error -- that's what I get for making a last-minute edit, even to the comments, without testing! :-p Here is the corrected patch. -- David From d259cff104d2084455476b82e92a3a27524f4263 Mon Sep 17 00:00:00 2001 From: David Favro <openwrt@meta-dynamic.com> Date: Fri, 27 Apr 2012 14:17:52 -0400 Subject: [PATCH] uhttpd URL-codec enhancements. * uh_urlencode() and uh_urldecode() now return an error condition for buffer-overflow and malformed-encoding rather than normal return with corrupt or truncated data. As HTTP request processing is currently implemented, this causes a 404 HTTP status returned to the client, while 400 is more appropriate. * Exposed urlencode() to Lua. * Lua's uhttpd.urlencode() and .urldecode() now raise an error condition for buffer-overflow and malformed-encoding rather than normal return with incorrect data. git-svn-id: svn://svn.openwrt.org/openwrt/trunk/package/uhttpd/src@31570 3c298f89-4303-0410-b956-a3cf2f4a3e73
* uhttpd URL-codec bug fixes.jow2012-05-031-5/+11
| | | | | | | | | | | | | | | | | | | * Fixed output-buffer-overflow bug in uh_urlencode() and uh_urldecode() [tested input-buffer index against output-buffer length]. In reality, this would not typically cause an overflow on decode, where the output string would be expected to be shorter than the input string; and uh_urlencode() seems to have been unreferenced in the source. * Fixed bug: uh_urlencode() and uh_urldecode() both read one extra byte from the input-string. While this could manifest in C code, the result was most egregious when called from Lua, where it caused an extra null byte to be embedded at the end of the output string. * uh_urlencode() cleanup: removed redundant bitwise-and. Signed-off-by: David Favro <openwrt@meta-dynamic.com> git-svn-id: svn://svn.openwrt.org/openwrt/trunk/package/uhttpd/src@31569 3c298f89-4303-0410-b956-a3cf2f4a3e73
* [package] uhttpd: cope with DES crypted passwd entries by not relying on a ↵jow2011-11-091-5/+2
| | | | | | leading dollar sign to indicate a cipher git-svn-id: svn://svn.openwrt.org/openwrt/trunk/package/uhttpd/src@28886 3c298f89-4303-0410-b956-a3cf2f4a3e73
* [package] uhttpd: rework CyaSSL and OpenSSL integration; move protected ↵jow2011-11-051-35/+44
| | | | | | recv() and send() operations below the ssl layer - fixes hangs when accessing via https git-svn-id: svn://svn.openwrt.org/openwrt/trunk/package/uhttpd/src@28761 3c298f89-4303-0410-b956-a3cf2f4a3e73
* [package] uhttpd: protect tcp receive operations with select, make tcp ↵jow2011-01-091-7/+23
| | | | | | keep-alive optional (#8272) git-svn-id: svn://svn.openwrt.org/openwrt/trunk/package/uhttpd/src@24952 3c298f89-4303-0410-b956-a3cf2f4a3e73
* [package] uhttpd: redirect to same location with trailing slash appended if ↵jow2010-11-101-2/+19
| | | | | | directories are requested git-svn-id: svn://svn.openwrt.org/openwrt/trunk/package/uhttpd/src@23952 3c298f89-4303-0410-b956-a3cf2f4a3e73
* [package] uhttpd: make it work without shadow password supportjow2010-11-061-1/+8
| | | | git-svn-id: svn://svn.openwrt.org/openwrt/trunk/package/uhttpd/src@23897 3c298f89-4303-0410-b956-a3cf2f4a3e73
* [package] uhttpd: fix segfault triggered by Basic Auth checkingjow2010-08-251-2/+0
| | | | git-svn-id: svn://svn.openwrt.org/openwrt/trunk/package/uhttpd/src@22805 3c298f89-4303-0410-b956-a3cf2f4a3e73
* [package] uhttpd:jow2010-08-181-14/+13
| | | | | | | | | - fix parsing of interpreter entries in the config file, fixes serving of static files as .cgi with X-Wrt - better cope with connection aborts, especially during header transfer - fix return value checking of TLS reads and writes, solves some blocking issues git-svn-id: svn://svn.openwrt.org/openwrt/trunk/package/uhttpd/src@22692 3c298f89-4303-0410-b956-a3cf2f4a3e73
* [package] uhttpd:jow2010-08-141-47/+76
| | | | | | | | | - more robust handling of network failures on static file serving - support unlimited amount of authentication realms, listener and client sockets - support for interpreters (.php => /usr/bin/php-cgi) git-svn-id: svn://svn.openwrt.org/openwrt/trunk/package/uhttpd/src@22630 3c298f89-4303-0410-b956-a3cf2f4a3e73
* [package] uhttpd: add option to reject requests from RFC1918 IPs to public ↵jow2010-08-111-0/+15
| | | | | | server IPs (DNS rebinding countermeasure) git-svn-id: svn://svn.openwrt.org/openwrt/trunk/package/uhttpd/src@22589 3c298f89-4303-0410-b956-a3cf2f4a3e73
* [package] uhttpd:jow2010-07-231-4/+20
| | | | | | | | | | | - fix a compile warning - support custom index file names - support custom error pages (or cgi handler) - add option to disable directory listings - add REDIRECT_STATUS for CGI requests, fixes php-cgi git-svn-id: svn://svn.openwrt.org/openwrt/trunk/package/uhttpd/src@22366 3c298f89-4303-0410-b956-a3cf2f4a3e73
* [package] uhttpd:jow2010-04-241-2/+6
| | | | | | | | | - ignore authentication realms that refer to user accounts with no password set yet (X-Wrt compatibility) - fix off-by-one in CGI header parsing, fixes cgi programs that emit bad header lines (AsteriskGUI compatibility) - bump version git-svn-id: svn://svn.openwrt.org/openwrt/trunk/package/uhttpd/src@21121 3c298f89-4303-0410-b956-a3cf2f4a3e73
* [package] uhttpd: fix bug in path canonization introduced by r20883jow2010-04-151-2/+3
| | | | git-svn-id: svn://svn.openwrt.org/openwrt/trunk/package/uhttpd/src@20885 3c298f89-4303-0410-b956-a3cf2f4a3e73
* [package] uhttpd:jow2010-04-151-4/+78
| | | | | | | | | - make network timeout configurable, increase default to 30 seconds (#7067) - follow symlinks in docroot and add option to disable that - fix mimetype detection for files with combined extensions (.tar.gz, ...) git-svn-id: svn://svn.openwrt.org/openwrt/trunk/package/uhttpd/src@20883 3c298f89-4303-0410-b956-a3cf2f4a3e73
* [package] uhttpd: block SIGCHLD until it is expected (#6957)jow2010-03-271-0/+19
| | | | git-svn-id: svn://svn.openwrt.org/openwrt/trunk/package/uhttpd/src@20513 3c298f89-4303-0410-b956-a3cf2f4a3e73
* [package] add uhttpd (moved from LuCI trunk)jow2010-03-251-0/+749
git-svn-id: svn://svn.openwrt.org/openwrt/trunk/package/uhttpd/src@20428 3c298f89-4303-0410-b956-a3cf2f4a3e73