diff --git a/include/extern.h b/include/extern.h index ce73cad17..e8019a0b4 100644 --- a/include/extern.h +++ b/include/extern.h @@ -158,7 +158,6 @@ E void HostServSyncVhosts(NickAlias *na); /**** encrypt.c ****/ E int enc_encrypt(const std::string &src, std::string &dest); -E int enc_encrypt_in_place(std::string &buf); E int enc_decrypt(const std::string &src, std::string &dest); E int enc_check_password(std::string &plaintext, std::string &password); diff --git a/include/modules.h b/include/modules.h index 502093081..cb5e6dd28 100644 --- a/include/modules.h +++ b/include/modules.h @@ -439,7 +439,6 @@ class CoreExport Module * see src/encrypt.c for detailed informations */ virtual EventReturn OnEncrypt(const std::string &src, std::string &dest) { return EVENT_CONTINUE; } - virtual EventReturn OnEncryptInPlace(std::string &buf) { return EVENT_CONTINUE; } virtual EventReturn OnDecrypt(const std::string &hashm, const std::string &src, std::string &dest) { return EVENT_CONTINUE; } virtual EventReturn OnCheckPassword(const std::string &hashm, std::string &plaintext, std::string &password) { return EVENT_CONTINUE; } @@ -1106,7 +1105,7 @@ enum Implementation I_OnReload, I_OnPreServerConnect, I_OnNewServer, I_OnServerConnect, I_OnPreUplinkSync, I_OnServerDisconnect, I_OnPreCommandRun, I_OnPreCommand, I_OnPostCommand, I_OnPreDatabaseExpire, I_OnPreRestart, I_OnRestart, I_OnPreShutdown, I_OnShutdown, I_OnSignal, I_OnServerQuit, I_OnTopicUpdated, - I_OnEncrypt, I_OnEncryptInPlace, I_OnEncryptCheckLen, I_OnDecrypt, I_OnCheckPassword, + I_OnEncrypt, I_OnEncryptCheckLen, I_OnDecrypt, I_OnCheckPassword, I_OnChannelModeSet, I_OnChannelModeUnset, I_OnUserModeSet, I_OnUserModeUnset, I_OnChannelModeAdd, I_OnUserModeAdd, I_OnMLock, I_OnUnMLock, I_OnServerSync, I_OnUplinkSync, I_END diff --git a/src/core/enc_md5.cpp b/src/core/enc_md5.cpp index 5644cf869..fafb79309 100644 --- a/src/core/enc_md5.cpp +++ b/src/core/enc_md5.cpp @@ -321,7 +321,6 @@ class EMD5 : public Module this->SetType(ENCRYPTION); ModuleManager::Attach(I_OnEncrypt, this); - ModuleManager::Attach(I_OnEncryptInPlace, this); ModuleManager::Attach(I_OnDecrypt, this); ModuleManager::Attach(I_OnCheckPassword, this); } @@ -345,11 +344,6 @@ class EMD5 : public Module return EVENT_ALLOW; } - EventReturn OnEncryptInPlace(std::string &buf) - { - return this->OnEncrypt(buf, buf); - } - EventReturn OnDecrypt(const std::string &hashm, const std::string &src, std::string &dest) { if (hashm != "md5") diff --git a/src/core/enc_none.cpp b/src/core/enc_none.cpp index 9e618baed..58ccdaff1 100644 --- a/src/core/enc_none.cpp +++ b/src/core/enc_none.cpp @@ -18,7 +18,6 @@ class ENone : public Module this->SetType(ENCRYPTION); ModuleManager::Attach(I_OnEncrypt, this); - ModuleManager::Attach(I_OnEncryptInPlace, this); ModuleManager::Attach(I_OnDecrypt, this); ModuleManager::Attach(I_OnCheckPassword, this); } @@ -34,11 +33,6 @@ class ENone : public Module return EVENT_ALLOW; } - EventReturn OnEncryptInPlace(std::string &buf) - { - return this->OnEncrypt(buf, buf); - } - EventReturn OnDecrypt(const std::string &hashm, const std::string &src, std::string &dest) { if (hashm != "plain") diff --git a/src/core/enc_old.cpp b/src/core/enc_old.cpp index af4613699..a53115628 100644 --- a/src/core/enc_old.cpp +++ b/src/core/enc_old.cpp @@ -326,7 +326,6 @@ class EOld : public Module this->SetType(ENCRYPTION); ModuleManager::Attach(I_OnEncrypt, this); - ModuleManager::Attach(I_OnEncryptInPlace, this); ModuleManager::Attach(I_OnDecrypt, this); ModuleManager::Attach(I_OnCheckPassword, this); } @@ -353,11 +352,6 @@ class EOld : public Module return EVENT_ALLOW; } - EventReturn OnEncryptInPlace(std::string &buf) - { - return this->OnEncrypt(buf, buf); - } - EventReturn OnDecrypt(const std::string &hashm, const std::string &src, std::string &dest ) { if (hashm != "oldmd5") diff --git a/src/core/enc_sha1.cpp b/src/core/enc_sha1.cpp index 180a8b58d..b986d6938 100644 --- a/src/core/enc_sha1.cpp +++ b/src/core/enc_sha1.cpp @@ -174,7 +174,6 @@ class ESHA1 : public Module this->SetType(ENCRYPTION); ModuleManager::Attach(I_OnEncrypt, this); - ModuleManager::Attach(I_OnEncryptInPlace, this); ModuleManager::Attach(I_OnEncryptCheckLen, this); ModuleManager::Attach(I_OnDecrypt, this); ModuleManager::Attach(I_OnCheckPassword, this); @@ -201,11 +200,6 @@ class ESHA1 : public Module return EVENT_ALLOW; } - EventReturn OnEncryptInPlace(std::string &buf) - { - return this->OnEncrypt(buf, buf); - } - EventReturn OnDecrypt(const std::string &hashm, std::string &src, std::string &dest) { if (hashm != "sha1") diff --git a/src/core/enc_sha256.cpp b/src/core/enc_sha256.cpp index bef38fb1d..fde7cf14c 100644 --- a/src/core/enc_sha256.cpp +++ b/src/core/enc_sha256.cpp @@ -254,7 +254,6 @@ class ESHA256 : public Module this->SetType(ENCRYPTION); ModuleManager::Attach(I_OnEncrypt, this); - ModuleManager::Attach(I_OnEncryptInPlace, this); ModuleManager::Attach(I_OnDecrypt, this); ModuleManager::Attach(I_OnCheckPassword, this); @@ -284,11 +283,6 @@ class ESHA256 : public Module return EVENT_ALLOW; } - EventReturn OnEncryptInPlace(std::string &buf) - { - return this->OnEncrypt(buf, buf); - } - EventReturn OnDecrypt(const std::string &hashm, std::string &src, std::string &dest) { if (hashm != "sha256") diff --git a/src/core/ns_register.cpp b/src/core/ns_register.cpp index 3579df173..3fba0407e 100644 --- a/src/core/ns_register.cpp +++ b/src/core/ns_register.cpp @@ -270,8 +270,7 @@ class CommandNSRegister : public CommandNSConfirm passcode[idx] = '\0'; nr = new NickRequest(u->nick); nr->passcode = passcode; - nr->password = pass; - enc_encrypt_in_place(nr->password); + enc_encrypt(pass, nr->password); if (email) nr->email = sstrdup(email); nr->requested = time(NULL); diff --git a/src/encrypt.cpp b/src/encrypt.cpp index 1910c00f9..f70d8fa8c 100644 --- a/src/encrypt.cpp +++ b/src/encrypt.cpp @@ -27,20 +27,6 @@ int enc_encrypt(const std::string &src, std::string &dest) return -1; } -/** - * Encrypt null-terminated string stored in buffer `buf' of size `size', - * placing the result in the same buffer. Returns 0 on success, -1 on - * error. - **/ -int enc_encrypt_in_place(std::string &buf) -{ - EventReturn MOD_RESULT; - FOREACH_RESULT(I_OnEncryptInPlace, OnEncryptInPlace(buf)); - if (MOD_RESULT == EVENT_ALLOW) - return 0; - return -1; -} - /** * Decrypt encrypted string `src' into buffer `dest' of length `len'. * Returns 1 (not 0) on success, -1 if the encryption algorithm does not