From 87ccc8ec61599ed5799612c61b7a61d4b78a7c41 Mon Sep 17 00:00:00 2001 From: Alexey Dokuchaev Date: Sun, 18 Jan 2015 10:10:44 +0000 Subject: [PATCH] Backport a (modified) patch from Red Hat to allow passing custom directory for creating new user directories via makeweb(1). --- www/thttpd/Makefile | 2 + www/thttpd/files/patch-extras_makeweb.1 | 21 ++++++++++ www/thttpd/files/patch-extras_makeweb.c | 54 +++++++++++++++++++++++++ 3 files changed, 77 insertions(+) create mode 100644 www/thttpd/files/patch-extras_makeweb.1 create mode 100644 www/thttpd/files/patch-extras_makeweb.c diff --git a/www/thttpd/Makefile b/www/thttpd/Makefile index 441f7ff0bf18..d13a93e2673c 100644 --- a/www/thttpd/Makefile +++ b/www/thttpd/Makefile @@ -30,6 +30,8 @@ post-patch: @${REINPLACE_CMD} -e '/\.htpasswd/!s|htpasswd|thttpdpasswd|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 diff --git a/www/thttpd/files/patch-extras_makeweb.1 b/www/thttpd/files/patch-extras_makeweb.1 new file mode 100644 index 000000000000..c9aee52ff7e3 --- /dev/null +++ b/www/thttpd/files/patch-extras_makeweb.1 @@ -0,0 +1,21 @@ +--- extras/makeweb.1.orig 2005-06-29 17:53:22 UTC ++++ extras/makeweb.1 +@@ -2,11 +2,17 @@ + .SH NAME + makeweb - create user web directory + .SH SYNOPSIS +-.B makeweb ++.B makeweb ++[\fI -d webdir \fR] + .SH DESCRIPTION + .PP + This program allows users to create their own web subdirectories off + of the main web directory. ++.PP ++.TP ++\fB\-d\fR ++Specify the root directory for new user directories. The default directory ++is /var/www + .SH "SEE ALSO + thttpd(8) + .SH AUTHOR diff --git a/www/thttpd/files/patch-extras_makeweb.c b/www/thttpd/files/patch-extras_makeweb.c new file mode 100644 index 000000000000..9b5376d3f922 --- /dev/null +++ b/www/thttpd/files/patch-extras_makeweb.c @@ -0,0 +1,54 @@ +--- extras/makeweb.c.orig 2005-06-29 17:53:25 UTC ++++ extras/makeweb.c +@@ -48,6 +48,11 @@ + + static char* argv0; + ++static void ++usage( void ) ++{ ++ fprintf( stderr, "usage: %s [-d webdir]\n", argv0 ); ++} + + static void + check_room( int size, int len ) +@@ -126,17 +131,27 @@ main( int argc, char** argv ) + struct passwd* pwd; + char* username; + char* homedir; ++ int opts; + char dirname[5000]; + char linkname[5000]; + char linkbuf[5000]; + struct stat sb; + + argv0 = argv[0]; +- if ( argc != 1 ) ++ ++#ifndef TILDE_MAP_2 ++ webdir = WEBDIR; ++#endif /* TILDE_MAP_2 */ ++ ++ if ( (opts = getopt(argc, argv, "d:h")) != -1 ) ++ { ++ switch (opts) + { +- (void) fprintf( stderr, "usage: %s\n", argv0 ); +- exit( 1 ); ++ case 'd': webdir = strdup(optarg); break; ++ case 'h': ++ default: usage(); return 1; break; + } ++ } + + pwd = getpwuid( getuid() ); + if ( pwd == (struct passwd*) 0 ) +@@ -162,8 +177,6 @@ main( int argc, char** argv ) + + #else /* TILDE_MAP_2 */ + +- /* Gather the pieces. */ +- webdir = WEBDIR; + #ifdef TILDE_MAP_1 + prefix = TILDE_MAP_1; + #else /* TILDE_MAP_1 */