[NeoStats-Devel] [Commits] r2837 - trunk/src

[email protected] Thu, 29 Sep 2005 01:11:38 +1000
Newsgroups gmane.comp.neostats.devel
Message-ID <[email protected]>
Author: Fish
Date: Wed Sep 28 23:11:30 2005
New Revision: 2837

Modified:
   trunk/src/conf.c
Log:
make sure that users use a hostname other than stats.neostats.net or stats.somenet.net (causes problems with secure.irc-chat.net database)

Modified: trunk/src/conf.c
==============================================================================
--- trunk/src/conf.c	(original)
+++ trunk/src/conf.c	Wed Sep 28 23:11:30 2005
@@ -53,6 +53,7 @@
 static int cb_verify_mask( cfg_t *cfg, cfg_opt_t *opt );
 static int cb_noload( cfg_t *cfg, cfg_opt_t *opt );
 static int cb_verify_host( cfg_t *cfg, cfg_opt_t *opt );
+static int cb_verify_neohost( cfg_t *cfg, cfg_opt_t *opt );
 static int cb_verify_settime( cfg_t *cfg, cfg_opt_t *opt );
 
 /** @brief Core Configuration Items
@@ -115,7 +116,7 @@
 };
 
 validate_args arg_validate[] = {
-	{"ServerConfig|Name", &cb_verify_host},
+	{"ServerConfig|Name", &cb_verify_neohost},
 	{"ServerConfig|ServiceChannel", &cb_verify_chan},
 	{"ServerConfig|ServerNumeric", &cb_verify_numeric},
 	{"ServerConfig|BindTo", &cb_verify_bind},
@@ -539,6 +540,31 @@
 	return CFG_SUCCESS;
 }
 
+/** @brief cb_verify_neohost
+ *
+ *  Verify hostname/ip address configuration value
+ *  Config subsystem use only
+ *
+ *  @param cfg pointer to config structure
+ *  @param opt pointer to option
+ *
+ *  @return none
+ */
+
+static int cb_verify_neohost( cfg_t *cfg, cfg_opt_t *opt )
+{
+	if( ValidateHost( opt->values[0]->string ) == NS_FAILURE )
+	{
+		cfg_error( cfg, "Invalid hostname %s for option %s", opt->values[0]->string, opt->name );
+		return CFG_PARSE_ERROR;
+	}
+	if ((!strcasecmp(opt->values[0]->string, "stats.neostats.net")) || (!strcasecmp(opt->values[0]->string, "stats.somennet.net"))) {
+		cfg_error( cfg, "You must use a hostname other than %s", opt->values[0]->string);
+		return CFG_PARSE_ERROR;
+	}
+	return CFG_SUCCESS;
+}
+
 /** @brief cb_verify_settime
  *
  *  Verify settime configuration value