commit - d273c0648d7bb1245d43d8d34ff75b62270155e2
commit + e45334e6ae0b658a2d3d4f47bc3e9ddfdb83a44f
blob - a034a275edc32373952e64f67b8064f98def684b
blob + 5c38d746a682d6e1236ba2f29690b65d0e0e0016
--- config.c
+++ config.c
{
memset(&conf, 0, sizeof(conf));
- TAILQ_INIT(&hosts);
-
TAILQ_INIT(&conf.fcgi);
+ TAILQ_INIT(&conf.hosts);
conf.port = 1965;
conf.ipv6 = 0;
TAILQ_REMOVE(&conf.fcgi, f, fcgi);
free(f);
}
- memset(&conf, 0, sizeof(conf));
- conf.ps = ps;
- conf.sock4 = conf.sock6 = -1;
- conf.protos = TLS_PROTOCOL_TLSv1_2 | TLS_PROTOCOL_TLSv1_3;
- init_mime(&conf.mime);
- TAILQ_INIT(&conf.fcgi);
-
- TAILQ_FOREACH_SAFE(h, &hosts, vhosts, th) {
+ TAILQ_FOREACH_SAFE(h, &conf.hosts, vhosts, th) {
free(h->cert_path);
free(h->key_path);
free(h->ocsp_path);
free(p);
}
- TAILQ_REMOVE(&hosts, h, vhosts);
+ TAILQ_REMOVE(&conf.hosts, h, vhosts);
free(h);
}
+
+ memset(&conf, 0, sizeof(conf));
+
+ conf.ps = ps;
+ conf.sock4 = conf.sock6 = -1;
+ conf.protos = TLS_PROTOCOL_TLSv1_2 | TLS_PROTOCOL_TLSv1_3;
+ init_mime(&conf.mime);
+ TAILQ_INIT(&conf.fcgi);
+ TAILQ_INIT(&conf.hosts);
}
static int
}
int
-config_send(struct conf *conf, struct vhosthead *hosts)
+config_send(struct conf *conf)
{
struct privsep *ps = conf->ps;
struct etm *m;
return -1;
}
- TAILQ_FOREACH(h, hosts, vhosts) {
+ TAILQ_FOREACH(h, &conf->hosts, vhosts) {
struct vhost vcopy;
memcpy(&vcopy, h, sizeof(vcopy));
vh = new_vhost();
strlcpy(vh->domain, vht.domain, sizeof(vh->domain));
h = vh;
- TAILQ_INSERT_TAIL(&hosts, h, vhosts);
+ TAILQ_INSERT_TAIL(&conf->hosts, h, vhosts);
/* reset proxy */
p = NULL;
blob - 63065aa618e8a098ed498501d0cd387ca342ec1b
blob + 47ed883805ee02ede1a49148a7c24de2765bc410
--- ge.c
+++ ge.c
struct conf conf;
int privsep_process;
-
-struct vhosthead hosts = TAILQ_HEAD_INITIALIZER(hosts);
static const struct option opts[] = {
{"help", no_argument, NULL, 'h'},
/* set up the implicit vhost and location */
host = xcalloc(1, sizeof(*host));
- TAILQ_INSERT_HEAD(&hosts, host, vhosts);
+ TAILQ_INSERT_HEAD(&conf.hosts, host, vhosts);
loc = xcalloc(1, sizeof(*loc));
loc->fcgi = -1;
blob - 11aaec404f67102274e360377ac50b0f7323fbc1
blob + 7a7a47d59153945a0f83db89e815b90bdcf2b801
--- gmid.c
+++ gmid.c
{"version", no_argument, NULL, 'V'},
{NULL, 0, NULL, 0},
};
-
-struct vhosthead hosts;
int sock4, sock6;
int privsep_process;
if (proc_compose(ps, PROC_SERVER, IMSG_RECONF_START, NULL, 0) == -1)
return -1;
- if (config_send(conf, &hosts) == -1)
+ if (config_send(conf) == -1)
return -1;
if (proc_compose(ps, PROC_SERVER, IMSG_RECONF_END, NULL, 0) == -1)
blob - fc64880a13d8d8fb58c39b15f18c7ee6fa17fc94
blob + 20e20561ad8897f10d46b36c5dc54841afa437e0
--- gmid.h
+++ gmid.h
TAILQ_ENTRY(alist) aliases;
};
-extern TAILQ_HEAD(vhosthead, vhost) hosts;
+TAILQ_HEAD(vhosthead, vhost);
struct vhost {
char domain[HOST_NAME_MAX + 1];
char *cert_path;
struct event evsock6;
struct fcgihead fcgi;
+ struct vhosthead hosts;
};
extern const char *config_path;
/* config.c */
void config_init(void);
void config_free(void);
-int config_send(struct conf *, struct vhosthead *);
+int config_send(struct conf *);
int config_recv(struct conf *, struct imsg *);
/* parse.y */
blob - fb88fcac5af5df99b46d30ed604da028ecb28065
blob + d4ac93a011e898d39a759ea126c85333b8b9368d
--- parse.y
+++ parse.y
vhost : SERVER string {
host = new_vhost();
- TAILQ_INSERT_HEAD(&hosts, host, vhosts);
+ TAILQ_INSERT_HEAD(&conf.hosts, host, vhosts);
loc = new_location();
TAILQ_INSERT_HEAD(&host->locations, loc, locations);
if (*conf.user != '\0')
printf("user \"%s\"\n", conf.user);
- TAILQ_FOREACH(h, &hosts, vhosts) {
+ TAILQ_FOREACH(h, &conf.hosts, vhosts) {
printf("\nserver \"%s\" {\n", h->domain);
printf(" cert \"%s\"\n", h->cert);
printf(" key \"%s\"\n", h->key);
blob - 80f8d25cfb68c2b6d2cab4e4cc8031d3b955052e
blob + dd7dcc875e069678853006010393e58f52d7e815
--- server.c
+++ server.c
goto err;
}
- TAILQ_FOREACH(h, &hosts, vhosts) {
+ TAILQ_FOREACH(h, &conf.hosts, vhosts) {
if (matches(h->domain, c->domain))
goto found;
TAILQ_FOREACH(a, &h->aliases, aliases) {
fatalx("tls_config_set_protocols: %s",
tls_config_error(tlsconf));
- h = TAILQ_FIRST(&hosts);
+ h = TAILQ_FIRST(&conf.hosts);
/* we need to set something, then we can add how many key we want */
if (tls_config_set_keypair_mem(tlsconf, h->cert, h->certlen,
struct vhost *h;
struct location *l;
- TAILQ_FOREACH(h, &hosts, vhosts) {
+ TAILQ_FOREACH(h, &conf.hosts, vhosts) {
TAILQ_FOREACH(l, &h->locations, locations) {
if (*l->dir == '\0')
continue;