From e0dc983e264ac42cb5363e1d06c161ee4bb33b4a Mon Sep 17 00:00:00 2001 From: reyk Date: Thu, 31 Jul 2014 13:28:15 +0000 Subject: [PATCH] Rename the "docroot" variable to "path" because it will be used for either files or the fastcgi socket (and there's no need to use a union yet). --- usr.sbin/httpd/config.c | 10 +++++----- usr.sbin/httpd/httpd.h | 10 +++++----- usr.sbin/httpd/parse.y | 14 +++++++------- usr.sbin/httpd/server_file.c | 6 +++--- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/usr.sbin/httpd/config.c b/usr.sbin/httpd/config.c index cc8060f313c..6130a0ba181 100644 --- a/usr.sbin/httpd/config.c +++ b/usr.sbin/httpd/config.c @@ -1,4 +1,4 @@ -/* $OpenBSD: config.c,v 1.8 2014/07/31 09:34:57 reyk Exp $ */ +/* $OpenBSD: config.c,v 1.9 2014/07/31 13:28:15 reyk Exp $ */ /* * Copyright (c) 2011 - 2014 Reyk Floeter @@ -238,11 +238,11 @@ config_getserver_config(struct httpd *env, struct server *srv, if ((srv_conf->flags & f) == 0) srv_conf->flags |= srv->srv_conf.flags & f; - f = SRVFLAG_DOCROOT; + f = SRVFLAG_PATH; if ((srv_conf->flags & f) == 0) { - (void)strlcpy(srv_conf->docroot, - srv->srv_conf.docroot, - sizeof(srv_conf->docroot)); + (void)strlcpy(srv_conf->path, + srv->srv_conf.path, + sizeof(srv_conf->path)); } f = SRVFLAG_FCGI|SRVFLAG_NO_FCGI; diff --git a/usr.sbin/httpd/httpd.h b/usr.sbin/httpd/httpd.h index 66c047ca64b..ae4b2b4cf0d 100644 --- a/usr.sbin/httpd/httpd.h +++ b/usr.sbin/httpd/httpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: httpd.h,v 1.21 2014/07/31 09:34:57 reyk Exp $ */ +/* $OpenBSD: httpd.h,v 1.22 2014/07/31 13:28:15 reyk Exp $ */ /* * Copyright (c) 2006 - 2014 Reyk Floeter @@ -277,14 +277,14 @@ SPLAY_HEAD(client_tree, client); #define SRVFLAG_NO_INDEX 0x02 #define SRVFLAG_AUTO_INDEX 0x04 #define SRVFLAG_NO_AUTO_INDEX 0x08 -#define SRVFLAG_DOCROOT 0x10 +#define SRVFLAG_PATH 0x10 #define SRVFLAG_LOCATION 0x20 #define SRVFLAG_FCGI 0x40 #define SRVFLAG_NO_FCGI 0x80 #define SRVFLAG_BITS \ "\10\01INDEX\02NO_INDEX\03AUTO_INDEX\04NO_AUTO_INDEX" \ - "\05LOCATION\06FCGI\07NO_FCGI" + "\05PATH\06LOCATION\07FCGI\10NO_FCGI" #define TCPFLAG_NODELAY 0x01 #define TCPFLAG_NNODELAY 0x02 @@ -303,9 +303,9 @@ SPLAY_HEAD(client_tree, client); struct server_config { u_int32_t id; char name[MAXHOSTNAMELEN]; - char docroot[MAXPATHLEN]; - char index[NAME_MAX]; char location[NAME_MAX]; + char index[NAME_MAX]; + char path[MAXPATHLEN]; in_port_t port; struct sockaddr_storage ss; diff --git a/usr.sbin/httpd/parse.y b/usr.sbin/httpd/parse.y index 253664b98f8..905c777f2ce 100644 --- a/usr.sbin/httpd/parse.y +++ b/usr.sbin/httpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.11 2014/07/31 09:34:57 reyk Exp $ */ +/* $OpenBSD: parse.y,v 1.12 2014/07/31 13:28:15 reyk Exp $ */ /* * Copyright (c) 2007 - 2014 Reyk Floeter @@ -216,8 +216,8 @@ server : SERVER STRING { } free($2); - strlcpy(s->srv_conf.docroot, HTTPD_DOCROOT, - sizeof(s->srv_conf.docroot)); + strlcpy(s->srv_conf.path, HTTPD_DOCROOT, + sizeof(s->srv_conf.path)); strlcpy(s->srv_conf.index, HTTPD_INDEX, sizeof(s->srv_conf.index)); s->srv_conf.id = ++last_server_id; @@ -284,15 +284,15 @@ serveroptsl : LISTEN ON STRING port { host_free(&al); } | ROOT STRING { - if (strlcpy(srv->srv_conf.docroot, $2, - sizeof(srv->srv_conf.docroot)) >= - sizeof(srv->srv_conf.docroot)) { + if (strlcpy(srv->srv_conf.path, $2, + sizeof(srv->srv_conf.path)) >= + sizeof(srv->srv_conf.path)) { yyerror("document root too long"); free($2); YYERROR; } free($2); - srv->srv_conf.flags |= SRVFLAG_DOCROOT; + srv->srv_conf.flags |= SRVFLAG_PATH; } | DIRECTORY dirflags | DIRECTORY '{' dirflags_l '}' diff --git a/usr.sbin/httpd/server_file.c b/usr.sbin/httpd/server_file.c index 5101d3952fd..e2887af73ee 100644 --- a/usr.sbin/httpd/server_file.c +++ b/usr.sbin/httpd/server_file.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server_file.c,v 1.19 2014/07/30 07:09:38 reyk Exp $ */ +/* $OpenBSD: server_file.c,v 1.20 2014/07/31 13:28:15 reyk Exp $ */ /* * Copyright (c) 2006 - 2014 Reyk Floeter @@ -149,7 +149,7 @@ server_file(struct httpd *env, struct client *clt) /* Request path is already canonicalized */ if ((size_t)snprintf(path, sizeof(path), "%s%s", - srv_conf->docroot, desc->http_path) >= sizeof(path)) { + srv_conf->path, desc->http_path) >= sizeof(path)) { /* Do not echo the uncanonicalized path */ server_abort_http(clt, 500, desc->http_path); return (-1); @@ -225,7 +225,7 @@ server_file_index(struct httpd *env, struct client *clt) /* Request path is already canonicalized */ if ((size_t)snprintf(path, sizeof(path), "%s%s", - srv_conf->docroot, desc->http_path) >= sizeof(path)) + srv_conf->path, desc->http_path) >= sizeof(path)) goto fail; /* Now open the file, should be readable or we have another problem */ -- 2.20.1