X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=ircd%2Fm_rehash.c;h=8e8c2db6f6151111f47f0812e409884a25ec809d;hb=refs%2Fheads%2Fupstream-ssl;hp=000f94bd902f9e3ec2f0a60c10bdc931ec6f0c55;hpb=ae91ef6320f611af74e70a0db2620c338fbaa7d5;p=ircu2.10.12-pk.git diff --git a/ircd/m_rehash.c b/ircd/m_rehash.c index 000f94b..8e8c2db 100644 --- a/ircd/m_rehash.c +++ b/ircd/m_rehash.c @@ -79,77 +79,53 @@ * note: it is guaranteed that parv[0]..parv[parc-1] are all * non-NULL pointers. */ -#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 "config.h" + #include "client.h" #include "ircd.h" #include "ircd_log.h" #include "ircd_reply.h" #include "ircd_string.h" +#include "motd.h" #include "numeric.h" #include "s_conf.h" #include "send.h" -#include +/* #include -- Now using assert in ircd_log.h */ /* * mo_rehash - oper message handler + * + * parv[1] = 'm' flushes the MOTD cache and returns + * parv[1] = 'l' reopens the log files and returns + * parv[1] = 'q' to not rehash the resolver (optional) */ int mo_rehash(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) { -#if defined(OPER_REHASH) || defined(LOCOP_REHASH) -#ifndef LOCOP_REHASH - if (!MyUser(sptr) || !IsOper(sptr)) -#else -#ifdef OPER_REHASH - if (!MyUser(sptr) || !IsAnOper(sptr)) -#else - if (!MyUser(sptr) || !IsLocOp(sptr)) -#endif -#endif - { - sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]); - return 0; - } - sendto_one(sptr, rpl_str(RPL_REHASHING), me.name, parv[0], configfile); - sendto_ops("%s is rehashing Server config file", parv[0]); - ircd_log(L_INFO, "REHASH From %s\n", get_client_name(sptr, HIDE_IP)); - return rehash(cptr, (parc > 1) ? ((*parv[1] == 'q') ? 2 : 0) : 0); -#endif /* defined(OPER_REHASH) || defined(LOCOP_REHASH) */ - return 0; -} + int flag = 0; -#if 0 -#if defined(OPER_REHASH) || defined(LOCOP_REHASH) -/* - * m_rehash - */ -int m_rehash(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) -{ -#ifndef LOCOP_REHASH - if (!MyUser(sptr) || !IsOper(sptr)) -#else -#ifdef OPER_REHASH - if (!MyUser(sptr) || !IsAnOper(sptr)) -#else - if (!MyUser(sptr) || !IsLocOp(sptr)) -#endif -#endif - { - sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]); - return 0; + if (!HasPriv(sptr, PRIV_REHASH)) + return send_reply(sptr, ERR_NOPRIVILEGES); + + if (parc > 1) { /* special processing */ + if (*parv[1] == 'm') { + send_reply(sptr, SND_EXPLICIT | RPL_REHASHING, ":Flushing MOTD cache"); + motd_recache(); /* flush MOTD cache */ + return 0; + } else if (*parv[1] == 'l') { + send_reply(sptr, SND_EXPLICIT | RPL_REHASHING, ":Reopening log files"); + log_reopen(); /* reopen log files */ + return 0; + } else if (*parv[1] == 'q') + flag = 2; } - sendto_one(sptr, rpl_str(RPL_REHASHING), me.name, parv[0], configfile); - sendto_ops("%s is rehashing Server config file", parv[0]); - ircd_log(L_INFO, "REHASH From %s\n", get_client_name(sptr, HIDE_IP)); - return rehash(cptr, (parc > 1) ? ((*parv[1] == 'q') ? 2 : 0) : 0); + + send_reply(sptr, RPL_REHASHING, configfile); + sendto_opmask_butone(0, SNO_OLDSNO, "%C is rehashing Server config file", + sptr); + + log_write(LS_SYSTEM, L_INFO, 0, "REHASH From %#C", sptr); + + return rehash(cptr, flag); } -#endif -#endif /* 0 */