- Update to version 2.26 and cleanup MASTER_SITES; define LICENSE

- Change default WWW root from ${PREFIX}/www/data to more expected (and
  standard) ${WWWDIR} (${PREFIX}/www/thttpd) and default CGI pattern to
  "/cgi-bin/*" since this goes better in line with default installation
- Enable IPREAL option by default (do not convert it to unconditional
  patch as it could lead to privacy violation, which might be unwanted)
- Change served data default MIME type to "application/octet-stream"
- Rename thttpdpasswd(1) and its manpage to thtpasswd(1); this not just
  makes it shorter, but is more consistent with what popular GNU/Linux
  distributions do
- Stop generating index pages for directories by default for security
  reasons, provide an option for that
- Properly stagify port by patching upstream makefiles instead of doing
  entire installation by hand (and thus retire `do-install' target)
- Adjust and sort pkg-plist in accordance with the the above changes
This commit is contained in:
Alexey Dokuchaev 2015-01-18 13:37:34 +00:00
parent 2b84fa03cc
commit a6de0a3f68
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=377327
11 changed files with 136 additions and 45 deletions

View file

@ -2,54 +2,47 @@
# $FreeBSD$
PORTNAME= thttpd
PORTVERSION= 2.25b
PORTREVISION= 6
PORTVERSION= 2.26
CATEGORIES= www ipv6
MASTER_SITES= http://www.acme.com/software/thttpd/ \
http://atreides.freenix.no/~anders/
MASTER_SITES= http://www.acme.com/software/thttpd/
MAINTAINER= danfe@FreeBSD.org
COMMENT= Tiny/turbo/throttling HTTP server with CGI support
LICENSE= BSD2CLAUSE
USES= gmake # parallel builds (-jX) are broken with BSD make(1)
GNU_CONFIGURE= yes
MAKE_ARGS= WEBDIR=${WWWDIR}
USE_RC_SUBR= ${PORTNAME}
SUB_FILES= pkg-message thttpd.conf.sample
SUB_LIST= WWWOWN=${WWWOWN} WWWGRP=${WWWGRP}
OPTIONS_DEFINE= SENDFILE IPREAL
OPTIONS_DEFAULT= SENDFILE
OPTIONS_DEFINE= SENDFILE IPREAL INDEXES
OPTIONS_DEFAULT= SENDFILE IPREAL
SENDFILE_DESC= Use sendfile(2) to serve files
IPREAL_DESC= Respect (pass on) "X-Forwarded-For" header
INDEXES_DESC= Generate index pages for directories
SENDFILE_EXTRA_PATCHES= ${FILESDIR}/extra-patch-config.h
IPREAL_EXTRA_PATCHES= ${FILESDIR}/extra-patch-ip_real
.include <bsd.port.options.mk>
post-patch:
.for f in extras/htpasswd.1 extras/htpasswd.c thttpd.8 extras/Makefile.in
@${REINPLACE_CMD} -e '/\.htpasswd/!s|htpasswd|thttpdpasswd|g' \
${WRKSRC}/${f}
# To avoid conflict with other ports that also install htpasswd(1)
.for f in extras/htpasswd.1 extras/htpasswd.c thttpd.8
@${REINPLACE_CMD} -e '/\.htpasswd/!s|htpasswd|t&|g' ${WRKSRC}/${f}
.endfor
@${REINPLACE_CMD} -e 's|/var/www|${WWWDIR}|' \
${WRKSRC}/extras/makeweb.1
@${MV} ${WRKSRC}/extras/htpasswd.1 ${WRKSRC}/extras/thttpdpasswd.1
@${MV} ${WRKSRC}/extras/htpasswd.c ${WRKSRC}/extras/thttpdpasswd.c
.if ! ${PORT_OPTIONS:MINDEXES}
@${REINPLACE_CMD} -e '/GENERATE_INDEXES/s|.*|/* & */|' \
${WRKSRC}/config.h
.endif
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/thttpd ${STAGEDIR}${PREFIX}/sbin
${INSTALL_PROGRAM} ${WRKSRC}/extras/makeweb \
${WRKSRC}/extras/thttpdpasswd ${STAGEDIR}${PREFIX}/bin
${INSTALL_SCRIPT} ${WRKSRC}/extras/syslogtocern \
${STAGEDIR}${PREFIX}/bin
@${MKDIR} ${STAGEDIR}${PREFIX}/www/data \
${STAGEDIR}${PREFIX}/www/cgi-bin
${INSTALL_PROGRAM} ${WRKSRC}/cgi-src/redirect ${WRKSRC}/cgi-src/ssi \
${WRKSRC}/cgi-src/phf ${STAGEDIR}${PREFIX}/www/cgi-bin
${INSTALL_MAN} ${WRKSRC}/extras/makeweb.1 \
${WRKSRC}/extras/thttpdpasswd.1 ${STAGEDIR}${PREFIX}/man/man1
${INSTALL_MAN} ${WRKSRC}/thttpd.8 ${WRKSRC}/cgi-src/redirect.8 \
${WRKSRC}/cgi-src/ssi.8 ${WRKSRC}/extras/syslogtocern.8 \
${STAGEDIR}${PREFIX}/man/man8
post-install:
${INSTALL_DATA} ${WRKDIR}/thttpd.conf.sample ${STAGEDIR}${PREFIX}/etc
.include <bsd.port.mk>

View file

@ -1,2 +1,2 @@
SHA256 (thttpd-2.25b.tar.gz) = 07719b08b1cff6a21c08697a7bcb4395425b07ee753106262fb62a03a7d32360
SIZE (thttpd-2.25b.tar.gz) = 132275
SHA256 (thttpd-2.26.tar.gz) = 15b3f6c60f854061e333227e9ea9ff789d34a092c9365690a8c0d3ecfc85cbb7
SIZE (thttpd-2.26.tar.gz) = 132950

View file

@ -20,7 +20,17 @@
WEBDIR=$(WEBDIR) \
CGIBINDIR=$(CGIBINDIR) \
MANDIR=$(MANDIR) \
@@ -118,9 +116,7 @@ install-man:
@@ -110,17 +108,15 @@ install: installthis install-man install
installthis:
-mkdir -p $(DESTDIR)$(BINDIR)
- $(INSTALL) -m 555 -o bin -g bin thttpd $(DESTDIR)$(BINDIR)
+ $(INSTALL) -m 555 thttpd $(DESTDIR)$(BINDIR)
install-man:
-mkdir -p $(DESTDIR)$(MANDIR)/man8
- $(INSTALL) -m 444 -o bin -g bin thttpd.8 $(DESTDIR)$(MANDIR)/man8
+ $(INSTALL) -m 444 thttpd.8 $(DESTDIR)$(MANDIR)/man8
installsubdirs:
for i in $(SUBDIRS) ; do ( \

View file

@ -9,3 +9,32 @@
DEFS = @DEFS@
INCLS = -I..
CFLAGS = $(CCOPT) $(DEFS) $(INCLS)
@@ -67,17 +67,17 @@
cd .. ; $(MAKE) $(MFLAGS) strerror.o
install: all
- -mkdir -p $(CGIBINDIR)
- rm -f $(CGIBINDIR)/redirect
- cp redirect $(CGIBINDIR)/redirect
- rm -f $(MANDIR)/man8/redirect.8
- cp redirect.8 $(MANDIR)/man8/redirect.8
- rm -f $(CGIBINDIR)/ssi
- cp ssi $(CGIBINDIR)/ssi
- rm -f $(MANDIR)/man8/ssi.8
- cp ssi.8 $(MANDIR)/man8/ssi.8
- rm -f $(CGIBINDIR)/phf
- cp phf $(CGIBINDIR)/phf
+ -mkdir -p $(DESTDIR)$(CGIBINDIR)
+ rm -f $(DESTDIR)$(CGIBINDIR)/redirect
+ cp redirect $(DESTDIR)$(CGIBINDIR)/redirect
+ rm -f $(DESTDIR)$(MANDIR)/man8/redirect.8
+ cp redirect.8 $(DESTDIR)$(MANDIR)/man8/redirect.8
+ rm -f $(DESTDIR)$(CGIBINDIR)/ssi
+ cp ssi $(DESTDIR)$(CGIBINDIR)/ssi
+ rm -f $(DESTDIR)$(MANDIR)/man8/ssi.8
+ cp ssi.8 $(DESTDIR)$(MANDIR)/man8/ssi.8
+ rm -f $(DESTDIR)$(CGIBINDIR)/phf
+ cp phf $(DESTDIR)$(CGIBINDIR)/phf
clean:
rm -f $(CLEANFILES)

View file

@ -9,3 +9,32 @@
DEFS = @DEFS@
INCLS = -I..
CFLAGS = $(CCOPT) $(DEFS) $(INCLS)
@@ -66,18 +66,16 @@
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
- cp makeweb.1 $(MANDIR)/man1/makeweb.1
- rm -f $(MANDIR)/man1/htpasswd.1
- cp htpasswd.1 $(MANDIR)/man1/htpasswd.1
- rm -f $(MANDIR)/man8/syslogtocern.8
- cp syslogtocern.8 $(MANDIR)/man8/syslogtocern.8
+ rm -f $(DESTDIR)$(BINDIR)/makeweb $(DESTDIR)$(BINDIR)/thtpasswd $(DESTDIR)$(BINDIR)/syslogtocern
+ cp makeweb $(DESTDIR)$(BINDIR)/makeweb
+ cp htpasswd $(DESTDIR)$(BINDIR)/thtpasswd
+ cp syslogtocern $(DESTDIR)$(BINDIR)/syslogtocern
+ rm -f $(DESTDIR)$(MANDIR)/man1/makeweb.1
+ cp makeweb.1 $(DESTDIR)$(MANDIR)/man1/makeweb.1
+ rm -f $(DESTDIR)$(MANDIR)/man1/thtpasswd.1
+ cp htpasswd.1 $(DESTDIR)$(MANDIR)/man1/thtpasswd.1
+ rm -f $(DESTDIR)$(MANDIR)/man8/syslogtocern.8
+ cp syslogtocern.8 $(DESTDIR)$(MANDIR)/man8/syslogtocern.8
clean:
rm -f $(CLEANFILES)

View file

@ -143,9 +143,9 @@
strcpy(user,argv[2]);
found = 0;
- while(!(getline(line,MAX_STRING_LEN,f))) {
- while(!(my_getline(line,MAX_STRING_LEN,f))) {
+ /* line we get is username:pwd, or possibly any other cruft */
+ while(!(getline(line,MAX_LINE_LEN,f))) {
+ while(!(my_getline(line,MAX_LINE_LEN,f))) {
+ char *i;
+
if(found || (line[0] == '#') || (!line[0])) {

View file

@ -18,7 +18,39 @@
rest[--restlen] = '\0'; /* trim trailing slash */
if ( ! tildemapped )
/* Remove any leading slashes. */
@@ -3889,6 +3889,9 @@
@@ -2348,8 +2348,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
@@ -2571,7 +2574,7 @@
size_t ext_len, encodings_len;
int i, top, bot, mid;
int r;
- char* default_type = "text/plain; charset=%s";
+ char* default_type = "application/octet-stream";
/* Peel off encoding extensions until there aren't any more. */
n_me_indexes = 0;
@@ -3312,7 +3315,7 @@
cp += strcspn( 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;
@@ -3889,6 +3892,9 @@
httpd_send_err( hc, 500, err500title, "", err500form, hc->encodedurl );
return -1;
}

View file

@ -13,7 +13,7 @@
syslog( LOG_NOTICE, "re-opening logfile" );
logfp = fopen( logfile, "a" );
- if ( logfp == (FILE*) 0 )
+ retchmod = chmod( logfile, S_IRUSR|S_IWUSR );
+ retchmod = chmod( logfile, S_IRUSR|S_IWUSR|S_IRGRP );
+ if ( logfp == (FILE*) 0 || retchmod != 0 )
{
syslog( LOG_CRIT, "re-opening %.80s - %m", logfile );

View file

@ -3,7 +3,7 @@ If you want users to be able to create their own Web
subdirectories off of the main web directory, you need to:
1. Add a group for www admins (e.g., "%%WWWGRP%%")
2. chgrp thatgroup %%PREFIX%%/bin/makeweb %%PREFIX%%/www
2. chgrp thatgroup %%PREFIX%%/bin/makeweb %%WWWDIR%%
3. chmod 2755 %%PREFIX%%/bin/makeweb
4. Tell users about makeweb(1)

View file

@ -1,6 +1,6 @@
user=%%WWWOWN%%
dir=%%PREFIX%%/www/data
dir=%%WWWDIR%%
chroot
cgipat=*.cgi
cgipat=/cgi-bin/*
logfile=/var/log/thttpd.log
pidfile=/var/run/thttpd.pid

View file

@ -1,16 +1,14 @@
bin/thttpdpasswd
bin/makeweb
bin/syslogtocern
@sample etc/thttpd.conf.sample
man/man1/makeweb.1.gz
man/man1/thttpdpasswd.1.gz
man/man1/thtpasswd.1.gz
man/man8/redirect.8.gz
man/man8/ssi.8.gz
man/man8/syslogtocern.8.gz
man/man8/thttpd.8.gz
sbin/makeweb
sbin/syslogtocern
sbin/thttpd
www/cgi-bin/phf
www/cgi-bin/redirect
www/cgi-bin/ssi
@dirrmtry www/cgi-bin
@dirrmtry www/data
sbin/thtpasswd
%%WWWDIR%%/cgi-bin/phf
%%WWWDIR%%/cgi-bin/redirect
%%WWWDIR%%/cgi-bin/ssi