Change lockserv emergency unlock procedure, and add one for jumpserver [jackmcbarn]

git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@12630 e03df62e-2008-0410-955e-edbf42e46eb7
This commit is contained in:
danieldg 2010-03-13 04:18:25 +00:00
parent e9808ffb01
commit b822830c5b
3 changed files with 14 additions and 11 deletions

View File

@ -953,6 +953,8 @@
# Jump Server module: Adds support for the RPL_REDIR numeric # Jump Server module: Adds support for the RPL_REDIR numeric
# This module is oper-only. # This module is oper-only.
# To use, JUMPSERVER must be in one of your oper class blocks. # To use, JUMPSERVER must be in one of your oper class blocks.
# If your server is redirecting new clients and you get disconnected,
# do a REHASH from shell to open up again.
#<module name="m_jumpserver.so"> #<module name="m_jumpserver.so">
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
@ -1038,7 +1040,7 @@
# These commands require OPER status and that the LOCKSERV UNLOCKSERV # # These commands require OPER status and that the LOCKSERV UNLOCKSERV #
# are specified in a <class> tag that the oper is part of. This is so # # are specified in a <class> tag that the oper is part of. This is so #
# you can control who has access to this possible dangerous command. # # you can control who has access to this possible dangerous command. #
# If your server is locked and you got disconnected, do a REHASH from # # If your server is locked and you get disconnected, do a REHASH from #
# shell to open up again. # shell to open up again.
# #
# This module is oper-only. # This module is oper-only.

View File

@ -138,8 +138,8 @@ class ModuleJumpServer : public Module
ModuleJumpServer() : js(this) ModuleJumpServer() : js(this)
{ {
ServerInstance->AddCommand(&js); ServerInstance->AddCommand(&js);
Implementation eventlist[] = { I_OnUserRegister }; Implementation eventlist[] = { I_OnUserRegister, I_OnRehash };
ServerInstance->Modules->Attach(eventlist, this, 1); ServerInstance->Modules->Attach(eventlist, this, 2);
} }
virtual ~ModuleJumpServer() virtual ~ModuleJumpServer()
@ -158,6 +158,11 @@ class ModuleJumpServer : public Module
return MOD_RES_PASSTHRU; return MOD_RES_PASSTHRU;
} }
virtual void OnRehash(User* user)
{
// Emergency way to unlock
if (!user) js.redirect_new_users = false;
}
virtual Version GetVersion() virtual Version GetVersion()
{ {

View File

@ -68,15 +68,10 @@ private:
CommandLockserv lockcommand; CommandLockserv lockcommand;
CommandUnlockserv unlockcommand; CommandUnlockserv unlockcommand;
virtual void ResetLocked()
{
locked = false;
}
public: public:
ModuleLockserv() : lockcommand(this, locked), unlockcommand(this, locked) ModuleLockserv() : lockcommand(this, locked), unlockcommand(this, locked)
{ {
ResetLocked(); locked = false;
ServerInstance->AddCommand(&lockcommand); ServerInstance->AddCommand(&lockcommand);
ServerInstance->AddCommand(&unlockcommand); ServerInstance->AddCommand(&unlockcommand);
Implementation eventlist[] = { I_OnUserRegister, I_OnRehash, I_OnCheckReady }; Implementation eventlist[] = { I_OnUserRegister, I_OnRehash, I_OnCheckReady };
@ -90,7 +85,8 @@ public:
virtual void OnRehash(User* user) virtual void OnRehash(User* user)
{ {
ResetLocked(); // Emergency way to unlock
if (!user) locked = false;
} }
virtual ModResult OnUserRegister(LocalUser* user) virtual ModResult OnUserRegister(LocalUser* user)
@ -110,7 +106,7 @@ public:
virtual Version GetVersion() virtual Version GetVersion()
{ {
return Version("Allows locking of the server to stop all incoming connections till unlocked again", VF_VENDOR); return Version("Allows locking of the server to stop all incoming connections until unlocked again", VF_VENDOR);
} }
}; };