diff options
author | Dastgir <dastgirp@gmail.com> | 2018-07-26 11:02:21 +0530 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2019-02-01 20:18:03 +0100 |
commit | dd50f75ad8ec7c4810206600de0ca32cf0af2899 (patch) | |
tree | f4ee2bb81c49637bba8d9a848d5f3110b0cedd4f /src/char/char.c | |
parent | 504ad2ca7d6ef4923093f74ac2afd5fc1bd39fd1 (diff) | |
download | hercules-dd50f75ad8ec7c4810206600de0ca32cf0af2899.tar.gz hercules-dd50f75ad8ec7c4810206600de0ca32cf0af2899.tar.bz2 hercules-dd50f75ad8ec7c4810206600de0ca32cf0af2899.tar.xz hercules-dd50f75ad8ec7c4810206600de0ca32cf0af2899.zip |
Updated login-server to give appropriate response code to char-server when IP is not allowed
Updated char-server to show proper error message.
Fixes #737
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/char/char.c')
-rw-r--r-- | src/char/char.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/char/char.c b/src/char/char.c index 99198fa50..d882e3448 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -2302,19 +2302,29 @@ static void char_ping_login_server(int fd) static int char_parse_fromlogin_connection_state(int fd) { - if (RFIFOB(fd,2)) { - //printf("connect login server error : %d\n", RFIFOB(fd,2)); + switch (RFIFOB(fd,2)) { + case 0: + ShowStatus("Connected to login-server (connection #%d).\n", fd); + loginif->on_ready(); + break; + case 1: // Invalid username/password ShowError("Can not connect to login-server.\n"); ShowError("The server communication passwords (default s1/p1) are probably invalid.\n"); ShowError("Also, please make sure your login db has the correct communication username/passwords and the gender of the account is S.\n"); ShowError("The communication passwords are set in /conf/map/map-server.conf and /conf/char/char-server.conf\n"); sockt->eof(fd); return 1; - } else { - ShowStatus("Connected to login-server (connection #%d).\n", fd); - loginif->on_ready(); + case 2: // IP not allowed + ShowError("Can not connect to login-server.\n"); + ShowError("Please make sure your IP is allowed in conf/network.conf\n"); + sockt->eof(fd); + return 1; + default: + ShowError("Invalid response from the login-server. Error code: %d\n", (int)RFIFOB(fd,2)); + sockt->eof(fd); + return 1; } - RFIFOSKIP(fd,3); + RFIFOSKIP(fd, 3); return 0; } |