summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Friis <peavey@placid.dk>2008-05-31 12:59:35 +0000
committerDennis Friis <peavey@placid.dk>2008-05-31 12:59:35 +0000
commit0a74f9ba775857aeb281266a6e8cc10052023774 (patch)
tree207f244774f2a283c2c5159c8caaa6294be87e81
parent40954e262f305d8d4a9927bc7b90943463eebf25 (diff)
downloadtmwa-0a74f9ba775857aeb281266a6e8cc10052023774.tar.gz
tmwa-0a74f9ba775857aeb281266a6e8cc10052023774.tar.bz2
tmwa-0a74f9ba775857aeb281266a6e8cc10052023774.tar.xz
tmwa-0a74f9ba775857aeb281266a6e8cc10052023774.zip
Add optional update_host to loginserver so you can tell the client that an alternative update host is available. Based on patch by Sanga
-rw-r--r--conf/login_athena.conf5
-rw-r--r--src/login/login.c28
-rw-r--r--src/map/clif.c2
3 files changed, 34 insertions, 1 deletions
diff --git a/conf/login_athena.conf b/conf/login_athena.conf
index 44f7166..311d601 100644
--- a/conf/login_athena.conf
+++ b/conf/login_athena.conf
@@ -50,6 +50,11 @@ login_log_filename: log/login.log
// Name of the file of that logs the unknown packets (for debug or hack check)
login_log_unknown_packets_filename: log/login_unknown_packets.log
+// Update host
+// Tells the client that an alternative updatehost is available if the client supports this.
+// If left out nothing will be sent. max lenght 127.
+// update_host: somehost.someserver
+
// Indicate if the unknown packets are saved or not
//(the unknown packets coming from the char-server or ladministration does not relate to, which is always saved)
// Be careful: if you receive an attack, your hard disk can cause lag...
diff --git a/src/login/login.c b/src/login/login.c
index 8d9818d..30c6152 100644
--- a/src/login/login.c
+++ b/src/login/login.c
@@ -41,6 +41,7 @@ int login_port = 6900;
char lan_char_ip[16];
int subneti[4];
int subnetmaski[4];
+char update_host[128] = "";
char account_filename[1024] = "save/account.txt";
char GM_account_filename[1024] = "conf/GM_account.txt";
@@ -2706,6 +2707,7 @@ int parse_login(int fd) {
int result, i, j;
unsigned char *p = (unsigned char *) &session[fd]->client_addr.sin_addr;
char ip[16];
+ int host_len;
sprintf(ip, "%d.%d.%d.%d", p[0], p[1], p[2], p[3]);
@@ -2788,6 +2790,29 @@ int parse_login(int fd) {
printf("Connection of the GM (level:%d) account '%s' accepted.\n", gm_level, account.userid);
else
printf("Connection of the account '%s' accepted.\n", account.userid);
+
+ /*
+ * Add a 0x0063 packet, which contains the name of the update host. The packet will only
+ * be sent if login_athena.conf contains a non-null entry for "update_host:"
+ *
+ * Because older clients cannot handle the 0x63 packet, we check the "version 2" value
+ * from the incoming 0x64 packet (the byte at offset 54). If bit 0 of this is set,
+ * then the client can safely accept the 0x63 packet. The "version 2" value is not
+ * otherwise used by eAthena.
+ */
+ if ((RFIFOW(fd, 0) == 0x64) && (RFIFOB(fd, 54) & 0x01))
+ {
+ host_len = (int)strlen(update_host);
+ if (host_len > 0)
+ {
+ WFIFOW(fd, 0) = 0x63;
+ WFIFOW(fd, 2) = 4 + host_len;
+ memcpy(WFIFOP(fd, 4), update_host, host_len);
+ WFIFOSET(fd, 4 + host_len);
+ }
+ }
+
+ // Load list of char servers into outbound packet
server_num = 0;
for(i = 0; i < MAX_SERVERS; i++) {
if (server_fd[i] >= 0) {
@@ -3351,6 +3376,9 @@ int login_config_read(const char *cfgName) {
ANTI_FREEZE_INTERVAL = 5; // minimum 5 seconds
} else if (strcmpi(w1, "import") == 0) {
login_config_read(w2);
+ } else if (strcmpi(w1, "update_host") == 0) {
+ strncpy(update_host, w2, sizeof(update_host));
+ update_host[sizeof(update_host)-1] = '\0';
}
}
}
diff --git a/src/map/clif.c b/src/map/clif.c
index 04d6c4b..618e05a 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -58,7 +58,7 @@ static const int packet_len_table[0x220] = {
//#0x0040
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 55, 17, 3, 37, 46, -1, 23, -1, 3,108, 3, 2,
+ 0, 0, 0, -1, 55, 17, 3, 37, 46, -1, 23, -1, 3,108, 3, 2,
#if PACKETVER < 2
3, 28, 19, 11, 3, -1, 9, 5, 52, 51, 56, 58, 41, 2, 6, 6,
#else // 78-7b 亀島以降 lv99エフェクト用