SOURCES: lighttpd-branch.diff - up to r2025

glen glen at pld-linux.org
Mon Nov 12 17:18:59 CET 2007


Author: glen                         Date: Mon Nov 12 16:18:59 2007 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- up to r2025

---- Files affected:
SOURCES:
   lighttpd-branch.diff (1.22 -> 1.23) 

---- Diffs:

================================================================
Index: SOURCES/lighttpd-branch.diff
diff -u SOURCES/lighttpd-branch.diff:1.22 SOURCES/lighttpd-branch.diff:1.23
--- SOURCES/lighttpd-branch.diff:1.22	Mon Nov  5 15:38:46 2007
+++ SOURCES/lighttpd-branch.diff	Mon Nov 12 17:18:53 2007
@@ -1,7 +1,7 @@
 Index: src/configfile-glue.c
 ===================================================================
---- src/configfile-glue.c	(.../tags/lighttpd-1.4.18)	(revision 2015)
-+++ src/configfile-glue.c	(.../branches/lighttpd-1.4.x)	(revision 2015)
+--- src/configfile-glue.c	(.../tags/lighttpd-1.4.18)	(revision 2025)
++++ src/configfile-glue.c	(.../branches/lighttpd-1.4.x)	(revision 2025)
 @@ -341,6 +341,10 @@
  		}
  		break;
@@ -15,8 +15,8 @@
  		break;
 Index: src/array.h
 ===================================================================
---- src/array.h	(.../tags/lighttpd-1.4.18)	(revision 2015)
-+++ src/array.h	(.../branches/lighttpd-1.4.x)	(revision 2015)
+--- src/array.h	(.../tags/lighttpd-1.4.18)	(revision 2025)
++++ src/array.h	(.../branches/lighttpd-1.4.x)	(revision 2025)
 @@ -90,6 +90,7 @@
  	COMP_HTTP_COOKIE,
  	COMP_HTTP_REMOTEIP,
@@ -27,8 +27,8 @@
  } comp_key_t;
 Index: src/mod_staticfile.c
 ===================================================================
---- src/mod_staticfile.c	(.../tags/lighttpd-1.4.18)	(revision 2015)
-+++ src/mod_staticfile.c	(.../branches/lighttpd-1.4.x)	(revision 2015)
+--- src/mod_staticfile.c	(.../tags/lighttpd-1.4.18)	(revision 2025)
++++ src/mod_staticfile.c	(.../branches/lighttpd-1.4.x)	(revision 2025)
 @@ -483,8 +483,24 @@
  			/* if the value is the same as our ETag, we do a Range-request,
  			 * otherwise a full 200 */
@@ -57,8 +57,8 @@
  
 Index: src/response.c
 ===================================================================
---- src/response.c	(.../tags/lighttpd-1.4.18)	(revision 2015)
-+++ src/response.c	(.../branches/lighttpd-1.4.x)	(revision 2015)
+--- src/response.c	(.../tags/lighttpd-1.4.18)	(revision 2025)
++++ src/response.c	(.../branches/lighttpd-1.4.x)	(revision 2025)
 @@ -180,6 +180,7 @@
  		buffer_copy_string_buffer(con->uri.authority, con->request.http_host);
  		buffer_to_lower(con->uri.authority);
@@ -69,8 +69,8 @@
  		config_patch_connection(srv, con, COMP_HTTP_REFERER);   /* Referer:     */
 Index: src/configparser.y
 ===================================================================
---- src/configparser.y	(.../tags/lighttpd-1.4.18)	(revision 2015)
-+++ src/configparser.y	(.../branches/lighttpd-1.4.x)	(revision 2015)
+--- src/configparser.y	(.../tags/lighttpd-1.4.18)	(revision 2025)
++++ src/configparser.y	(.../branches/lighttpd-1.4.x)	(revision 2025)
 @@ -422,6 +422,7 @@
        { COMP_HTTP_COOKIE,        CONST_STR_LEN("HTTP[\"cookie\"]"     ) },
        { COMP_HTTP_REMOTEIP,      CONST_STR_LEN("HTTP[\"remoteip\"]"   ) },
