diff options
author | Francesco Colista <fcolista@alpinelinux.org> | 2016-08-22 08:41:09 +0000 |
---|---|---|
committer | Francesco Colista <fcolista@alpinelinux.org> | 2016-08-22 08:41:09 +0000 |
commit | f90c15a50a5cefedf36bd7c043d5069b3652c092 (patch) | |
tree | d497bdbbaffcb5c6187e79913f7a95808676ada8 /community/thttpd | |
parent | 53a4f790089c6699afc42a41e31ea685f1699b18 (diff) | |
download | aports-f90c15a50a5cefedf36bd7c043d5069b3652c092.tar.bz2 aports-f90c15a50a5cefedf36bd7c043d5069b3652c092.tar.xz |
community/thttpd: moved from testing
Diffstat (limited to 'community/thttpd')
-rw-r--r-- | community/thttpd/APKBUILD | 105 | ||||
-rw-r--r-- | community/thttpd/discreet.patch | 34 | ||||
-rw-r--r-- | community/thttpd/forwarded-for.patch | 16 | ||||
-rw-r--r-- | community/thttpd/getline.patch | 21 | ||||
-rw-r--r-- | community/thttpd/thttpd-makeweb-notsuid.patch | 12 | ||||
-rw-r--r-- | community/thttpd/thttpd-webgroup.patch | 13 | ||||
-rw-r--r-- | community/thttpd/thttpd.conf | 8 | ||||
-rw-r--r-- | community/thttpd/thttpd.confd | 7 | ||||
-rw-r--r-- | community/thttpd/thttpd.initd | 27 | ||||
-rw-r--r-- | community/thttpd/thttpd.logrotated | 6 | ||||
-rw-r--r-- | community/thttpd/thttpd.post-install | 2 | ||||
-rw-r--r-- | community/thttpd/thttpd.pre-install | 8 |
12 files changed, 259 insertions, 0 deletions
diff --git a/community/thttpd/APKBUILD b/community/thttpd/APKBUILD new file mode 100644 index 0000000000..f2d91e3ce2 --- /dev/null +++ b/community/thttpd/APKBUILD @@ -0,0 +1,105 @@ +# Contributor: z3bra <willy at mailoo dot org> +# Maintainer: Francesco Colista <fcolista@alpinelinux.org> +pkgname=thttpd +pkgver=2.27 +pkgrel=1 +pkgdesc="Simple, small, portable, fast, adn secure HTTP server" +url="http://www.acme.com/software/thttpd" +arch="all" +license="custom:BSD" +depends="" +depends_dev="" +makedepends="$depends_dev" +install="$pkgname.pre-install $pkgname.post-install" +subpackages="$pkgname-doc" +source="http://www.acme.com/software/$pkgname/$pkgname-$pkgver.tar.gz + thttpd.initd + thttpd.confd + thttpd.conf + thttpd.logrotated + thttpd-webgroup.patch + forwarded-for.patch + thttpd-makeweb-notsuid.patch + " + +_builddir=$srcdir/$pkgname-$pkgver +prepare() { + local i + cd "$_builddir" + for i in $source; do + case $i in + *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;; + esac + done + echo 'mkv video/x-matroska' >> mime_types.txt +} + +build() { + cd "$_builddir" + + ./configure --prefix=/usr --mandir=/usr/share/man + sed -e 's/^CFLAGS =/CFLAGS +=/' \ + -e '/^STATICFLAG =/c STATICFLAG =' \ + -i Makefile */Makefile || return 1 + + make || return 1 +} + +package() { + cd "$_builddir" + + mkdir -p $pkgdir/usr/share/man/man1 + + make \ + BINDIR="$pkgdir"/usr/sbin \ + WEBDIR="$pkgdir"/var/www/http \ + MANDIR="$pkgdir"/usr/share/man \ + WEBGROUP=www-data install || return 1 + + rm -rf "$pkgdir"/var/www/http/* + + install -m755 -D "$srcdir"/$pkgname.initd \ + "$pkgdir"/etc/init.d/$pkgname || return 1 + install -m644 -D "$srcdir"/$pkgname.confd \ + "$pkgdir"/etc/conf.d/$pkgname || return 1 + install -m644 -D "$srcdir"/$pkgname.conf \ + "$pkgdir"/etc/thttpd.conf || return 1 + install -m644 -D "$srcdir"/$pkgname.logrotated \ + "$pkgdir"/etc/logrotate.d/thttpd || return 1 + + install -d "$pkgdir"/var/log/thttpd + install -d "$pkgdir"/usr/share/licenses/"$pkgname" + head -n 26 thttpd.c > \ + "$pkgdir"/usr/share/licenses/"$pkgname"/LICENSE || return 1 + mkdir -p "$pkgdir/usr/share/doc/$pkgname" + cat > $pkgdir/usr/share/doc/$pkgname/README.alpine <<EOF + To use makeweb, please set suid to makeweb binary with: + ------------------------------------------------------- + chmod 2755 /usr/sbin/makeweb +EOF +} + +md5sums="02b6caea4439bea27d2f395e4197494f thttpd-2.27.tar.gz +0e5239ab3c23753fa288d53b4eb28241 thttpd.initd +7e53378c3ab359beee6f1b3198bdb353 thttpd.confd +fb88ae8b618a34431ec6d3608e06cc88 thttpd.conf +e29e38de0195bdbacec8daaa016cabfa thttpd.logrotated +5677f99962af531b65e4f58198b84fc0 thttpd-webgroup.patch +9976ae6a2bb06b076a100c05235a72b8 forwarded-for.patch +a810cf21f0caf648856ed5851023e794 thttpd-makeweb-notsuid.patch" +sha256sums="b1c4bc37ada7c39cc2bcfbf86b3bc05be91be49f8bb4f55379eaff1f66516d7a thttpd-2.27.tar.gz +e132cbcd0f78313e4406438385143bca00ef22c164286429fd2f6613e5f1d9bf thttpd.initd +25f55ad96c73d8c22117dd6ef331e85fed5a3ba78b4b0ec329832e82a4159e4e thttpd.confd +51e5f3cea217be5cc36b5f5b5084e2bf4d2611f6577ca98c98ed3a69ac5bebf2 thttpd.conf +774ac53a3ea2b9ccf08b8ce75bf0253f72e25054ed0cd0bae4e257526248376c thttpd.logrotated +04cab749b869a38d34bafb1c638c4d57bf561e6f64dde7dd0a3da5df37ce7a5d thttpd-webgroup.patch +eb3be98c65b8f9297867205772cd9939f526ac1c2227c24ba7e8ff754dd2216c forwarded-for.patch +96ea2ac4d8dabb605caa22fa0591e53bbf57cead2d5311dd7c16e56b46463b8a thttpd-makeweb-notsuid.patch" +sha512sums="fe682d4b219b163712ca0d4572d31a724857f671dcd07fabb0134b86f42046f57c819e05abf7bab4b7c28afcf597375759b526aebbb9dd6765c54c0ec44f3e8b thttpd-2.27.tar.gz +bc7416986e135ade401721708060b94ce3bb885a3aa40893d68abc1b305c13609e086fbb48f8db11656902c294bf558a81814013ef3a14d73f0c5f0df0decb7d thttpd.initd +9b4309c2bc88d11ce71d40ab813e9cbe78e4ec7368e3e98f35da1d5a324ee0630a6892b43f58f84490e2b534a573673b106a9d5dd406fedefb2a4c664e455aa1 thttpd.confd +f1b86a554177a5f2a343abb4aac6fa9bc06dafd7cabdaf8329e6478bcc296f39a56d839e85ac4bf77b682e6e9cdbbe844732dfac034d0d775b65cdeaefc4349e thttpd.conf +5b2800825583e93cf4be76e71d2840b9894c1779a810d562a0b6145cae0c7504dadfdc1e844f1611a48cca3b4518d41b47e41a68f33043d58ffde85f1e56e3f3 thttpd.logrotated +349721da9e670ca666891f98ca338ae0041c09b353fc42bdd87015803f0b668478be8e48f36d5b56b5e172d3a7b262bf4a71c9619607a068e41c2bc292bde2be thttpd-webgroup.patch +02c079ca104f2358cd20756082657dca96f7a88cbeb611de81504f1581c5e085a7a2765ec55b6e0ae1948803afced85e8a45fc6deb2fef1ec5ba1ba96ce68b4b forwarded-for.patch +1138a827049f73b43ce142c914fad0670bcd4577de16485ade024314c616056ab6789897663d8b6592331354d44065eae7aa712e20f5c930a80513448416fa17 thttpd-makeweb-notsuid.patch" diff --git a/community/thttpd/discreet.patch b/community/thttpd/discreet.patch new file mode 100644 index 0000000000..b427ecc2cb --- /dev/null +++ b/community/thttpd/discreet.patch @@ -0,0 +1,34 @@ +diff -Naur old/libhttpd.c new/libhttpd.c +--- old/libhttpd.c 2012-04-27 14:24:50.971711600 +0200 ++++ new/libhttpd.c 2012-04-27 14:33:24.559135581 +0200 +@@ -744,7 +744,7 @@ + (void) my_snprintf( buf, sizeof(buf), "\ + <HTML>\n\ + <HEAD><TITLE>%d %s</TITLE></HEAD>\n\ +-<BODY BGCOLOR=\"#cc9999\" TEXT=\"#000000\" LINK=\"#2020ff\" VLINK=\"#4040cc\">\n\ ++<BODY>\n\ + <H2>%d %s</H2>\n", + status, title, status, title ); + add_response( hc, buf ); +@@ -769,11 +769,8 @@ + char buf[1000]; + + (void) my_snprintf( buf, sizeof(buf), "\ +-<HR>\n\ +-<ADDRESS><A HREF=\"%s\">%s</A></ADDRESS>\n\ + </BODY>\n\ +-</HTML>\n", +- SERVER_ADDRESS, EXPOSED_SERVER_SOFTWARE ); ++</HTML>\n" ); + add_response( hc, buf ); + } + +@@ -2766,7 +2763,7 @@ + (void) fprintf( fp, "\ + <HTML>\n\ + <HEAD><TITLE>Index of %.80s</TITLE></HEAD>\n\ +-<BODY BGCOLOR=\"#99cc99\" TEXT=\"#000000\" LINK=\"#2020ff\" VLINK=\"#4040cc\">\n\ ++<BODY>\n\ + <H2>Index of %.80s</H2>\n\ + <PRE>\n\ + mode links bytes last-changed name\n\ diff --git a/community/thttpd/forwarded-for.patch b/community/thttpd/forwarded-for.patch new file mode 100644 index 0000000000..348eb00cf2 --- /dev/null +++ b/community/thttpd/forwarded-for.patch @@ -0,0 +1,16 @@ +diff -Naur old/libhttpd.c new/libhttpd.c +--- old/libhttpd.c 2005-06-30 03:50:39.000000000 +1000 ++++ new/libhttpd.c 2012-10-24 12:12:17.144560917 +1100 +@@ -2207,6 +2207,12 @@ + if ( strcasecmp( cp, "keep-alive" ) == 0 ) + hc->keep_alive = 1; + } ++ else if ( strncasecmp( buf, "X-Forwarded-For:", 16 ) == 0 ) ++ { ++ 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/community/thttpd/getline.patch b/community/thttpd/getline.patch new file mode 100644 index 0000000000..1ec3946b10 --- /dev/null +++ b/community/thttpd/getline.patch @@ -0,0 +1,21 @@ +diff -Nur 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 2010-04-11 14:43:31.037809054 +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/community/thttpd/thttpd-makeweb-notsuid.patch b/community/thttpd/thttpd-makeweb-notsuid.patch new file mode 100644 index 0000000000..a1e0fa143f --- /dev/null +++ b/community/thttpd/thttpd-makeweb-notsuid.patch @@ -0,0 +1,12 @@ +diff --git a/extras/Makefile.in b/extras/Makefile.in +index a29780f..3e19a79 100644 +--- a/extras/Makefile.in ++++ b/extras/Makefile.in +@@ -69,7 +69,6 @@ install: all + rm -f $(BINDIR)/makeweb $(BINDIR)/htpasswd $(BINDIR)/syslogtocern + cp makeweb $(BINDIR)/makeweb + chgrp $(WEBGROUP) $(BINDIR)/makeweb +- chmod 2755 $(BINDIR)/makeweb + cp htpasswd $(BINDIR)/htpasswd + cp syslogtocern $(BINDIR)/syslogtocern + rm -f $(MANDIR)/man1/makeweb.1 diff --git a/community/thttpd/thttpd-webgroup.patch b/community/thttpd/thttpd-webgroup.patch new file mode 100644 index 0000000000..fb493c88f4 --- /dev/null +++ b/community/thttpd/thttpd-webgroup.patch @@ -0,0 +1,13 @@ +diff --git a/Makefile b/Makefile +index ddd5f9a..d40fd6a 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -40,7 +40,7 @@ WEBDIR = $(prefix)/www + # CONFIGURE: The group that the web directory belongs to. This is so that + # the makeweb program can be installed set-group-id to that group, and make + # subdirectories. If you're not going to use makeweb, ignore this. +-WEBGROUP = www ++WEBGROUP = www-data + + # CONFIGURE: Directory for CGI executables. + CGIBINDIR = $(WEBDIR)/cgi-bin diff --git a/community/thttpd/thttpd.conf b/community/thttpd/thttpd.conf new file mode 100644 index 0000000000..3623b89899 --- /dev/null +++ b/community/thttpd/thttpd.conf @@ -0,0 +1,8 @@ +dir=/var/www/http +vhost +chroot +user=thttpd +cgipat=**.cgi +logfile=/var/log/thttpd/thttpd.log +pidfile=/var/run/thttpd.pid +charset=utf-8 diff --git a/community/thttpd/thttpd.confd b/community/thttpd/thttpd.confd new file mode 100644 index 0000000000..ad09531fe1 --- /dev/null +++ b/community/thttpd/thttpd.confd @@ -0,0 +1,7 @@ +# Sample conf.d file for alpine linux + +# +# Specify daemon options here. +# + +sample_opts="-C /etc/thttpd.conf" diff --git a/community/thttpd/thttpd.initd b/community/thttpd/thttpd.initd new file mode 100644 index 0000000000..5ba5247b6d --- /dev/null +++ b/community/thttpd/thttpd.initd @@ -0,0 +1,27 @@ +#!/sbin/openrc-run +# init.d file for thttpd + +name=thttpd +daemon=/usr/sbin/$name + +depend() { + need net + after firewall +} + +start() { + ebegin "Starting ${name}" + start-stop-daemon --start --quiet \ + --pidfile /var/run/${name}.pid \ + --exec ${daemon} -- ${sample_opts} + eend $? +} + +stop() { + ebegin "Stopping ${name}" + start-stop-daemon --stop --quiet \ + --pidfile /var/run/$name.pid \ + --exec ${daemon} + eend $? +} + diff --git a/community/thttpd/thttpd.logrotated b/community/thttpd/thttpd.logrotated new file mode 100644 index 0000000000..cbc559fb33 --- /dev/null +++ b/community/thttpd/thttpd.logrotated @@ -0,0 +1,6 @@ +/var/log/thttpd/*log { + missingok + postrotate + /etc/init.d/thttpd restart >/dev/null + endscript +} diff --git a/community/thttpd/thttpd.post-install b/community/thttpd/thttpd.post-install new file mode 100644 index 0000000000..039e4d0069 --- /dev/null +++ b/community/thttpd/thttpd.post-install @@ -0,0 +1,2 @@ +#!/bin/sh +exit 0 diff --git a/community/thttpd/thttpd.pre-install b/community/thttpd/thttpd.pre-install new file mode 100644 index 0000000000..47dd3b0663 --- /dev/null +++ b/community/thttpd/thttpd.pre-install @@ -0,0 +1,8 @@ +#!/bin/sh + +addgroup -S -g 82 www-data 2>/dev/null +adduser -S -D -H -h /var/www/localhost/htdocs -s /sbin/nologin \ + -g thttpd thttpd 2>/dev/null +addgroup thttpd www-data 2>/dev/null + +exit 0 |