summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/example_new.conf23
-rw-r--r--src/config.c69
-rw-r--r--src/core/os_set.c30
3 files changed, 43 insertions, 79 deletions
diff --git a/data/example_new.conf b/data/example_new.conf
index 66417f6f0..0714da134 100644
--- a/data/example_new.conf
+++ b/data/example_new.conf
@@ -111,7 +111,8 @@ uplink
*
* This section contains information about the Services server.
*/
-serverinfo {
+serverinfo
+{
/*
* The hostname that Services will be seen as, it must have no conflicts with any
* other server names on the rest of your IRC network. Note that it does not have
@@ -128,6 +129,20 @@ serverinfo {
description = "Services for IRC Networks"
/*
+ * The local address that Services will bind to before connecting to the remote
+ * server. This may be useful for multihomed hosts. If neither of these are given,
+ * Services will let the Operating System choose the local address. If only a
+ * hostname is specified, Services will bind to that address but let the Operating
+ * System choose the local port. These directives are optional, and may be overridden
+ * with the -local command-line option when starting Services.
+ *
+ * If you don't know what this means or don't need to use it, just leave these
+ * directives commented out.
+ */
+ #localhost = "nowhere."
+ #localport = 0
+
+ /*
* This directive instructs Anope which IRCd Protocol to speak when connecting.
* You MUST modify this to match the IRCd you run.
*
@@ -173,7 +188,8 @@ serverinfo {
* This section contains information about the IRC network that Services will be
* connecting to.
*/
-networkinfo {
+networkinfo
+{
/*
* For the given channel, every use that has or gets op status of the channel
* will automatically receive the +h user mode. This directive is optional.
@@ -216,7 +232,8 @@ networkinfo {
*
* This section contains various options which determine how Services will operate.
*/
-options {
+options
+{
/*
* The encryption module to use when dealing with passwords. This determines how
* the passwords are stored in the databases, and does not add any security as
diff --git a/src/config.c b/src/config.c
index 9b61d3ec6..29eff4bb5 100644
--- a/src/config.c
+++ b/src/config.c
@@ -251,17 +251,6 @@ static char *ChanCoreModules;
char **ChanServCoreModules;
int ChanServCoreNumber;
-
-char *MysqlHost;
-char *MysqlUser;
-char *MysqlPass;
-char *MysqlName;
-int MysqlPort;
-char *MysqlSecure;
-char *MysqlSock;
-int MysqlRetries = 0;
-int MysqlRetryGap = 0;
-
int DefConLevel;
static std::string DefCon1;
static std::string DefCon2;
@@ -589,6 +578,7 @@ bool DoUplink(ServerConfig *conf, const char *, const char **, ValueList &values
bool DoneUplinks(ServerConfig *, const char *)
{
+ if (Uplinks.empty()) throw ConfigException("You must define at least one uplink block!");
return true;
}
@@ -675,6 +665,8 @@ int ServerConfig::Read(bool bail)
* Any questions about these, w00t, feel free to ask. */
{"serverinfo", "name", "", new ValueContainerChar(&ServerName), DT_HOSTNAME | DT_NORELOAD, ValidateNotEmpty},
{"serverinfo", "description", "", new ValueContainerChar(&ServerDesc), DT_CHARPTR | DT_NORELOAD, ValidateNotEmpty},
+ {"serverinfo", "localhost", "", new ValueContainerChar(&LocalHost), DT_HOSTNAME | DT_NORELOAD, NoValidation},
+ {"serverinfo", "localport", "0", new ValueContainerInt(&LocalPort), DT_INTEGER | DT_NORELOAD, ValidatePort},
{"serverinfo", "type", "", new ValueContainerChar(&IRCDModule), DT_CHARPTR | DT_NORELOAD, ValidateNotEmpty},
{"serverinfo", "id", "", new ValueContainerChar(&Numeric), DT_NOSPACES | DT_NORELOAD, NoValidation},
{"serverinfo", "ident", "", new ValueContainerChar(&ServiceUser), DT_CHARPTR | DT_NORELOAD, ValidateNotEmpty},
@@ -1436,10 +1428,9 @@ bool ValueItem::GetBool()
/*************************************************************************/
+/* Yay, no more core directives using the old config! -- CyberBotX
Directive directives[] = {
- {"LocalAddress", {{PARAM_STRING, 0, &LocalHost},
- {PARAM_PORT, PARAM_OPTIONAL, &LocalPort}}},
-};
+};*/
/*************************************************************************/
@@ -1634,13 +1625,13 @@ int parse(char *buf, int linenum, int reload)
if (!dir)
return 1;
- for (n = 0; n < lenof(directives); n++) {
+ /*for (n = 0; n < lenof(directives); n++) {
Directive *d = &directives[n];
retval = parse_directive(d, dir, ac, av, linenum, reload, s);
if (!retval) {
break;
}
- }
+ }*/
return retval;
}
@@ -1678,12 +1669,12 @@ int read_config(int reload)
char buf[1024], *s;
int defconCount = 0;
- if (reload) {
- unsigned int i, n;
+ /*if (reload) {
+ unsigned int i, n;*/
/* Reset all the reloadable settings */
- for (n = 0; n < lenof(directives); n++) {
+ /*for (n = 0; n < lenof(directives); n++) {
Directive *d = &directives[n];
for (i = 0; i < MAXPARAMS && d->params[i].type != PARAM_NONE;
@@ -1703,7 +1694,7 @@ int read_config(int reload)
}
}
}
- }
+ }*/
retval = serverConfig.Read(reload ? false : true);
if (!retval) return 0; // Temporary until most of the below is modified to use the new parser -- CyberBotX
@@ -1727,23 +1718,20 @@ int read_config(int reload)
}
fclose(config);
- // This section will need better checking after we get LocalAddress moved to the new config
- /*if (!reload) {
- if (RemoteServer3)
- CHECK(RemoteServer2);
-
- if (LocalHost && RemoteServer) {
- if ((!stricmp(LocalHost, RemoteServer))
- && LocalPort == RemotePort) {
- printf
- ("\n*** LocalAddress and RemoteServer are set to use the same IP address\n"
- "*** (%s) and port (%d). This would have resulted in errors.\n"
- "*** Change the LocalAddress to bind to another port.\n",
- RemoteServer, LocalPort);
- retval = 0;
+ if (!reload) {
+ if (LocalHost) {
+ std::list<Uplink *>::iterator curr_uplink = Uplinks.begin(), end_uplink = Uplinks.end();
+ for (; curr_uplink != end_uplink; ++curr_uplink) {
+ Uplink *this_uplink = *curr_uplink;
+ if (!stricmp(LocalHost, this_uplink->host) && LocalPort == this_uplink->port) {
+ printf("\n<serverinfo:localhost> matches an <uplink:host> entry (%s)\nand <serverinfo:localport> matches an <uplink:port> entry (%s).\nThis will fail, you must make sure they are different.\n", this_uplink->host, this_uplink->port);
+ retval = 0;
+ }
}
}
- }*/
+ // Just in case someone put something in for <serverinfo:localport> without defining <serverinfo:localhost> too
+ else LocalPort = 0;
+ }
if (temp_nsuserhost) {
if (!(s = strchr(temp_nsuserhost, '@'))) {
@@ -1791,17 +1779,6 @@ int read_config(int reload)
retval = 0;
}
- if (!MysqlRetries || !MysqlRetryGap) {
- MysqlRetries = 5;
- MysqlRetryGap = 1;
- } else if (((MysqlRetries * MysqlRetryGap) > 60)
- || ((MysqlRetries * MysqlRetryGap) < 1)) {
- error(0,
- "MysqlRetries * MysqlRetryGap must be between 1 and 60, using standard values.");
- MysqlRetries = 5;
- MysqlRetryGap = 1;
- }
-
CSDefFlags = 0;
if (CSDefaults.empty()) CSDefFlags = CI_KEEPTOPIC | CI_SECURE | CI_SECUREFOUNDER | CI_SIGNKICK;
else if (CSDefaults != "none") {
diff --git a/src/core/os_set.c b/src/core/os_set.c
index 600a292d0..ade3442d9 100644
--- a/src/core/os_set.c
+++ b/src/core/os_set.c
@@ -95,12 +95,6 @@ int do_set(User * u)
(noexpire ? OPER_SET_LIST_OPTION_ON :
OPER_SET_LIST_OPTION_OFF);
notice_lang(s_OperServ, u, index, "NOEXPIRE");
-#ifdef USE_MYSQL
- index =
- (do_mysql ? OPER_SET_LIST_OPTION_ON :
- OPER_SET_LIST_OPTION_OFF);
- notice_lang(s_OperServ, u, index, "SQL");
-#endif
} else if (!setting) {
syntax_error(s_OperServ, u, "SET", OPER_SET_SYNTAX);
} else if (stricmp(option, "IGNORE") == 0) {
@@ -113,30 +107,6 @@ int do_set(User * u)
} else {
notice_lang(s_OperServ, u, OPER_SET_IGNORE_ERROR);
}
-#ifdef USE_MYSQL
- } else if (stricmp(option, "SQL") == 0) {
- if (stricmp(setting, "on") == 0) {
- if (!MysqlHost) {
- notice_lang(s_OperServ, u, OPER_SET_SQL_ERROR_DISABLED);
- } else {
- if (rdb_init()) {
- notice_lang(s_OperServ, u, OPER_SET_SQL_ON);
- } else {
- notice_lang(s_OperServ, u, OPER_SET_SQL_ERROR_INIT);
- }
- }
- } else if (stricmp(setting, "off") == 0) {
- if (!MysqlHost) {
- notice_lang(s_OperServ, u, OPER_SET_SQL_ERROR_DISABLED);
- } else {
- /* could call rdb_close() but that does nothing - TSL */
- do_mysql = 0;
- notice_lang(s_OperServ, u, OPER_SET_SQL_OFF);
- }
- } else {
- notice_lang(s_OperServ, u, OPER_SET_SQL_ERROR);
- }
-#endif
} else if (stricmp(option, "READONLY") == 0) {
if (stricmp(setting, "on") == 0) {
readonly = 1;