-/* $OpenBSD: httpd.c,v 1.15 2014/08/04 15:49:28 reyk Exp $ */
+/* $OpenBSD: httpd.c,v 1.16 2014/08/05 09:24:21 jsg Exp $ */
/*
* Copyright (c) 2014 Reyk Floeter <reyk@openbsd.org>
main(int argc, char *argv[])
{
int c;
+ unsigned int proc;
int debug = 0, verbose = 0;
u_int32_t opts = 0;
struct httpd *env;
ps->ps_instances[PROC_SERVER] = env->sc_prefork_server;
ps->ps_ninstances = env->sc_prefork_server;
+ for (proc = 0; proc < nitems(procs); proc++)
+ procs[proc].p_chroot = env->sc_chroot;
+
proc_init(ps, procs, nitems(procs));
setproctitle("parent");
-.\" $OpenBSD: httpd.conf.5,v 1.21 2014/08/04 17:38:12 reyk Exp $
+.\" $OpenBSD: httpd.conf.5,v 1.22 2014/08/05 09:24:21 jsg Exp $
.\"
.\" Copyright (c) 2014 Reyk Floeter <reyk@openbsd.org>
.\"
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: August 4 2014 $
+.Dd $Mdocdate: August 5 2014 $
.Dt HTTPD.CONF 5
.Os
.Sh NAME
to a server.
.Xr httpd 8
runs 3 server processes by default.
+.It Ic chroot Ar directory
+Set the
+.Xr chroot 2
+directory.
+If not specified, it defaults to
+.Pa /var/www ,
+the home directory of the www user.
.El
.Sh SERVERS
The configured web servers.
-/* $OpenBSD: httpd.h,v 1.42 2014/08/04 18:12:15 reyk Exp $ */
+/* $OpenBSD: httpd.h,v 1.43 2014/08/05 09:24:21 jsg Exp $ */
/*
* Copyright (c) 2006 - 2014 Reyk Floeter <reyk@openbsd.org>
u_int16_t sc_prefork_server;
u_int16_t sc_id;
int sc_paused;
+ char *sc_chroot;
struct serverlist *sc_servers;
struct mediatypes *sc_mediatypes;
-/* $OpenBSD: parse.y,v 1.23 2014/08/04 17:38:12 reyk Exp $ */
+/* $OpenBSD: parse.y,v 1.24 2014/08/05 09:24:21 jsg Exp $ */
/*
* Copyright (c) 2007 - 2014 Reyk Floeter <reyk@openbsd.org>
%}
-%token AUTO COMMON COMBINED CONNECTION DIRECTORY FCGI FILE INDEX LISTEN
+%token AUTO CHROOT COMMON COMBINED CONNECTION DIRECTORY FCGI FILE INDEX LISTEN
%token LOCATION LOG NO ON PORT PREFORK ROOT SERVER SOCKET SSL STYLE SYSLOG
%token TYPES
%token ERROR INCLUDE
}
conf->sc_prefork_server = $2;
}
+ | CHROOT STRING {
+ conf->sc_chroot = $2;
+ }
;
server : SERVER STRING {
/* this has to be sorted always */
static const struct keywords keywords[] = {
{ "auto", AUTO },
+ { "chroot", CHROOT },
{ "combined", COMBINED },
{ "common", COMMON },
{ "connection", CONNECTION },