diff options
author | MadCamel <madcamel@gmail.com> | 2009-08-29 20:43:53 -0400 |
---|---|---|
committer | MadCamel <madcamel@gmail.com> | 2009-08-29 20:45:59 -0400 |
commit | 837194519b2be29aa7665828e4d7cb8035fe1c3b (patch) | |
tree | 6aefce861fe537c58a585c5ec6e353331891e1ba /src/login/login.c | |
parent | de294e7c7d5ccf129eea3ce45c8023fa7b6d371d (diff) | |
download | tmwa-837194519b2be29aa7665828e4d7cb8035fe1c3b.tar.gz tmwa-837194519b2be29aa7665828e4d7cb8035fe1c3b.tar.bz2 tmwa-837194519b2be29aa7665828e4d7cb8035fe1c3b.tar.xz tmwa-837194519b2be29aa7665828e4d7cb8035fe1c3b.zip |
Converted to Mersenne Twister for random.
Randomerer! Also: Fixed a security problem. Can you find it?
Diffstat (limited to 'src/login/login.c')
-rw-r--r-- | src/login/login.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/login/login.c b/src/login/login.c index 6c4ca82..b44eb19 100644 --- a/src/login/login.c +++ b/src/login/login.c @@ -25,6 +25,7 @@ #include "version.h" #include "db.h" #include "lock.h" +#include "mt_rand.h" #ifdef PASSWORDENC #include "md5calc.h" @@ -1153,8 +1154,8 @@ int mmo_auth(struct mmo_account* account, int fd) { sprintf(tmpstr + strlen(tmpstr), ".%03d", (int)tv.tv_usec / 1000); account->account_id = auth_dat[i].account_id; - account->login_id1 = rand(); - account->login_id2 = rand(); + account->login_id1 = mt_random(); + account->login_id2 = mt_random(); memcpy(account->lastlogin, auth_dat[i].lastlogin, 24); memcpy(auth_dat[i].lastlogin, tmpstr, 24); account->sex = auth_dat[i].sex; @@ -3785,8 +3786,6 @@ int do_init(int argc, char **argv) { save_config_in_log(); // not before, because log file name can be changed login_lan_config_read((argc > 1) ? argv[1] : LAN_CONF_NAME); - srand(time(NULL)); - for(i = 0; i< AUTH_FIFO_SIZE; i++) auth_fifo[i].delflag = 1; for(i = 0; i < MAX_SERVERS; i++) |