summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2018-11-15 09:03:03 +0300
committerAndrei Karas <akaras@inbox.ru>2018-11-27 23:10:23 +0300
commit602ea2bc985e317d483aedc89f80e052befec57a (patch)
tree299fd5295cc2da31f3e1b6f692cd4c3209133af8 /src
parentfabfaf566459da17e1543be920769677d92c79b8 (diff)
downloadhercules-602ea2bc985e317d483aedc89f80e052befec57a.tar.gz
hercules-602ea2bc985e317d483aedc89f80e052befec57a.tar.bz2
hercules-602ea2bc985e317d483aedc89f80e052befec57a.tar.xz
hercules-602ea2bc985e317d483aedc89f80e052befec57a.zip
Add packet AC_REQ_MOBILE_OTP
Diffstat (limited to 'src')
-rw-r--r--src/login/lclif.p.h3
-rw-r--r--src/login/login.c22
-rw-r--r--src/login/login.h1
3 files changed, 24 insertions, 2 deletions
diff --git a/src/login/lclif.p.h b/src/login/lclif.p.h
index e4d6fe31f..21fc2048a 100644
--- a/src/login/lclif.p.h
+++ b/src/login/lclif.p.h
@@ -61,7 +61,6 @@ enum login_packet_id {
PACKET_ID_AC_ACCEPT_LOGIN = 0x0069,
PACKET_ID_AC_ACCEPT_LOGIN2 = 0x0ac4,
- PACKET_ID_AC_REQ_MOBILE_OTP = 0x09a2,
PACKET_ID_AC_REFUSE_LOGIN = 0x006a,
PACKET_ID_SC_NOTIFY_BAN = 0x0081,
PACKET_ID_AC_ACK_HASH = 0x01dc,
@@ -176,8 +175,8 @@ struct PACKET_CA_ACK_MOBILE_OTP {
uint32 aid; ///< Account ID
char code[6]; ///< Code
} __attribute__((packed));
-
DEFINE_PACKET_HEADER(CA_ACK_MOBILE_OTP, 0x09a3);
+
// for enum login_packet_id
#define PACKET_ID_CA_ACK_MOBILE_OTP HEADER_CA_ACK_MOBILE_OTP
#define packet_CA_ACK_MOBILE_OTP PACKET_CA_ACK_MOBILE_OTP
diff --git a/src/login/login.c b/src/login/login.c
index c1844cb25..dce85e9c7 100644
--- a/src/login/login.c
+++ b/src/login/login.c
@@ -35,6 +35,7 @@
#include "common/memmgr.h"
#include "common/md5calc.h"
#include "common/nullpo.h"
+#include "common/packetsstatic_len.h"
#include "common/random.h"
#include "common/showmsg.h"
#include "common/socket.h"
@@ -67,6 +68,14 @@ static AccountDB *accounts = NULL;
//-----------------------------------------------------
#define AUTH_TIMEOUT 30000
+#if PACKETVER_MAIN_NUM >= 20181114 || PACKETVER_RE_NUM >= 20181114 || defined(PACKETVER_ZERO)
+struct PACKET_AC_REQ_MOBILE_OTP {
+ int16 packet_id; ///< Packet ID (#PACKET_ID_CA_SSO_LOGIN_REQ)
+ uint32 aid; ///< Account ID
+} __attribute__((packed));
+DEFINE_PACKET_HEADER(AC_REQ_MOBILE_OTP, 0x09a2);
+#endif
+
/**
* @see DBCreateData
*/
@@ -1400,6 +1409,18 @@ static bool login_client_login_otp(int fd, struct login_session_data *sd)
#endif // PACKETVER_ZERO
}
+static void login_client_login_mobile_otp_request(int fd, struct login_session_data *sd) __attribute__((nonnull (2)));
+static void login_client_login_mobile_otp_request(int fd, struct login_session_data *sd)
+{
+#if PACKETVER_MAIN_NUM >= 20181114 || PACKETVER_RE_NUM >= 20181114 || defined(PACKETVER_ZERO)
+ WFIFOHEAD(sd->fd, sizeof(struct PACKET_AC_REQ_MOBILE_OTP));
+ struct PACKET_AC_REQ_MOBILE_OTP *packet = WP2PTR(sd->fd);
+ packet->packet_id = HEADER_AC_REQ_MOBILE_OTP;
+ packet->aid = sd->account_id;
+ WFIFOSET(fd, sizeof(struct PACKET_AC_REQ_MOBILE_OTP));
+#endif
+}
+
static void login_char_server_connection_status(int fd, struct login_session_data* sd, uint8 status) __attribute__((nonnull (2)));
static void login_char_server_connection_status(int fd, struct login_session_data* sd, uint8 status)
{
@@ -2275,6 +2296,7 @@ void login_defaults(void)
login->parse_fromchar = login_parse_fromchar;
login->client_login = login_client_login;
login->client_login_otp = login_client_login_otp;
+ login->client_login_mobile_otp_request = login_client_login_mobile_otp_request;
login->parse_request_connection = login_parse_request_connection;
login->auth_ok = login_auth_ok;
login->auth_failed = login_auth_failed;
diff --git a/src/login/login.h b/src/login/login.h
index 8a863f5aa..7f74057c6 100644
--- a/src/login/login.h
+++ b/src/login/login.h
@@ -219,6 +219,7 @@ struct login_interface {
void (*auth_failed) (struct login_session_data* sd, int result);
bool (*client_login) (int fd, struct login_session_data *sd);
bool (*client_login_otp) (int fd, struct login_session_data *sd);
+ void (*client_login_mobile_otp_request) (int fd, struct login_session_data *sd);
void (*char_server_connection_status) (int fd, struct login_session_data* sd, uint8 status);
void (*parse_request_connection) (int fd, struct login_session_data* sd, const char *ip, uint32 ipl);
void (*config_set_defaults) (void);