From 3f9d00a84d85c2cac0766ec72ca92524ab06d55a Mon Sep 17 00:00:00 2001 From: codemastr Date: Tue, 6 Jul 2004 21:55:34 +0000 Subject: [PATCH] Fixed a bug where an ident in a vhost {} was never sent out to other servers and added user@host support for set::hosts --- Changes | 2 ++ doc/unreal32docs.html | 17 ++++++++----- src/modules/m_oper.c | 14 ++++++++++- src/modules/m_vhost.c | 4 +++- src/s_conf.c | 55 +++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 84 insertions(+), 8 deletions(-) diff --git a/Changes b/Changes index 7a951edb7..5b2d96f36 100644 --- a/Changes +++ b/Changes @@ -253,3 +253,5 @@ - Fixed ban bug: halfops were also prevented from doing nickchanges if banned, plus.. +b ~n:*!*@* also made nickchanges impossible for voiced(&halfop'ed) people (so like half of the purpose of it was defeated @$#&@#). Reported by Rocko. +- Fixed a bug where an ident in a vhost {} was never sent out to other servers and added + user@host support for set::hosts (#0001834) reported/suggested by bleepy. diff --git a/doc/unreal32docs.html b/doc/unreal32docs.html index 368eb1e1b..995ba8021 100644 --- a/doc/unreal32docs.html +++ b/doc/unreal32docs.html @@ -2160,18 +2160,23 @@ set { Defines the prefix that will be used on hiddenhosts (+x). This is usually three or four letters representing the network name.

set::hosts::local <locop-host-name>;
- Defines the hostname that will be assigned to local opers when they set +x.

+ Defines the hostname that will be assigned to local opers when they set +x. You may + optionally specify a username@host for this value.

set::hosts::global <globop-host-name>;
Defines the hostname that will be assigned to global operators when they set - +x.

+ +x. You may optionally specify a username@host for this value.

set::hosts::coadmin <coadmin-host-name>;
- Sets the hostname that will be assigned to co-admins when they set +x.

+ Sets the hostname that will be assigned to co-admins when they set +x. You may + optionally specify a username@host for this value.

set::hosts::admin <admin-host-name>;
- Defines the hostname that will be set for admins when they set +x.

+ Defines the hostname that will be set for admins when they set +x. You may + optionally specify a username@host for this value.

set::hosts::servicesadmin <servicesadmin-host-name>;
- Sets the hostname that will be given to services-admins when they set +x.

+ Sets the hostname that will be given to services-admins when they set +x. You may + optionally specify a username@host for this value.

set::hosts::netadmin <netadmin-host-name>;
- Sets the hostname that will be given to netadmins when they set +x.

+ Sets the hostname that will be given to netadmins when they set +x. You may + optionally specify a username@host for this value.

set::hosts::host-on-oper-up <yes/no>;
If set to yes, the H/get_host flag will be honored and +x will be automatically set at /oper. If set to no, the user must set +x manually to receive the oper diff --git a/src/modules/m_oper.c b/src/modules/m_oper.c index 1756fb646..2be1a1271 100644 --- a/src/modules/m_oper.c +++ b/src/modules/m_oper.c @@ -270,7 +270,19 @@ DLLFUNC int m_oper(aClient *cptr, aClient *sptr, int parc, char *parv[]) { sptr->oflag = aconf->oflags; if ((aconf->oflags & OFLAG_HIDE) && iNAH && !BadPtr(host)) { - iNAH_host(sptr, host); + char *c; + char *vhost = host; + + if ((c = strchr(host, '@'))) + { + vhost = c+1; + strncpy(sptr->user->username, host, c-host); + sptr->user->username[c-host] = 0; + sendto_serv_butone_token(NULL, sptr->name, MSG_SETIDENT, + TOK_SETIDENT, "%s", + sptr->user->username); + } + iNAH_host(sptr, vhost); SetHidden(sptr); } else if (IsHidden(sptr) && !sptr->user->virthost) { diff --git a/src/modules/m_vhost.c b/src/modules/m_vhost.c index 1a6075fcc..320ad5d43 100644 --- a/src/modules/m_vhost.c +++ b/src/modules/m_vhost.c @@ -175,12 +175,14 @@ int m_vhost(aClient *cptr, aClient *sptr, int parc, char *parv[]) if (vhost->virtuser) { strcpy(olduser, sptr->user->username); strlcpy(sptr->user->username, vhost->virtuser, USERLEN); + sendto_serv_butone_token(cptr, sptr->name, MSG_SETIDENT, TOK_SETIDENT, + "%s", sptr->user->username); } sptr->umodes |= UMODE_HIDE; sptr->umodes |= UMODE_SETHOST; sendto_serv_butone_token(cptr, sptr->name, MSG_SETHOST, TOK_SETHOST, - "%s", vhost->virthost); + "%s", sptr->user->virthost); sendto_one(sptr, ":%s MODE %s :+tx", sptr->name, sptr->name); if (vhost->swhois) { diff --git a/src/s_conf.c b/src/s_conf.c index a61b66b42..065ed0ce6 100644 --- a/src/s_conf.c +++ b/src/s_conf.c @@ -6489,6 +6489,7 @@ int _test_set(ConfigFile *conf, ConfigEntry *ce) else if (!strcmp(cep->ce_varname, "hosts")) { for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) { + char *c, *host; if (!cepp->ce_vardata) { config_error("%s:%i: set::hosts item without value", @@ -6526,6 +6527,60 @@ int _test_set(ConfigFile *conf, ConfigEntry *ce) continue; } + if ((c = strchr(cepp->ce_vardata, '@'))) + { + char *tmp; + if (!(*(c+1)) || (c-cepp->ce_vardata) > USERLEN || + c == cepp->ce_vardata) + { + config_error("%s:%i: illegal value for set::hosts::%s", + cepp->ce_fileptr->cf_filename, + cepp->ce_varlinenum, + cepp->ce_varname); + errors++; + continue; + } + for (tmp = cepp->ce_vardata; tmp != c; tmp++) + { + if (*tmp == '~' && tmp == cepp->ce_vardata) + continue; + if (!isallowed(*tmp)) + break; + } + if (tmp != c) + { + config_error("%s:%i: illegal value for set::hosts::%s", + cepp->ce_fileptr->cf_filename, + cepp->ce_varlinenum, + cepp->ce_varname); + errors++; + continue; + } + host = c+1; + } + else + host = cepp->ce_vardata; + if (strlen(host) > HOSTLEN) + { + config_error("%s:%i: illegal value for set::hosts::%s", + cepp->ce_fileptr->cf_filename, + cepp->ce_varlinenum, + cepp->ce_varname); + errors++; + continue; + } + for (; *host; host++) + { + if (!isallowed(*host) && *host != ':') + { + config_error("%s:%i: illegal value for set::hosts::%s", + cepp->ce_fileptr->cf_filename, + cepp->ce_varlinenum, + cepp->ce_varname); + errors++; + continue; + } + } } } else if (!strcmp(cep->ce_varname, "cloak-keys"))