- Fixed remote /rehash bug (). Actually rewrote 20/25% ;).

Also minor doc fixes, not worth mentioning in Changelog.
This commit is contained in:
Bram Matthys 2003-02-21 02:44:48 +00:00
parent 775378a410
commit 64dab7821a
3 changed files with 35 additions and 23 deletions

View file

@ -1932,3 +1932,4 @@ seen. gmtime warning still there
- Fixed chmode +u again.
- Fixed a bug reported by mQ where it was possible to include spaces in a TKL host
- Documentation updates (added a section about features).
- Fixed remote /rehash bug (#0000600).

View file

@ -19,7 +19,7 @@
<font size="4"><a href="http://www.unrealircd.com">http://www.unrealircd.com</a></font><br>
<font size="4">Version: 3.2</font><br>
<strong>Current Version:</strong> 3.2 Beta15<br>
<strong>Released:</strong> 2002-02-XX </div>
<strong>Last doc update:</strong> 2002-02-21 </div>
<strong>Head Coders:</strong> Stskeeps / Codemastr / Luke / McSkaf / Syzop<br>
<strong>Contributors:</strong> Zogg / NiQuiL / assyrian / chasm / DrBin / llthangel / Griever / nighthawk<br>
<strong>Documentation:</strong> CKnight^ / Syzop<br>
@ -166,7 +166,7 @@
<p>This is controlled by usermode +x (like: /mode yournix +x), admins can also force +x to be enabled
by default, or make it so users can never do -x.</p>
<p>The cloaked host is generated by some formula which uses 3 &quot;cloak keys&quot;, you are required
to set those 3 keys in your config file, they should be 3 random numbers between 10.000 and 4.294.967.296.
to set those 3 keys in your config file, they should be 3 random numbers between 10.000 and 4.294.967.295.
If someone else knows these keys they can decode the host a bit and discover the real host so you
have to keep them secret. They also should be the same at all servers!</p>

View file

@ -3464,6 +3464,7 @@ CMD_FUNC(m_admin)
** now allows the -flags in remote rehash
** ugly code but it seems to work :) -- codemastr
** added -all and fixed up a few lines -- niquil (niquil@programmer.net)
** fixed remote rehashing, but it's getting a bit weird code again -- Syzop
*/
CMD_FUNC(m_rehash)
{
@ -3483,6 +3484,20 @@ CMD_FUNC(m_rehash)
}
x = 0;
if (BadPtr(parv[2])) {
/* If the argument starts with a '-' (like -motd, -opermotd, etc) then it's
* assumed not to be a server. -- Syzop
*/
if (parv[1] && (parv[1][0] == '-'))
x = HUNTED_ISME;
else
x = hunt_server_token(cptr, sptr, MSG_REHASH, TOK_REHASH, "%s", 1, parc, parv);
} else {
x = hunt_server_token(cptr, sptr, MSG_REHASH, TOK_REHASH, "%s %s", 1, parc, parv);
}
if (x != HUNTED_ISME)
return 0; /* Now forwarded or server didnt exist */
if (cptr != sptr)
{
#ifndef REMOTE_REHASH
@ -3502,26 +3517,7 @@ CMD_FUNC(m_rehash)
}
parv[1] = parv[2];
}
else
{
if (find_server_quick(parv[1]))
{
if (parv[2])
{
if ((x =
hunt_server_token(cptr, sptr, MSG_REHASH, TOK_REHASH, "%s %s",
1, parc, parv)) != HUNTED_ISME)
return 0;
}
else
{
if ((x =
hunt_server_token(cptr, sptr, MSG_REHASH, TOK_REHASH, "%s", 1,
parc, parv)) != HUNTED_ISME)
return 0;
}
}
}
if (!BadPtr(parv[1]))
{
@ -3539,6 +3535,8 @@ CMD_FUNC(m_rehash)
aMotd *amotd;
sendto_ops("%sRehashing everything on the request of %s",
cptr != sptr ? "Remotely " : "",sptr->name);
if (cptr != sptr)
sendto_serv_butone(&me, ":%s GLOBOPS :%s is remotely rehashing everything", me.name, sptr->name);
opermotd = (aMotd *) read_file(OPATH, &opermotd);
botmotd = (aMotd *) read_file(BPATH, &botmotd);
motd = (aMotd *) read_motd(MPATH);
@ -3578,6 +3576,8 @@ CMD_FUNC(m_rehash)
("%sRehashing OperMOTD on request of %s",
cptr != sptr ? "Remotely " : "",
sptr->name);
if (cptr != sptr)
sendto_serv_butone(&me, ":%s GLOBOPS :%s is remotely rehashing OperMOTD", me.name, sptr->name);
opermotd = (aMotd *) read_file(OPATH, &opermotd);
return 0;
}
@ -3587,6 +3587,8 @@ CMD_FUNC(m_rehash)
("%sRehashing BotMOTD on request of %s",
cptr != sptr ? "Remotely " : "",
sptr->name);
if (cptr != sptr)
sendto_serv_butone(&me, ":%s GLOBOPS :%s is remotely rehashing BotMOTD", me.name, sptr->name);
botmotd = (aMotd *) read_file(BPATH, &botmotd);
return 0;
}
@ -3599,6 +3601,8 @@ CMD_FUNC(m_rehash)
("%sRehashing all MOTDs and RULES on request of %s",
cptr != sptr ? "Remotely " : "",
sptr->name);
if (cptr != sptr)
sendto_serv_butone(&me, ":%s GLOBOPS :%s is remotely rehashing all MOTDs and RULES", me.name, sptr->name);
motd = (aMotd *) read_motd(MPATH);
rules = (aMotd *) read_rules(RPATH);
for (tlds = conf_tld; tlds;
@ -3627,12 +3631,19 @@ CMD_FUNC(m_rehash)
}
return 0;
}
/* didn't match / fall trough... should we continue?? */
sendto_ops("%s is %srehashing server config file (unknown option)",
sptr->name, cptr != sptr ? "Remotely " : "");
if (cptr != sptr)
sendto_serv_butone(&me, ":%s GLOBOPS :%s is remotely rehashing server config file (unknown option)",
me.name, sptr->name);
}
}
else
sendto_ops("%s is rehashing server config file", parv[0]);
sendto_one(sptr, rpl_str(RPL_REHASHING), me.name, parv[0], configfile);
if (cptr == sptr)
sendto_one(sptr, rpl_str(RPL_REHASHING), me.name, parv[0], configfile);
return rehash(cptr, sptr, (parc > 1) ? ((*parv[1] == 'q') ? 2 : 0) : 0);
}