commit - 951314cb79fa18c00ff2443521b2d84c5199715e
commit + 6f7b669becb0ebf2058fa2bbe834de48c01de933
blob - 8da608da85f742ebfc20ecee0571f89f2ac2a777
blob + ca5611098388b5551ccf73fa99c9c15c32c0ed3a
--- src/ngircd/conf.c
+++ src/ngircd/conf.c
static void Set_Defaults PARAMS(( bool InitServers ));
static bool Read_Config PARAMS(( bool ngircd_starting ));
-static void Validate_Config PARAMS(( bool TestOnly, bool Rehash ));
+static bool Validate_Config PARAMS(( bool TestOnly, bool Rehash ));
static void Handle_GLOBAL PARAMS(( int Line, char *Var, char *Arg ));
static void Handle_OPERATOR PARAMS(( int Line, char *Var, char *Arg ));
struct group *grp;
unsigned int i;
char *topic;
+ bool config_valid;
Use_Log = false;
- Read_Config( true );
- Validate_Config(true, false);
+ if (! Read_Config(true))
+ return 1;
+ config_valid = Validate_Config(true, false);
+
/* If stdin and stdout ("you can read our nice message and we can
* read in your keypress") are valid tty's, wait for a key: */
if( isatty( fileno( stdin )) && isatty( fileno( stdout ))) {
printf( " Topic = %s\n\n", topic ? topic : "");
}
- return 0;
+ return (config_valid ? 0 : 1);
} /* Conf_Test */
} /* Handle_CHANNEL */
-static void
+static bool
Validate_Config(bool Configtest, bool Rehash)
{
/* Validate configuration settings. */
#ifdef DEBUG
int i, servers, servers_once;
#endif
+ bool config_valid = true;
char *ptr;
/* Validate configured server name, see RFC 2812 section 2.3.1 */
if (!Conf_ServerName[0]) {
/* No server name configured! */
+ config_valid = false;
Config_Error(LOG_ALERT,
"No (valid) server name configured in \"%s\" (section 'Global': 'Name')!",
NGIRCd_ConfFile);
if (Conf_ServerName[0] && !strchr(Conf_ServerName, '.')) {
/* No dot in server name! */
+ config_valid = false;
Config_Error(LOG_ALERT,
"Invalid server name configured in \"%s\" (section 'Global': 'Name'): Dot missing!",
NGIRCd_ConfFile);
#ifdef STRICT_RFC
if (!Conf_ServerAdminMail[0]) {
/* No administrative contact configured! */
+ config_valid = false;
Config_Error(LOG_ALERT,
"No administrator email address configured in \"%s\" ('AdminEMail')!",
NGIRCd_ConfFile);
"Configuration: Operators=%d, Servers=%d[%d], Channels=%d",
Conf_Oper_Count, servers, servers_once, Conf_Channel_Count);
#endif
+
+ return config_valid;
} /* Validate_Config */