summaryrefslogtreecommitdiff
path: root/src/login
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2018-11-24 03:27:40 +0300
committerAndrei Karas <akaras@inbox.ru>2018-12-12 21:18:06 +0300
commit1f7f90156632811bcf7f0102325ba504428bc44a (patch)
tree8e7624eecafc85ac9a496b1272a2ccafba16e508 /src/login
parent30cf149e9db5b9e33d819b831f78c02eeb586d39 (diff)
downloadhercules-1f7f90156632811bcf7f0102325ba504428bc44a.tar.gz
hercules-1f7f90156632811bcf7f0102325ba504428bc44a.tar.bz2
hercules-1f7f90156632811bcf7f0102325ba504428bc44a.tar.xz
hercules-1f7f90156632811bcf7f0102325ba504428bc44a.zip
Update packet AC_LOGIN_OTP.
Diffstat (limited to 'src/login')
-rw-r--r--src/login/login.c43
-rw-r--r--src/login/packets_ac_struct.h31
2 files changed, 47 insertions, 27 deletions
diff --git a/src/login/login.c b/src/login/login.c
index 67abd45af..4c40677fa 100644
--- a/src/login/login.c
+++ b/src/login/login.c
@@ -1370,36 +1370,25 @@ static bool login_client_login(int fd, struct login_session_data *sd)
static bool login_client_login_otp(int fd, struct login_session_data *sd) __attribute__((nonnull (2)));
static bool login_client_login_otp(int fd, struct login_session_data *sd)
{
+#if PACKETVER_MAIN_NUM >= 20170621 || PACKETVER_RE_NUM >= 20170621 || defined(PACKETVER_ZERO)
// send ok response with fake token
-#ifdef PACKETVER_ZERO
-#if PACKETVER >= 20171127
- WFIFOHEAD(fd, 33);
- WFIFOW(fd, 0) = 0x0ae3;
- WFIFOW(fd, 2) = 33; // len
- WFIFOL(fd, 4) = 0; // normal login
- safestrncpy(WFIFOP(fd, 8), "S1000", 6);
- safestrncpy(WFIFOP(fd, 28), "token", 6);
- WFIFOSET(fd, 33);
-#elif PACKETVER >= 20171123
- WFIFOHEAD(fd, 19);
- WFIFOW(fd, 0) = 0x0ae3;
- WFIFOW(fd, 2) = 19; // len
- WFIFOL(fd, 4) = 0; // normal login
- safestrncpy(WFIFOP(fd, 8), "S1000", 6);
- safestrncpy(WFIFOP(fd, 14), "token", 6);
- WFIFOSET(fd, 19);
-#else
- WFIFOHEAD(fd, 13);
- WFIFOW(fd, 0) = 0x0ad1;
- WFIFOW(fd, 2) = 13; // len
- WFIFOL(fd, 4) = 0; // normal login
- safestrncpy(WFIFOP(fd, 8), "token", 6);
- WFIFOSET(fd, 13);
-#endif
+ const int len = sizeof(struct PACKET_AC_LOGIN_OTP) + 6; // + "token" string
+ WFIFOHEAD(fd, len);
+ struct PACKET_AC_LOGIN_OTP *packet = WP2PTR(sd->fd);
+ memset(packet, 0, len);
+ packet->packet_id = HEADER_AC_LOGIN_OTP;
+ packet->packet_len = len;
+ packet->loginFlag = 0; // normal login
+#if PACKETVER_MAIN_NUM >= 20171213 || PACKETVER_RE_NUM >= 20171213 || PACKETVER_ZERO_NUM >= 20171123
+ safestrncpy(packet->loginFlag2, "S1000", 6);
+#endif // PACKETVER_MAIN_NUM >= 20171213 || PACKETVER_RE_NUM >= 20171213 || PACKETVER_ZERO_NUM >= 20171123
+
+ safestrncpy(packet->token, "token", 6);
+ WFIFOSET(fd, len);
return true;
-#else // PACKETVER_ZERO
+#else // PACKETVER_MAIN_NUM >= 20170621 || PACKETVER_RE_NUM >= 20170621 || defined(PACKETVER_ZERO)
return false;
-#endif // PACKETVER_ZERO
+#endif // PACKETVER_MAIN_NUM >= 20170621 || PACKETVER_RE_NUM >= 20170621 || defined(PACKETVER_ZERO)
}
static void login_client_login_mobile_otp_request(int fd, struct login_session_data *sd) __attribute__((nonnull (2)));
diff --git a/src/login/packets_ac_struct.h b/src/login/packets_ac_struct.h
index 6ec92b38f..c9fb04f26 100644
--- a/src/login/packets_ac_struct.h
+++ b/src/login/packets_ac_struct.h
@@ -118,6 +118,37 @@ struct PACKET_AC_REQ_MOBILE_OTP {
DEFINE_PACKET_HEADER(AC_REQ_MOBILE_OTP, 0x09a2);
#endif
+#if PACKETVER_MAIN_NUM >= 20171213 || PACKETVER_RE_NUM >= 20171213 || PACKETVER_ZERO_NUM >= 20171808
+// AC_LOGIN_OTP2
+struct PACKET_AC_LOGIN_OTP {
+ int16 packet_id;
+ int16 packet_len;
+ int32 loginFlag;
+ char loginFlag2[20];
+ char token[];
+} __attribute__((packed));
+DEFINE_PACKET_HEADER(AC_LOGIN_OTP, 0x0ae3);
+#elif PACKETVER_ZERO_NUM >= 20171123
+// AC_LOGIN_OTP2
+struct PACKET_AC_LOGIN_OTP {
+ int16 packet_id;
+ int16 packet_len;
+ int32 loginFlag;
+ char loginFlag2[6];
+ char token[];
+} __attribute__((packed));
+DEFINE_PACKET_HEADER(AC_LOGIN_OTP, 0x0ae3);
+#elif PACKETVER_MAIN_NUM >= 20170621 || PACKETVER_RE_NUM >= 20170621 || defined(PACKETVER_ZERO)
+// AC_LOGIN_OTP1
+struct PACKET_AC_LOGIN_OTP {
+ int16 packet_id;
+ int16 packet_len;
+ int32 loginFlag;
+ char token[];
+} __attribute__((packed));
+DEFINE_PACKET_HEADER(AC_LOGIN_OTP, 0x0ad1);
+#endif
+
#if !defined(sun) && (!defined(__NETBSD__) || __NetBSD_Version__ >= 600000000) // NetBSD 5 and Solaris don't like pragma pack but accept the packed attribute
#pragma pack(pop)
#endif // not NetBSD < 6 / Solaris