From: Alex Badea Date: Tue, 16 Apr 2002 13:34:07 +0000 (+0000) Subject: Author: beware && Alex Badea X-Git-Url: http://git.pk910.de/?a=commitdiff_plain;h=0edaae387ee724a00f5212b5c3b6434454cd522f;p=ircu2.10.12-pk.git Author: beware && Alex Badea Log message: beware: fixed m_whois The Right Way (tm), also cleaned up m_admin Vampire-: fixed hunt_server_cmd not sending "no such server" for servermasks (pull-up from u2_10_11 branch) git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@741 c9e4aea6-c8fd-4c43-8297-357d70d61c8c --- diff --git a/ChangeLog b/ChangeLog index 4efa31a..bb761e2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2002-04-16 Alex Badea + + * ircd/s_user.c (hunt_server_cmd): also send a "no such server" + reply if the servername contains a '*' and it doesn't exist + + * include/patchlevel.h (PATCHLEVEL): bump patchlevel + +2002-04-16 beware + + * ircd/m_whois.c: the previous patch broke whois, fixed it + another way + + * ircd/m_admin.c: cleaned up m_admin too while we're here, + hunt_server_cmd can do all the work for us + 2002-04-15 Alex Badea * ircd/m_stats.c: added verbose server reporting (/stats v diff --git a/include/patchlevel.h b/include/patchlevel.h index 72f5f2b..d954db7 100644 --- a/include/patchlevel.h +++ b/include/patchlevel.h @@ -18,7 +18,7 @@ * $Id$ * */ -#define PATCHLEVEL "03" +#define PATCHLEVEL "04" #define RELEASE ".12.alpha." diff --git a/ircd/m_admin.c b/ircd/m_admin.c index b918f3b..e9b4488 100644 --- a/ircd/m_admin.c +++ b/ircd/m_admin.c @@ -135,19 +135,9 @@ int mo_admin(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) assert(0 != cptr); assert(cptr == sptr); - if (parc > 1) { - struct Client *acptr; - acptr = FindUser(parv[1]); - if (acptr) - parv[1] = cli_name(cli_user(acptr)->server); - else if (!(acptr = find_match_server(parv[1]))) - return send_reply(sptr, ERR_NOSUCHSERVER, parv[1]); - - parv[1] = cli_name(acptr); - if (hunt_server_cmd(sptr, CMD_ADMIN, cptr, HEAD_IN_SAND_REMOTE, ":%C", 1, - parc, parv) != HUNTED_ISME) - return 0; - } + if (hunt_server_cmd(sptr, CMD_ADMIN, cptr, HEAD_IN_SAND_REMOTE, ":%C", 1, + parc, parv) != HUNTED_ISME) + return 0; return send_admin_info(sptr); } diff --git a/ircd/m_whois.c b/ircd/m_whois.c index 4324e0a..5a51094 100644 --- a/ircd/m_whois.c +++ b/ircd/m_whois.c @@ -357,7 +357,6 @@ int m_whois(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) if (parc > 2) { - struct Client *acptr; /* For convenience: Accept a nickname as first parameter, by replacing * it with the correct servername - as is needed by hunt_server(). * This is the secret behind the /whois nick nick trick. @@ -370,22 +369,11 @@ int m_whois(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) parv[1] = parv[2]; #endif - acptr = FindUser(parv[1]); - - if (IsOper(sptr) && !(acptr)) - { - send_reply(sptr, ERR_NOSUCHSERVER, parv[1]); - return 0; - } + if (hunt_server_cmd(sptr, CMD_WHOIS, cptr, 0, "%C :%s", 1, parc, parv) != + HUNTED_ISME) + return 0; - if (acptr) - { - parv[1] = cli_name(cli_user(acptr)->server); - if (hunt_server_cmd(sptr, CMD_WHOIS, cptr, 0, "%C :%s", 1, parc, parv) != - HUNTED_ISME) - return 0; - parv[1] = parv[2]; - } + parv[1] = parv[2]; } for (tmp = parv[1]; (nick = ircd_strtok(&p, tmp, ",")); tmp = 0) diff --git a/ircd/s_user.c b/ircd/s_user.c index 52d55a8..dd6b51b 100644 --- a/ircd/s_user.c +++ b/ircd/s_user.c @@ -175,7 +175,9 @@ struct Client *next_client(struct Client *next, const char* ch) * Command can have only max 8 parameters. * * server parv[server] is the parameter identifying the - * target server. + * target server. It can be a nickname, servername, + * or server mask (from a local user) or a server + * numeric (from a remote server). * * *WARNING* * parv[server] is replaced with the pointer to the @@ -205,8 +207,10 @@ int hunt_server_cmd(struct Client *from, const char *cmd, const char *tok, if (MyUser(from)) { /* Make sure it's a server */ if (!strchr(to, '*')) { - if (0 == (acptr = FindClient(to))) + if (0 == (acptr = FindClient(to))) { + send_reply(from, ERR_NOSUCHSERVER, to); return HUNTED_NOSUCH; + } if (cli_user(acptr)) acptr = cli_user(acptr)->server; @@ -251,8 +255,10 @@ int hunt_server_prio_cmd(struct Client *from, const char *cmd, const char *tok, if (MyUser(from)) { /* Make sure it's a server */ if (!strchr(to, '*')) { - if (0 == (acptr = FindClient(to))) + if (0 == (acptr = FindClient(to))) { + send_reply(from, ERR_NOSUCHSERVER, to); return HUNTED_NOSUCH; + } if (cli_user(acptr)) acptr = cli_user(acptr)->server;