]> git.stg.codes - stg.git/blob - projects/sgauthstress/user.cpp
15fb1ece725d635b13ed47b0f71b93ba89918ee0
[stg.git] / projects / sgauthstress / user.cpp
1 #include <cstring>
2
3 #include "user.h"
4
5 USER::USER(const std::string & l,
6            const std::string & pwd,
7            uint32_t i)
8     : login(l),
9       password(pwd),
10       ip(i),
11       aliveTimeout(0),
12       userTimeout(0),
13       phase(1),
14       phaseChangeTime(0),
15       rnd(0)
16 {
17 unsigned char key[IA_PASSWD_LEN];
18 memset(key, 0, IA_PASSWD_LEN);
19 strncpy((char *)key, password.c_str(), IA_PASSWD_LEN);
20 Blowfish_Init(&ctx, key, IA_PASSWD_LEN);
21
22 sock = socket(AF_INET, SOCK_DGRAM, 0);
23 }
24
25 USER::~USER()
26 {
27 close(sock);
28 }