@@ -79,10 +79,185 @@
        { COMP_UNSET, NULL, 0 },
      };
      size_t i;
+Index: src/spawn-fcgi.c
+===================================================================
+--- src/spawn-fcgi.c	(.../tags/lighttpd-1.4.18)	(revision 2025)
++++ src/spawn-fcgi.c	(.../branches/lighttpd-1.4.x)	(revision 2025)
+@@ -37,7 +37,7 @@
+ #endif
+ 
+ #ifdef HAVE_SYS_UN_H
+-int fcgi_spawn_connection(char *appPath, char *addr, unsigned short port, const char *unixsocket, int child_count, int pid_fd, int nofork) {
++int fcgi_spawn_connection(char *appPath, char **appArgv, char *addr, unsigned short port, const char *unixsocket, int child_count, int pid_fd, int nofork) {
+ 	int fcgi_fd;
+ 	int socket_type, status;
+ 	struct timeval tv = { 0, 100 * 1000 };
+@@ -137,11 +137,10 @@
+ 		switch (child) {
+ 		case 0: {
+ 			char cgi_childs[64];
+-			char *b;
+ 
+ 			int i = 0;
+ 
+-			/* is save as we limit to 256 childs */
++			/* is safe as we limit to 256 childs */
+ 			sprintf(cgi_childs, "PHP_FCGI_CHILDREN=%d", child_count);
+ 
+ 			if(fcgi_fd != FCGI_LISTENSOCK_FILENO) {
+@@ -160,13 +159,18 @@
+ 			putenv(cgi_childs);
+ 
+ 			/* fork and replace shell */
+-			b = malloc(strlen("exec ") + strlen(appPath) + 1);
+-			strcpy(b, "exec ");
+-			strcat(b, appPath);
++			if (appArgv) {
++				execv(appArgv[0], appArgv);
+ 
+-			/* exec the cgi */
+-			execl("/bin/sh", "sh", "-c", b, (char *)NULL);
++			} else {
++				char *b = malloc(strlen("exec ") + strlen(appPath) + 1);
++				strcpy(b, "exec ");
++				strcat(b, appPath);
+ 
++				/* exec the cgi */
++				execl("/bin/sh", "sh", "-c", b, (char *)NULL);
++			}
++
+ 			exit(errno);
+ 
+ 			break;
+@@ -239,9 +243,12 @@
+ }
+ 
+ void show_help () {
+-	char *b = "spawn-fcgi" "-" PACKAGE_VERSION \
+-" - spawns fastcgi processes\n" \
+-"usage:\n" \
++	char *b = \
++"Usage: spawn-fcgi [options] -- <fcgiapp> [fcgi app arguments]\n" \
++"\n" \
++"spawn-fcgi v" PACKAGE_VERSION " - spawns fastcgi processes\n" \
++"\n" \
++"Options:\n" \
+ " -f <fcgiapp> filename of the fcgi-application\n" \
+ " -a <addr>    bind to ip address\n" \
+ " -p <port>    bind to tcp-port\n" \
+@@ -264,6 +271,7 @@
+ 	char *fcgi_app = NULL, *changeroot = NULL, *username = NULL,
+                *groupname = NULL, *unixsocket = NULL, *pid_file = NULL,
+                 *addr = NULL;
++	char **fcgi_app_argv = { NULL };
+ 	unsigned short port = 0;
+ 	int child_count = 5;
+ 	int i_am_root, o;
+@@ -274,7 +282,7 @@
+ 
+ 	i_am_root = (getuid() == 0);
+ 
+-       while(-1 != (o = getopt(argc, argv, "c:f:g:hna:p:u:vC:s:P:"))) {
++	while(-1 != (o = getopt(argc, argv, "c:f:g:hna:p:u:vC:s:P:"))) {
+ 		switch(o) {
+ 		case 'f': fcgi_app = optarg; break;
+                case 'a': addr = optarg;/* ip addr */ break;
+@@ -294,7 +302,11 @@
+ 		}
+ 	}
+ 
+-	if (fcgi_app == NULL || (port == 0 && unixsocket == NULL)) {
++	if (optind < argc) {
++		fcgi_app_argv = &argv[optind];
++	}
++
++	if ((fcgi_app == NULL && fcgi_app_argv == NULL) || (port == 0 && unixsocket == NULL)) {
+ 		show_help();
+ 		return -1;
+ 	}
+@@ -404,6 +416,18 @@
+ 			}
+ 		}
+ 
++		/*
++		 * Change group before chroot, when we have access
++		 * to /etc/group
++		 */
++		if (groupname) {
++			setgid(grp->gr_gid);
++			setgroups(0, NULL);
++			if (username) {
++				initgroups(username, grp->gr_gid);
++			}
++		}
++
+ 		if (changeroot) {
+ 			if (-1 == chroot(changeroot)) {
+ 				fprintf(stderr, "%s.%d: %s %s\n",
+@@ -420,18 +444,12 @@
+ 		}
+ 
+ 		/* drop root privs */
+-		if (groupname) {
+-			setgid(grp->gr_gid);
+-		}
+ 		if (username) {
+-			if (groupname) {
+-				initgroups(username, grp->gr_gid);
+-			}
+ 			setuid(pwd->pw_uid);
+ 		}
+ 	}
+ 
+-       return fcgi_spawn_connection(fcgi_app, addr, port, unixsocket, child_count, pid_fd, nofork);
++       return fcgi_spawn_connection(fcgi_app, fcgi_app_argv, addr, port, unixsocket, child_count, pid_fd, nofork);
+ }
+ #else
+ int main() {
+Index: src/server.c
+===================================================================
+--- src/server.c	(.../tags/lighttpd-1.4.18)	(revision 2025)
++++ src/server.c	(.../branches/lighttpd-1.4.x)	(revision 2025)
+@@ -759,6 +759,19 @@
+ 
+ 			return -1;
+ 		}
++#ifdef HAVE_PWD_H
++		/* 
++		 * Change group before chroot, when we have access
++		 * to /etc/group
++		 * */
++		if (srv->srvconf.groupname->used) {
++			setgid(grp->gr_gid);
++			setgroups(0, NULL);
++			if (srv->srvconf.username->used) {
++				initgroups(srv->srvconf.username->ptr, grp->gr_gid);
++			}
++		}
++#endif
+ #ifdef HAVE_CHROOT
+ 		if (srv->srvconf.changeroot->used) {
+ 			tzset();
+@@ -775,15 +788,7 @@
+ #endif
+ #ifdef HAVE_PWD_H
+ 		/* drop root privs */
+-		if (srv->srvconf.groupname->used) {
+-			setgid(grp->gr_gid);
+-			setgroups(0, NULL);
+-		}
+-
+ 		if (srv->srvconf.username->used) {
+-			if (srv->srvconf.groupname->used) {
+-				initgroups(srv->srvconf.username->ptr, grp->gr_gid);
+-			}
+ 			setuid(pwd->pw_uid);
+ 		}
+ #endif
 Index: doc/configuration.txt
 ===================================================================
---- doc/configuration.txt	(.../tags/lighttpd-1.4.18)	(revision 2015)
-+++ doc/configuration.txt	(.../branches/lighttpd-1.4.x)	(revision 2015)
+--- doc/configuration.txt	(.../tags/lighttpd-1.4.18)	(revision 2025)
++++ doc/configuration.txt	(.../branches/lighttpd-1.4.x)	(revision 2025)
 @@ -85,6 +85,8 @@
  
  $HTTP["cookie"]
@@ -92,11 +267,20 @@
  $HTTP["host"]
    match on host
  $HTTP["useragent"]
+Index: Makefile.am
+===================================================================
+--- Makefile.am	(.../tags/lighttpd-1.4.18)	(revision 2025)
++++ Makefile.am	(.../branches/lighttpd-1.4.x)	(revision 2025)
+@@ -1,3 +1,3 @@
+ SUBDIRS=src doc tests cygwin openwrt
+ 
+-EXTRA_DIST=lighttpd.spec
++EXTRA_DIST=lighttpd.spec SConstruct
 Index: NEWS
 ===================================================================
---- NEWS	(.../tags/lighttpd-1.4.18)	(revision 2015)
-+++ NEWS	(.../branches/lighttpd-1.4.x)	(revision 2015)
-@@ -3,6 +3,11 @@
+--- NEWS	(.../tags/lighttpd-1.4.18)	(revision 2025)
++++ NEWS	(.../branches/lighttpd-1.4.x)	(revision 2025)
+@@ -3,6 +3,13 @@
  NEWS
  ====
  
@@ -104,7 +288,81 @@
 +
 +  * added support for If-Range: <date> (#1346)
 +  * added support for matching $HTTP["scheme"] in configs
++  * fixed initgroups() called after chroot (#1384)
++  * execute fcgi app without /bin/sh if used as argument to spawn-fcgi (#1428)
 +
  - 1.4.18 - 2007-09-09
  
    * fixed compile error on IRIX 6.5.x on prctl() (#1333)
+Index: lighttpd.spec.in
+===================================================================
+--- lighttpd.spec.in	(.../tags/lighttpd-1.4.18)	(revision 2025)
++++ lighttpd.spec.in	(.../branches/lighttpd-1.4.x)	(revision 2025)
+@@ -6,21 +6,19 @@
+ Packager: Jan Kneschke <jan at kneschke.de>
+ License: BSD
+ Group: Networking/Daemons
+-URL: http://jan.kneschke.de/projects/lighttpd/
++URL: http://www.lighttpd.net/
+ Requires: pcre >= 3.1 zlib
+-BuildPrereq: libtool zlib-devel
++BuildRequires: libtool zlib-devel
+ BuildRoot: %{_tmppath}/%{name}-root
+ 
+-
+ %description
+ lighttpd is intented to be a frontend for ad-servers which have to deliver
+ small files concurrently to many connections.
+ 
+-Available rpmbuild rebuild options :
+---with : ssl mysql lua memcache
++Available rpmbuild rebuild options:
++--with: ssl mysql lua memcache
+ 
+ %prep
+-
+ %setup -q
+ 
+ %build
+@@ -33,14 +31,13 @@
+ make
+ 
+ %install
+-
+ %makeinstall
+ 
+ mkdir -p %{buildroot}%{_sysconfdir}/{init.d,sysconfig}
+-if test -f /etc/redhat-release -o -f /etc/fedora-release; then
+-  install -m 755 doc/rc.lighttpd.redhat %{buildroot}%{_sysconfdir}/init.d/lighttpd
++if [ -f /etc/redhat-release -o -f /etc/fedora-release ]; then
++	install -m 755 doc/rc.lighttpd.redhat %{buildroot}%{_sysconfdir}/init.d/lighttpd
+ else
+-  install -m 755 doc/rc.lighttpd %{buildroot}%{_sysconfdir}/init.d/lighttpd
++	install -m 755 doc/rc.lighttpd %{buildroot}%{_sysconfdir}/init.d/lighttpd
+ fi
+ install -m 644 doc/sysconfig.lighttpd %{buildroot}%{_sysconfdir}/sysconfig/lighttpd
+ 
+@@ -49,16 +46,16 @@
+ 
+ %post
+ ## read http://www.fedora.us/docs/spec.html next time :)
+-if test "$1" = "1"; then
+-  # real install, not upgrade
+-  /sbin/chkconfig --add lighttpd
++if [ "$1" = "1" ]; then
++	# real install, not upgrade
++	/sbin/chkconfig --add lighttpd
+ fi
+ 
+ %preun
+-if test "$1" = "0"; then
+-  # real uninstall, not upgrade
+-  %{_sysconfdir}/init.d/lighttpd stop
+-  /sbin/chkconfig --del lighttpd
++if [ "$1" = "0"]; then
++	# real uninstall, not upgrade
++	%{_sysconfdir}/init.d/lighttpd stop
++	/sbin/chkconfig --del lighttpd
+ fi
+ 
+ %files
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/lighttpd-branch.diff?r1=1.22&r2=1.23&f=u



More information about the pld-cvs-commit mailing list