summaryrefslogtreecommitdiff
path: root/www-servers
diff options
context:
space:
mode:
Diffstat (limited to 'www-servers')
-rw-r--r--www-servers/thttpd/Manifest7
-rw-r--r--www-servers/thttpd/files/thttpd-2.25b-fix-illegal-path-info.patch17
-rw-r--r--www-servers/thttpd/files/thttpd-2.25b-glibc-2.10.patch21
-rw-r--r--www-servers/thttpd/files/thttpd-2.25b-monolithic-timer.patch126
-rw-r--r--www-servers/thttpd/files/thttpd-2.25b-respect-CFLAGS--dont-link-static.patch55
-rw-r--r--www-servers/thttpd/files/thttpd-2.25b-use-Status-header.patch12
-rw-r--r--www-servers/thttpd/files/thttpd-2.25b-use-X-Forwarded-For-header.patch15
-rw-r--r--www-servers/thttpd/thttpd-2.25b-r8.ebuild78
8 files changed, 331 insertions, 0 deletions
diff --git a/www-servers/thttpd/Manifest b/www-servers/thttpd/Manifest
index cfeec09b..74880559 100644
--- a/www-servers/thttpd/Manifest
+++ b/www-servers/thttpd/Manifest
@@ -4,7 +4,14 @@ AUX thttpd-2.25/fix-insecure-tmp-creation-CVE-2005-3124.diff 724 RMD160 45ebedb4
AUX thttpd-2.25/thttpd.conf.sample 672 RMD160 fd44c3f0c094b06aa6a18ff2b360e4cf9174ffc5 SHA1 2bd69756e0c17fe5e79a4eb76486d300defbd671 SHA256 36c778f749a1277569c72b23f9c4e25b80e10c7c74a43f493c99648ec8e5b787
AUX thttpd-2.25/thttpd.confd 1152 RMD160 78503da6afa0bae20ecace503a3f5f8b7532c4ee SHA1 8599769e121d620eea18b27d51ce3d85414ee75d SHA256 cb723bdc62b339a20c238989d45d26bfcd79fa3a8d31e9bd666fdef979c31c54
AUX thttpd-2.25/thttpd.init 745 RMD160 cb2eda2714728f8cee568b83013f3b5bb70974e7 SHA1 83fdd54a3ac959dc5c6a066a181a41c1d898ed9c SHA256 5e4512079ef620a442833a3ff05c0c4ac2856c6c65cc13da8191bd67d0b1b5da
+AUX thttpd-2.25b-fix-illegal-path-info.patch 646 RMD160 e83cc6adcd4ac49893922b38157301b5d472b4b3 SHA1 2822d63bb8c9eec63280071d8d52afff2d860c12 SHA256 7dd3de6fea9de73b3f8352ad4b61d0d0d758edf4cf51b32d68e96eddeca3c16a
+AUX thttpd-2.25b-glibc-2.10.patch 691 RMD160 0fa29c1e864e75fd4a0e0dd097a304435379f63d SHA1 f7a7d121bbfcbfc87d3c500743484db9b415094c SHA256 30ad7d07c03b45497e8067dd9d5ef2abe2a8fc86de7ce40184c178144b3f03b3
+AUX thttpd-2.25b-monolithic-timer.patch 3764 RMD160 630a9ecf7f986156cd3e886357427d668e9392c5 SHA1 d8459c47e7596a6a0bf95634ef1575c35e52e0ef SHA256 b37d4a3b32fd30bf21b307a865dc4bb04d97cd846037fdb002847164b6668f56
+AUX thttpd-2.25b-respect-CFLAGS--dont-link-static.patch 1722 RMD160 af3b614bc3b9f9f916d2097559766473a29d969c SHA1 53b0ecba535daa8d1825fc5f878a06e66a81ffbb SHA256 5916e36cc5666e8f07d5bfb096fa2a139d637d28d5ed763679f3ff0929dbfa49
+AUX thttpd-2.25b-use-Status-header.patch 486 RMD160 51cc1029b88f8527ff8d6c5aececba33a9d4d06a SHA1 9610f7b002d6679b625959edbdea51e1350168bd SHA256 bd7b51245a96f876160d3d97da665d646347f768d9f8b73135efdeb133195bb2
+AUX thttpd-2.25b-use-X-Forwarded-For-header.patch 606 RMD160 b3f7c330a8fb9bb2c036a83527f5e536d559bacb SHA1 0495d26c4827151a306329aff5c9c123ac278d1c SHA256 9db45110e0729b0f5ff5ea65ca1ebbf636e3cd41afcc9572cc6b477035798fd9
AUX thttpd-getline.diff 600 RMD160 f8b1a1407c8371bfaafb0af104bc0f3104db9db0 SHA1 c8cf581642db84095c35df716b896f34dbca4917 SHA256 772092f58b93524571eb87a82906d25b5fb32c9040ea328d83aab4a5740927be
AUX thttpd.logrotate 197 RMD160 28c782571b226e49680a80bcbe5313ccc2a92d5c SHA1 384127ca1725a08fcfcd08de46a200c53966c24e SHA256 0399d9fdc31a5555307d33c4744b21271e9d7d4d6ded78573fb9b2210f593bc6
DIST thttpd-2.25b.tar.gz 132363 RMD160 15020e8d04d27b30c4da3104387a281e35d58025 SHA1 51bc25ef035d7557c869a02ce353580a1cadfa2c SHA256 4ceaa30ef55702d5cfdffdccd3a2dee8d3090e852c18c7ce8d17d692ad0bf024
EBUILD thttpd-2.25b-r7.ebuild 1573 RMD160 b9206ef010bd96281ce0b2e00c83e131ab431dcd SHA1 80f43f83abb9a831cec7ccee948c1ce6b8882d78 SHA256 b7148c079ea0337ae6783afdf28c379333441343be9fd7a6511b13043553dee6
+EBUILD thttpd-2.25b-r8.ebuild 1969 RMD160 65dc049eb5badb39a183ab24dca533b51bcba11b SHA1 f1509519bf864c14f2b8e4f043ad05b422018be5 SHA256 c22ec026c5fafb5e4d2de67e221bfe83527a34c067e96352f3c39a0fc8b62b8c
diff --git a/www-servers/thttpd/files/thttpd-2.25b-fix-illegal-path-info.patch b/www-servers/thttpd/files/thttpd-2.25b-fix-illegal-path-info.patch
new file mode 100644
index 00000000..d1688f14
--- /dev/null
+++ b/www-servers/thttpd/files/thttpd-2.25b-fix-illegal-path-info.patch
@@ -0,0 +1,17 @@
+diff -Naur thttpd-2.25b.orig/libhttpd.c thttpd-2.25b/libhttpd.c
+--- thttpd-2.25b.orig/libhttpd.c 2007-10-14 10:09:55.000000000 +0000
++++ thttpd-2.25b/libhttpd.c 2007-10-14 10:09:11.000000000 +0000
+@@ -2322,8 +2320,11 @@
+ {
+ int i;
+ i = strlen( hc->origfilename ) - strlen( hc->pathinfo );
+- if ( i > 0 && strcmp( &hc->origfilename[i], hc->pathinfo ) == 0 )
+- hc->origfilename[i - 1] = '\0';
++ if ( strcmp( &hc->origfilename[i], hc->pathinfo ) == 0 )
++ {
++ if ( i == 0 ) hc->origfilename[0] = '\0';
++ else hc->origfilename[i - 1] = '\0';
++ }
+ }
+
+ /* If the expanded filename is an absolute path, check that it's still
diff --git a/www-servers/thttpd/files/thttpd-2.25b-glibc-2.10.patch b/www-servers/thttpd/files/thttpd-2.25b-glibc-2.10.patch
new file mode 100644
index 00000000..c9722782
--- /dev/null
+++ b/www-servers/thttpd/files/thttpd-2.25b-glibc-2.10.patch
@@ -0,0 +1,21 @@
+diff -ur thttpd-2.25b.orig/extras/htpasswd.c thttpd-2.25b/extras/htpasswd.c
+--- thttpd-2.25b.orig/extras/htpasswd.c 2001-12-19 02:08:08.000000000 +0200
++++ thttpd-2.25b/extras/htpasswd.c 2009-08-09 16:40:06.000000000 +0300
+@@ -49,7 +49,7 @@
+ while((line[y++] = line[x++]));
+ }
+
+-static int getline(char *s, int n, FILE *f) {
++static int get_line(char *s, int n, FILE *f) {
+ register int i=0;
+
+ while(1) {
+@@ -189,7 +189,7 @@
+ strcpy(user,argv[2]);
+
+ found = 0;
+- while(!(getline(line,MAX_STRING_LEN,f))) {
++ while(!(get_line(line,MAX_STRING_LEN,f))) {
+ if(found || (line[0] == '#') || (!line[0])) {
+ putline(tfp,line);
+ continue;
diff --git a/www-servers/thttpd/files/thttpd-2.25b-monolithic-timer.patch b/www-servers/thttpd/files/thttpd-2.25b-monolithic-timer.patch
new file mode 100644
index 00000000..9ff38aec
--- /dev/null
+++ b/www-servers/thttpd/files/thttpd-2.25b-monolithic-timer.patch
@@ -0,0 +1,126 @@
+diff -Nru thttpd-2.25b.orig/configure.in thttpd-2.25b/configure.in
+--- thttpd-2.25b.orig/configure.in 2003-12-25 20:41:13.000000000 +0200
++++ thttpd-2.25b/configure.in 2010-07-08 00:04:25.000000000 +0300
+@@ -123,6 +123,8 @@
+ ;;
+ esac
+
++AC_CHECK_LIB(rt, clock_gettime)
++
+ AC_ACME_TM_GMTOFF
+ AC_ACME_INT64T
+ AC_ACME_SOCKLENT
+diff -Nru thttpd-2.25b.orig/thttpd.c thttpd-2.25b/thttpd.c
+--- thttpd-2.25b.orig/thttpd.c 2003-12-25 21:06:52.000000000 +0200
++++ thttpd-2.25b/thttpd.c 2010-07-08 00:41:28.000000000 +0300
+@@ -742,7 +742,7 @@
+ }
+
+ /* Main loop. */
+- (void) gettimeofday( &tv, (struct timezone*) 0 );
++ tmr_prepare_timeval( &tv );
+ while ( ( ! terminate ) || num_connects > 0 )
+ {
+ /* Do we need to re-open the log file? */
+@@ -761,7 +761,7 @@
+ syslog( LOG_ERR, "fdwatch - %m" );
+ exit( 1 );
+ }
+- (void) gettimeofday( &tv, (struct timezone*) 0 );
++ tmr_prepare_timeval( &tv );
+
+ if ( num_ready == 0 )
+ {
+diff -Nru thttpd-2.25b.orig/timers.c thttpd-2.25b/timers.c
+--- thttpd-2.25b.orig/timers.c 2002-08-22 04:04:12.000000000 +0300
++++ thttpd-2.25b/timers.c 2010-07-08 11:47:03.000000000 +0300
+@@ -41,7 +41,13 @@
+
+ ClientData JunkClientData;
+
+-
++#undef HAVE_LIBRT_MONO
++#if defined(HAVE_LIBRT) && defined(CLOCK_MONOTONIC)
++#define HAVE_LIBRT_MONO
++#include <time.h>
++static int use_monotonic = 0; /* monotonic clock runtime availability flag */
++static struct timeval tv_diff; /* system time - monotonic difference at start */
++#endif
+
+ static unsigned int
+ hash( Timer* t )
+@@ -145,6 +151,26 @@
+ timers[h] = (Timer*) 0;
+ free_timers = (Timer*) 0;
+ alloc_count = active_count = free_count = 0;
++
++ /* Check for monotonic clock availability */
++#ifdef HAVE_LIBRT_MONO
++ struct timespec ts;
++ struct timeval tv_start, tv;
++
++ /* Try to get monotonic clock time */
++ if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0) {
++ use_monotonic = 1;
++
++ /* Get current system time */
++ (void) gettimeofday( &tv_start , (struct timezone*) 0 );
++ tv.tv_sec = ts.tv_sec;
++ tv.tv_usec = ts.tv_nsec / 1000L;
++ /* Calculate and save the difference: tv_start is since the Epoch, so tv_start > ts
++ tv_diff = tv_start - tv */
++ timersub( &tv_start, &tv, &tv_diff );
++ }
++#endif
++
+ }
+
+
+@@ -176,7 +202,7 @@
+ if ( nowP != (struct timeval*) 0 )
+ t->time = *nowP;
+ else
+- (void) gettimeofday( &t->time, (struct timezone*) 0 );
++ tmr_prepare_timeval( &t->time );
+ t->time.tv_sec += msecs / 1000L;
+ t->time.tv_usec += ( msecs % 1000L ) * 1000L;
+ if ( t->time.tv_usec >= 1000000L )
+@@ -349,3 +375,27 @@
+ if ( active_count + free_count != alloc_count )
+ syslog( LOG_ERR, "timer counts don't add up!" );
+ }
++
++/* Fill timeval structure for further usage by the package. */
++void
++tmr_prepare_timeval( struct timeval *tv )
++{
++#ifdef HAVE_LIBRT_MONO
++ struct timespec ts;
++ struct timeval tv0;
++
++ if (use_monotonic) { /* use monotonic clock source ? */
++ if (clock_gettime(CLOCK_MONOTONIC,&ts) < 0) {
++ perror("clock_gettime"); return;
++ }
++ tv0.tv_sec = ts.tv_sec;
++ tv0.tv_usec = ts.tv_nsec / 1000L;
++ /* Return system time value like it was running accurately */
++ timeradd( &tv_diff, &tv0, tv );
++ } else {
++#endif
++ (void) gettimeofday( tv , (struct timezone*) 0 );
++#ifdef HAVE_LIBRT_MONO
++ }
++#endif
++}
+diff -Nru thttpd-2.25b.orig/timers.h thttpd-2.25b/timers.h
+--- thttpd-2.25b.orig/timers.h 2001-04-13 08:37:41.000000000 +0300
++++ thttpd-2.25b/timers.h 2010-07-08 00:09:15.000000000 +0300
+@@ -106,4 +106,7 @@
+ /* Generate debugging statistics syslog message. */
+ extern void tmr_logstats( long secs );
+
++/* Fill timeval structure for further usage by the package. */
++extern void tmr_prepare_timeval( struct timeval *tv );
++
+ #endif /* _TIMERS_H_ */
diff --git a/www-servers/thttpd/files/thttpd-2.25b-respect-CFLAGS--dont-link-static.patch b/www-servers/thttpd/files/thttpd-2.25b-respect-CFLAGS--dont-link-static.patch
new file mode 100644
index 00000000..ce915c70
--- /dev/null
+++ b/www-servers/thttpd/files/thttpd-2.25b-respect-CFLAGS--dont-link-static.patch
@@ -0,0 +1,55 @@
+diff -Naur thttpd-2.25b.orig/cgi-src/Makefile.in thttpd-2.25b/cgi-src/Makefile.in
+--- thttpd-2.25b.orig/cgi-src/Makefile.in 2010-10-28 23:33:28.000000000 +0200
++++ thttpd-2.25b/cgi-src/Makefile.in 2010-10-29 00:05:43.000000000 +0200
+@@ -31,10 +31,9 @@
+ MANDIR = @mandir@
+
+ CC = @CC@
+-CCOPT = @V_CCOPT@
+ DEFS = @DEFS@
+ INCLS = -I..
+-CFLAGS = $(CCOPT) $(DEFS) $(INCLS)
++CFLAGS += $(DEFS) $(INCLS)
+ LDFLAGS = @LDFLAGS@ @V_STATICFLAG@
+ LIBS = @LIBS@
+ NETLIBS = @V_NETLIBS@
+diff -Naur thttpd-2.25b.orig/extras/Makefile.in thttpd-2.25b/extras/Makefile.in
+--- thttpd-2.25b.orig/extras/Makefile.in 2010-10-28 23:33:28.000000000 +0200
++++ thttpd-2.25b/extras/Makefile.in 2010-10-29 00:06:36.000000000 +0200
+@@ -32,11 +32,9 @@
+ MANDIR = @mandir@
+
+ CC = @CC@
+-CCOPT = @V_CCOPT@
+ DEFS = @DEFS@
+ INCLS = -I..
+-CFLAGS = $(CCOPT) $(DEFS) $(INCLS)
+-STATICFLAG = @V_STATICFLAG@
++CFLAGS += $(DEFS) $(INCLS)
+ LDFLAGS = @LDFLAGS@
+ LIBS = @LIBS@
+ NETLIBS = @V_NETLIBS@
+@@ -59,7 +57,7 @@
+ $(CC) $(CFLAGS) -DWEBDIR=\"$(WEBDIR)\" -c makeweb.c
+
+ htpasswd: htpasswd.o
+- $(CC) $(LDFLAGS) $(STATICFLAG) htpasswd.o -o htpasswd $(LIBS)
++ $(CC) $(LDFLAGS) htpasswd.o -o htpasswd $(LIBS)
+
+ htpasswd.o: htpasswd.c ../config.h
+ $(CC) $(CFLAGS) -DWEBDIR=\"$(WEBDIR)\" -c htpasswd.c
+diff -Naur thttpd-2.25b.orig/Makefile.in thttpd-2.25b/Makefile.in
+--- thttpd-2.25b.orig/Makefile.in 2010-10-28 23:33:28.000000000 +0200
++++ thttpd-2.25b/Makefile.in 2010-10-29 00:05:43.000000000 +0200
+@@ -47,10 +47,9 @@
+ # You shouldn't need to edit anything below here.
+
+ CC = @CC@
+-CCOPT = @V_CCOPT@
+ DEFS = @DEFS@
+ INCLS = -I.
+-CFLAGS = $(CCOPT) $(DEFS) $(INCLS)
++CFLAGS += $(DEFS) $(INCLS)
+ LDFLAGS = @LDFLAGS@
+ LIBS = @LIBS@
+ NETLIBS = @V_NETLIBS@
diff --git a/www-servers/thttpd/files/thttpd-2.25b-use-Status-header.patch b/www-servers/thttpd/files/thttpd-2.25b-use-Status-header.patch
new file mode 100644
index 00000000..6aaae5a5
--- /dev/null
+++ b/www-servers/thttpd/files/thttpd-2.25b-use-Status-header.patch
@@ -0,0 +1,12 @@
+diff -Naur thttpd-2.25b.orig/libhttpd.c thttpd-2.25b/libhttpd.c
+--- thttpd-2.25b.orig/libhttpd.c 2007-10-14 10:09:11.000000000 +0000
++++ thttpd-2.25b/libhttpd.c 2007-10-14 10:21:37.000000000 +0000
+@@ -3279,7 +3279,7 @@
+ cp += strspn( cp, " \t" );
+ status = atoi( cp );
+ }
+- if ( ( cp = strstr( headers, "Location:" ) ) != (char*) 0 &&
++ else if ( ( cp = strstr( headers, "Location:" ) ) != (char*) 0 &&
+ cp < br &&
+ ( cp == headers || *(cp-1) == '\012' ) )
+ status = 302;
diff --git a/www-servers/thttpd/files/thttpd-2.25b-use-X-Forwarded-For-header.patch b/www-servers/thttpd/files/thttpd-2.25b-use-X-Forwarded-For-header.patch
new file mode 100644
index 00000000..0fec25ef
--- /dev/null
+++ b/www-servers/thttpd/files/thttpd-2.25b-use-X-Forwarded-For-header.patch
@@ -0,0 +1,15 @@
+--- thttpd-2.25b/libhttpd.c 2003-12-25 20:06:05.000000000 +0100
++++ thttpd-2.25b-patched/libhttpd.c 2005-01-09 00:26:04.867255248 +0100
+@@ -2207,6 +2207,12 @@
+ if ( strcasecmp( cp, "keep-alive" ) == 0 )
+ hc->keep_alive = 1;
+ }
++ else if ( strncasecmp( buf, "X-Forwarded-For:", 16 ) == 0 )
++ { // Use real IP if available
++ cp = &buf[16];
++ cp += strspn( cp, " \t" );
++ inet_aton( cp, &(hc->client_addr.sa_in.sin_addr) );
++ }
+ #ifdef LOG_UNKNOWN_HEADERS
+ else if ( strncasecmp( buf, "Accept-Charset:", 15 ) == 0 ||
+ strncasecmp( buf, "Accept-Language:", 16 ) == 0 ||
diff --git a/www-servers/thttpd/thttpd-2.25b-r8.ebuild b/www-servers/thttpd/thttpd-2.25b-r8.ebuild
new file mode 100644
index 00000000..b9baf61f
--- /dev/null
+++ b/www-servers/thttpd/thttpd-2.25b-r8.ebuild
@@ -0,0 +1,78 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/www-servers/thttpd/thttpd-2.25b-r8.ebuild,v 1.1 2010/10/28 22:25:24 bangert Exp $
+
+EAPI="3"
+
+WANT_AUTOCONF=2.1
+inherit eutils flag-o-matic autotools
+
+MY_P="${P%[a-z]*}"
+
+DESCRIPTION="Small and fast multiplexing webserver."
+HOMEPAGE="http://www.acme.com/software/thttpd/"
+SRC_URI="http://www.acme.com/software/thttpd/${P}.tar.gz"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64 ~hppa ~mips ~ppc ~sparc ~x86 ~x86-fbsd"
+IUSE="static"
+
+THTTPD_USER=thttpd
+THTTPD_GROUP=thttpd
+
+src_prepare() {
+ epatch "${FILESDIR}"/${MY_P}/*.diff
+ epatch "${FILESDIR}"/${P}-glibc-2.10.patch
+ epatch "${FILESDIR}"/${P}-fix-illegal-path-info.patch
+ epatch "${FILESDIR}"/${P}-monolithic-timer.patch
+ epatch "${FILESDIR}"/${P}-use-Status-header.patch
+ epatch "${FILESDIR}"/${P}-use-X-Forwarded-For-header.patch
+ epatch "${FILESDIR}"/${P}-respect-CFLAGS--dont-link-static.patch
+ eautoreconf
+}
+
+pkg_setup() {
+ ebegin "Creating thttpd user and group"
+ enewgroup ${THTTPD_GROUP}
+ enewuser ${THTTPD_USER} -1 -1 -1 ${THTTPD_GROUP}
+ eend ${?}
+}
+
+src_configure() {
+ use static && append-ldflags -static
+
+ CC="$(tc-getCC)" \
+ econf || die "econf failed"
+}
+
+src_compile() {
+ emake CC="$(tc-getCC)" || die "emake failed"
+}
+
+src_install () {
+ dodir /usr/share/man/man1
+ make prefix="${D}"/usr \
+ MANDIR="${D}"/usr/share/man \
+ WEBGROUP=${THTTPD_GROUP} \
+ WEBDIR="${D}"/var/www/localhost \
+ "$@" install || die "make install failed"
+
+ mv "${D}"/usr/sbin/{,th_}htpasswd
+ mv "${D}"/usr/share/man/man1/{,th_}htpasswd.1
+
+ newinitd "${FILESDIR}"/${MY_P}/thttpd.init thttpd
+ newconfd "${FILESDIR}"/${MY_P}/thttpd.confd thttpd
+
+ dodoc README INSTALL TODO
+
+ insinto /etc/logrotate.d
+ newins "${FILESDIR}/thttpd.logrotate" thttpd
+
+ insinto /etc/thttpd
+ doins "${FILESDIR}"/${MY_P}/thttpd.conf.sample
+}
+
+pkg_postinst() {
+ elog "Adjust THTTPD_DOCROOT in /etc/conf.d/thttpd !"
+}