/* * mo_rehash - REHASH message handler * */ static void mo_rehash(struct Client *client_p, struct Client *source_p, int parc, char *parv[]) { int found = NO; if ( !IsOperRehash(source_p) ) { sendto_one(source_p,":%s NOTICE %s :You need rehash = yes;", me.name, parv[0]); return; } if (parc > 1) { if (irccmp(parv[1],"CHANNELS") == 0) { sendto_realops_flags(FLAGS_ALL, L_ALL, "%s is forcing cleanup of channels",parv[0]); cleanup_channels(NULL); found = YES; } else if(irccmp(parv[1],"DNS") == 0) { sendto_one(source_p, form_str(RPL_REHASHING), me.name, parv[0], "DNS"); sendto_realops_flags(FLAGS_ALL, L_ALL,"%s is rehashing DNS", get_oper_name(source_p)); restart_resolver(); /* re-read /etc/resolv.conf AGAIN? and close/re-open res socket */ found = YES; } else if(irccmp(parv[1],"MOTD") == 0) { sendto_realops_flags(FLAGS_ALL, L_ALL, "%s is forcing re-reading of MOTD file", get_oper_name(source_p)); ReadMessageFile( &ConfigFileEntry.motd ); found = YES; } else if(irccmp(parv[1],"OMOTD") == 0) { sendto_realops_flags(FLAGS_ALL, L_ALL, "%s is forcing re-reading of OPER MOTD file", get_oper_name(source_p)); ReadMessageFile( &ConfigFileEntry.opermotd ); found = YES; } if(found) { ilog(L_NOTICE, "REHASH %s From %s\n", parv[1], get_client_name(source_p, HIDE_IP)); return; } else { sendto_one(source_p,":%s NOTICE %s :rehash one of :CHANNELS DNS MOTD OMOTD" ,me.name,source_p->name); return; } } else { sendto_one(source_p, form_str(RPL_REHASHING), me.name, parv[0], ConfigFileEntry.configfile); sendto_realops_flags(FLAGS_ALL, L_ALL, "%s is rehashing server config file", get_oper_name(source_p)); ilog(L_NOTICE, "REHASH From %s[%s]", get_oper_name(source_p), source_p->localClient->sockhost); rehash(0); return; } }
/* * mo_rehash - REHASH message handler * */ static void mo_rehash(struct Client *client_p, struct Client *source_p, int parc, char *parv[]) { int found = 0; if (!IsOperRehash(source_p)) { sendto_one(source_p, form_str(ERR_NOPRIVILEGES), me.name, source_p->name); return; } if (parc > 1) { if (irccmp(parv[1], "DNS") == 0) { sendto_one(source_p, form_str(RPL_REHASHING), me.name, parv[0], "DNS"); sendto_realops_flags(UMODE_ALL, L_ALL, "%s is rehashing DNS", get_oper_name(source_p)); restart_resolver(); /* re-read /etc/resolv.conf AGAIN? and close/re-open res socket */ found = 1; } else if (irccmp(parv[1], "MOTD") == 0) { sendto_realops_flags(UMODE_ALL, L_ALL, "%s is forcing re-reading of MOTD file", get_oper_name(source_p)); read_message_file(&ConfigFileEntry.motd); found = 1; } else if (irccmp(parv[1], "OMOTD") == 0) { sendto_realops_flags(UMODE_ALL, L_ALL, "%s is forcing re-reading of OPER MOTD file", get_oper_name(source_p)); read_message_file(&ConfigFileEntry.opermotd); found = 1; } if (found) { ilog(L_NOTICE, "REHASH %s From %s", parv[1], get_client_name(source_p, HIDE_IP)); return; } else { sendto_one(source_p, ":%s NOTICE %s :rehash one of :DNS MOTD OMOTD", me.name, source_p->name); return; } } else { sendto_one(source_p, form_str(RPL_REHASHING), me.name, source_p->name, ConfigFileEntry.configfile); sendto_realops_flags(UMODE_ALL, L_ALL, "%s is rehashing server config file", get_oper_name(source_p)); ilog(L_NOTICE, "REHASH From %s[%s]", get_oper_name(source_p), source_p->localClient->sockhost); rehash(0); } }