Make CUser::m_sUserName constant

Changing the user name for a CUser instance is a really, really bad idea. There
are lots of paths that depend on the user name and only few of them are fixed up
when the user name changes.

This fixes a problem where admin's "CloneUser from to" caused problems with
modules, because all modules where loaded under the old user name and thus they
read/write NV data from the wrong directory in ~/.znc/users.

Thanks to un1matr1x for reporting this.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter
2011-02-24 19:09:46 +01:00
parent 0b8f9eec42
commit d44e590336
3 changed files with 14 additions and 22 deletions

View File

@@ -563,14 +563,13 @@ class CAdminMod : public CModule {
return;
}
CUser* pNewUser = new CUser(sOldUsername);
CUser* pNewUser = new CUser(sNewUsername);
CString sError;
if (!pNewUser->Clone(*pOldUser, sError)) {
delete pNewUser;
PutModule("Error: Cloning failed! [" + sError + "]");
return;
}
pNewUser->SetUserName(sNewUsername);
pNewUser->SetIRCConnectEnabled(false);
if (!CZNC::Get().AddUser(pNewUser, sError)) {