diff options
Diffstat (limited to 'src/login')
-rw-r--r-- | src/login/admin.c | 44 | ||||
-rw-r--r-- | src/login/login.c | 64 | ||||
-rw-r--r-- | src/login/login.h | 4 |
3 files changed, 56 insertions, 56 deletions
diff --git a/src/login/admin.c b/src/login/admin.c index 64f7c1b3c..7115e6f05 100644 --- a/src/login/admin.c +++ b/src/login/admin.c @@ -117,7 +117,7 @@ int parse_admin(int fd) memcpy(WFIFOP(fd,len+5), auth_dat[j].userid, 24); WFIFOB(fd,len+29) = auth_dat[j].sex; WFIFOL(fd,len+30) = auth_dat[j].logincount; - if (auth_dat[j].state == 0 && auth_dat[j].ban_until_time != 0) // if no state and banished + if (auth_dat[j].state == 0 && auth_dat[j].unban_time != 0) // if no state and banished WFIFOL(fd,len+34) = 7; // 6 = Your are Prohibited to log in until %s else WFIFOL(fd,len+34) = auth_dat[j].state; @@ -595,7 +595,7 @@ int parse_admin(int fd) if (i != -1) { memcpy(WFIFOP(fd,6), auth_dat[i].userid, 24); ShowNotice("'ladmin': Change of a validity limit (account: %s, new validity: %d (%s), ip: %s)\n", auth_dat[i].userid, timestamp, (timestamp == 0 ? "unlimited" : tmpstr), ip); - auth_dat[i].connect_until_time = timestamp; + auth_dat[i].expiration_time = timestamp; WFIFOL(fd,2) = auth_dat[i].account_id; mmo_auth_sync(); } else { @@ -628,7 +628,7 @@ int parse_admin(int fd) memcpy(WFIFOP(fd,6), auth_dat[i].userid, 24); WFIFOL(fd,2) = auth_dat[i].account_id; ShowNotice("'ladmin': Change of the final date of a banishment (account: %s, new final date of banishment: %d (%s), ip: %s)\n", auth_dat[i].userid, timestamp, (timestamp == 0 ? "no banishment" : tmpstr), ip); - if (auth_dat[i].ban_until_time != timestamp) { + if (auth_dat[i].unban_time != timestamp) { if (timestamp != 0) { unsigned char buf[16]; WBUFW(buf,0) = 0x2731; @@ -642,7 +642,7 @@ int parse_admin(int fd) auth_fifo[j].login_id1++; // to avoid reconnection error when come back from map-server (char-server will ask again the authentication) */ } - auth_dat[i].ban_until_time = timestamp; + auth_dat[i].unban_time = timestamp; mmo_auth_sync(); } } else { @@ -671,10 +671,10 @@ int parse_admin(int fd) if (i != -1) { WFIFOL(fd,2) = auth_dat[i].account_id; memcpy(WFIFOP(fd,6), auth_dat[i].userid, 24); - if (auth_dat[i].ban_until_time == 0 || auth_dat[i].ban_until_time < time(NULL)) + if (auth_dat[i].unban_time == 0 || auth_dat[i].unban_time < time(NULL)) timestamp = time(NULL); else - timestamp = auth_dat[i].ban_until_time; + timestamp = auth_dat[i].unban_time; tmtime = localtime(×tamp); tmtime->tm_year = tmtime->tm_year + (short)RFIFOW(fd,26); tmtime->tm_mon = tmtime->tm_mon + (short)RFIFOW(fd,28); @@ -688,7 +688,7 @@ int parse_admin(int fd) timestamp = 0; strftime(tmpstr, 24, login_config.date_format, localtime(×tamp)); ShowNotice("'ladmin': Adjustment of a final date of a banishment (account: %s, (%+d y %+d m %+d d %+d h %+d mn %+d s) -> new validity: %d (%s), ip: %s)\n", auth_dat[i].userid, (short)RFIFOW(fd,26), (short)RFIFOW(fd,28), (short)RFIFOW(fd,30), (short)RFIFOW(fd,32), (short)RFIFOW(fd,34), (short)RFIFOW(fd,36), timestamp, (timestamp == 0 ? "no banishment" : tmpstr), ip); - if (auth_dat[i].ban_until_time != timestamp) { + if (auth_dat[i].unban_time != timestamp) { if (timestamp != 0) { unsigned char buf[16]; WBUFW(buf,0) = 0x2731; @@ -704,14 +704,14 @@ int parse_admin(int fd) } */ } - auth_dat[i].ban_until_time = timestamp; + auth_dat[i].unban_time = timestamp; mmo_auth_sync(); } } else { - strftime(tmpstr, 24, login_config.date_format, localtime(&auth_dat[i].ban_until_time)); - ShowNotice("'ladmin': Impossible to adjust the final date of a banishment (account: %s, %d (%s) + (%+d y %+d m %+d d %+d h %+d mn %+d s) -> ???, ip: %s)\n", auth_dat[i].userid, auth_dat[i].ban_until_time, (auth_dat[i].ban_until_time == 0 ? "no banishment" : tmpstr), (short)RFIFOW(fd,26), (short)RFIFOW(fd,28), (short)RFIFOW(fd,30), (short)RFIFOW(fd,32), (short)RFIFOW(fd,34), (short)RFIFOW(fd,36), ip); + strftime(tmpstr, 24, login_config.date_format, localtime(&auth_dat[i].unban_time)); + ShowNotice("'ladmin': Impossible to adjust the final date of a banishment (account: %s, %d (%s) + (%+d y %+d m %+d d %+d h %+d mn %+d s) -> ???, ip: %s)\n", auth_dat[i].userid, auth_dat[i].unban_time, (auth_dat[i].unban_time == 0 ? "no banishment" : tmpstr), (short)RFIFOW(fd,26), (short)RFIFOW(fd,28), (short)RFIFOW(fd,30), (short)RFIFOW(fd,32), (short)RFIFOW(fd,34), (short)RFIFOW(fd,36), ip); } - WFIFOL(fd,30) = (unsigned long)auth_dat[i].ban_until_time; + WFIFOL(fd,30) = (unsigned long)auth_dat[i].unban_time; } else { memcpy(WFIFOP(fd,6), account_name, 24); ShowNotice("'ladmin': Attempt to adjust the final date of a banishment of an unknown account (account: %s, ip: %s)\n", account_name, ip); @@ -775,7 +775,7 @@ int parse_admin(int fd) if (i != -1) { WFIFOL(fd,2) = auth_dat[i].account_id; memcpy(WFIFOP(fd,6), auth_dat[i].userid, 24); - timestamp = auth_dat[i].connect_until_time; + timestamp = auth_dat[i].expiration_time; if (timestamp == 0 || timestamp < time(NULL)) timestamp = time(NULL); tmtime = localtime(×tamp); @@ -787,15 +787,15 @@ int parse_admin(int fd) tmtime->tm_sec = tmtime->tm_sec + (short)RFIFOW(fd,36); timestamp = mktime(tmtime); if (timestamp != -1) { - strftime(tmpstr, 24, login_config.date_format, localtime(&auth_dat[i].connect_until_time)); + strftime(tmpstr, 24, login_config.date_format, localtime(&auth_dat[i].expiration_time)); strftime(tmpstr2, 24, login_config.date_format, localtime(×tamp)); - ShowNotice("'ladmin': Adjustment of a validity limit (account: %s, %d (%s) + (%+d y %+d m %+d d %+d h %+d mn %+d s) -> new validity: %d (%s), ip: %s)\n", auth_dat[i].userid, auth_dat[i].connect_until_time, (auth_dat[i].connect_until_time == 0 ? "unlimited" : tmpstr), (short)RFIFOW(fd,26), (short)RFIFOW(fd,28), (short)RFIFOW(fd,30), (short)RFIFOW(fd,32), (short)RFIFOW(fd,34), (short)RFIFOW(fd,36), timestamp, (timestamp == 0 ? "unlimited" : tmpstr2), ip); - auth_dat[i].connect_until_time = timestamp; + ShowNotice("'ladmin': Adjustment of a validity limit (account: %s, %d (%s) + (%+d y %+d m %+d d %+d h %+d mn %+d s) -> new validity: %d (%s), ip: %s)\n", auth_dat[i].userid, auth_dat[i].expiration_time, (auth_dat[i].expiration_time == 0 ? "unlimited" : tmpstr), (short)RFIFOW(fd,26), (short)RFIFOW(fd,28), (short)RFIFOW(fd,30), (short)RFIFOW(fd,32), (short)RFIFOW(fd,34), (short)RFIFOW(fd,36), timestamp, (timestamp == 0 ? "unlimited" : tmpstr2), ip); + auth_dat[i].expiration_time = timestamp; mmo_auth_sync(); - WFIFOL(fd,30) = (unsigned long)auth_dat[i].connect_until_time; + WFIFOL(fd,30) = (unsigned long)auth_dat[i].expiration_time; } else { - strftime(tmpstr, 24, login_config.date_format, localtime(&auth_dat[i].connect_until_time)); - ShowNotice("'ladmin': Impossible to adjust a validity limit (account: %s, %d (%s) + (%+d y %+d m %+d d %+d h %+d mn %+d s) -> ???, ip: %s)\n", auth_dat[i].userid, auth_dat[i].connect_until_time, (auth_dat[i].connect_until_time == 0 ? "unlimited" : tmpstr), (short)RFIFOW(fd,26), (short)RFIFOW(fd,28), (short)RFIFOW(fd,30), (short)RFIFOW(fd,32), (short)RFIFOW(fd,34), (short)RFIFOW(fd,36), ip); + strftime(tmpstr, 24, login_config.date_format, localtime(&auth_dat[i].expiration_time)); + ShowNotice("'ladmin': Impossible to adjust a validity limit (account: %s, %d (%s) + (%+d y %+d m %+d d %+d h %+d mn %+d s) -> ???, ip: %s)\n", auth_dat[i].userid, auth_dat[i].expiration_time, (auth_dat[i].expiration_time == 0 ? "unlimited" : tmpstr), (short)RFIFOW(fd,26), (short)RFIFOW(fd,28), (short)RFIFOW(fd,30), (short)RFIFOW(fd,32), (short)RFIFOW(fd,34), (short)RFIFOW(fd,36), ip); WFIFOL(fd,30) = 0; } } else { @@ -828,8 +828,8 @@ int parse_admin(int fd) memcpy(WFIFOP(fd,60), auth_dat[i].lastlogin, 24); memcpy(WFIFOP(fd,84), auth_dat[i].last_ip, 16); memcpy(WFIFOP(fd,100), auth_dat[i].email, 40); - WFIFOL(fd,140) = (unsigned long)auth_dat[i].connect_until_time; - WFIFOL(fd,144) = (unsigned long)auth_dat[i].ban_until_time; + WFIFOL(fd,140) = (unsigned long)auth_dat[i].expiration_time; + WFIFOL(fd,144) = (unsigned long)auth_dat[i].unban_time; WFIFOW(fd,148) = (uint16)strlen(auth_dat[i].memo); if (auth_dat[i].memo[0]) { memcpy(WFIFOP(fd,150), auth_dat[i].memo, strlen(auth_dat[i].memo)); @@ -863,8 +863,8 @@ int parse_admin(int fd) memcpy(WFIFOP(fd,60), auth_dat[i].lastlogin, 24); memcpy(WFIFOP(fd,84), auth_dat[i].last_ip, 16); memcpy(WFIFOP(fd,100), auth_dat[i].email, 40); - WFIFOL(fd,140) = (unsigned long)auth_dat[i].connect_until_time; - WFIFOL(fd,144) = (unsigned long)auth_dat[i].ban_until_time; + WFIFOL(fd,140) = (unsigned long)auth_dat[i].expiration_time; + WFIFOL(fd,144) = (unsigned long)auth_dat[i].unban_time; WFIFOW(fd,148) = (uint16)strlen(auth_dat[i].memo); if (auth_dat[i].memo[0]) { memcpy(WFIFOP(fd,150), auth_dat[i].memo, strlen(auth_dat[i].memo)); diff --git a/src/login/login.c b/src/login/login.c index 8b5243811..88832634f 100644 --- a/src/login/login.c +++ b/src/login/login.c @@ -338,7 +338,7 @@ int mmo_auth_tostr(char* str, struct mmo_account* p) str_p += sprintf(str_p, "%d\t%s\t%s\t%s\t%c\t%d\t%u\t%s\t%s\t%ld\t%s\t%s\t%ld\t", p->account_id, p->userid, p->pass, p->lastlogin, p->sex, p->logincount, p->state, p->email, p->error_message, - (long)p->connect_until_time, p->last_ip, p->memo, (long)p->ban_until_time); + (long)p->expiration_time, p->last_ip, p->memo, (long)p->unban_time); for(i = 0; i < p->account_reg2_num; i++) if (p->account_reg2[i].str[0]) @@ -358,8 +358,8 @@ int mmo_auth_init(void) int logincount, n; uint32 i, j; char line[2048], *p, userid[2048], pass[2048], lastlogin[2048], sex, email[2048], error_message[2048], last_ip[2048], memo[2048]; - long ban_until_time; - long connect_until_time; + long unban_time; + long expiration_time; char str[2048]; char v[2048]; int GM_count = 0; @@ -393,11 +393,11 @@ int mmo_auth_init(void) if (((i = sscanf(line, "%d\t%[^\t]\t%[^\t]\t%[^\t]\t%c\t%d\t%u\t" "%[^\t]\t%[^\t]\t%ld\t%[^\t]\t%[^\t]\t%ld%n", &account_id, userid, pass, lastlogin, &sex, &logincount, &state, - email, error_message, &connect_until_time, last_ip, memo, &ban_until_time, &n)) == 13 && line[n] == '\t') || + email, error_message, &expiration_time, last_ip, memo, &unban_time, &n)) == 13 && line[n] == '\t') || ((i = sscanf(line, "%d\t%[^\t]\t%[^\t]\t%[^\t]\t%c\t%d\t%u\t" "%[^\t]\t%[^\t]\t%ld\t%[^\t]\t%[^\t]%n", &account_id, userid, pass, lastlogin, &sex, &logincount, &state, - email, error_message, &connect_until_time, last_ip, memo, &n)) == 12 && line[n] == '\t')) { + email, error_message, &expiration_time, last_ip, memo, &n)) == 12 && line[n] == '\t')) { n = n + 1; // Some checks @@ -470,11 +470,11 @@ int mmo_auth_init(void) } if (i == 13) - auth_dat[auth_num].ban_until_time = (time_t)ban_until_time; + auth_dat[auth_num].unban_time = (time_t)unban_time; else - auth_dat[auth_num].ban_until_time = 0; + auth_dat[auth_num].unban_time = 0; - auth_dat[auth_num].connect_until_time = (time_t)connect_until_time; + auth_dat[auth_num].expiration_time = (time_t)expiration_time; last_ip[15] = '\0'; remove_control_chars(last_ip); @@ -575,8 +575,8 @@ int mmo_auth_init(void) // Initialization of new data strncpy(auth_dat[auth_num].email, "a@a.com", 40); strncpy(auth_dat[auth_num].error_message, "-", 20); - auth_dat[auth_num].ban_until_time = 0; - auth_dat[auth_num].connect_until_time = 0; + auth_dat[auth_num].unban_time = 0; + auth_dat[auth_num].expiration_time = 0; strncpy(auth_dat[auth_num].last_ip, "-", 16); strncpy(auth_dat[auth_num].memo, "-", 255); @@ -848,7 +848,7 @@ int mmo_auth_new(struct mmo_account* account) static int num_regs = 0; // registration counter unsigned int tick = gettick(); - time_t connect_until = 0; + time_t expiration_time = 0; unsigned int i = auth_num; // check if the account doesn't exist already @@ -889,10 +889,10 @@ int mmo_auth_new(struct mmo_account* account) auth_dat[i].state = 0; safestrncpy(auth_dat[i].email, e_mail_check(account->email) ? account->email : "a@a.com", sizeof(auth_dat[i].email)); safestrncpy(auth_dat[i].error_message, "-", sizeof(auth_dat[i].error_message)); - auth_dat[i].ban_until_time = 0; + auth_dat[i].unban_time = 0; if( login_config.start_limited_time != -1 ) - connect_until = time(NULL) + login_config.start_limited_time; - auth_dat[i].connect_until_time = connect_until; + expiration_time = time(NULL) + login_config.start_limited_time; + auth_dat[i].expiration_time = expiration_time; strncpy(auth_dat[i].last_ip, "-", 16); strncpy(auth_dat[i].memo, "-", 255); auth_dat[i].account_reg2_num = 0; @@ -1013,15 +1013,15 @@ int mmo_auth(struct login_session_data* sd) return 1; // 1 = Incorrect Password } - if( auth_dat[i].connect_until_time != 0 && auth_dat[i].connect_until_time < time(NULL) ) + if( auth_dat[i].expiration_time != 0 && auth_dat[i].expiration_time < time(NULL) ) { ShowNotice("Connection refused (account: %s, pass: %s, expired ID, ip: %s)\n", sd->userid, sd->passwd, ip); return 2; // 2 = This ID is expired } - if( auth_dat[i].ban_until_time != 0 && auth_dat[i].ban_until_time > time(NULL) ) + if( auth_dat[i].unban_time != 0 && auth_dat[i].unban_time > time(NULL) ) { - strftime(tmpstr, 20, login_config.date_format, localtime(&auth_dat[i].ban_until_time)); + strftime(tmpstr, 20, login_config.date_format, localtime(&auth_dat[i].unban_time)); tmpstr[19] = '\0'; ShowNotice("Connection refused (account: %s, pass: %s, banned until %s, ip: %s)\n", sd->userid, sd->passwd, tmpstr, ip); return 6; // 6 = Your are Prohibited to log in until %s @@ -1050,7 +1050,7 @@ int mmo_auth(struct login_session_data* sd) safestrncpy(auth_dat[i].lastlogin, tmpstr, sizeof(auth_dat[i].lastlogin)); safestrncpy(auth_dat[i].last_ip, ip, sizeof(auth_dat[i].last_ip)); - auth_dat[i].ban_until_time = 0; + auth_dat[i].unban_time = 0; auth_dat[i].logincount++; // Save until for change ip/time of auth is not very useful => limited save for that @@ -1146,7 +1146,7 @@ int parse_fromchar(int fd) node->sex == sex && node->ip == ip_ ) {// found - uint32 connect_until_time; + uint32 expiration_time; char email[40]; unsigned int k; @@ -1160,12 +1160,12 @@ int parse_fromchar(int fd) if( k < auth_num ) { strcpy(email, auth_dat[k].email); - connect_until_time = (uint32)auth_dat[k].connect_until_time; + expiration_time = (uint32)auth_dat[k].expiration_time; } else { memset(email, 0, sizeof(email)); - connect_until_time = 0; + expiration_time = 0; } // send ack @@ -1176,7 +1176,7 @@ int parse_fromchar(int fd) WFIFOL(fd,10) = login_id2; WFIFOB(fd,14) = 0; memcpy(WFIFOP(fd,15), email, 40); - WFIFOL(fd,55) = connect_until_time; + WFIFOL(fd,55) = expiration_time; WFIFOSET(fd,59); } else @@ -1243,7 +1243,7 @@ int parse_fromchar(int fd) if( RFIFOREST(fd) < 6 ) return 0; { - uint32 connect_until_time = 0; + uint32 expiration_time = 0; char email[40] = ""; int account_id = RFIFOL(fd,2); @@ -1255,14 +1255,14 @@ int parse_fromchar(int fd) else { safestrncpy(email, auth_dat[i].email, sizeof(email)); - connect_until_time = (uint32)auth_dat[i].connect_until_time; + expiration_time = (uint32)auth_dat[i].expiration_time; } WFIFOHEAD(fd,50); WFIFOW(fd,0) = 0x2717; WFIFOL(fd,2) = account_id; safestrncpy((char*)WFIFOP(fd,6), email, 40); - WFIFOL(fd,46) = connect_until_time; + WFIFOL(fd,46) = expiration_time; WFIFOSET(fd,50); } break; @@ -1368,10 +1368,10 @@ int parse_fromchar(int fd) { time_t timestamp; struct tm *tmtime; - if (auth_dat[i].ban_until_time == 0 || auth_dat[i].ban_until_time < time(NULL)) + if (auth_dat[i].unban_time == 0 || auth_dat[i].unban_time < time(NULL)) timestamp = time(NULL); else - timestamp = auth_dat[i].ban_until_time; + timestamp = auth_dat[i].unban_time; tmtime = localtime(×tamp); tmtime->tm_year = tmtime->tm_year + year; tmtime->tm_mon = tmtime->tm_mon + month; @@ -1401,7 +1401,7 @@ int parse_fromchar(int fd) if( j < AUTH_FIFO_SIZE ) auth_fifo[j].login_id1++; // to avoid reconnection error when come back from map-server (char-server will ask again the authentication) */ - auth_dat[i].ban_until_time = timestamp; + auth_dat[i].unban_time = timestamp; // Save mmo_auth_sync(); } @@ -1494,11 +1494,11 @@ int parse_fromchar(int fd) if( i == auth_num ) ShowNotice("Char-server '%s': Error of UnBan request (account: %d not found, ip: %s).\n", server[id].name, account_id, ip); else - if( auth_dat[i].ban_until_time == 0 ) + if( auth_dat[i].unban_time == 0 ) ShowNotice("Char-server '%s': Error of UnBan request (account: %d, no change for unban date, ip: %s).\n", server[id].name, account_id, ip); else { - auth_dat[i].ban_until_time = 0; + auth_dat[i].unban_time = 0; ShowNotice("Char-server '%s': UnBan request (account: %d, ip: %s).\n", server[id].name, account_id, ip); } } @@ -1753,8 +1753,8 @@ void login_auth_failed(struct login_session_data* sd, int result) {// 6 = Your are Prohibited to log in until %s char tmpstr[20]; int i = search_account_index(sd->userid); - time_t ban_until_time = ( i >= 0 ) ? auth_dat[i].ban_until_time : 0; - strftime(tmpstr, 20, login_config.date_format, localtime(&ban_until_time)); + time_t unban_time = ( i >= 0 ) ? auth_dat[i].unban_time : 0; + strftime(tmpstr, 20, login_config.date_format, localtime(&unban_time)); safestrncpy((char*)WFIFOP(fd,3), tmpstr, 20); // ban timestamp goes here } WFIFOSET(fd,23); diff --git a/src/login/login.h b/src/login/login.h index 8470578aa..1147d6bb6 100644 --- a/src/login/login.h +++ b/src/login/login.h @@ -82,8 +82,8 @@ struct mmo_account { uint32 state; // packet 0x006a value + 1 (0: compte OK) char email[40]; // e-mail (by default: a@a.com) char error_message[20]; // Message of error code #6 = Your are Prohibited to log in until %s (packet 0x006a) - time_t ban_until_time; // # of seconds 1/1/1970 (timestamp): ban time limit of the account (0 = no ban) - time_t connect_until_time; // # of seconds 1/1/1970 (timestamp): Validity limit of the account (0 = unlimited) + time_t unban_time; // # of seconds 1/1/1970 (timestamp): ban time limit of the account (0 = no ban) + time_t expiration_time; // # of seconds 1/1/1970 (timestamp): Validity limit of the account (0 = unlimited) char last_ip[16]; // save of last IP of connection char memo[255]; // a memo field int account_reg2_num; |