summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2012-02-13 00:10:45 -0500
committerAdam <Adam@anope.org>2012-02-13 00:10:45 -0500
commit086790d6331357022f4da17c76b26b9fc6e2ad90 (patch)
treee82d9e0b67cfc5ad0251d8bdcd2490207a875fc6 /modules
parent1bc8e2ab82db9ce00faaa44887338873a2cd9210 (diff)
Removed our RNG and just use the systems, it's not very widely used. Also made DNS query ids not random as they don't need to be.
Diffstat (limited to 'modules')
-rw-r--r--modules/commands/ns_register.cpp2
-rw-r--r--modules/commands/ns_resetpass.cpp2
-rw-r--r--modules/commands/ns_set_email.cpp2
-rw-r--r--modules/encryption/enc_sha256.cpp2
4 files changed, 4 insertions, 4 deletions
diff --git a/modules/commands/ns_register.cpp b/modules/commands/ns_register.cpp
index 3010c0eb4..341397c67 100644
--- a/modules/commands/ns_register.cpp
+++ b/modules/commands/ns_register.cpp
@@ -337,7 +337,7 @@ static bool SendRegmail(User *u, NickAlias *na, BotInfo *bi)
};
int idx, min = 1, max = 62;
for (idx = 0; idx < 9; ++idx)
- codebuf += chars[1 + static_cast<int>((static_cast<float>(max - min)) * getrandom16() / 65536.0) + min];
+ codebuf += chars[1 + static_cast<int>((static_cast<float>(max - min)) * static_cast<uint16_t>(rand()) / 65536.0) + min];
na->nc->Extend("ns_register_passcode", new ExtensibleString(codebuf));
}
else
diff --git a/modules/commands/ns_resetpass.cpp b/modules/commands/ns_resetpass.cpp
index ab357f484..f3aa47630 100644
--- a/modules/commands/ns_resetpass.cpp
+++ b/modules/commands/ns_resetpass.cpp
@@ -132,7 +132,7 @@ static bool SendResetEmail(User *u, NickAlias *na, BotInfo *bi)
Anope::string passcode;
int idx;
for (idx = 0; idx < 20; ++idx)
- passcode += chars[1 + static_cast<int>((static_cast<float>(max - min)) * getrandom16() / 65536.0) + min];
+ passcode += chars[1 + static_cast<int>((static_cast<float>(max - min)) * static_cast<uint16_t>(rand()) / 65536.0) + min];
Anope::string subject = translate(na->nc, Config->MailResetSubject.c_str());
Anope::string message = translate(na->nc, Config->MailResetMessage.c_str());
diff --git a/modules/commands/ns_set_email.cpp b/modules/commands/ns_set_email.cpp
index 6a4ece4ca..8ce71165e 100644
--- a/modules/commands/ns_set_email.cpp
+++ b/modules/commands/ns_set_email.cpp
@@ -25,7 +25,7 @@ static bool SendConfirmMail(User *u, BotInfo *bi)
int idx, min = 1, max = 62;
Anope::string code;
for (idx = 0; idx < 9; ++idx)
- code += chars[1 + static_cast<int>((static_cast<float>(max - min)) * getrandom16() / 65536.0) + min];
+ code += chars[1 + static_cast<int>((static_cast<float>(max - min)) * static_cast<uint16_t>(rand()) / 65536.0) + min];
u->Account()->Extend("ns_set_email_passcode", new ExtensibleString(code));
Anope::string subject = Config->MailEmailchangeSubject;
diff --git a/modules/encryption/enc_sha256.cpp b/modules/encryption/enc_sha256.cpp
index 4e9d50b96..d77cd072d 100644
--- a/modules/encryption/enc_sha256.cpp
+++ b/modules/encryption/enc_sha256.cpp
@@ -128,7 +128,7 @@ class ESHA256 : public Module
void NewRandomIV()
{
for (int i = 0; i < 8; ++i)
- iv[i] = getrandom32();
+ iv[i] = static_cast<uint32_t>(rand());
}
/* returns the IV as base64-encrypted string */