From 23a7cd1e0c71eb20fc997f4dd234e52b6db6656c Mon Sep 17 00:00:00 2001 From: Michael Dukelsky Date: Thu, 5 Dec 2019 17:01:14 +0300 Subject: [PATCH] enforce defining main address before defining areas --- cvsdate.h | 2 +- fidoconf.spec | 2 +- src/line.c | 20 ++++++++++++++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/cvsdate.h b/cvsdate.h index 4860a6d5..27997a44 100644 --- a/cvsdate.h +++ b/cvsdate.h @@ -1 +1 @@ -char cvs_date[]="2019-01-08"; +char cvs_date[]="2019-12-05"; diff --git a/fidoconf.spec b/fidoconf.spec index c20ebb14..32c4e403 100644 --- a/fidoconf.spec +++ b/fidoconf.spec @@ -1,4 +1,4 @@ -%define reldate 20190311 +%define reldate 20191205 %define reltype C # may be one of: C (current), R (release), S (stable) diff --git a/src/line.c b/src/line.c index 39ad6c60..8dbaf8a6 100644 --- a/src/line.c +++ b/src/line.c @@ -249,6 +249,12 @@ void printLinkError(void) exit(EX_CONFIG); } +void printAddrError(void) +{ + prErr("The main address must be defined before any areas!"); + exit(EX_CONFIG); +} + s_link *getDescrLink(s_fidoconfig *config) { if (config->describeLinkDefaults) { /* describing defaults for links */ @@ -1803,6 +1809,11 @@ int parseEchoArea(char *token, s_fidoconfig *config) { int rc; s_area *area; + + if (config->addr == NULL) + { + printAddrError(); + } if (token == NULL) { prErr("Parameters after %s are missing!", actualKeyword); return 1; @@ -1820,6 +1831,11 @@ int parseNetMailArea(char *token, s_fidoconfig *config) { int rc; s_area *area; + + if (config->addr == NULL) + { + printAddrError(); + } if (token == NULL) { prErr("Parameters after %s are missing!", actualKeyword); return 1; @@ -1838,6 +1854,10 @@ int parseFileArea(char *token, s_fidoconfig *config) int rc; s_area *area; + if (config->addr == NULL) + { + printAddrError(); + } if (token == NULL) { prErr("Parameters after %s are missing!", actualKeyword); return 1;