From 220c9db54ddedea4f0a4b67bd4cf7f7e4a6a3303 Mon Sep 17 00:00:00 2001 From: "B.Greenham" Date: Tue, 2 Mar 2010 01:57:25 -0500 Subject: [PATCH] Add general::default_operhost. --- doc/example.conf | 1 + doc/reference.conf | 7 +++++++ include/s_conf.h | 1 + modules/m_info.c | 6 ++++++ src/newconf.c | 1 + src/s_conf.c | 7 +++++++ src/s_user.c | 17 +++++++++++++++++ 7 files changed, 40 insertions(+) diff --git a/doc/example.conf b/doc/example.conf index 1c5c75f..1e9234b 100755 --- a/doc/example.conf +++ b/doc/example.conf @@ -462,6 +462,7 @@ general { default_operstring = "is an IRC Operator"; default_adminstring = "is a Server Administrator"; + default_operhost = "staff.testnet.net"; servicestring = "is a Network Service"; disable_fake_channels = no; tkline_expire_notices = no; diff --git a/doc/reference.conf b/doc/reference.conf index 636800d..5642ad7 100755 --- a/doc/reference.conf +++ b/doc/reference.conf @@ -1004,6 +1004,13 @@ general { */ default_adminstring = "is a Server Administrator"; + /* default operhost: defines the default virtual host that + * operators will receiving upon opering up. Can be overriden + * by the vhost option in individual operator blocks. This + * must be a valid hostmask. + */ + default_operhost = "staff.testnet.net"; + /* servicestring: defines the response for opered services (+S) * in /whois queries, eg "is a Network Service". * This is updated on rehash. diff --git a/include/s_conf.h b/include/s_conf.h index 6e18c42..10f6601 100644 --- a/include/s_conf.h +++ b/include/s_conf.h @@ -138,6 +138,7 @@ struct config_file_entry char *default_operstring; char *default_adminstring; + char *default_operhost; char *servicestring; char *kline_reason; diff --git a/modules/m_info.c b/modules/m_info.c index 36cf629..e697547 100644 --- a/modules/m_info.c +++ b/modules/m_info.c @@ -151,6 +151,12 @@ static struct InfoStruct info_table[] = { &ConfigFileEntry.default_operstring, "Default operstring at startup.", }, + { + "default_operhost", + OUTPUT_STRING, + &ConfigFileEntry.default_operhost, + "Default vhost for operators to receive upon opering up.", + }, { "servicestring", OUTPUT_STRING, diff --git a/src/newconf.c b/src/newconf.c index a13841a..ffdc34b 100644 --- a/src/newconf.c +++ b/src/newconf.c @@ -2141,6 +2141,7 @@ static struct ConfEntry conf_general_table[] = { "default_operstring", CF_QSTRING, NULL, REALLEN, &ConfigFileEntry.default_operstring }, { "default_adminstring",CF_QSTRING, NULL, REALLEN, &ConfigFileEntry.default_adminstring }, + { "default_operhost", CF_QSTRING, NULL, REALLEN, &ConfigFileEntry.default_operhost }, { "servicestring", CF_QSTRING, NULL, REALLEN, &ConfigFileEntry.servicestring }, { "egdpool_path", CF_QSTRING, NULL, MAXPATHLEN, &ConfigFileEntry.egdpool_path }, { "kline_reason", CF_QSTRING, NULL, REALLEN, &ConfigFileEntry.kline_reason }, diff --git a/src/s_conf.c b/src/s_conf.c index 66d407c..b0e07e6 100644 --- a/src/s_conf.c +++ b/src/s_conf.c @@ -680,6 +680,7 @@ set_default_conf(void) ConfigFileEntry.default_operstring = rb_strdup("is an IRC operator"); ConfigFileEntry.default_adminstring = rb_strdup("is a Server Administrator"); + ConfigFileEntry.default_operhost = rb_strdup(""); ConfigFileEntry.servicestring = rb_strdup("is a Network Service"); ConfigFileEntry.default_umodes = UMODE_INVISIBLE; @@ -876,6 +877,12 @@ validate_conf(void) splitchecking = 0; } + if(!valid_hostname(ConfigFileEntry.default_operhost)) + { + conf_report_error("Warning -- invalid default_operhost specified, ignoring."); + ConfigFileEntry.default_operhost = rb_strdup(""); + } + /* Parse the exemptchanops option and set the internal variables * that we will use. */ char * ech; diff --git a/src/s_user.c b/src/s_user.c index c64d50f..062b0ed 100644 --- a/src/s_user.c +++ b/src/s_user.c @@ -1310,6 +1310,23 @@ oper_up(struct Client *source_p, struct oper_conf *oper_p) else source_p->umodes |= DEFAULT_OPER_UMODES; + if(!EmptyString(ConfigFileEntry.default_operhost)) + { + change_nick_user_host(source_p, source_p->name, source_p->username, ConfigFileEntry.default_operhost, 0, "Changing host"); + + sendto_one_numeric(source_p, RPL_HOSTHIDDEN, "%s :is now your hidden host (set by %s)", source_p->host, source_p->servptr->name); + + sendto_server(NULL, NULL, + CAP_EUID | CAP_TS6, NOCAPS, ":%s CHGHOST %s :%s", + use_id(&me), use_id(source_p), source_p->host); + sendto_server(NULL, NULL, + CAP_TS6, CAP_EUID, ":%s ENCAP * CHGHOST %s :%s", + use_id(&me), use_id(source_p), source_p->host); + + if (!IsDynSpoof(source_p)) + SetDynSpoof(source_p); + } + if (oper_p->snomask) { source_p->snomask |= oper_p->snomask;