summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2015-08-08 13:49:04 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2015-08-08 17:38:18 -0700
commit56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch)
tree3f91093cdb475e565ae857f1c5a7fd339e2d781e /www-servers/thttpd
downloadgentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip
proj/gentoo: Initial commit
This commit represents a new era for Gentoo: Storing the gentoo-x86 tree in Git, as converted from CVS. This commit is the start of the NEW history. Any historical data is intended to be grafted onto this point. Creation process: 1. Take final CVS checkout snapshot 2. Remove ALL ChangeLog* files 3. Transform all Manifests to thin 4. Remove empty Manifests 5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$ 5.1. Do not touch files with -kb/-ko keyword flags. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'www-servers/thttpd')
-rw-r--r--www-servers/thttpd/Manifest2
-rw-r--r--www-servers/thttpd/files/thttpd-fix-world-readable-log.patch59
-rw-r--r--www-servers/thttpd/files/thttpd-renamed-htpasswd.patch108
-rw-r--r--www-servers/thttpd/files/thttpd.conf.sample38
-rw-r--r--www-servers/thttpd/files/thttpd.confd.135
-rw-r--r--www-servers/thttpd/files/thttpd.init.134
-rw-r--r--www-servers/thttpd/files/thttpd.logrotate12
-rw-r--r--www-servers/thttpd/files/thttpd.service12
-rw-r--r--www-servers/thttpd/metadata.xml8
-rw-r--r--www-servers/thttpd/thttpd-2.26.4-r3.ebuild74
-rw-r--r--www-servers/thttpd/thttpd-2.27.0.ebuild81
-rw-r--r--www-servers/thttpd/thttpd-9999.ebuild81
12 files changed, 544 insertions, 0 deletions
diff --git a/www-servers/thttpd/Manifest b/www-servers/thttpd/Manifest
new file mode 100644
index 00000000000..65853b6ecb9
--- /dev/null
+++ b/www-servers/thttpd/Manifest
@@ -0,0 +1,2 @@
+DIST sthttpd-2.26.4.tar.gz 194544 SHA256 78e87979140cbda123c81b4051552242dbbffb5dec1a17e5f95ec4826b1eaddb SHA512 64d0ab4720cc0a8926bc8537d335f5238e5343cf6caad837fe09fe46bfaaaa7013b690193905b3db31a5e945141e7fb3aca52355459ff151ce56b30cfefccd87 WHIRLPOOL e38cce33dd417ce8e30426d0764797e24ebfab2060bacf2f27ee2717b2025e48e6f32245cc6a5ebfed856f8755098f1540ec7ed2005aad1aeff65454dd731c1a
+DIST sthttpd-2.27.0.tar.gz 206781 SHA256 97d660a881331e93818e872ce11536f461105d70a18dfc5de5895851c4b2afdb SHA512 78945867a01de2f9019deb2d1f21cdedf675c9d67f5de672d0d0bfdc397b444ac287a91d96976dddcdca080cc944e72dd3d1f95f31a592eb839125c494799bdc WHIRLPOOL 55ab90405b3affcb260dc4cfa14008f79cc0b2fd808686078b34ae0a6be2cc4941241406d78f9c2d06360ab6a07f1bf4abc1cf814a46ebe136f031058026419f
diff --git a/www-servers/thttpd/files/thttpd-fix-world-readable-log.patch b/www-servers/thttpd/files/thttpd-fix-world-readable-log.patch
new file mode 100644
index 00000000000..5c011bac52b
--- /dev/null
+++ b/www-servers/thttpd/files/thttpd-fix-world-readable-log.patch
@@ -0,0 +1,59 @@
+From d2e186dbd58d274a0dea9b59357edc8498b5388d Mon Sep 17 00:00:00 2001
+From: "Anthony G. Basile" <blueness@gentoo.org>
+Date: Tue, 26 Feb 2013 14:28:26 -0500
+Subject: [PATCH] src/thttpd.c: Fix world readable log, CVE-2013-0348.
+
+Make sure that the logfile is created or reopened as read/write
+by thttpd user only.
+
+X-gentoo-Bug: 458896
+X-gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=458896
+Reported-by: Agostino Sarubbo <ago@gentoo.org>
+Signed-off-by: Anthony G. Basile <basile@opensource.dyc.edu>
+---
+ src/thttpd.c | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/src/thttpd.c b/src/thttpd.c
+index 019b8c0..f33a7a7 100644
+--- a/src/thttpd.c
++++ b/src/thttpd.c
+@@ -326,6 +326,7 @@ static void
+ re_open_logfile( void )
+ {
+ FILE* logfp;
++ int retchmod;
+
+ if ( no_log || hs == (httpd_server*) 0 )
+ return;
+@@ -335,7 +336,8 @@ re_open_logfile( void )
+ {
+ syslog( LOG_NOTICE, "re-opening logfile" );
+ logfp = fopen( logfile, "a" );
+- if ( logfp == (FILE*) 0 )
++ retchmod = chmod( logfile, S_IRUSR|S_IWUSR );
++ if ( logfp == (FILE*) 0 || retchmod != 0 )
+ {
+ syslog( LOG_CRIT, "re-opening %.80s - %m", logfile );
+ return;
+@@ -355,6 +357,7 @@ main( int argc, char** argv )
+ gid_t gid = 32767;
+ char cwd[MAXPATHLEN+1];
+ FILE* logfp;
++ int retchmod;
+ int num_ready;
+ int cnum;
+ connecttab* c;
+@@ -424,7 +427,8 @@ main( int argc, char** argv )
+ else
+ {
+ logfp = fopen( logfile, "a" );
+- if ( logfp == (FILE*) 0 )
++ retchmod = chmod( logfile, S_IRUSR|S_IWUSR );
++ if ( logfp == (FILE*) 0 || retchmod != 0 )
+ {
+ syslog( LOG_CRIT, "%.80s - %m", logfile );
+ perror( logfile );
+--
+1.7.12.4
+
diff --git a/www-servers/thttpd/files/thttpd-renamed-htpasswd.patch b/www-servers/thttpd/files/thttpd-renamed-htpasswd.patch
new file mode 100644
index 00000000000..31e68429dbd
--- /dev/null
+++ b/www-servers/thttpd/files/thttpd-renamed-htpasswd.patch
@@ -0,0 +1,108 @@
+diff --git a/configure.ac b/configure.ac
+index 2c2dfae..e028a0d 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -42,12 +42,6 @@ if test "x${WEBDIR}" = "x" ; then
+ WEBDIR='/usr/local/www'
+ fi
+
+-AC_ARG_VAR(WEBGROUP, [The group that the web server will run as])
+-
+-if test "x${WEBGROUP}" = "x" ; then
+- WEBGROUP='thttpd'
+-fi
+-
+ AC_CONFIG_FILES([Makefile
+ docs/Makefile
+ extras/Makefile
+diff --git a/docs/Makefile.am b/docs/Makefile.am
+index 303c25f..2823290 100644
+--- a/docs/Makefile.am
++++ b/docs/Makefile.am
+@@ -1 +1 @@
+-dist_man_MANS = htpasswd.1 makeweb.1 redirect.8 ssi.8 syslogtocern.8 thttpd.8
++dist_man_MANS = th_htpasswd.1 makeweb.1 redirect.8 ssi.8 syslogtocern.8 thttpd.8
+diff --git a/docs/htpasswd.1 b/docs/htpasswd.1
+deleted file mode 100644
+index 1124b02..0000000
+--- a/docs/htpasswd.1
++++ /dev/null
+@@ -1,16 +0,0 @@
+-.TH htpasswd 1 "05 May 1998"
+-.SH NAME
+-htpasswd - manipulate HTTP-server password files
+-.SH SYNOPSIS
+-.B htpasswd
+-.RB [ -c ]
+-.I passwordfile
+-.I username
+-.SH DESCRIPTION
+-.PP
+-Sets a user's password in an httpd-style password file.
+-The -c flag creates a new file.
+-.SH AUTHOR
+-Rob McCool.
+-Modified 29aug97 by Jef Poskanzer to accept new password on stdin,
+-if stdin is a pipe or file. This is necessary for use from CGI.
+diff --git a/docs/th_htpasswd.1 b/docs/th_htpasswd.1
+new file mode 100644
+index 0000000..f524af9
+--- /dev/null
++++ b/docs/th_htpasswd.1
+@@ -0,0 +1,16 @@
++.TH th_htpasswd 1 "05 May 1998"
++.SH NAME
++th_htpasswd - manipulate HTTP-server password files
++.SH SYNOPSIS
++.B th_htpasswd
++.RB [ -c ]
++.I passwordfile
++.I username
++.SH DESCRIPTION
++.PP
++Sets a user's password in an httpd-style password file.
++The -c flag creates a new file.
++.SH AUTHOR
++Rob McCool.
++Modified 29aug97 by Jef Poskanzer to accept new password on stdin,
++if stdin is a pipe or file. This is necessary for use from CGI.
+diff --git a/docs/thttpd.8 b/docs/thttpd.8
+index a0fd334..78af884 100644
+--- a/docs/thttpd.8
++++ b/docs/thttpd.8
+@@ -270,7 +270,7 @@ called .htpasswd by default.
+ This file is formatted as the familiar colon-separated
+ username/encrypted-password pair, records delimited by newlines.
+ The protection does not carry over to subdirectories.
+-The utility program htpasswd(1) is included to help create and
++The utility program th_htpasswd(1) is included to help create and
+ modify .htpasswd files.
+ .PP
+ Relevant thttpd.h option: AUTH_FILE
+@@ -562,7 +562,7 @@ This is a little tricky to set up correctly, for instance if you are using
+ chroot() then the log file must be within the chroot tree, but it's
+ definitely doable.
+ .SH "SEE ALSO"
+-redirect(8), ssi(8), makeweb(1), htpasswd(1), syslogtocern(8), weblog_parse(1), http_get(1)
++redirect(8), ssi(8), makeweb(1), th_htpasswd(1), syslogtocern(8), weblog_parse(1), http_get(1)
+ .SH THANKS
+ .PP
+ Many thanks to contributors, reviewers, testers:
+diff --git a/extras/Makefile.am b/extras/Makefile.am
+index b1f3b4d..ffd19d7 100644
+--- a/extras/Makefile.am
++++ b/extras/Makefile.am
+@@ -1,11 +1,7 @@
+ AM_CPPFLAGS = -DWEBDIR='"$(WEBDIR)"'
+
+-sbin_PROGRAMS = makeweb htpasswd
++sbin_PROGRAMS = makeweb th_htpasswd
+ makeweb_SOURCES = makeweb.c
+-htpasswd_SOURCES = htpasswd.c
++th_htpasswd_SOURCES = th_htpasswd.c
+
+ dist_sbin_SCRIPTS = syslogtocern
+-
+-install-exec-hook:
+- chgrp $(WEBGROUP) $(DESTDIR)$(sbindir)/makeweb
+- chmod 2751 $(DESTDIR)$(sbindir)/makeweb
diff --git a/www-servers/thttpd/files/thttpd.conf.sample b/www-servers/thttpd/files/thttpd.conf.sample
new file mode 100644
index 00000000000..462bd0c198d
--- /dev/null
+++ b/www-servers/thttpd/files/thttpd.conf.sample
@@ -0,0 +1,38 @@
+## /etc/thttpd.conf
+##
+## do not leave empty lines in here!
+## format is: key=value
+##
+## run in debug-mode?
+#debug
+##
+## what interface to bind to?
+## (default is binding to any interface)
+#host=www.example.org
+port=80
+user=thttpd
+##
+## CGI:
+## ? match a single char
+## * matches any string excluding "/"
+## ** matches any string including "/"
+## separate multiple patterns with "|"
+#cgipat=**.sh|**.cgi
+##
+## chroot:
+chroot
+#nochroot
+##
+logfile=/var/log/thttpd.log
+pidfile=/var/run/thttpd.pid
+##
+charset=iso-8859-1
+##
+## control the caching: (in secs)
+#maxage 60
+##
+## virtual hosting:
+#vhost
+##
+## cache-control: send this "max-age" in all HTTP-responses:
+#max-age=0
diff --git a/www-servers/thttpd/files/thttpd.confd.1 b/www-servers/thttpd/files/thttpd.confd.1
new file mode 100644
index 00000000000..b5f630e7ecc
--- /dev/null
+++ b/www-servers/thttpd/files/thttpd.confd.1
@@ -0,0 +1,35 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License, v2 or later
+
+## Config file for /etc/init.d/thttpd
+
+## the startup-dir of thttpd is the docroot, so we specify it here
+## and the init-script does a "cd" prior to startup:
+THTTPD_DOCROOT="/var/www/localhost"
+
+## There are 2 ways to configure thttpd:
+## 1) specify all params on the cmd-line
+## 2) use a config-file (and start with "-C <conf-file>")
+
+## For additional thttpd instances, run:
+# ln -s /etc/init.d/thttpd /etc/init.d/thttpd.$NAME
+# cp /etc/conf.d/thttpd /etc/conf.d/thttpd.$NAME
+
+## Note: 1) and 2) can be mixed but
+## the init-script set PID (option -i) to
+## /var/run/thttpd.$NAME.run
+## and logfile (option -l) to
+## /var/log/thttpd.$NAME.log
+##
+## We choose 1) here -- if you have a more complicated setup read
+## thttpd(8) for details on 2).
+
+THTTPD_OPTS="-p 80 -u thttpd -r"
+
+## For a more complex setup (e.g. cgi-support) use an external configfile:
+## comment the THTTPD_OPTS line above und use the one below.
+#THTTPD_OPTS="-C /etc/thttpd/thttpd.conf"
+
+## If you know what you are doing you can add cgi-support with the line below;
+## but you _should_ use the extern-configfile version!
+#THTTPD_OPTS="$THTTPD_OPTS -c **.cgi|**.sh"
diff --git a/www-servers/thttpd/files/thttpd.init.1 b/www-servers/thttpd/files/thttpd.init.1
new file mode 100644
index 00000000000..415ead79d6a
--- /dev/null
+++ b/www-servers/thttpd/files/thttpd.init.1
@@ -0,0 +1,34 @@
+#!/sbin/runscript
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License, v3 or later
+
+depend() {
+ need net
+ use dns logger netmount
+ after sshd
+}
+
+checkconfig() {
+ if [ ! -d "$THTTPD_DOCROOT" ]; then
+ eend 1 "THTTPD_DOCROOT not set correctly in /etc/conf.d/${SVCNAME}"
+ fi
+}
+
+start() {
+ ebegin "Starting ${SVCNAME}"
+
+ checkconfig || return 1
+
+ start-stop-daemon --quiet --start --exec /usr/sbin/thttpd \
+ --pidfile /var/run/${SVCNAME}.pid --chdir "$THTTPD_DOCROOT" -- \
+ -i /var/run/${SVCNAME}.pid \
+ -l /var/log/${SVCNAME}.log \
+ ${THTTPD_OPTS}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping ${SVCNAME}"
+ start-stop-daemon --quiet --stop --pidfile /var/run/${SVCNAME}.pid
+ eend $?
+}
diff --git a/www-servers/thttpd/files/thttpd.logrotate b/www-servers/thttpd/files/thttpd.logrotate
new file mode 100644
index 00000000000..7e75c813524
--- /dev/null
+++ b/www-servers/thttpd/files/thttpd.logrotate
@@ -0,0 +1,12 @@
+/var/log/thttpd.log {
+ daily
+ rotate 5
+ compress
+ delaycompress
+ missingok
+ notifempty
+ sharedscripts
+ postrotate
+ kill -HUP `cat /var/run/thttpd.pid 2>/dev/null` 2>/dev/null || true
+ endscript
+}
diff --git a/www-servers/thttpd/files/thttpd.service b/www-servers/thttpd/files/thttpd.service
new file mode 100644
index 00000000000..4e56c0877d7
--- /dev/null
+++ b/www-servers/thttpd/files/thttpd.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Fork of thttpd, a small, fast, multiplexing webserver.
+After=network.target
+
+[Service]
+Type=forking
+PIDFile=/var/run/thttpd.pid
+WorkingDirectory=/var/www/localhost
+ExecStart=/usr/sbin/thttpd -C /etc/thttpd/thttpd.conf
+
+[Install]
+WantedBy=multi-user.target
diff --git a/www-servers/thttpd/metadata.xml b/www-servers/thttpd/metadata.xml
new file mode 100644
index 00000000000..d67a15ac128
--- /dev/null
+++ b/www-servers/thttpd/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer>
+ <email>blueness@gentoo.org</email>
+ <name>Anthony G. Basile</name>
+</maintainer>
+</pkgmetadata>
diff --git a/www-servers/thttpd/thttpd-2.26.4-r3.ebuild b/www-servers/thttpd/thttpd-2.26.4-r3.ebuild
new file mode 100644
index 00000000000..64a5940df92
--- /dev/null
+++ b/www-servers/thttpd/thttpd-2.26.4-r3.ebuild
@@ -0,0 +1,74 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils flag-o-matic systemd toolchain-funcs user
+
+MY_P="s${P}"
+
+DESCRIPTION="Fork of thttpd, a small, fast, multiplexing webserver"
+HOMEPAGE="http://opensource.dyc.edu/sthttpd"
+SRC_URI="http://opensource.dyc.edu/pub/sthttpd/${MY_P}.tar.gz"
+S="${WORKDIR}/${MY_P}"
+
+LICENSE="BSD GPL-2"
+SLOT="0"
+KEYWORDS="amd64 arm ~hppa ~mips ppc ppc64 sparc x86 ~amd64-linux ~arm-linux ~x86-linux"
+IUSE=""
+
+RDEPEND=""
+DEPEND=""
+
+WEBROOT="/var/www/localhost"
+
+THTTPD_USER=thttpd
+THTTPD_GROUP=thttpd
+THTTPD_DOCROOT="${EPREFIX}${WEBROOT}/htdocs"
+
+DOCS=( README TODO )
+
+pkg_setup() {
+ ebegin "Creating thttpd user and group"
+ enewgroup ${THTTPD_GROUP}
+ enewuser ${THTTPD_USER} -1 -1 -1 ${THTTPD_GROUP}
+}
+
+src_prepare () {
+ epatch "${FILESDIR}"/thttpd-fix-world-readable-log.patch
+}
+
+src_configure() {
+ econf WEBDIR=${THTTPD_DOCROOT}
+}
+
+src_install () {
+ default
+
+ newinitd "${FILESDIR}"/thttpd.init.1 thttpd
+ newconfd "${FILESDIR}"/thttpd.confd.1 thttpd
+
+ insinto /etc/logrotate.d
+ newins "${FILESDIR}/thttpd.logrotate" thttpd
+
+ insinto /etc/thttpd
+ doins "${FILESDIR}"/thttpd.conf.sample
+
+ systemd_dounit "${FILESDIR}/${PN}.service"
+
+ #move htdocs to docdir, bug #429632
+ docompress -x /usr/share/doc/"${PF}"/htdocs.dist
+ mv "${ED}"${WEBROOT}/htdocs \
+ "${ED}"/usr/share/doc/"${PF}"/htdocs.dist
+ mkdir "${ED}"${WEBROOT}/htdocs
+
+ keepdir ${WEBROOT}/htdocs
+
+ chown root:${THTTPD_GROUP} "${ED}/usr/sbin/makeweb" \
+ || die "Failed chown makeweb"
+ chmod 2751 "${ED}/usr/sbin/makeweb" \
+ || die "Failed chmod makeweb"
+ chmod 755 "${ED}/usr/share/doc/${PF}/htdocs.dist/cgi-bin/printenv" \
+ || die "Failed chmod printenv"
+}
diff --git a/www-servers/thttpd/thttpd-2.27.0.ebuild b/www-servers/thttpd/thttpd-2.27.0.ebuild
new file mode 100644
index 00000000000..507e1f56aa3
--- /dev/null
+++ b/www-servers/thttpd/thttpd-2.27.0.ebuild
@@ -0,0 +1,81 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+inherit autotools eutils flag-o-matic toolchain-funcs user
+
+if [[ ${PV} = 9999* ]]
+then
+ EGIT_REPO_URI="git://opensource.dyc.edu/s${PN}.git"
+ inherit git-2
+ KEYWORDS="ppc64 sparc"
+else
+ MY_P="s${P}"
+ S="${WORKDIR}/${MY_P}"
+ SRC_URI="http://opensource.dyc.edu/pub/sthttpd/${MY_P}.tar.gz"
+ KEYWORDS="amd64 arm ~hppa ~mips ppc ppc64 sparc x86 ~amd64-linux ~arm-linux ~x86-linux"
+fi
+
+DESCRIPTION="Fork of thttpd, a small, fast, multiplexing webserver"
+HOMEPAGE="http://opensource.dyc.edu/sthttpd"
+
+LICENSE="BSD GPL-2"
+SLOT="0"
+IUSE=""
+
+RDEPEND=""
+DEPEND=""
+
+WEBROOT="/var/www/localhost"
+
+THTTPD_USER=thttpd
+THTTPD_GROUP=thttpd
+THTTPD_DOCROOT="${EPREFIX}${WEBROOT}/htdocs"
+
+DOCS=( README TODO )
+
+pkg_setup() {
+ ebegin "Creating thttpd user and group"
+ enewgroup ${THTTPD_GROUP}
+ enewuser ${THTTPD_USER} -1 -1 -1 ${THTTPD_GROUP}
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/thttpd-renamed-htpasswd.patch
+ mv "${S}"/extras/{htpasswd.c,th_htpasswd.c} || die
+ eautoreconf -f -i
+}
+
+src_configure() {
+ econf WEBDIR=${THTTPD_DOCROOT}
+}
+
+src_install () {
+ default
+
+ newinitd "${FILESDIR}"/thttpd.init.1 thttpd
+ newconfd "${FILESDIR}"/thttpd.confd.1 thttpd
+
+ insinto /etc/logrotate.d
+ newins "${FILESDIR}/thttpd.logrotate" thttpd
+
+ insinto /etc/thttpd
+ doins "${FILESDIR}"/thttpd.conf.sample
+
+ #move htdocs to docdir, bug #429632
+ docompress -x /usr/share/doc/"${PF}"/htdocs.dist
+ mv "${ED}"${WEBROOT}/htdocs \
+ "${ED}"/usr/share/doc/"${PF}"/htdocs.dist || die
+ mkdir "${ED}"${WEBROOT}/htdocs || die
+
+ keepdir ${WEBROOT}/htdocs
+
+ chown root:${THTTPD_GROUP} "${ED}/usr/sbin/makeweb" \
+ || die "Failed chown makeweb"
+ chmod 2751 "${ED}/usr/sbin/makeweb" \
+ || die "Failed chmod makeweb"
+ chmod 755 "${ED}/usr/share/doc/${PF}/htdocs.dist/cgi-bin/printenv" \
+ || die "Failed chmod printenv"
+}
diff --git a/www-servers/thttpd/thttpd-9999.ebuild b/www-servers/thttpd/thttpd-9999.ebuild
new file mode 100644
index 00000000000..afbafc0ee56
--- /dev/null
+++ b/www-servers/thttpd/thttpd-9999.ebuild
@@ -0,0 +1,81 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+inherit autotools eutils flag-o-matic toolchain-funcs user
+
+if [[ ${PV} = 9999* ]]
+then
+ EGIT_REPO_URI="git://opensource.dyc.edu/s${PN}.git"
+ inherit git-2
+ KEYWORDS=""
+else
+ MY_P="s${P}"
+ S="${WORKDIR}/${MY_P}"
+ SRC_URI="http://opensource.dyc.edu/pub/sthttpd/${MY_P}.tar.gz"
+ KEYWORDS="~amd64 ~arm ~hppa ~mips ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~arm-linux ~x86-linux"
+fi
+
+DESCRIPTION="Fork of thttpd, a small, fast, multiplexing webserver"
+HOMEPAGE="http://opensource.dyc.edu/sthttpd"
+
+LICENSE="BSD GPL-2"
+SLOT="0"
+IUSE=""
+
+RDEPEND=""
+DEPEND=""
+
+WEBROOT="/var/www/localhost"
+
+THTTPD_USER=thttpd
+THTTPD_GROUP=thttpd
+THTTPD_DOCROOT="${EPREFIX}${WEBROOT}/htdocs"
+
+DOCS=( README TODO )
+
+pkg_setup() {
+ ebegin "Creating thttpd user and group"
+ enewgroup ${THTTPD_GROUP}
+ enewuser ${THTTPD_USER} -1 -1 -1 ${THTTPD_GROUP}
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/thttpd-renamed-htpasswd.patch
+ mv "${S}"/extras/{htpasswd.c,th_htpasswd.c}
+ eautoreconf -f -i
+}
+
+src_configure() {
+ econf WEBDIR=${THTTPD_DOCROOT}
+}
+
+src_install () {
+ default
+
+ newinitd "${FILESDIR}"/thttpd.init.1 thttpd
+ newconfd "${FILESDIR}"/thttpd.confd.1 thttpd
+
+ insinto /etc/logrotate.d
+ newins "${FILESDIR}/thttpd.logrotate" thttpd
+
+ insinto /etc/thttpd
+ doins "${FILESDIR}"/thttpd.conf.sample
+
+ #move htdocs to docdir, bug #429632
+ docompress -x /usr/share/doc/"${PF}"/htdocs.dist
+ mv "${ED}"${WEBROOT}/htdocs \
+ "${ED}"/usr/share/doc/"${PF}"/htdocs.dist
+ mkdir "${ED}"${WEBROOT}/htdocs
+
+ keepdir ${WEBROOT}/htdocs
+
+ chown root:${THTTPD_GROUP} "${ED}/usr/sbin/makeweb" \
+ || die "Failed chown makeweb"
+ chmod 2751 "${ED}/usr/sbin/makeweb" \
+ || die "Failed chmod makeweb"
+ chmod 755 "${ED}/usr/share/doc/${PF}/htdocs.dist/cgi-bin/printenv" \
+ || die "Failed chmod printenv"
+}