|
@@ -96,8 +96,6 @@ int char_per_account = 0; //Maximum charas per account (default unlimited) [Siri
|
|
|
int log_char = 1; // loggin char or not [devil]
|
|
|
int log_inter = 1; // loggin inter or not [devil]
|
|
|
|
|
|
-char *char_server_dns = NULL;
|
|
|
-
|
|
|
// Advanced subnet check [LuzZza]
|
|
|
struct _subnet {
|
|
|
long subnet;
|
|
@@ -2174,24 +2172,26 @@ int parse_tologin(int fd) {
|
|
|
|
|
|
case 0x2735:
|
|
|
{
|
|
|
- unsigned char ip_str[4];
|
|
|
- if (char_server_dns && resolve_hostbyname(char_server_dns, ip_str, NULL))
|
|
|
- {
|
|
|
- ShowInfo("IP Sync [%s] in progress...\n",char_server_dns);
|
|
|
+ unsigned char buf[2];
|
|
|
+ in_addr_t new_ip = 0;
|
|
|
+ RFIFOSKIP(fd,2);
|
|
|
+
|
|
|
+ WBUFW(buf,0) = 0x2b1e;
|
|
|
+ mapif_sendall(buf, 2);
|
|
|
+
|
|
|
+ new_ip = resolve_hostbyname(login_ip_str, NULL, NULL);
|
|
|
+ if (new_ip && new_ip != login_ip) //Update login ip, too.
|
|
|
+ login_ip = new_ip;
|
|
|
+
|
|
|
+ new_ip = resolve_hostbyname(char_ip_str, NULL, NULL);
|
|
|
+ if (new_ip && new_ip != char_ip)
|
|
|
+ { //Update ip.
|
|
|
+ char_ip = new_ip;
|
|
|
+ ShowInfo("Updating IP for [%s].\n",char_ip_str);
|
|
|
WFIFOW(fd,0) = 0x2736;
|
|
|
- WFIFOB(fd,2) = ip_str[0];
|
|
|
- WFIFOB(fd,3) = ip_str[1];
|
|
|
- WFIFOB(fd,4) = ip_str[2];
|
|
|
- WFIFOB(fd,5) = ip_str[3];
|
|
|
+ WFIFOL(fd,2) = char_ip;
|
|
|
WFIFOSET(fd,6);
|
|
|
}
|
|
|
- for(i = 0; i < MAX_MAP_SERVERS; i++){
|
|
|
- if(server_fd[i] >= 0){
|
|
|
- WFIFOW(server_fd[i], 0) = 0x2b1e;
|
|
|
- WFIFOSET(server_fd[i], 2);
|
|
|
- }
|
|
|
- }
|
|
|
- RFIFOSKIP(fd,2);
|
|
|
break;
|
|
|
}
|
|
|
default:
|
|
@@ -2988,12 +2988,11 @@ int parse_frommap(int fd) {
|
|
|
}
|
|
|
|
|
|
case 0x2736:
|
|
|
- for(i = 0; i < MAX_MAP_SERVERS; i++){
|
|
|
- if(server_fd[i] == fd){
|
|
|
- ShowInfo("IP Sync (Server #%d %d.%d.%d.%d) successful.\n",i,(int)RFIFOB(fd,2),(int)RFIFOB(fd,3),(int)RFIFOB(fd,4),(int)RFIFOB(fd,5));
|
|
|
- server[i].ip = RFIFOL(fd, 2);
|
|
|
- }
|
|
|
- }
|
|
|
+ if (RFIFOREST(fd) < 6) return 0;
|
|
|
+ ShowInfo("Updated IP address of Server #%d to %d.%d.%d.%d.\n",i,
|
|
|
+ (int)RFIFOB(fd,2),(int)RFIFOB(fd,3),
|
|
|
+ (int)RFIFOB(fd,4),(int)RFIFOB(fd,5));
|
|
|
+ server[id].ip = RFIFOL(fd, 2);
|
|
|
RFIFOSKIP(fd,6);
|
|
|
break;
|
|
|
|
|
@@ -3954,8 +3953,6 @@ void do_final(void) {
|
|
|
char_db_->destroy(char_db_, NULL);
|
|
|
online_char_db->destroy(online_char_db, NULL);
|
|
|
|
|
|
- if(char_server_dns) aFree(char_server_dns);
|
|
|
-
|
|
|
mysql_close(&mysql_handle);
|
|
|
if(char_gm_read)
|
|
|
mysql_close(&lmysql_handle);
|
|
@@ -4096,27 +4093,28 @@ int char_config_read(const char *cfgName) {
|
|
|
wisp_server_name[sizeof(wisp_server_name) - 1] = '\0';
|
|
|
}
|
|
|
} else if (strcmpi(w1, "login_ip") == 0) {
|
|
|
- unsigned char ip_str[4];
|
|
|
- login_ip = resolve_hostbyname(w2, ip_str, login_ip_str);
|
|
|
- if (login_ip)
|
|
|
- ShowStatus("Login server IP address : %s -> %s\n", w2, login_ip_str);
|
|
|
+ unsigned char ip_str[16];
|
|
|
+ login_ip = resolve_hostbyname(w2, NULL, ip_str);
|
|
|
+ if (login_ip) {
|
|
|
+ strncpy(login_ip_str, w2, sizeof(login_ip_str));
|
|
|
+ ShowStatus("Login server IP address : %s -> %s\n", w2, ip_str);
|
|
|
+ }
|
|
|
} else if (strcmpi(w1, "login_port") == 0) {
|
|
|
login_port=atoi(w2);
|
|
|
} else if (strcmpi(w1, "char_ip") == 0) {
|
|
|
- unsigned char ip_str[4];
|
|
|
- char_ip = resolve_hostbyname(w2, ip_str, char_ip_str);
|
|
|
+ unsigned char ip_str[16];
|
|
|
+ char_ip = resolve_hostbyname(w2, NULL, ip_str);
|
|
|
if (char_ip){
|
|
|
- if(char_server_dns)
|
|
|
- aFree(char_server_dns);
|
|
|
- char_server_dns = (char *)aCalloc(strlen(w2)+1, 1);
|
|
|
- strcpy(char_server_dns, w2);
|
|
|
- ShowStatus("Character server IP address : %s -> %s\n", w2, char_ip_str);
|
|
|
+ strncpy(char_ip_str, w2, sizeof(char_ip_str));
|
|
|
+ ShowStatus("Character server IP address : %s -> %s\n", w2, ip_str);
|
|
|
}
|
|
|
} else if (strcmpi(w1, "bind_ip") == 0) {
|
|
|
- unsigned char ip_str[4];
|
|
|
- bind_ip = resolve_hostbyname(w2, ip_str, bind_ip_str);
|
|
|
- if (bind_ip)
|
|
|
- ShowStatus("Character server binging IP address : %s -> %s\n", w2, bind_ip_str);
|
|
|
+ unsigned char ip_str[16];
|
|
|
+ bind_ip = resolve_hostbyname(w2, NULL, ip_str);
|
|
|
+ if (bind_ip) {
|
|
|
+ strncpy(bind_ip_str, w2, sizeof(bind_ip_str));
|
|
|
+ ShowStatus("Character server binding IP address : %s -> %s\n", w2, ip_str);
|
|
|
+ }
|
|
|
} else if (strcmpi(w1, "char_port") == 0) {
|
|
|
char_port = atoi(w2);
|
|
|
} else if (strcmpi(w1, "char_maintenance") == 0) {
|