From 90fb20a2db5ecd9d0b368cbff95f9851ef5eca4f Mon Sep 17 00:00:00 2001 From: luke Date: Fri, 28 Jun 2002 16:40:20 +0000 Subject: [PATCH] Deprecated akill and rakill. --- Changes | 8 ++ src/s_conf.c | 202 -------------------------------------------- src/s_kline.c | 225 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 233 insertions(+), 202 deletions(-) diff --git a/Changes b/Changes index 92c5a432f..0e73a8118 100644 --- a/Changes +++ b/Changes @@ -421,3 +421,11 @@ oper opers. I like this, if you don't email me and maybe I'll add a conf option for it. --Luke =================================== + +Deprecated /akill and /rakill. Please stop using +these commands. They're old and will be removed in +future releases. For now they simply add/remove a +permanent gline, which is essentially what an akill +is anyway (yes, I know they disappear when you rehash) +--Luke +=================================== diff --git a/src/s_conf.c b/src/s_conf.c index cbbe52b1f..43a6c9108 100644 --- a/src/s_conf.c +++ b/src/s_conf.c @@ -1874,208 +1874,6 @@ static int is_comment(comment) -/* -** m_rakill; -** parv[0] = sender prefix -** parv[1] = hostmask -** parv[2] = username -** parv[3] = comment -*/ -int m_rakill(cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; -{ - char *hostmask, *usermask; - int result; - - if (parc < 2 && IsPerson(sptr)) - { - sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS), - me.name, parv[0], "AKILL"); - return 0; - } - - if (IsServer(sptr) && parc < 3) - return 0; - - if (!IsServer(cptr)) - { - if (!IsOper(sptr)) - { - sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, - sptr->name); - return 0; - } - else - { - if ((hostmask = (char *)index(parv[1], '@'))) - { - *hostmask = 0; - hostmask++; - usermask = parv[1]; - } - else - { - sendto_one(sptr, ":%s NOTICE %s :%s", me.name, - sptr->name, "Please use a user@host mask."); - return 0; - } - } - } - else - { - hostmask = parv[1]; - usermask = parv[2]; - } - - if (!usermask || !hostmask) - { - /* - * This is very bad, it should never happen. - */ - sendto_ops("Error adding akill from %s!", sptr->name); - return 0; - } - - result = del_temp_conf(CONF_KILL, hostmask, NULL, usermask, 0, 0, 2); - if (result == KLINE_DEL_ERR) - { - if (!MyClient(sptr)) - { - sendto_serv_butone(cptr, ":%s RAKILL %s %s", - IsServer(cptr) ? parv[0] : me.name, hostmask, - usermask); - return 0; - } - sendto_one(sptr, ":%s NOTICE %s :Akill %s@%s does not exist.", - me.name, sptr->name, usermask, hostmask); - return 0; - } - - if (MyClient(sptr)) - { - sendto_ops("%s removed akill for %s@%s", - sptr->name, usermask, hostmask); - sendto_serv_butone(&me, - ":%s GLOBOPS :%s removed akill for %s@%s", - me.name, sptr->name, usermask, hostmask); - } - - sendto_serv_butone(cptr, ":%s RAKILL %s %s", - IsServer(cptr) ? parv[0] : me.name, hostmask, usermask); - - loop.do_ban_check = 1; -} - -/* ** m_akill; -** parv[0] = sender prefix -** parv[1] = hostmask -** parv[2] = username -** parv[3] = comment -*/ -int m_akill(cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; -{ - char *hostmask, *usermask, *comment; - - - if (parc < 2 && IsPerson(sptr)) - { - sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS), - me.name, parv[0], "AKILL"); - return 0; - } - - if (IsServer(sptr) && parc < 3) - return 0; - - if (!IsServer(cptr)) - { - if (!IsOper(sptr)) - { - sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, - sptr->name); - return 0; - } - else - { - comment = parc < 3 ? NULL : parv[2]; - if ((hostmask = (char *)index(parv[1], '@'))) - { - *hostmask = 0; - hostmask++; - usermask = parv[1]; - } - else - { - sendto_one(sptr, ":%s NOTICE %s :%s", me.name, - sptr->name, - "Please use a nick!user@host mask."); - return 0; - } - if (!strcmp(usermask, "*") || !strchr(hostmask, '.')) - { - sendto_one(sptr, - "NOTICE %s :*** What a sweeping AKILL. If only your admin knew you tried that..", - parv[0]); - sendto_realops("%s attempted to /akill *@*", - parv[0]); - return 0; - } - if (MyClient(sptr)) - { - sendto_ops("%s added akill for %s@%s (%s)", - sptr->name, usermask, hostmask, - !BadPtr(comment) ? comment : "no reason"); - sendto_serv_butone(&me, - ":%s GLOBOPS :%s added akill for %s@%s (%s)", - me.name, sptr->name, usermask, hostmask, - !BadPtr(comment) ? comment : "no reason"); - } - } - } - else - { - hostmask = parv[1]; - usermask = parv[2]; - comment = parc < 4 ? NULL : parv[3]; - } - - if (!usermask || !hostmask) - { - /* - * This is very bad, it should never happen. - */ - sendto_ops("Error adding akill from %s!", sptr->name); - return 0; - } - - if (!find_kill_byname(hostmask, usermask)) - { - -#ifndef COMMENT_IS_FILE - add_temp_conf(CONF_KILL, hostmask, comment, usermask, 0, 0, 2); -#else - add_temp_conf(CONF_KILL, hostmask, NULL, usermask, 0, 0, 2); -#endif - } - - if (comment) - sendto_serv_butone(cptr, ":%s AKILL %s %s :%s", - IsServer(cptr) ? parv[0] : me.name, hostmask, - usermask, comment); - else - sendto_serv_butone(cptr, ":%s AKILL %s %s", - IsServer(cptr) ? parv[0] : me.name, hostmask, usermask); - - - loop.do_ban_check = 1; - -} - /* m_sqline ** parv[0] = sender ** parv[1] = nickmask diff --git a/src/s_kline.c b/src/s_kline.c index 675bd9535..d2f1b015e 100644 --- a/src/s_kline.c +++ b/src/s_kline.c @@ -1304,3 +1304,228 @@ int m_shun(aClient *cptr, aClient *sptr, int parc, char *parv[]) } } + +/* ** m_akill; +** parv[0] = sender prefix +** parv[1] = hostmask +** parv[2] = username +** parv[3] = comment +*/ +int m_akill(cptr, sptr, parc, parv) + aClient *cptr, *sptr; + int parc; + char *parv[]; +{ + aTKline *tk; + int found = 0; + int i; + char *mask = NULL; + char mo[1024], mo2[1024]; + char *p, *usermask, *hostmask; + char *tkllayer[9] = { + me.name, /*0 server.name */ + NULL, /*1 +|- */ + "G", /*2 G */ + NULL, /*3 user */ + NULL, /*4 host */ + NULL, /*5 setby */ + NULL, /*6 expire_at */ + NULL, /*7 set_at */ + NULL /*8 reason */ + }; + + if (parc == 1) + { + tkl_stats(sptr); + return 0; + } + + if (IsServer(sptr)) + { + return; + } + if (!IsOper(sptr)) + { + sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, + sptr->name); + return 0; + } + + if (parc < 3) + { + sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS), + me.name, sptr->name, "GLINE"); + return; + } + + mask = parv[1]; + + /* Check if its a hostmask and legal .. */ + p = strchr(mask, '@'); + if (!p || (p == mask)) + { + sendto_one(sptr, + ":%s NOTICE %s :*** [G:Line error] Please use a user@host mask.", + me.name, sptr->name); + return 0; + } + + if (p) + { + p++; + i = 0; + while (*p) + { + if (*p != '*' && *p != '.') + i++; + p++; + } + if (i < 4) + { + sendto_one(sptr, + ":%s NOTICE %s :*** [G:Line error] Too broad mask", + me.name, sptr->name); + return 0; + } + } + + usermask = strtok(mask, "@"); + hostmask = strtok(NULL, ""); + tkl_check_expire(); + + for (tk = tklines; tk; tk = tk->next) + { + if (tk->type == (TKL_GLOBAL | TKL_KILL)) + { + if (!match(tk->hostmask, usermask) + && !match(tk->usermask, hostmask)) + { + found = 1; + break; + } + } + } + + if (found == 1) + { + sendto_one(sptr, + ":%s NOTICE %s :*** [G:Line error] Match already exists!", + me.name, sptr->name); + return 0; + } + tkllayer[1] = "+"; + tkllayer[3] = usermask; + tkllayer[4] = hostmask; + tkllayer[5] = + make_nick_user_host(sptr->name, sptr->user->username, + (IsHidden(sptr) ? sptr->user->virthost : sptr->user->realhost)); + ircsprintf(mo, "%li", 0); + ircsprintf(mo2, "%li", TStime()); + tkllayer[6] = mo; + tkllayer[7] = mo2; + tkllayer[8] = parv[2]; + /* call the tkl layer .. */ + sendto_one(sptr,"*** Notice -- This command is deprecated and will eventually be removed. Please use /gline next time."); + m_tkl(&me, &me, 9, tkllayer); +} + +/* + * ** m_rakill; + * ** parv[0] = sender prefix + * ** parv[1] = hostmask + * ** parv[2] = username + * ** parv[3] = comment + * */ +int m_rakill(cptr, sptr, parc, parv) + aClient *cptr, *sptr; + int parc; + char *parv[]; +{ + aTKline *tk; + int found = 0; + int i; + char *mask = NULL; + char mo[1024], mo2[1024]; + char *p, *usermask, *hostmask; + char *tkllayer[9] = { + me.name, /*0 server.name */ + NULL, /*1 +|- */ + "G", /*2 G */ + NULL, /*3 user */ + NULL, /*4 host */ + NULL, /*5 setby */ + NULL, /*6 expire_at */ + NULL, /*7 set_at */ + NULL /*8 reason */ + }; + + if (parc == 1) + { + tkl_stats(sptr); + return 0; + } + + if (IsServer(sptr)) + { + return; + } + if (!IsOper(sptr)) + { + sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, + sptr->name); + return 0; + } + + if (parc < 2) + { + sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS), + me.name, sptr->name, "GLINE"); + return; + } + + mask = parv[1]; + + /* Check if its a hostmask and legal .. */ + p = strchr(mask, '@'); + if (!p || (p == mask)) + { + sendto_one(sptr, + ":%s NOTICE %s :*** [G:Line error] Please use a user@host mask.", + me.name, sptr->name); + return 0; + } + + usermask = strtok(mask, "@"); + hostmask = strtok(NULL, ""); + tkl_check_expire(); + + for (tk = tklines; tk; tk = tk->next) + { + if (tk->type == (TKL_GLOBAL | TKL_KILL)) + { + if (!match(tk->hostmask, usermask) + && !match(tk->usermask, hostmask)) + { + found = 1; + break; + } + } + } + + if (found == 1) + { + sendto_one(sptr, + ":%s NOTICE %s :*** [G:Line error] No such G:Line", me.name, + sptr->name); + return 0; + } + tkllayer[1] = "-"; + tkllayer[3] = usermask; + tkllayer[4] = hostmask; + tkllayer[5] = + make_nick_user_host(sptr->name, sptr->user->username, + (IsHidden(sptr) ? sptr->user->virthost : sptr->user->realhost)); + /* call the tkl layer .. */ + m_tkl(&me, &me, 6, tkllayer); +} +