From 1f7f90156632811bcf7f0102325ba504428bc44a Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 24 Nov 2018 03:27:40 +0300 Subject: Update packet AC_LOGIN_OTP. --- src/login/login.c | 43 ++++++++++++++++--------------------------- 1 file changed, 16 insertions(+), 27 deletions(-) (limited to 'src/login/login.c') 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))); -- cgit v1.2.3-60-g2f50