diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/login/lclif.c | 13 | ||||
-rw-r--r-- | src/login/lclif.p.h | 15 | ||||
-rw-r--r-- | src/login/login.c | 28 | ||||
-rw-r--r-- | src/login/login.h | 1 |
4 files changed, 55 insertions, 2 deletions
diff --git a/src/login/lclif.c b/src/login/lclif.c index 47b2526c4..1870f9bc9 100644 --- a/src/login/lclif.c +++ b/src/login/lclif.c @@ -216,6 +216,15 @@ enum parsefunc_rcode lclif_parse_CA_SSO_LOGIN_REQ(int fd, struct login_session_d return PACKET_VALID; } +/// @copydoc lclif_interface_private::parse_CA_LOGIN_OTP() +enum parsefunc_rcode lclif_parse_CA_LOGIN_OTP(int fd, struct login_session_data *sd) __attribute__((nonnull (2))); +enum parsefunc_rcode lclif_parse_CA_LOGIN_OTP(int fd, struct login_session_data *sd) +{ + //const struct packet_CA_LOGIN_OTP *packet = RP2PTR(fd); + login->client_login_otp(fd, sd); + return PACKET_VALID; +} + /// @copydoc lclif_interface_private::parse_CA_REQ_HASH() enum parsefunc_rcode lclif_parse_CA_REQ_HASH(int fd, struct login_session_data *sd) __attribute__((nonnull (2))); enum parsefunc_rcode lclif_parse_CA_REQ_HASH(int fd, struct login_session_data *sd) @@ -502,6 +511,7 @@ void packetdb_loaddb(void) packet_def(CA_LOGIN_PCBANG), packet_def(CA_LOGIN_HAN), packet_def2(CA_SSO_LOGIN_REQ, -1), + packet_def(CA_LOGIN_OTP), packet_def(CA_REQ_HASH), #undef packet_def #undef packet_def2 @@ -512,7 +522,7 @@ void packetdb_loaddb(void) for (i = 0; i < length; ++i) { int16 packet_id = packet[i].packet_id; - Assert_retb(packet_id >= MIN_PACKET_DB && packet_id < MAX_PACKET_DB); + Assert_retb(packet_id >= MIN_PACKET_DB && packet_id <= MAX_PACKET_DB); lclif->p->dbs->packet_db[packet_id].len = packet[i].packet_len; lclif->p->dbs->packet_db[packet_id].pFunc = packet[i].pFunc; } @@ -565,6 +575,7 @@ void lclif_defaults(void) lclif->p->parse_CA_LOGIN_PCBANG = lclif_parse_CA_LOGIN_PCBANG; lclif->p->parse_CA_LOGIN_HAN = lclif_parse_CA_LOGIN_HAN; lclif->p->parse_CA_SSO_LOGIN_REQ = lclif_parse_CA_SSO_LOGIN_REQ; + lclif->p->parse_CA_LOGIN_OTP = lclif_parse_CA_LOGIN_OTP; lclif->p->parse_CA_REQ_HASH = lclif_parse_CA_REQ_HASH; lclif->p->parse_CA_CHARSERVERCONNECT = lclif_parse_CA_CHARSERVERCONNECT; } diff --git a/src/login/lclif.p.h b/src/login/lclif.p.h index d28f1c587..5aa7337f4 100644 --- a/src/login/lclif.p.h +++ b/src/login/lclif.p.h @@ -35,7 +35,7 @@ // Packet DB #define MIN_PACKET_DB 0x0064 -#define MAX_PACKET_DB 0x08ff +#define MAX_PACKET_DB 0x0acf /* Enums */ @@ -51,6 +51,7 @@ enum login_packet_id { PACKET_ID_CA_LOGIN4 = 0x027c, PACKET_ID_CA_LOGIN_HAN = 0x02b0, PACKET_ID_CA_SSO_LOGIN_REQ = 0x0825, + PACKET_ID_CA_LOGIN_OTP = 0x0acf, PACKET_ID_CA_REQ_HASH = 0x01db, PACKET_ID_CA_CHARSERVERCONNECT = 0x2710, // Custom Hercules Packet //PACKET_ID_CA_SSO_LOGIN_REQa = 0x825a, /* unused */ @@ -160,6 +161,17 @@ struct packet_CA_SSO_LOGIN_REQ { char t1[]; ///< SSO Login Token (variable length) } __attribute__((packed)); +/** + * Packet structure for CA_LOGIN_OTP. + */ +struct packet_CA_LOGIN_OTP { + int16 packet_id; ///< Packet ID (#PACKET_ID_CA_LOGIN_OTP) + uint32 devFlags; ///< flags including dev flag + char login[25]; ///< Username + char password[32]; ///< Password encrypted by rijndael + char flagsStr[5]; ///< Unknown flags. Normally string: G000 +} __attribute__((packed)); + #if 0 // Unused struct packet_CA_SSO_LOGIN_REQa { int16 packet_id; @@ -325,6 +337,7 @@ struct lclif_interface_private { LoginParseFunc *parse_CA_LOGIN_PCBANG; ///< Packet handler for #packet_CA_LOGIN_PCBANG. LoginParseFunc *parse_CA_LOGIN_HAN; ///< Packet handler for #packet_CA_LOGIN_HAN. LoginParseFunc *parse_CA_SSO_LOGIN_REQ; ///< Packet handler for #packet_CA_SSO_LOGIN_REQ. + LoginParseFunc *parse_CA_LOGIN_OTP; ///< Packet handler for #packet_CA_LOGIN_OTP. LoginParseFunc *parse_CA_REQ_HASH; ///< Packet handler for #packet_CA_REQ_HASH. LoginParseFunc *parse_CA_CHARSERVERCONNECT; ///< Packet handler for #packet_CA_CHARSERVERCONNECT. }; diff --git a/src/login/login.c b/src/login/login.c index 3db9558b8..1c1d69250 100644 --- a/src/login/login.c +++ b/src/login/login.c @@ -1360,6 +1360,33 @@ bool login_client_login(int fd, struct login_session_data *sd) return false; } +bool login_client_login_otp(int fd, struct login_session_data *sd) __attribute__((nonnull (2))); +bool login_client_login_otp(int fd, struct login_session_data *sd) +{ + // send ok response with fake token +#ifdef PACKETVER_ZERO +#if 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 + return true; +#else // PACKETVER_ZERO + return false; +#endif // PACKETVER_ZERO +} + void login_char_server_connection_status(int fd, struct login_session_data* sd, uint8 status) __attribute__((nonnull (2))); void login_char_server_connection_status(int fd, struct login_session_data* sd, uint8 status) { @@ -2218,6 +2245,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->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 d5c9972c0..3af54ef50 100644 --- a/src/login/login.h +++ b/src/login/login.h @@ -212,6 +212,7 @@ struct login_interface { void (*auth_ok) (struct login_session_data* sd); 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 (*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); |