diff options
author | Pierre-Yves Ritschard <pyr@cvs.openbsd.org> | 2007-10-18 20:49:07 +0000 |
---|---|---|
committer | Pierre-Yves Ritschard <pyr@cvs.openbsd.org> | 2007-10-18 20:49:07 +0000 |
commit | 8b92003371cad889543363ed160d5517e1f328bb (patch) | |
tree | 35960d16d81fce992e1e0022231a3b13ce45d961 | |
parent | 6f1c71b9977ec4838e8a0f2afa8e50cb199998ac (diff) |
extra arg to warn slipped through.
-rw-r--r-- | usr.sbin/hoststated/parse.y | 19 | ||||
-rw-r--r-- | usr.sbin/relayd/parse.y | 19 |
2 files changed, 22 insertions, 16 deletions
diff --git a/usr.sbin/hoststated/parse.y b/usr.sbin/hoststated/parse.y index 208e7f31cf7..8ec99460ac8 100644 --- a/usr.sbin/hoststated/parse.y +++ b/usr.sbin/hoststated/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.66 2007/10/18 20:32:38 deraadt Exp $ */ +/* $OpenBSD: parse.y,v 1.67 2007/10/18 20:49:06 pyr Exp $ */ /* * Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org> @@ -884,7 +884,7 @@ sslcache : NUMBER { relay : RELAY STRING { struct relay *r; - TAILQ_FOREACH(r, &conf->relays, entry) + TAILQ_FOREACH(r, conf->relays, entry) if (!strcmp(r->conf.name, $2)) break; if (r != NULL) { @@ -929,9 +929,11 @@ relay : RELAY STRING { rlay->proto = &conf->proto_default; rlay->conf.proto = conf->proto_default.id; } + if (relay_load_certfile(rlay) == -1) + YYERROR; conf->relaycount++; SPLAY_INIT(&rlay->sessions); - TAILQ_INSERT_HEAD(&conf->relays, rlay, entry); + TAILQ_INSERT_HEAD(conf->relays, rlay, entry); } ; @@ -1529,7 +1531,7 @@ pushfile(const char *name, int secret) if ((nfile = calloc(1, sizeof(struct file))) == NULL || (nfile->name = strdup(name)) == NULL) { - warn("malloc", nfile->name); + warn("malloc"); return (NULL); } if ((nfile->stream = fopen(nfile->name, "r")) == NULL) { @@ -1575,7 +1577,8 @@ parse_config(const char *filename, int opts) if ((conf = calloc(1, sizeof(*conf))) == NULL || (conf->tables = calloc(1, sizeof(*conf->tables))) == NULL || - (conf->services = calloc(1, sizeof(*conf->services))) == NULL) { + (conf->services = calloc(1, sizeof(*conf->services))) == NULL || + (conf->relays = calloc(1, sizeof(*conf->relays))) == NULL) { warn("cannot allocate memory"); return (NULL); } @@ -1585,8 +1588,8 @@ parse_config(const char *filename, int opts) TAILQ_INIT(conf->services); TAILQ_INIT(conf->tables); + TAILQ_INIT(conf->relays); TAILQ_INIT(&conf->protos); - TAILQ_INIT(&conf->relays); memset(&conf->empty_table, 0, sizeof(conf->empty_table)); conf->empty_table.conf.id = EMPTY_TABLE; @@ -1639,12 +1642,12 @@ parse_config(const char *filename, int opts) } } - if (TAILQ_EMPTY(conf->services) && TAILQ_EMPTY(&conf->relays)) { + if (TAILQ_EMPTY(conf->services) && TAILQ_EMPTY(conf->relays)) { log_warnx("no services, nothing to do"); errors++; } - if (TAILQ_EMPTY(&conf->relays)) + if (TAILQ_EMPTY(conf->relays)) conf->prefork_relay = 0; if (timercmp(&conf->timeout, &conf->interval, >=)) { diff --git a/usr.sbin/relayd/parse.y b/usr.sbin/relayd/parse.y index 208e7f31cf7..8ec99460ac8 100644 --- a/usr.sbin/relayd/parse.y +++ b/usr.sbin/relayd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.66 2007/10/18 20:32:38 deraadt Exp $ */ +/* $OpenBSD: parse.y,v 1.67 2007/10/18 20:49:06 pyr Exp $ */ /* * Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org> @@ -884,7 +884,7 @@ sslcache : NUMBER { relay : RELAY STRING { struct relay *r; - TAILQ_FOREACH(r, &conf->relays, entry) + TAILQ_FOREACH(r, conf->relays, entry) if (!strcmp(r->conf.name, $2)) break; if (r != NULL) { @@ -929,9 +929,11 @@ relay : RELAY STRING { rlay->proto = &conf->proto_default; rlay->conf.proto = conf->proto_default.id; } + if (relay_load_certfile(rlay) == -1) + YYERROR; conf->relaycount++; SPLAY_INIT(&rlay->sessions); - TAILQ_INSERT_HEAD(&conf->relays, rlay, entry); + TAILQ_INSERT_HEAD(conf->relays, rlay, entry); } ; @@ -1529,7 +1531,7 @@ pushfile(const char *name, int secret) if ((nfile = calloc(1, sizeof(struct file))) == NULL || (nfile->name = strdup(name)) == NULL) { - warn("malloc", nfile->name); + warn("malloc"); return (NULL); } if ((nfile->stream = fopen(nfile->name, "r")) == NULL) { @@ -1575,7 +1577,8 @@ parse_config(const char *filename, int opts) if ((conf = calloc(1, sizeof(*conf))) == NULL || (conf->tables = calloc(1, sizeof(*conf->tables))) == NULL || - (conf->services = calloc(1, sizeof(*conf->services))) == NULL) { + (conf->services = calloc(1, sizeof(*conf->services))) == NULL || + (conf->relays = calloc(1, sizeof(*conf->relays))) == NULL) { warn("cannot allocate memory"); return (NULL); } @@ -1585,8 +1588,8 @@ parse_config(const char *filename, int opts) TAILQ_INIT(conf->services); TAILQ_INIT(conf->tables); + TAILQ_INIT(conf->relays); TAILQ_INIT(&conf->protos); - TAILQ_INIT(&conf->relays); memset(&conf->empty_table, 0, sizeof(conf->empty_table)); conf->empty_table.conf.id = EMPTY_TABLE; @@ -1639,12 +1642,12 @@ parse_config(const char *filename, int opts) } } - if (TAILQ_EMPTY(conf->services) && TAILQ_EMPTY(&conf->relays)) { + if (TAILQ_EMPTY(conf->services) && TAILQ_EMPTY(conf->relays)) { log_warnx("no services, nothing to do"); errors++; } - if (TAILQ_EMPTY(&conf->relays)) + if (TAILQ_EMPTY(conf->relays)) conf->prefork_relay = 0; if (timercmp(&conf->timeout, &conf->interval, >=)) { |