mirror of
https://github.com/znc/znc.git
synced 2026-08-07 09:22:55 +02:00
Make GetPass() return a CString instead of a char*
In theory this could lead to extra copies of the password in memory, but since no caller actually makes sure that those passwords are forgotten as fast as possible, I don't see why this should be done the Old Way(tm). git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1343 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
@@ -210,7 +210,7 @@ CString CUtils::SaltedHash(const CString& sPass, const CString& sSalt) {
|
||||
return CString(sPass + sSalt).MD5();
|
||||
}
|
||||
|
||||
char* CUtils::GetPass(const CString& sPrompt) {
|
||||
CString CUtils::GetPass(const CString& sPrompt) {
|
||||
PrintPrompt(sPrompt);
|
||||
return getpass("");
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ public:
|
||||
static CString GetSaltedHashPass(CString& sSalt);
|
||||
static CString GetSalt();
|
||||
static CString SaltedHash(const CString& sPass, const CString& sSalt);
|
||||
static char* GetPass(const CString& sPrompt);
|
||||
static CString GetPass(const CString& sPrompt);
|
||||
static bool GetInput(const CString& sPrompt, CString& sRet, const CString& sDefault = "", const CString& sHint = "");
|
||||
static bool GetBoolInput(const CString& sPrompt, bool bDefault);
|
||||
static bool GetBoolInput(const CString& sPrompt, bool *pbDefault = NULL);
|
||||
|
||||
+3
-5
@@ -71,12 +71,10 @@ public:
|
||||
{
|
||||
if (m_sPassword.empty())
|
||||
{
|
||||
char *pTmp = CUtils::GetPass("Enter Encryption Key for away.so: ");
|
||||
CString sTmp = CUtils::GetPass("Enter Encryption Key for away.so: ");
|
||||
|
||||
if (pTmp)
|
||||
m_sPassword = CBlowfish::MD5(pTmp);
|
||||
|
||||
*pTmp = 0;
|
||||
if (!sTmp.empty())
|
||||
m_sPassword = CBlowfish::MD5(sTmp);
|
||||
}
|
||||
|
||||
if (!BootStrap())
|
||||
|
||||
@@ -71,12 +71,10 @@ public:
|
||||
{
|
||||
if (m_sPassword.empty())
|
||||
{
|
||||
char *pTmp = CUtils::GetPass("Enter Encryption Key for " + GetModName() + ".so");
|
||||
CString sTmp = CUtils::GetPass("Enter Encryption Key for " + GetModName() + ".so");
|
||||
|
||||
if (pTmp)
|
||||
m_sPassword = CBlowfish::MD5(pTmp);
|
||||
|
||||
*pTmp = 0;
|
||||
if (!sTmp.empty())
|
||||
m_sPassword = CBlowfish::MD5(sTmp);
|
||||
}
|
||||
|
||||
const vector<CChan *>& vChans = m_pUser->GetChans();
|
||||
|
||||
Reference in New Issue
Block a user