Don't ever ask for a password via stdin in away and savebuff

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1388 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
psychon
2009-02-20 19:15:31 +00:00
parent 3d42554349
commit 7a985ac077
2 changed files with 18 additions and 34 deletions

View File

@@ -58,26 +58,16 @@ public:
virtual bool OnLoad(const CString& sArgs, CString& sMessage)
{
if (!sArgs.empty())
{
m_sPassword = CBlowfish::MD5(sArgs);
return(OnBoot());
}
return true;
}
virtual bool OnBoot()
{
if (m_sPassword.empty())
{
CString sTmp = CUtils::GetPass("Enter Encryption Key for " + GetModName() + ".so");
if (!sTmp.empty())
m_sPassword = CBlowfish::MD5(sTmp);
}
const vector<CChan *>& vChans = m_pUser->GetChans();
if (sArgs.empty())
{
sMessage = "This module needs as an argument a keyphrase used for encryption";
return false;
}
m_sPassword = CBlowfish::MD5(sArgs);
for (u_int a = 0; a < vChans.size(); a++)
{
if (!vChans[a]->KeepBuffer())
@@ -85,6 +75,8 @@ public:
if (!BootStrap(vChans[a]))
{
sMessage = "Failed to decrypt your saved messages - "
"Did you give the right encryption key as an argument to this module?";
m_bBootError = true;
return(false);
}