X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=ircd%2Fm_squit.c;h=5913cf2eae253cddce07fa9b0a00abd8005e3a18;hb=refs%2Fheads%2Fupstream;hp=f28015de752a4edd130c6e80a21db5877837d4e4;hpb=0c8060248693049c19591a9243f8a4ea6a7f4c72;p=ircu2.10.12-pk.git diff --git a/ircd/m_squit.c b/ircd/m_squit.c index f28015d..5913cf2 100644 --- a/ircd/m_squit.c +++ b/ircd/m_squit.c @@ -22,19 +22,13 @@ * * $Id$ */ +#include "config.h" -#if 0 -/* - * No need to include handlers.h here the signatures must match - * and we don't need to force a rebuild of all the handlers everytime - * we add a new one to the list. --Bleep - */ -#include "handlers.h" -#endif /* 0 */ #include "client.h" #include "hash.h" #include "ircd.h" #include "ircd_chattr.h" +#include "ircd_log.h" #include "ircd_reply.h" #include "ircd_string.h" #include "numeric.h" @@ -45,7 +39,7 @@ #include "s_user.h" #include "send.h" -#include +/* #include -- Now using assert in ircd_log.h */ #include #include #include @@ -67,7 +61,7 @@ int ms_squit(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) { const char* server = parv[1]; struct Client *acptr; - time_t timestamp; + time_t timestamp = 0; char *comment = 0; if (parc < 2) @@ -76,12 +70,12 @@ int ms_squit(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) comment = parv[parc-1]; if (BadPtr(parv[parc - 1])) - comment=sptr->name; + comment = cli_name(sptr); - acptr = FindNServer(server); + acptr = FindServer(server); if (!acptr) - acptr = FindServer(server); + acptr = FindNServer(server); if (!acptr) { Debug((DEBUG_NOTICE, "Ignoring SQUIT to an unknown server")); @@ -89,17 +83,19 @@ int ms_squit(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) } /* If they are squitting me, we reverse it */ - if (IsMe(acptr)) { - cptr = acptr; - acptr = &me; - } - - timestamp = atoi(parv[2]); + if (IsMe(acptr)) + acptr = cptr; /* Bugfix by Prefect */ + + if (parc > 2) + timestamp = atoi(parv[2]); + else + protocol_violation(cptr, "SQUIT with no timestamp/reason"); /* If atoi(parv[2]) == 0 we must indeed squit ! * It will be our neighbour. */ - if ( timestamp != 0 && timestamp != acptr->serv->timestamp) { + if ( timestamp != 0 && timestamp != cli_serv(acptr)->timestamp) + { Debug((DEBUG_NOTICE, "Ignoring SQUIT with the wrong timestamp")); return 0; } @@ -126,41 +122,39 @@ int mo_squit(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) return need_more_params(sptr, "SQUIT"); if (parc < 3 || BadPtr(parv[2])) - comment = sptr->name; + comment = cli_name(sptr); else comment = parv[2]; server = parv[1]; /* - * The following allows wild cards in SQUIT. Only usefull + * The following allows wild cards in SQUIT. Only useful * when the command is issued by an oper. */ for (acptr = GlobalClientList; (acptr = next_client(acptr, server)); - acptr = acptr->next) { + acptr = cli_next(acptr)) { if (IsServer(acptr) || IsMe(acptr)) break; } /* Not found? Bugger. */ if (!acptr || IsMe(acptr)) - return send_error_to_client(sptr, ERR_NOSUCHSERVER, server); + return send_reply(sptr, ERR_NOSUCHSERVER, server); /* * Look for a matching server that is closer, - * that way we won't accidently squit two close + * that way we won't accidentally squit two close * servers like davis.* and davis-r.* when typing * /SQUIT davis* */ - for (acptr2 = acptr->serv->up; acptr2 != &me; - acptr2 = acptr2->serv->up) - if (!match(server, acptr2->name)) + for (acptr2 = cli_serv(acptr)->up; acptr2 != &me; + acptr2 = cli_serv(acptr2)->up) + if (!match(server, cli_name(acptr2))) acptr = acptr2; /* Disallow local opers to squit remote servers */ if (IsLocOp(sptr) && !MyConnect(acptr)) - return send_error_to_client(sptr, ERR_NOPRIVILEGES); + return send_reply(sptr, ERR_NOPRIVILEGES); return exit_client(cptr, acptr, sptr, comment); } - -